RTEMS 6.1-rc1
fsl_mipi_csi2rx.h
1/*
2 * Copyright 2017, 2019-2020 NXP
3 * All rights reserved.
4 *
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef _FSL_MIPI_CSI2RX_H_
10#define _FSL_MIPI_CSI2RX_H_
11
12#include "fsl_common.h"
13
19/*******************************************************************************
20 * Definitions
21 ******************************************************************************/
22
26#define FSL_CSI2RX_DRIVER_VERSION (MAKE_VERSION(2, 0, 4))
29#if (defined(FSL_FEATURE_CSI2RX_HAS_NO_REG_PREFIX) && FSL_FEATURE_CSI2RX_HAS_NO_REG_PREFIX)
30
31#define CSI2RX_REG_CFG_NUM_LANES(base) (base)->CFG_NUM_LANES
32#define CSI2RX_REG_CFG_DISABLE_DATA_LANES(base) (base)->CFG_DISABLE_DATA_LANES
33#define CSI2RX_REG_BIT_ERR(base) (base)->BIT_ERR
34#define CSI2RX_REG_IRQ_STATUS(base) (base)->IRQ_STATUS
35#define CSI2RX_REG_IRQ_MASK(base) (base)->IRQ_MASK
36#define CSI2RX_REG_ULPS_STATUS(base) (base)->ULPS_STATUS
37#define CSI2RX_REG_PPI_ERRSOT_HS(base) (base)->PPI_ERRSOT_HS
38#define CSI2RX_REG_PPI_ERRSOTSYNC_HS(base) (base)->PPI_ERRSOTSYNC_HS
39#define CSI2RX_REG_PPI_ERRESC(base) (base)->PPI_ERRESC
40#define CSI2RX_REG_PPI_ERRSYNCESC(base) (base)->PPI_ERRSYNCESC
41#define CSI2RX_REG_PPI_ERRCONTROL(base) (base)->PPI_ERRCONTROL
42#define CSI2RX_REG_CFG_DISABLE_PAYLOAD_0(base) (base)->CFG_DISABLE_PAYLOAD_0
43#define CSI2RX_REG_CFG_DISABLE_PAYLOAD_1(base) (base)->CFG_DISABLE_PAYLOAD_1
44#define CSI2RX_REG_CFG_IGNORE_VC(base) (base)->CFG_IGNORE_VC
45#define CSI2RX_REG_CFG_VID_VC(base) (base)->CFG_VID_VC
46#define CSI2RX_REG_CFG_VID_P_FIFO_SEND_LEVEL(base) (base)->CFG_VID_P_FIFO_SEND_LEVEL
47#define CSI2RX_REG_CFG_VID_VSYNC(base) (base)->CFG_VID_VSYNC
48#define CSI2RX_REG_CFG_VID_HSYNC_FP(base) (base)->CFG_VID_HSYNC_FP
49#define CSI2RX_REG_CFG_VID_HSYNC(base) (base)->CFG_VID_HSYNC
50#define CSI2RX_REG_CFG_VID_HSYNC_BP(base) (base)->CFG_VID_HSYNC_BP
51
52#else
53
54#define CSI2RX_REG_CFG_NUM_LANES(base) (base)->CSI2RX_CFG_NUM_LANES
55#define CSI2RX_REG_CFG_DISABLE_DATA_LANES(base) (base)->CSI2RX_CFG_DISABLE_DATA_LANES
56#define CSI2RX_REG_BIT_ERR(base) (base)->CSI2RX_BIT_ERR
57#define CSI2RX_REG_IRQ_STATUS(base) (base)->CSI2RX_IRQ_STATUS
58#define CSI2RX_REG_IRQ_MASK(base) (base)->CSI2RX_IRQ_MASK
59#define CSI2RX_REG_ULPS_STATUS(base) (base)->CSI2RX_ULPS_STATUS
60#define CSI2RX_REG_PPI_ERRSOT_HS(base) (base)->CSI2RX_PPI_ERRSOT_HS
61#define CSI2RX_REG_PPI_ERRSOTSYNC_HS(base) (base)->CSI2RX_PPI_ERRSOTSYNC_HS
62#define CSI2RX_REG_PPI_ERRESC(base) (base)->CSI2RX_PPI_ERRESC
63#define CSI2RX_REG_PPI_ERRSYNCESC(base) (base)->CSI2RX_PPI_ERRSYNCESC
64#define CSI2RX_REG_PPI_ERRCONTROL(base) (base)->CSI2RX_PPI_ERRCONTROL
65#define CSI2RX_REG_CFG_DISABLE_PAYLOAD_0(base) (base)->CSI2RX_CFG_DISABLE_PAYLOAD_0
66#define CSI2RX_REG_CFG_DISABLE_PAYLOAD_1(base) (base)->CSI2RX_CFG_DISABLE_PAYLOAD_1
67#define CSI2RX_REG_CFG_IGNORE_VC(base) (base)->CSI2RX_CFG_IGNORE_VC
68#define CSI2RX_REG_CFG_VID_VC(base) (base)->CSI2RX_CFG_VID_VC
69#define CSI2RX_REG_CFG_VID_P_FIFO_SEND_LEVEL(base) (base)->CSI2RX_CFG_VID_P_FIFO_SEND_LEVEL
70#define CSI2RX_REG_CFG_VID_VSYNC(base) (base)->CSI2RX_CFG_VID_VSYNC
71#define CSI2RX_REG_CFG_VID_HSYNC_FP(base) (base)->CSI2RX_CFG_VID_HSYNC_FP
72#define CSI2RX_REG_CFG_VID_HSYNC(base) (base)->CSI2RX_CFG_VID_HSYNC
73#define CSI2RX_REG_CFG_VID_HSYNC_BP(base) (base)->CSI2RX_CFG_VID_HSYNC_BP
74
75#endif
76
77#ifndef MIPI_CSI2RX_CSI2RX_CFG_NUM_LANES_csi2rx_cfg_num_lanes_MASK
78#define MIPI_CSI2RX_CSI2RX_CFG_NUM_LANES_csi2rx_cfg_num_lanes_MASK MIPI_CSI2RX_CFG_NUM_LANES_CFG_NUM_LANES_MASK
79#endif
80
81#ifndef MIPI_CSI2RX_CSI2RX_IRQ_MASK_csi2rx_irq_mask_MASK
82#define MIPI_CSI2RX_CSI2RX_IRQ_MASK_csi2rx_irq_mask_MASK MIPI_CSI2RX_IRQ_MASK_IRQ_MASK_MASK
83#endif
84
87{
88 kCSI2RX_DataLane0 = (1U << 0U),
89 kCSI2RX_DataLane1 = (1U << 1U),
90 kCSI2RX_DataLane2 = (1U << 2U),
91 kCSI2RX_DataLane3 = (1U << 3U)
92};
93
96{
123
125typedef struct _csi2rx_config
126{
127 uint8_t laneNum;
132
135{
137 kCSI2RX_BitErrorEccOneBit = (1U << 1U)
139
142{
149
152{
153 kCSI2RX_InterruptCrcError = (1U << 0U), /* CRC error. */
154 kCSI2RX_InterruptEccOneBitError = (1U << 1U), /* One bit ECC error. */
155 kCSI2RX_InterruptEccTwoBitError = (1U << 2U), /* One bit ECC error. */
156 kCSI2RX_InterruptUlpsStatusChange = (1U << 3U), /* ULPS status changed. */
157 kCSI2RX_InterruptErrorSotHs = (1U << 4U), /* D-PHY ErrSotHS occurred. */
158 kCSI2RX_InterruptErrorSotSyncHs = (1U << 5U), /* D-PHY ErrSotSync_HS occurred. */
159 kCSI2RX_InterruptErrorEsc = (1U << 6U), /* D-PHY ErrEsc occurred. */
160 kCSI2RX_InterruptErrorSyncEsc = (1U << 7U), /* D-PHY ErrSyncEsc occurred. */
161 kCSI2RX_InterruptErrorControl = (1U << 8U), /* D-PHY ErrControl occurred. */
162};
163
166{
177};
178
179/*******************************************************************************
180 * API
181 ******************************************************************************/
182#if defined(__cplusplus)
183extern "C" {
184#endif
185
193
200
230static inline uint32_t CSI2RX_GetBitError(MIPI_CSI2RX_Type *base)
231{
232 return CSI2RX_REG_BIT_ERR(base);
233}
234
244static inline uint32_t CSI2RX_GetEccBitErrorPosition(uint32_t bitError)
245{
246 return (bitError >> 2U) & 0x1FU;
247}
248
265static inline uint32_t CSI2RX_GetUlpsStatus(MIPI_CSI2RX_Type *base)
266{
267 return CSI2RX_REG_ULPS_STATUS(base);
268}
269
295static inline uint32_t CSI2RX_GetPpiErrorDataLanes(MIPI_CSI2RX_Type *base, csi2rx_ppi_error_t errorType)
296{
297 uint32_t errorLanes;
298
299 if (kCSI2RX_PpiErrorSotHs == errorType)
300 {
301 errorLanes = CSI2RX_REG_PPI_ERRSOT_HS(base);
302 }
303 else if (kCSI2RX_PpiErrorSotSyncHs == errorType)
304 {
305 errorLanes = CSI2RX_REG_PPI_ERRSOTSYNC_HS(base);
306 }
307 else if (kCSI2RX_PpiErrorEsc == errorType)
308 {
309 errorLanes = CSI2RX_REG_PPI_ERRESC(base);
310 }
311 else if (kCSI2RX_PpiErrorSyncEsc == errorType)
312 {
313 errorLanes = CSI2RX_REG_PPI_ERRSYNCESC(base);
314 }
315 else
316 {
317 errorLanes = CSI2RX_REG_PPI_ERRCONTROL(base);
318 }
319
320 return errorLanes;
321}
322
337static inline void CSI2RX_EnableInterrupts(MIPI_CSI2RX_Type *base, uint32_t mask)
338{
339 CSI2RX_REG_IRQ_MASK(base) &= ~mask;
340}
341
356static inline void CSI2RX_DisableInterrupts(MIPI_CSI2RX_Type *base, uint32_t mask)
357{
358 CSI2RX_REG_IRQ_MASK(base) |= mask;
359}
360
370static inline uint32_t CSI2RX_GetInterruptStatus(MIPI_CSI2RX_Type *base)
371{
372 return CSI2RX_REG_IRQ_STATUS(base);
373}
374
375#if defined(__cplusplus)
376}
377#endif
378
383#endif /* _FSL_MIPI_CSI2RX_H_ */
_csi2rx_ulps_status
MIPI CSI2RX D-PHY ULPS state.
Definition: fsl_mipi_csi2rx.h:166
_csi2rx_ppi_error
MIPI CSI2RX PPI error types.
Definition: fsl_mipi_csi2rx.h:142
void CSI2RX_Init(MIPI_CSI2RX_Type *base, const csi2rx_config_t *config)
Enables and configures the CSI2RX peripheral module.
Definition: fsl_mipi_csi2rx.c:220
_csi2rx_interrupt
MIPI CSI2RX interrupt.
Definition: fsl_mipi_csi2rx.h:152
struct _csi2rx_config csi2rx_config_t
CSI2RX configuration.
enum _csi2rx_ppi_error csi2rx_ppi_error_t
MIPI CSI2RX PPI error types.
_csi2rx_data_lane
CSI2RX data lanes.
Definition: fsl_mipi_csi2rx.h:87
_csi2rx_payload
CSI2RX payload type.
Definition: fsl_mipi_csi2rx.h:96
_csi2rx_bit_error
MIPI CSI2RX bit errors.
Definition: fsl_mipi_csi2rx.h:135
void CSI2RX_Deinit(MIPI_CSI2RX_Type *base)
Disables the CSI2RX peripheral module.
Definition: fsl_mipi_csi2rx.c:250
uint8_t tHsSettle_EscClk
Definition: fsl_mipi_csi2rx.h:128
uint8_t laneNum
Definition: fsl_mipi_csi2rx.h:127
@ kCSI2RX_DataLane0Ulps
Definition: fsl_mipi_csi2rx.h:168
@ kCSI2RX_DataLane1Mark
Definition: fsl_mipi_csi2rx.h:174
@ kCSI2RX_DataLane2Mark
Definition: fsl_mipi_csi2rx.h:175
@ kCSI2RX_DataLane2Ulps
Definition: fsl_mipi_csi2rx.h:170
@ kCSI2RX_ClockLaneMark
Definition: fsl_mipi_csi2rx.h:172
@ kCSI2RX_ClockLaneUlps
Definition: fsl_mipi_csi2rx.h:167
@ kCSI2RX_DataLane3Ulps
Definition: fsl_mipi_csi2rx.h:171
@ kCSI2RX_DataLane1Ulps
Definition: fsl_mipi_csi2rx.h:169
@ kCSI2RX_DataLane0Mark
Definition: fsl_mipi_csi2rx.h:173
@ kCSI2RX_DataLane3Mark
Definition: fsl_mipi_csi2rx.h:176
@ kCSI2RX_PpiErrorSotSyncHs
Definition: fsl_mipi_csi2rx.h:144
@ kCSI2RX_PpiErrorEsc
Definition: fsl_mipi_csi2rx.h:145
@ kCSI2RX_PpiErrorControl
Definition: fsl_mipi_csi2rx.h:147
@ kCSI2RX_PpiErrorSotHs
Definition: fsl_mipi_csi2rx.h:143
@ kCSI2RX_PpiErrorSyncEsc
Definition: fsl_mipi_csi2rx.h:146
@ kCSI2RX_DataLane1
Definition: fsl_mipi_csi2rx.h:89
@ kCSI2RX_DataLane3
Definition: fsl_mipi_csi2rx.h:91
@ kCSI2RX_DataLane0
Definition: fsl_mipi_csi2rx.h:88
@ kCSI2RX_DataLane2
Definition: fsl_mipi_csi2rx.h:90
@ kCSI2RX_PayloadGroup1UserDefined1
Definition: fsl_mipi_csi2rx.h:114
@ kCSI2RX_PayloadGroup1UserDefined5
Definition: fsl_mipi_csi2rx.h:118
@ kCSI2RX_PayloadGroup1UserDefined2
Definition: fsl_mipi_csi2rx.h:115
@ kCSI2RX_PayloadGroup1UserDefined7
Definition: fsl_mipi_csi2rx.h:120
@ kCSI2RX_PayloadGroup0RGB666
Definition: fsl_mipi_csi2rx.h:106
@ kCSI2RX_PayloadGroup0RGB444
Definition: fsl_mipi_csi2rx.h:103
@ kCSI2RX_PayloadGroup1UserDefined4
Definition: fsl_mipi_csi2rx.h:117
@ kCSI2RX_PayloadGroup0Raw6
Definition: fsl_mipi_csi2rx.h:108
@ kCSI2RX_PayloadGroup0Raw14
Definition: fsl_mipi_csi2rx.h:113
@ kCSI2RX_PayloadGroup1UserDefined3
Definition: fsl_mipi_csi2rx.h:116
@ kCSI2RX_PayloadGroup0Null
Definition: fsl_mipi_csi2rx.h:97
@ kCSI2RX_PayloadGroup0Raw7
Definition: fsl_mipi_csi2rx.h:109
@ kCSI2RX_PayloadGroup0Raw8
Definition: fsl_mipi_csi2rx.h:110
@ kCSI2RX_PayloadGroup0RGB555
Definition: fsl_mipi_csi2rx.h:104
@ kCSI2RX_PayloadGroup0RGB888
Definition: fsl_mipi_csi2rx.h:107
@ kCSI2RX_PayloadGroup0Raw10
Definition: fsl_mipi_csi2rx.h:111
@ kCSI2RX_PayloadGroup1UserDefined6
Definition: fsl_mipi_csi2rx.h:119
@ kCSI2RX_PayloadGroup0RGB565
Definition: fsl_mipi_csi2rx.h:105
@ kCSI2RX_PayloadGroup0Blank
Definition: fsl_mipi_csi2rx.h:98
@ kCSI2RX_PayloadGroup0YUV422_10Bit
Definition: fsl_mipi_csi2rx.h:102
@ kCSI2RX_PayloadGroup0Embedded
Definition: fsl_mipi_csi2rx.h:99
@ kCSI2RX_PayloadGroup0YUV422_8Bit
Definition: fsl_mipi_csi2rx.h:101
@ kCSI2RX_PayloadGroup0Raw12
Definition: fsl_mipi_csi2rx.h:112
@ kCSI2RX_PayloadGroup1UserDefined8
Definition: fsl_mipi_csi2rx.h:121
@ kCSI2RX_PayloadGroup0YUV420_8Bit
Definition: fsl_mipi_csi2rx.h:100
@ kCSI2RX_BitErrorEccOneBit
Definition: fsl_mipi_csi2rx.h:137
@ kCSI2RX_BitErrorEccTwoBit
Definition: fsl_mipi_csi2rx.h:136
Definition: MIMXRT1166_cm4.h:63541
CSI2RX configuration.
Definition: fsl_mipi_csi2rx.h:126
Definition: deflate.c:114