CSIRX driver provides API to capture raw data frames from the CSIRX interface.
Features Supported
- APIs to setup complexio, dphy, common CSIRX settings, context specific CSIRX settings
- APIs to register callback for different CISRX events including frame complete and "every N lines" interrupts
- APIs to setup CSIRX in debug mode to generate test data without connecting a sensor
SysConfig Features
- Note
- It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
- Comprehensive CSIRX configuration for complexio, dphy, common config and context specifc config via SysConfig
- SysConfig generates the CSIRX open related sequence calls
- User can use SysConfig to setup CSIRX and then they need to call CSIRX APIs mainly to capture frames and recycle buffers.
Features NOT Supported
NA
Important Usage Guidelines
NA
Example Usage
Include the below file to access the APIs
Do below to open and configure CSIRX, here we show the usage assuming SysConfig is used. If you dont use SysConfig, then refer the SysConfig generated code form the CSIRX example in the SDK for a sample recommended API sequence call.
/* make sure to include the below file to get access to all CSIRX configuration variables and functions, this file is generate via SysConfig */
#include "ti_drivers_open_close.h"
/* see the file, generated by SysConfig, "ti_drivers_open_close.c", to see the exact CSIRX APIs calls and configuration values that are generated from SysConfig */
/* use below to open all drivers configured via SysConfig including CSIRX */
Drivers_open();
/* === OR ===
/*
* If the "Enable Instance Open in Drivers_open" in SysConfig is unchecked, then call below API to setup the CSIRX.
* Typically this is needed if the CSIRX setup should be done after sensor init or at some specific point in your application
*/
status = Drivers_csirxInstanceOpen(
CONFIG_CSIRX0,
CONFIG_CSIRX0_NUM_CONTEXT,
gConfigCsirx0ContextConfig
);
DebugP_assert(status==SystemP_SUCCESS);
Given below is a sample CSIRX buffer definition, which we will use to capture data into. Double buffers or ping and pong buffers are used, so that CSIRX can continue capture to pong buffer while the SW processes the ping buffer.
#define MY_CSIRX__FRAME_LINES_MAX (4U)
#define MY_CSIRX__BYTES_PER_LINE_MAX (128U)
uint8_t gMyCsirxBuf[2][MY_CSIRX__FRAME_LINES_MAX*MY_CSIRX__BYTES_PER_LINE_MAX]
__attribute__((aligned(64), section(
".bss.dss_l3")));
Given below is a sample ISR to handle CSIRX interrupts,
bool gMyCsirxContextIntrDone = false;
uint8_t gMyCsirxContextId = 0;
void my_csirx_commonCallback(
CSIRX_Handle handle,
void *arg,
struct CSIRX_CommonIntr_s *irq)
{
if(irq->isContextIntr[gMyCsirxContextId])
{
{
gMyCsirxContextIntrDone = true;
}
}
}
Finally, given below is how we enable data capture, wait for frames and process the data from the ping and pong buffers.
uint32_t bufId = 0;
while(1)
{
while( gMyCsirxContextIntrDone != true )
{
}
gMyCsirxContextIntrDone = false;
bufId = bufId ^ 1;
}
API
APIs for CSIRX