27#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX78002_CSI2_H_
28#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX78002_CSI2_H_
66 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_0_YUV420_10BIT,
68 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_0_YUV420_8BIT_LEG,
70 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_0_YUV420_8BIT_CSP,
72 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_0_YUV420_10BIT_CSP,
75 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_0_YUV422_10BIT,
97 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE30,
99 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE31,
101 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE32,
103 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE33,
105 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE34,
107 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE35,
109 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE36,
111 ~MXC_F_CSI2_CFG_DISABLE_PAYLOAD_1_USR_DEF_TYPE37,
181 MXC_CSI2_FORMAT_BGBG_GRGR =
209typedef struct _mxc_csi2_capture_stats_t {
215 size_t bytes_captured;
216} mxc_csi2_capture_stats_t;
591bool MXC_CSI2_DMA_Frame_Complete(
void);
593mxc_csi2_capture_stats_t MXC_CSI2_GetCaptureStats(
void);
Registers, Bit Masks and Bit Positions for the CSI2 Peripheral Module.
#define MXC_S_CSI2_VFIFO_CFG0_DMAMODE_DMA_REQ
Definition: csi2_regs.h:862
#define MXC_S_CSI2_VFIFO_CFG0_DMAMODE_NO_DMA
Definition: csi2_regs.h:860
#define MXC_S_CSI2_VFIFO_CFG0_DMAMODE_FIFO_THD
Definition: csi2_regs.h:864
#define MXC_S_CSI2_VFIFO_CFG0_DMAMODE_FIFO_FULL
Definition: csi2_regs.h:866
#define MXC_S_CSI2_VFIFO_RAW_CTRL_RGB_TYP_RGB444
Definition: csi2_regs.h:1065
#define MXC_F_CSI2_VFIFO_RAW_CTRL_RAW_FMT_POS
Definition: csi2_regs.h:1051
#define MXC_S_CSI2_VFIFO_RAW_CTRL_RGB_TYP_RGB555
Definition: csi2_regs.h:1067
#define MXC_S_CSI2_VFIFO_RAW_CTRL_RGB_TYP_RGB666
Definition: csi2_regs.h:1071
#define MXC_S_CSI2_VFIFO_RAW_CTRL_RGB_TYP_RGB565
Definition: csi2_regs.h:1069
#define MXC_S_CSI2_VFIFO_RAW_CTRL_RGB_TYP_RGG888
Definition: csi2_regs.h:1073
uint32_t virtual_channel
Virtual Channel (0-3)
Definition: csi2.h:263
uint32_t wait_en
AHB Wait Enable.
Definition: csi2.h:265
uint32_t lines_per_frame
Image Height.
Definition: csi2.h:281
mxc_csi2_swap_sel_t d1_swap_sel
Data Lane 1 Control Source Select.
Definition: csi2.h:241
uint32_t wait_cyc
AHB Maximal Wait Cycles.
Definition: csi2.h:266
mxc_csi2_swap_sel_t c0_swap_sel
Clock Lane Control Source Select.
Definition: csi2.h:244
uint32_t rx_thd
FIFO Threshold.
Definition: csi2.h:272
uint32_t frame_num
Number of frames to capture.
Definition: csi2.h:284
mxc_csi2_dma_frame_t dma_whole_frame
DMA whole frame or line by line.
Definition: csi2.h:268
mxc_csi2_fbwm_t bandwidth_mode
Full Band Width Mode Enable.
Definition: csi2.h:273
mxc_csi2_lane_src_t lane_src
Data and Clock lane sources.
Definition: csi2.h:256
mxc_csi2_payload0_t payload0
Payload 0 data select.
Definition: csi2.h:254
mxc_csi2_swap_sel_t d0_swap_sel
Data Lane 0 Control Source Select.
Definition: csi2.h:240
mxc_csi2_raw_format_t raw_format
Select RAW format.
Definition: csi2.h:290
uint32_t flow_ctrl
Flow control selection.
Definition: csi2.h:264
mxc_csi2_swap_sel_t d3_swap_sel
Data Lane 3 Control Source Select.
Definition: csi2.h:243
mxc_csi2_err_det_t err_det_en
Error Detection Enable.
Definition: csi2.h:271
uint32_t bits_per_pixel_odd
Bits Per Pixel Odd.
Definition: csi2.h:282
uint32_t raw_buf1_addr
RAW Buffer 1 Address (line by line)
Definition: csi2.h:293
mxc_csi2_rgb_type_t rgb_type
Select final processed RGB type.
Definition: csi2.h:289
mxc_csi2_raw_autoflush_t autoflush
FIFO Automatic Flush-Out enable.
Definition: csi2.h:291
uint32_t raw_buf0_addr
RAW Buffer 0 Address (line by line)
Definition: csi2.h:292
mxc_csi2_ppi_clk_t invert_ppi_clk
Invert the PPI input clock.
Definition: csi2.h:251
uint32_t num_lanes
Configure number of lanes.
Definition: csi2.h:252
mxc_csi2_line_handler_cb_t line_handler
Callback triggered for each image row. Application code must implement this to offload data.
Definition: csi2.h:286
mxc_csi2_fiform_t fifo_rd_mode
FIFO Read Mode.
Definition: csi2.h:270
uint32_t flush_cnt
Flush Count.
Definition: csi2.h:253
mxc_csi2_swap_sel_t d2_swap_sel
Data Lane 2 Control Source Select.
Definition: csi2.h:242
uint8_t process_raw_to_rgb
Select if processing RAW data to RGB type.
Definition: csi2.h:288
uint32_t pixels_per_line
Image Width.
Definition: csi2.h:280
uint32_t bits_per_pixel_even
Bits Per Pixel Even.
Definition: csi2.h:283
mxc_csi2_dma_mode_t dma_mode
DMA Mode.
Definition: csi2.h:269
mxc_csi2_payload1_t payload1
Payload 1 data select.
Definition: csi2.h:255
mxc_csi2_raw_autoflush_t
Enumeration type for the CSI-2 Autoflush.
Definition: csi2.h:188
mxc_csi2_dma_mode_t MXC_CSI2_VFIFO_GetDMAMode(void)
Get the currently set DMA Mode for VFIFO.
int MXC_CSI2_CaptureFrameDMA(void)
Capture an image frame using DMA.
mxc_csi2_rgb_type_t MXC_CSI2_VFIFO_GetRGBType(void)
Get the currently set RGB type.
void MXC_CSI2_VFIFO_SetAHBWait(mxc_csi2_ahbwait_t wait_en)
Set the AHB Wait (enable/disable)
mxc_csi2_rgb_type_t
Enumeration type for the CSI-2 RGB Type.
Definition: csi2.h:163
mxc_csi2_dma_frame_t
Enumeration type for the CSI-2 DMA Frame option.
Definition: csi2.h:204
int MXC_CSI2_GetLaneCtrlSource(mxc_csi2_lane_src_t *src)
Get Lane Control Source for D0-D4 and C0.
mxc_csi2_raw_format_t MXC_CSI2_VFIFO_GetRAWFormat(void)
Gets the currently set Bayer Filter pattern RAW format type.
void MXC_CSI2_PPI_EnableInt(uint32_t mask)
Enable PHY Protocol interface (PPI) Interrupts.
int MXC_CSI2_VFIFO_SetRAWFormat(mxc_csi2_raw_format_t raw_format)
Sets the RAW format type.
int MXC_CSI2_VFIFO_SetDMAMode(mxc_csi2_dma_mode_t dma_mode)
Sets the DMA Mode for VFIFO.
int MXC_CSI2_Stop(void)
Disable the blocks and stop the CSI-2.
mxc_csi2_fbwm_t
Enumeration type for the CSI-2 VFIFO Bandwidth.
Definition: csi2.h:155
int MXC_CSI2_PPI_Stop(void)
Stops the PPI by disabling interrupts.
void MXC_CSI2_DMA_Callback(int a, int b)
The processing function for DMA and the CSI-2.
mxc_csi2_payload0_t
Enumeration type for the CSI-2 Payload 0 data types.
Definition: csi2.h:59
mxc_csi2_swap_sel_t
Enumeration type for the CSI-2 Lane Control Source Selections.
Definition: csi2.h:117
mxc_csi2_err_det_t
Enumeration type for CSI-2 VIFO Error Detection.
Definition: csi2.h:147
int MXC_CSI2_VFIFO_GetFIFOEntityCount(void)
Get the remaining current FIFO count in VFIFO.
mxc_csi2_dma_mode_t
Enumeration type for CSI-2 VFIFO DMA Mode.
Definition: csi2.h:128
int MXC_CSI2_CTRL_GetFlags(void)
Gets the interrupt flags that are currently set.
int MXC_CSI2_Init(mxc_csi2_req_t *req, mxc_csi2_ctrl_cfg_t *ctrl_cfg, mxc_csi2_vfifo_cfg_t *vfifo_cfg)
Initialize CSI-2.
mxc_csi2_payload1_t
Enumeration type for the CSI-2 Payload 1 Datatypes.
Definition: csi2.h:94
void MXC_CSI2_CTRL_ClearFlags(uint32_t flags)
Clears the interrupt flags.
void MXC_CSI2_VFIFO_ClearFlags(uint32_t flags)
Clears the interrupt flags for VFIFO.
int MXC_CSI2_VFIFO_Config(mxc_csi2_vfifo_cfg_t *cfg)
Clears the interrupt flags.
int MXC_CSI2_DMA_GetCurrentFrameEndCnt(void)
Gets the current DMA Frame End Count when using whole frame DMA requests.
int MXC_CSI2_Shutdown(void)
Shutdown CSI-2.
int MXC_CSI2_DMA_GetCurrentLineCnt(void)
Gets the current DMA line count when using line by line DMA requests.
mxc_csi2_raw_format_t
Enumeration type for the CSI-2 RAW Format.
Definition: csi2.h:174
int MXC_CSI2_Start(int num_data_lanes)
Enable the blocks and start the CSI-2.
int MXC_CSI2_CTRL_Config(mxc_csi2_ctrl_cfg_t *cfg)
Configure the RX Controller.
void MXC_CSI2_CTRL_EnableInt(uint32_t mask)
Enable RX Controller Interrupts.
int MXC_CSI2_PPI_GetFlags(void)
Gets the interrupt flags that are currently set for PPI.
int(* mxc_csi2_line_handler_cb_t)(uint8_t *data, unsigned int len)
The callback routine used to handle incoming image data from the camera sensor. It is triggered once ...
Definition: csi2.h:234
void MXC_CSI2_CTRL_DisableInt(uint32_t mask)
Disable RX Controller Interrupts.
mxc_csi2_ppi_clk_t
Enumeration type for the CSI-2 PPI Clock Inversion.
Definition: csi2.h:51
int MXC_CSI2_VFIFO_ProcessRAWtoRGB(mxc_csi2_req_t *req)
Set parameters for processing RAW image data to RGB type data.
int MXC_CSI2_DMA_Config(uint8_t *dst_addr, uint32_t byte_cnt, uint32_t burst_size)
Clears the interrupt flags for PPI.
int MXC_CSI2_SetLaneCtrlSource(mxc_csi2_lane_src_t *src)
Select Lane Control Source for D0-D4 and C0.
int MXC_CSI2_CaptureFrame(void)
Capture an image frame using DMA. Same as MXC_CSI2_CaptureFrameDMA.
mxc_csi2_fiform_t
Enumeration type for CSI-2 VFIFO Read Mode.
Definition: csi2.h:139
void MXC_CSI2_PPI_ClearFlags(uint32_t flags)
Clears the interrupt flags for PPI.
mxc_csi2_ahbwait_t MXC_CSI2_VFIFO_GetAHBWait(void)
Retrieves whether AHB Wait is enabled or disabled.
void MXC_CSI2_VFIFO_ChangeIntMode(uint32_t mask, uint32_t edge)
Change FIFO detection mode for FIFO-specific VFIFO interrupts.
int MXC_CSI2_VFIFO_GetPayloadType(uint32_t *payload0, uint32_t *payload1)
Get the Payload data type.
void MXC_CSI2_VFIFO_EnableInt(uint32_t mask, uint32_t edge)
Enable VFIFO Interrupts.
void MXC_CSI2_GetImageDetails(uint32_t *imgLen, uint32_t *w, uint32_t *h)
Grab the configured image details.
void MXC_CSI2_PPI_DisableInt(uint32_t mask)
Disable PHY Protocol interface (PPI) Interrupts.
int MXC_CSI2_VFIFO_Disable(void)
Only disables the VFIFO.
int MXC_CSI2_DMA_GetChannel(void)
Gets the acquired DMA channel used for CSI-2 operations.
int MXC_CSI2_VFIFO_Enable(void)
Only enables the VFIFO.
int MXC_CSI2_VFIFO_NextFIFOTrigMode(uint8_t ff_not_empty, uint8_t ff_abv_thd, uint8_t ff_full)
Set Next FIFO Trigger Mode: FIFO Not Empty, Above Threshold, Full.
mxc_csi2_ahbwait_t
Enumeration type for the CSI-2 AHB Wait option.
Definition: csi2.h:196
void(* mxc_csi2_frame_handler_cb_t)(mxc_csi2_req_t *req, int result)
The callback routine used to indicate to indicate transaction has terminated. This is currently unuse...
Definition: csi2.h:223
int MXC_CSI2_VFIFO_GetFlags(void)
Gets the interrupt flags that are currently set for VFIFO.
int MXC_CSI2_VFIFO_SetPayloadType(mxc_csi2_payload0_t payload0, mxc_csi2_payload1_t payload1)
Sets the Payload data type.
void MXC_CSI2_VFIFO_DisableInt(uint32_t mask)
Disable VFIFO Interrupts.
int MXC_CSI2_VFIFO_SetRGBType(mxc_csi2_rgb_type_t rgb_type)
Sets the RGB Type when reading CSI2 FIFO.
@ MXC_CSI2_AUTOFLUSH_ENABLE
Enable FIFO Automatic Flush-Out.
Definition: csi2.h:190
@ MXC_CSI2_AUTOFLUSH_DISABLE
Disable FIFO Automatic Flush-Out.
Definition: csi2.h:189
@ MXC_CSI2_TYPE_RGB555
RGB555 Type.
Definition: csi2.h:165
@ MXC_CSI2_TYPE_RGB565
RGB565 Type.
Definition: csi2.h:166
@ MXC_CSI2_TYPE_RGB666
RGB666 Type.
Definition: csi2.h:167
@ MXC_CSI2_TYPE_RGB444
RGB444 Type.
Definition: csi2.h:164
@ MXC_CSI2_TYPE_RGB888
RGB888 Type.
Definition: csi2.h:168
@ MXC_CSI2_DMA_WHOLE_FRAME
DMA entire frames at a time.
Definition: csi2.h:205
@ MXC_CSI2_DMA_LINE_BY_LINE
DMA line by line per frame.
Definition: csi2.h:206
@ MXC_CSI2_FULL_BW
Full Bandwidth Mode.
Definition: csi2.h:157
@ MXC_CSI2_NORMAL_BW
Normal Bandwidth Mode.
Definition: csi2.h:156
@ MXC_CSI2_PL0_YUV422_10BIT
YUV422 10-bit data.
Definition: csi2.h:74
@ MXC_CSI2_PL0_RGB444
RGB444 data.
Definition: csi2.h:76
@ MXC_CSI2_PL0_YUV420_10BIT
YUV420 10-bit data.
Definition: csi2.h:65
@ MXC_CSI2_PL0_LEG_YUV420_8BIT
Legacy YUV420 8-bit data.
Definition: csi2.h:67
@ MXC_CSI2_PL0_RAW8
RAW8 data.
Definition: csi2.h:83
@ MXC_CSI2_PL0_RAW7
RAW7 data.
Definition: csi2.h:82
@ MXC_CSI2_PL0_BLANK
BLANK payload data.
Definition: csi2.h:62
@ MXC_CSI2_PL0_RAW14
RAW14 data.
Definition: csi2.h:86
@ MXC_CSI2_PL0_RGB565
RGB565 data.
Definition: csi2.h:78
@ MXC_CSI2_PL0_RAW12
RAW12 data.
Definition: csi2.h:85
@ MXC_CSI2_PL0_YUV420_8BIT
YUV420 8-bit data.
Definition: csi2.h:64
@ MXC_CSI2_PL0_EMBEDDED
EMBEDDED payload data.
Definition: csi2.h:63
@ MXC_CSI2_PL0_RAW20
RAW20 data.
Definition: csi2.h:88
@ MXC_CSI2_PL0_YUV422_8BIT
YUV422 8-bit data.
Definition: csi2.h:73
@ MXC_CSI2_PL0_YUV422_8BIT_CSP
YUV422 8-bit CSP data.
Definition: csi2.h:69
@ MXC_CSI2_PL0_RGB888
RGB888 data.
Definition: csi2.h:80
@ MXC_CSI2_PL0_YUV422_10BIT_CSP
YUV422 10-bit CSP data.
Definition: csi2.h:71
@ MXC_CSI2_PL0_DISABLE_ALL
Disable payload0 data.
Definition: csi2.h:60
@ MXC_CSI2_PL0_RAW16
RAW16 data.
Definition: csi2.h:87
@ MXC_CSI2_PL0_RAW10
RAW10 data.
Definition: csi2.h:84
@ MXC_CSI2_PL0_NULL
NULL payload data.
Definition: csi2.h:61
@ MXC_CSI2_PL0_RGB666
RGB666 data.
Definition: csi2.h:79
@ MXC_CSI2_PL0_RAW6
RAW6 data.
Definition: csi2.h:81
@ MXC_CSI2_PL0_RGB555
RGB555 data.
Definition: csi2.h:77
@ MXC_CSI2_PAD_CDRX_PN_L1
Connected to PAD_CDRX_L1P/N.
Definition: csi2.h:119
@ MXC_CSI2_PAD_CDRX_PN_L3
Connected to PAD_CDRX_L3P/N.
Definition: csi2.h:121
@ MXC_CSI2_PAD_CDRX_PN_L4
Connected to PAD_CDRX_L4P/N.
Definition: csi2.h:122
@ MXC_CSI2_PAD_CDRX_PN_L2
Connected to PAD_CDRX_L2P/N.
Definition: csi2.h:120
@ MXC_CSI2_PAD_CDRX_PN_L0
Connected to PAD_CDRX_L0P/N.
Definition: csi2.h:118
@ MXC_CSI2_ERR_DETECT_ENABLE
Enable Error Detection.
Definition: csi2.h:149
@ MXC_CSI2_ERR_DETECT_DISABLE
Disable Error Detection.
Definition: csi2.h:148
@ MXC_CSI2_DMA_SEND_REQUEST
DMA Request Mode.
Definition: csi2.h:130
@ MXC_CSI2_DMA_FIFO_ABV_THD
Above FIFO Threshold Mode.
Definition: csi2.h:131
@ MXC_CSI2_DMA_FIFO_FULL
FIFO Full Mode.
Definition: csi2.h:133
@ MXC_CSI2_DMA_NO_DMA
No DMA Mode.
Definition: csi2.h:129
@ MXC_CSI2_PL1_UD_0x35
User defined type 0x35 data.
Definition: csi2.h:106
@ MXC_CSI2_PL1_UD_0x33
User defined type 0x33 data.
Definition: csi2.h:102
@ MXC_CSI2_PL1_UD_0x36
User defined type 0x36 data.
Definition: csi2.h:108
@ MXC_CSI2_PL1_UD_0x30
User defined type 0x30 data.
Definition: csi2.h:96
@ MXC_CSI2_PL1_UD_0x34
User defined type 0x34 data.
Definition: csi2.h:104
@ MXC_CSI2_PL1_UD_0x31
User defined type 0x31 data.
Definition: csi2.h:98
@ MXC_CSI2_PL1_UD_0x32
User defined type 0x32 data.
Definition: csi2.h:100
@ MXC_CSI2_PL1_DISABLE_ALL
Disable payload1 data.
Definition: csi2.h:95
@ MXC_CSI2_PL1_UD_0x37
User defined type 0x37 data.
Definition: csi2.h:110
@ MXC_CSI2_FORMAT_GRGR_BGBG
GRGR_BGBG Format.
Definition: csi2.h:177
@ MXC_CSI2_FORMAT_RGRG_GBGB
RGRG_GBGB Format.
Definition: csi2.h:175
@ MXC_CSI2_FORMAT_GBGB_RGRG
GBGB_RGRG Format.
Definition: csi2.h:179
@ MXC_CSI2_PPI_NO_INVERT
No inversion of PPI input clock.
Definition: csi2.h:52
@ MXC_CSI2_PPI_INVERT
Invert PPI input clock.
Definition: csi2.h:53
@ MXC_CSI2_READ_DIRECT_ADDR
Direct Addressing FIFO Read Mode.
Definition: csi2.h:141
@ MXC_CSI2_READ_ONE_BY_ONE
One by One FIFO Read Mode.
Definition: csi2.h:140
@ MXC_CSI2_AHBWAIT_DISABLE
Disable AHB Wait.
Definition: csi2.h:197
@ MXC_CSI2_AHBWAIT_ENABLE
Enable AHB Wait.
Definition: csi2.h:198
The information required to capture images.
Definition: csi2.h:279
Struct containing RX Controller and D-PHY configuration details.
Definition: csi2.h:250
Selects control source signals for data and clock lanes.
Definition: csi2.h:239
Struct containing parameters for the VFIFO.
Definition: csi2.h:262