RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Data Structures | Enumerator | Variables
Csi_driver

Data Structures

struct  _csi_config
 Configuration to initialize the CSI module. More...
 
struct  _csi_handle
 CSI handle structure. More...
 

Variables

uint16_t _csi_config::width
 
uint16_t _csi_config::height
 
uint32_t _csi_config::polarityFlags
 
uint8_t _csi_config::bytesPerPixel
 
uint16_t _csi_config::linePitch_Bytes
 
csi_work_mode_t _csi_config::workMode
 
csi_data_bus_t _csi_config::dataBus
 
bool _csi_config::useExtVsync
 
uint32_t _csi_handle::frameBufferQueue [CSI_DRIVER_ACTUAL_QUEUE_SIZE]
 
volatile uint8_t _csi_handle::queueWriteIdx
 
volatile uint8_t _csi_handle::queueReadIdx
 
void *volatile _csi_handle::emptyBuffer
 
volatile uint8_t _csi_handle::emptyBufferCnt
 
volatile uint8_t _csi_handle::activeBufferNum
 
volatile bool _csi_handle::transferStarted
 
csi_transfer_callback_t _csi_handle::callback
 
void * _csi_handle::userData
 

Driver version

enum  { kStatus_CSI_NoEmptyBuffer = MAKE_STATUS(kStatusGroup_CSI, 0) , kStatus_CSI_NoFullBuffer = MAKE_STATUS(kStatusGroup_CSI, 1) , kStatus_CSI_QueueFull = MAKE_STATUS(kStatusGroup_CSI, 2) , kStatus_CSI_FrameDone = MAKE_STATUS(kStatusGroup_CSI, 3) }
 Error codes for the CSI driver. More...
 
enum  _csi_work_mode { kCSI_GatedClockMode = CSI_CR1_GCLK_MODE(1U) , kCSI_NonGatedClockMode = 0U , kCSI_CCIR656ProgressiveMode = CSI_CR1_CCIR_EN(1U) }
 CSI work mode. More...
 
enum  _csi_data_bus { kCSI_DataBus8Bit , kCSI_DataBus16Bit , kCSI_DataBus24Bit }
 CSI data bus witdh. More...
 
enum  _csi_polarity_flags {
  kCSI_HsyncActiveLow = 0U , kCSI_HsyncActiveHigh = CSI_CR1_HSYNC_POL_MASK , kCSI_DataLatchOnRisingEdge = CSI_CR1_REDGE_MASK , kCSI_DataLatchOnFallingEdge = 0U ,
  kCSI_VsyncActiveHigh = 0U , kCSI_VsyncActiveLow = CSI_CR1_SOF_POL_MASK
}
 CSI signal polarity. More...
 
enum  _csi_fifo { kCSI_RxFifo = (1U << 0U) , kCSI_StatFifo = (1U << 1U) , kCSI_AllFifo = 0x01 | 0x02 }
 The CSI FIFO, used for FIFO operation. More...
 
enum  _csi_interrupt_enable {
  kCSI_EndOfFrameInterruptEnable = CSI_CR1_EOF_INT_EN_MASK , kCSI_ChangeOfFieldInterruptEnable = CSI_CR1_COF_INT_EN_MASK , kCSI_StatFifoOverrunInterruptEnable = CSI_CR1_SF_OR_INTEN_MASK , kCSI_RxFifoOverrunInterruptEnable = CSI_CR1_RF_OR_INTEN_MASK ,
  kCSI_StatFifoDmaDoneInterruptEnable = CSI_CR1_SFF_DMA_DONE_INTEN_MASK , kCSI_StatFifoFullInterruptEnable = CSI_CR1_STATFF_INTEN_MASK , kCSI_RxBuffer1DmaDoneInterruptEnable = CSI_CR1_FB2_DMA_DONE_INTEN_MASK , kCSI_RxBuffer0DmaDoneInterruptEnable = CSI_CR1_FB1_DMA_DONE_INTEN_MASK ,
  kCSI_RxFifoFullInterruptEnable = CSI_CR1_RXFF_INTEN_MASK , kCSI_StartOfFrameInterruptEnable = CSI_CR1_SOF_INTEN_MASK , kCSI_EccErrorInterruptEnable = CSI_CR3_ECC_INT_EN_MASK , kCSI_AhbResErrorInterruptEnable = CSI_CR3_HRESP_ERR_EN_MASK ,
  kCSI_BaseAddrChangeErrorInterruptEnable = CSI_CR18_BASEADDR_CHANGE_ERROR_IE_MASK << 6U , kCSI_Field0DoneInterruptEnable = CSI_CR18_FIELD0_DONE_IE_MASK << 6U , kCSI_Field1DoneInterruptEnable = CSI_CR18_DMA_FIELD1_DONE_IE_MASK << 6U
}
 CSI feature interrupt source. More...
 
enum  _csi_flags {
  kCSI_RxFifoDataReadyFlag = CSI_SR_DRDY_MASK , kCSI_EccErrorFlag = CSI_SR_ECC_INT_MASK , kCSI_AhbResErrorFlag = CSI_SR_HRESP_ERR_INT_MASK , kCSI_ChangeOfFieldFlag = CSI_SR_COF_INT_MASK ,
  kCSI_Field0PresentFlag = CSI_SR_F1_INT_MASK , kCSI_Field1PresentFlag = CSI_SR_F2_INT_MASK , kCSI_StartOfFrameFlag = CSI_SR_SOF_INT_MASK , kCSI_EndOfFrameFlag = CSI_SR_EOF_INT_MASK ,
  kCSI_RxFifoFullFlag = CSI_SR_RxFF_INT_MASK , kCSI_RxBuffer1DmaDoneFlag = CSI_SR_DMA_TSF_DONE_FB2_MASK , kCSI_RxBuffer0DmaDoneFlag = CSI_SR_DMA_TSF_DONE_FB1_MASK , kCSI_StatFifoFullFlag = CSI_SR_STATFF_INT_MASK ,
  kCSI_StatFifoDmaDoneFlag = CSI_SR_DMA_TSF_DONE_SFF_MASK , kCSI_StatFifoOverrunFlag = CSI_SR_SF_OR_INT_MASK , kCSI_RxFifoOverrunFlag = CSI_SR_RF_OR_INT_MASK , kCSI_Field0DoneFlag = CSI_SR_DMA_FIELD0_DONE_MASK ,
  kCSI_Field1DoneFlag = CSI_SR_DMA_FIELD1_DONE_MASK , kCSI_BaseAddrChangeErrorFlag = CSI_SR_BASEADDR_CHHANGE_ERROR_MASK
}
 CSI status flags. More...
 
typedef enum _csi_work_mode csi_work_mode_t
 CSI work mode.
 
typedef enum _csi_data_bus csi_data_bus_t
 CSI data bus witdh.
 
typedef struct _csi_config csi_config_t
 Configuration to initialize the CSI module.
 
typedef enum _csi_fifo csi_fifo_t
 The CSI FIFO, used for FIFO operation.
 
typedef struct _csi_handle csi_handle_t
 
typedef void(* csi_transfer_callback_t) (CSI_Type *base, csi_handle_t *handle, status_t status, void *userData)
 CSI transfer callback function.
 
#define FSL_CSI_DRIVER_VERSION   (MAKE_VERSION(2, 1, 5))
 
#define CSI_REG_CR1(base)   (base)->CR1
 
#define CSI_REG_CR2(base)   (base)->CR2
 
#define CSI_REG_CR3(base)   (base)->CR3
 
#define CSI_REG_CR18(base)   (base)->CR18
 
#define CSI_REG_SR(base)   (base)->SR
 
#define CSI_REG_DMASA_FB1(base)   (base)->DMASA_FB1
 
#define CSI_REG_DMASA_FB2(base)   (base)->DMASA_FB2
 
#define CSI_REG_IMAG_PARA(base)   (base)->IMAG_PARA
 
#define CSI_REG_FBUF_PARA(base)   (base)->FBUF_PARA
 
#define CSI_DRIVER_QUEUE_SIZE   4U
 Size of the frame buffer queue used in CSI transactional function.
 
#define CSI_DRIVER_FRAG_MODE   0U
 Enable fragment capture function or not.
 
#define CSI_DRIVER_ACTUAL_QUEUE_SIZE   (CSI_DRIVER_QUEUE_SIZE + 1U)
 
#define CSI_CR1_INT_EN_MASK   0xFFFF0000U
 
#define CSI_CR3_INT_EN_MASK   0x000000FFU
 
#define CSI_CR18_INT_EN_MASK   0x0000FF00U
 

Initialization and deinitialization

status_t CSI_Init (CSI_Type *base, const csi_config_t *config)
 Initialize the CSI.
 
void CSI_Deinit (CSI_Type *base)
 De-initialize the CSI.
 
void CSI_Reset (CSI_Type *base)
 Reset the CSI.
 
void CSI_GetDefaultConfig (csi_config_t *config)
 Get the default configuration for to initialize the CSI.
 

Module operation

void CSI_ClearFifo (CSI_Type *base, csi_fifo_t fifo)
 Clear the CSI FIFO.
 
void CSI_ReflashFifoDma (CSI_Type *base, csi_fifo_t fifo)
 Reflash the CSI FIFO DMA.
 
void CSI_EnableFifoDmaRequest (CSI_Type *base, csi_fifo_t fifo, bool enable)
 Enable or disable the CSI FIFO DMA request.
 
void CSI_SetRxBufferAddr (CSI_Type *base, uint8_t index, uint32_t addr)
 Set the RX frame buffer address.
 

Interrupts

void CSI_EnableInterrupts (CSI_Type *base, uint32_t mask)
 Enables CSI interrupt requests.
 
void CSI_DisableInterrupts (CSI_Type *base, uint32_t mask)
 Disable CSI interrupt requests.
 

Transactional

status_t CSI_TransferCreateHandle (CSI_Type *base, csi_handle_t *handle, csi_transfer_callback_t callback, void *userData)
 Initializes the CSI handle.
 
status_t CSI_TransferStart (CSI_Type *base, csi_handle_t *handle)
 Start the transfer using transactional functions.
 
status_t CSI_TransferStop (CSI_Type *base, csi_handle_t *handle)
 Stop the transfer using transactional functions.
 
status_t CSI_TransferSubmitEmptyBuffer (CSI_Type *base, csi_handle_t *handle, uint32_t frameBuffer)
 Submit empty frame buffer to queue.
 
status_t CSI_TransferGetFullBuffer (CSI_Type *base, csi_handle_t *handle, uint32_t *frameBuffer)
 Get one full frame buffer from queue.
 
void CSI_TransferHandleIRQ (CSI_Type *base, csi_handle_t *handle)
 CSI IRQ handle function.
 

Detailed Description

Typedef Documentation

◆ csi_transfer_callback_t

typedef void(* csi_transfer_callback_t) (CSI_Type *base, csi_handle_t *handle, status_t status, void *userData)

CSI transfer callback function.

When a new frame is received and saved to the frame buffer queue, the callback is called and the pass the status kStatus_CSI_FrameDone to upper layer.

◆ csi_work_mode_t

CSI work mode.

The CCIR656 interlace mode is not supported currently.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Error codes for the CSI driver.

Enumerator
kStatus_CSI_NoEmptyBuffer 

No empty frame buffer in queue to load to CSI.

kStatus_CSI_NoFullBuffer 

No full frame buffer in queue to read out.

kStatus_CSI_QueueFull 

Queue is full, no room to save new empty buffer.

kStatus_CSI_FrameDone 

New frame received and saved to queue.

◆ _csi_data_bus

CSI data bus witdh.

Enumerator
kCSI_DataBus8Bit 

8-bit data bus.

kCSI_DataBus16Bit 

16-bit data bus.

kCSI_DataBus24Bit 

24-bit data bus.

◆ _csi_fifo

enum _csi_fifo

The CSI FIFO, used for FIFO operation.

Enumerator
kCSI_RxFifo 

RXFIFO.

kCSI_StatFifo 

STAT FIFO.

kCSI_AllFifo 

Both RXFIFO and STAT FIFO.

◆ _csi_flags

enum _csi_flags

CSI status flags.

The following status register flags can be cleared:

  • kCSI_EccErrorFlag
  • kCSI_AhbResErrorFlag
  • kCSI_ChangeOfFieldFlag
  • kCSI_StartOfFrameFlag
  • kCSI_EndOfFrameFlag
  • kCSI_RxBuffer1DmaDoneFlag
  • kCSI_RxBuffer0DmaDoneFlag
  • kCSI_StatFifoDmaDoneFlag
  • kCSI_StatFifoOverrunFlag
  • kCSI_RxFifoOverrunFlag
  • kCSI_Field0DoneFlag
  • kCSI_Field1DoneFlag
  • kCSI_BaseAddrChangeErrorFlag
Enumerator
kCSI_RxFifoDataReadyFlag 

RXFIFO data ready.

kCSI_EccErrorFlag 

ECC error detected.

kCSI_AhbResErrorFlag 

Hresponse (AHB bus response) Error.

kCSI_ChangeOfFieldFlag 

Change of field.

kCSI_Field0PresentFlag 

Field 0 present in CCIR mode.

kCSI_Field1PresentFlag 

Field 1 present in CCIR mode.

kCSI_StartOfFrameFlag 

Start of frame (SOF) detected.

kCSI_EndOfFrameFlag 

End of frame (EOF) detected.

kCSI_RxFifoFullFlag 

RXFIFO full (Number of data reaches trigger level).

kCSI_RxBuffer1DmaDoneFlag 

RX frame buffer 1 DMA transfer done.

kCSI_RxBuffer0DmaDoneFlag 

RX frame buffer 0 DMA transfer done.

kCSI_StatFifoFullFlag 

STAT FIFO full (Reach trigger level).

kCSI_StatFifoDmaDoneFlag 

STAT FIFO DMA transfer done.

kCSI_StatFifoOverrunFlag 

STAT FIFO overrun.

kCSI_RxFifoOverrunFlag 

RXFIFO overrun.

kCSI_Field0DoneFlag 

Field 0 transfer done.

kCSI_Field1DoneFlag 

Field 1 transfer done.

kCSI_BaseAddrChangeErrorFlag 

The DMA output buffer base address changes before DMA completed.

◆ _csi_interrupt_enable

CSI feature interrupt source.

Enumerator
kCSI_EndOfFrameInterruptEnable 

End of frame interrupt enable.

kCSI_ChangeOfFieldInterruptEnable 

Change of field interrupt enable.

kCSI_StatFifoOverrunInterruptEnable 

STAT FIFO overrun interrupt enable.

kCSI_RxFifoOverrunInterruptEnable 

RXFIFO overrun interrupt enable.

kCSI_StatFifoDmaDoneInterruptEnable 

STAT FIFO DMA done interrupt enable.

kCSI_StatFifoFullInterruptEnable 

STAT FIFO full interrupt enable.

kCSI_RxBuffer1DmaDoneInterruptEnable 

RX frame buffer 1 DMA transfer done.

kCSI_RxBuffer0DmaDoneInterruptEnable 

RX frame buffer 0 DMA transfer done.

kCSI_RxFifoFullInterruptEnable 

RXFIFO full interrupt enable.

kCSI_StartOfFrameInterruptEnable 

Start of frame (SOF) interrupt enable.

kCSI_EccErrorInterruptEnable 

ECC error detection interrupt enable.

kCSI_AhbResErrorInterruptEnable 

AHB response Error interrupt enable.

kCSI_BaseAddrChangeErrorInterruptEnable 

The DMA output buffer base address changes before DMA completed.

kCSI_Field0DoneInterruptEnable 

Field 0 done interrupt enable.

kCSI_Field1DoneInterruptEnable 

Field 1 done interrupt enable.

◆ _csi_polarity_flags

CSI signal polarity.

Enumerator
kCSI_HsyncActiveLow 

HSYNC is active low.

kCSI_HsyncActiveHigh 

HSYNC is active high.

kCSI_DataLatchOnRisingEdge 

Pixel data latched at rising edge of pixel clock.

kCSI_DataLatchOnFallingEdge 

Pixel data latched at falling edge of pixel clock.

kCSI_VsyncActiveHigh 

VSYNC is active high.

kCSI_VsyncActiveLow 

VSYNC is active low.

◆ _csi_work_mode

CSI work mode.

The CCIR656 interlace mode is not supported currently.

Enumerator
kCSI_GatedClockMode 

HSYNC, VSYNC, and PIXCLK signals are used.

kCSI_NonGatedClockMode 

VSYNC, and PIXCLK signals are used.

kCSI_CCIR656ProgressiveMode 

CCIR656 progressive mode.

Function Documentation

◆ CSI_ClearFifo()

void CSI_ClearFifo ( CSI_Type base,
csi_fifo_t  fifo 
)

Clear the CSI FIFO.

This function clears the CSI FIFO.

Parameters
baseCSI peripheral base address.
fifoThe FIFO to clear.

brief Clear the CSI FIFO.

This function clears the CSI FIFO.

param base CSI peripheral base address. param fifo The FIFO to clear.

◆ CSI_Deinit()

void CSI_Deinit ( CSI_Type base)

De-initialize the CSI.

This function disables the CSI peripheral clock.

Parameters
baseCSI peripheral base address.

brief De-initialize the CSI.

This function disables the CSI peripheral clock.

param base CSI peripheral base address.

◆ CSI_DisableInterrupts()

void CSI_DisableInterrupts ( CSI_Type base,
uint32_t  mask 
)

Disable CSI interrupt requests.

Parameters
baseCSI peripheral base address.
maskThe interrupts to disable, pass in as OR'ed value of _csi_interrupt_enable.

brief Disable CSI interrupt requests.

param base CSI peripheral base address. param mask The interrupts to disable, pass in as OR'ed value of ref _csi_interrupt_enable.

◆ CSI_EnableFifoDmaRequest()

void CSI_EnableFifoDmaRequest ( CSI_Type base,
csi_fifo_t  fifo,
bool  enable 
)

Enable or disable the CSI FIFO DMA request.

Parameters
baseCSI peripheral base address.
fifoThe FIFO DMA reques to enable or disable.
enableTrue to enable, false to disable.

brief Enable or disable the CSI FIFO DMA request.

param base CSI peripheral base address. param fifo The FIFO DMA reques to enable or disable. param enable True to enable, false to disable.

◆ CSI_EnableInterrupts()

void CSI_EnableInterrupts ( CSI_Type base,
uint32_t  mask 
)

Enables CSI interrupt requests.

Parameters
baseCSI peripheral base address.
maskThe interrupts to enable, pass in as OR'ed value of _csi_interrupt_enable.

brief Enables CSI interrupt requests.

param base CSI peripheral base address. param mask The interrupts to enable, pass in as OR'ed value of ref _csi_interrupt_enable.

◆ CSI_GetDefaultConfig()

void CSI_GetDefaultConfig ( csi_config_t config)

Get the default configuration for to initialize the CSI.

The default configuration value is:

config->width = 320U;
config->height = 240U;
config->bytesPerPixel = 2U;
config->linePitch_Bytes = 320U * 2U;
config->useExtVsync = true;
@ kCSI_DataBus8Bit
Definition: fsl_csi.h:114
@ kCSI_GatedClockMode
Definition: fsl_csi.h:104
@ kCSI_DataLatchOnRisingEdge
Definition: fsl_csi.h:124
@ kCSI_HsyncActiveHigh
Definition: fsl_csi.h:123
Definition: deflate.c:114
Parameters
configPointer to the CSI configuration.

brief Get the default configuration for to initialize the CSI.

The default configuration value is:

code config->width = 320U; config->height = 240U; config->polarityFlags = kCSI_HsyncActiveHigh | kCSI_DataLatchOnRisingEdge; config->bytesPerPixel = 2U; config->linePitch_Bytes = 320U * 2U; config->workMode = kCSI_GatedClockMode; config->dataBus = kCSI_DataBus8Bit; config->useExtVsync = true; endcode

param config Pointer to the CSI configuration.

◆ CSI_Init()

status_t CSI_Init ( CSI_Type base,
const csi_config_t config 
)

Initialize the CSI.

This function enables the CSI peripheral clock, and resets the CSI registers.

Parameters
baseCSI peripheral base address.
configPointer to the configuration structure.
Return values
kStatus_SuccessInitialize successfully.
kStatus_InvalidArgumentInitialize failed because of invalid argument.

brief Initialize the CSI.

This function enables the CSI peripheral clock, and resets the CSI registers.

param base CSI peripheral base address. param config Pointer to the configuration structure.

retval kStatus_Success Initialize successfully. retval kStatus_InvalidArgument Initialize failed because of invalid argument.

◆ CSI_ReflashFifoDma()

void CSI_ReflashFifoDma ( CSI_Type base,
csi_fifo_t  fifo 
)

Reflash the CSI FIFO DMA.

This function reflashes the CSI FIFO DMA.

For RXFIFO, there are two frame buffers. When the CSI module started, it saves the frames to frame buffer 0 then frame buffer 1, the two buffers will be written by turns. After reflash DMA using this function, the CSI is reset to save frame to buffer 0.

Parameters
baseCSI peripheral base address.
fifoThe FIFO DMA to reflash.

brief Reflash the CSI FIFO DMA.

This function reflashes the CSI FIFO DMA.

For RXFIFO, there are two frame buffers. When the CSI module started, it saves the frames to frame buffer 0 then frame buffer 1, the two buffers will be written by turns. After reflash DMA using this function, the CSI is reset to save frame to buffer 0.

param base CSI peripheral base address. param fifo The FIFO DMA to reflash.

◆ CSI_Reset()

void CSI_Reset ( CSI_Type base)

Reset the CSI.

This function resets the CSI peripheral registers to default status.

Parameters
baseCSI peripheral base address.

brief Reset the CSI.

This function resets the CSI peripheral registers to default status.

param base CSI peripheral base address.

◆ CSI_SetRxBufferAddr()

void CSI_SetRxBufferAddr ( CSI_Type base,
uint8_t  index,
uint32_t  addr 
)

Set the RX frame buffer address.

Parameters
baseCSI peripheral base address.
indexBuffer index.
addrFrame buffer address to set.

brief Set the RX frame buffer address.

param base CSI peripheral base address. param index Buffer index. param addr Frame buffer address to set.

◆ CSI_TransferCreateHandle()

status_t CSI_TransferCreateHandle ( CSI_Type base,
csi_handle_t handle,
csi_transfer_callback_t  callback,
void *  userData 
)

Initializes the CSI handle.

This function initializes CSI handle, it should be called before any other CSI transactional functions.

Parameters
baseCSI peripheral base address.
handlePointer to the handle structure.
callbackCallback function for CSI transfer.
userDataCallback function parameter.
Return values
kStatus_SuccessHandle created successfully.

brief Initializes the CSI handle.

This function initializes CSI handle, it should be called before any other CSI transactional functions.

param base CSI peripheral base address. param handle Pointer to the handle structure. param callback Callback function for CSI transfer. param userData Callback function parameter.

retval kStatus_Success Handle created successfully.

◆ CSI_TransferGetFullBuffer()

status_t CSI_TransferGetFullBuffer ( CSI_Type base,
csi_handle_t handle,
uint32_t *  frameBuffer 
)

Get one full frame buffer from queue.

After the transfer started using function CSI_TransferStart, the incoming frames will be saved to the empty frame buffers in queue. This function gets the full-filled frame buffer from the queue. If there is no full frame buffer in queue, this function returns error.

Parameters
baseCSI peripheral base address.
handlePointer to the handle structure.
frameBufferFull frame buffer.
Return values
kStatus_SuccessStarted successfully.
kStatus_CSI_NoFullBufferThere is no full frame buffer in queue.

brief Get one full frame buffer from queue.

After the transfer started using function ref CSI_TransferStart, the incoming frames will be saved to the empty frame buffers in queue. This function gets the full-filled frame buffer from the queue. If there is no full frame buffer in queue, this function returns error.

param base CSI peripheral base address. param handle Pointer to the handle structure. param frameBuffer Full frame buffer.

retval kStatus_Success Started successfully. retval kStatus_CSI_NoFullBuffer There is no full frame buffer in queue.

◆ CSI_TransferHandleIRQ()

void CSI_TransferHandleIRQ ( CSI_Type base,
csi_handle_t handle 
)

CSI IRQ handle function.

This function handles the CSI IRQ request to work with CSI driver transactional APIs.

Parameters
baseCSI peripheral base address.
handleCSI handle pointer.

brief CSI IRQ handle function.

This function handles the CSI IRQ request to work with CSI driver transactional APIs.

param base CSI peripheral base address. param handle CSI handle pointer.

◆ CSI_TransferStart()

status_t CSI_TransferStart ( CSI_Type base,
csi_handle_t handle 
)

Start the transfer using transactional functions.

When the empty frame buffers have been submit to CSI driver using function CSI_TransferSubmitEmptyBuffer, user could call this function to start the transfer. The incoming frame will be saved to the empty frame buffer, and user could be optionally notified through callback function.

Parameters
baseCSI peripheral base address.
handlePointer to the handle structure.
Return values
kStatus_SuccessStarted successfully.
kStatus_CSI_NoEmptyBufferCould not start because no empty frame buffer in queue.

brief Start the transfer using transactional functions.

When the empty frame buffers have been submit to CSI driver using function ref CSI_TransferSubmitEmptyBuffer, user could call this function to start the transfer. The incoming frame will be saved to the empty frame buffer, and user could be optionally notified through callback function.

param base CSI peripheral base address. param handle Pointer to the handle structure.

retval kStatus_Success Started successfully. retval kStatus_CSI_NoEmptyBuffer Could not start because no empty frame buffer in queue.

◆ CSI_TransferStop()

status_t CSI_TransferStop ( CSI_Type base,
csi_handle_t handle 
)

Stop the transfer using transactional functions.

The driver does not clean the full frame buffers in queue. In other words, after calling this function, user still could get the full frame buffers in queue using function CSI_TransferGetFullBuffer.

Parameters
baseCSI peripheral base address.
handlePointer to the handle structure.
Return values
kStatus_SuccessStoped successfully.

brief Stop the transfer using transactional functions.

The driver does not clean the full frame buffers in queue. In other words, after calling this function, user still could get the full frame buffers in queue using function ref CSI_TransferGetFullBuffer.

param base CSI peripheral base address. param handle Pointer to the handle structure.

retval kStatus_Success Stoped successfully.

◆ CSI_TransferSubmitEmptyBuffer()

status_t CSI_TransferSubmitEmptyBuffer ( CSI_Type base,
csi_handle_t handle,
uint32_t  frameBuffer 
)

Submit empty frame buffer to queue.

This function could be called before CSI_TransferStart or after CSI_TransferStart. If there is no room in queue to store the empty frame buffer, this function returns error.

Parameters
baseCSI peripheral base address.
handlePointer to the handle structure.
frameBufferEmpty frame buffer to submit.
Return values
kStatus_SuccessStarted successfully.
kStatus_CSI_QueueFullCould not submit because there is no room in queue.

brief Submit empty frame buffer to queue.

This function could be called before ref CSI_TransferStart or after ref CSI_TransferStart. If there is no room in queue to store the empty frame buffer, this function returns error.

param base CSI peripheral base address. param handle Pointer to the handle structure. param frameBuffer Empty frame buffer to submit.

retval kStatus_Success Started successfully. retval kStatus_CSI_QueueFull Could not submit because there is no room in queue.

Variable Documentation

◆ activeBufferNum

volatile uint8_t _csi_handle::activeBufferNum

How many frame buffers are in progres currently.

◆ bytesPerPixel

uint8_t _csi_config::bytesPerPixel

Bytes per pixel, valid values are:

  • 2: Used for RGB565, YUV422, and so on.
  • 4: Used for XRGB8888, XYUV444, and so on.

◆ callback

csi_transfer_callback_t _csi_handle::callback

Callback function.

◆ dataBus

csi_data_bus_t _csi_config::dataBus

Data bus width.

◆ emptyBuffer

void* volatile _csi_handle::emptyBuffer

Pointer to maintain the empty frame buffers.

◆ emptyBufferCnt

volatile uint8_t _csi_handle::emptyBufferCnt

Empty frame buffers count.

◆ frameBufferQueue

uint32_t _csi_handle::frameBufferQueue[CSI_DRIVER_ACTUAL_QUEUE_SIZE]

Frame buffer queue.

◆ height

uint16_t _csi_config::height

Lines of the input frame.

◆ linePitch_Bytes

uint16_t _csi_config::linePitch_Bytes

Frame buffer line pitch, must be 8-byte aligned.

◆ polarityFlags

uint32_t _csi_config::polarityFlags

Timing signal polarity flags, OR'ed value of _csi_polarity_flags.

◆ queueReadIdx

volatile uint8_t _csi_handle::queueReadIdx

Pointer to read out the item.

◆ queueWriteIdx

volatile uint8_t _csi_handle::queueWriteIdx

Pointer to save incoming item.

◆ transferStarted

volatile bool _csi_handle::transferStarted

User has called CSI_TransferStart to start frame receiving.

◆ useExtVsync

bool _csi_config::useExtVsync

In CCIR656 progressive mode, set true to use external VSYNC signal, set false to use internal VSYNC signal decoded from SOF.

◆ userData

void* _csi_handle::userData

CSI callback function parameter.

◆ width

uint16_t _csi_config::width

Pixels of the input frame.

◆ workMode

csi_work_mode_t _csi_config::workMode

CSI work mode.