Vision Apps User Guide
UDMA initialization APIs (RTOS only)

Introduction

This section contains APIs for UDMA initialization.

Few utility APIs to copy/fill frames are implemented in this library using the UDMA LLD for convenience of application code.

For algorithms it is recommended to use the UDMA LLD APIs directly or UDMA DMA copy API present in PDK to avoid additional layer of software overhead.

Data Structures

struct  app_udma_init_prms_t
 UDMA init parameters. More...
 
struct  app_udma_create_prms_t
 Parameter to use when creating a logical DMA channel To avoid compatibility issues, user should called appUdmaCreatePrms_Init() to set default values for all params in this structure. More...
 
struct  app_udma_copy_1d_prms_t
 1D transfer request parameters More...
 
struct  app_udma_copy_2d_prms_t
 2D transfer request parameters More...
 
struct  app_udma_copy_nd_prms_t
 ND transfer request parameters. More...
 

Functions

void * appUdmaCsirxCsitxGetObj (void)
 Provides global handle to UDMA Obj BCDMA instance Required for CSIRX/CSITX on J721S2. More...
 
void appUdmaInitPrmSetDefault (app_udma_init_prms_t *prm)
 Sets default UDMA init parameters. More...
 
int32_t appUdmaInit (const app_udma_init_prms_t *prms)
 Performs initializations needed for UDMA. More...
 
int32_t appUdmaDeInit (void)
 Performs de-initializations needed for UDMA. More...
 
void * appUdmaGetObj (void)
 Provides global handle to UDMA Obj. More...
 
int32_t appUdmaTest (void)
 DMA copy test function. More...
 
int32_t appUdmaCopyInit (void)
 DMA copy init function. More...
 
int32_t appUdmaCopyDeinit (void)
 DMA copy deinit function. More...
 
app_udma_ch_handle_t appUdmaCopyCreate (const app_udma_create_prms_t *prms)
 DMA copy create channel function. More...
 
int32_t appUdmaCopyDelete (app_udma_ch_handle_t ch_handle)
 DMA copy delete channel function. More...
 
int32_t appUdmaCopy1D (app_udma_ch_handle_t ch_handle, const app_udma_copy_1d_prms_t *prms_1d)
 DMA copy 1D DMA copy function. More...
 
int32_t appUdmaCopy2D (app_udma_ch_handle_t ch_handle, const app_udma_copy_2d_prms_t *prms_2d, uint32_t num_transfers)
 DMA copy 2D DMA copy function. More...
 
int32_t appUdmaFill2D (app_udma_ch_handle_t ch_handle, const app_udma_copy_2d_prms_t *prms_2d, uint32_t num_transfers)
 DMA copy 2D DMA memfill function. More...
 
app_udma_ch_handle_t appUdmaCopyNDGetHandle (uint32_t ch_idx)
 Return handle to ND copy channel, if not already created, CH is created here. More...
 
int32_t appUdmaCopyNDReleaseHandle (uint32_t ch_idx)
 Releases reference to channel handle, if found to be last reference deletes the handle. More...
 
int32_t appUdmaCopyNDInit (app_udma_ch_handle_t ch_handle, const app_udma_copy_nd_prms_t *prms_nd)
 DMA copy ND init function. More...
 
int32_t appUdmaCopyNDDeinit (app_udma_ch_handle_t ch_handle)
 DMA copy ND de-init function. More...
 
int32_t appUdmaCopyNDTrigger (app_udma_ch_handle_t ch_handle)
 DMA copy ND trigger function. More...
 
int32_t appUdmaCopyNDWait (app_udma_ch_handle_t ch_handle)
 DMA copy ND wait function. More...
 
void appUdmaCopyNDPrmsPrint (app_udma_copy_nd_prms_t *prm, char *name)
 Prints params values. More...
 
static void appUdmaCreatePrms_Init (app_udma_create_prms_t *prms)
 Set defaults for app_udma_create_prms_t structure. More...
 
static void appUdmaCopy1DPrms_Init (app_udma_copy_1d_prms_t *prms_1d)
 Set defaults for app_udma_copy_1d_prms_t structure. More...
 
static void appUdmaCopy2DPrms_Init (app_udma_copy_2d_prms_t *prms_2d)
 Set defaults for app_udma_copy_2d_prms_t structure. More...
 
static void appUdmaCopyNDPrms_Init (app_udma_copy_nd_prms_t *prms_nd)
 Set defaults for app_udma_copy_nd_prms_t structure. More...
 

Typedefs

typedef void * app_udma_ch_handle_t
 App UDMA channel handle. More...
 

Macros

#define APP_UDMA_ND_CHANNELS_MAX   (16U)
 max number of ND copy channels one can open More...
 

Macro Definition Documentation

◆ APP_UDMA_ND_CHANNELS_MAX

#define APP_UDMA_ND_CHANNELS_MAX   (16U)

max number of ND copy channels one can open

Typedef Documentation

◆ app_udma_ch_handle_t

typedef void* app_udma_ch_handle_t

App UDMA channel handle.

Function Documentation

◆ appUdmaCsirxCsitxGetObj()

void* appUdmaCsirxCsitxGetObj ( void  )

Provides global handle to UDMA Obj BCDMA instance Required for CSIRX/CSITX on J721S2.

Returns
0 incase of success else returns failure code

◆ appUdmaInitPrmSetDefault()

void appUdmaInitPrmSetDefault ( app_udma_init_prms_t prm)

Sets default UDMA init parameters.

Parameters
prms[IN] Pointer to UDMA init params

◆ appUdmaInit()

int32_t appUdmaInit ( const app_udma_init_prms_t prms)

Performs initializations needed for UDMA.

Parameters
prms[IN] Pointer to UDMA init params
Returns
0 incase of success else returns failure code

◆ appUdmaDeInit()

int32_t appUdmaDeInit ( void  )

Performs de-initializations needed for UDMA.

Returns
0 incase of success else returns failure code

◆ appUdmaGetObj()

void* appUdmaGetObj ( void  )

Provides global handle to UDMA Obj.

Returns
0 incase of success else returns failure code

◆ appUdmaTest()

int32_t appUdmaTest ( void  )

DMA copy test function.

This function tests basic features of DMA copy. This could be called from vision apps test function. And not to be used by other application

Returns
0 incase of success else returns failure code

◆ appUdmaCopyInit()

int32_t appUdmaCopyInit ( void  )

DMA copy init function.

This should be called before calling other function. This function creates the default DMA channel required for API which passes NULL as the channel object.

Returns
0 incase of success else returns failure code

◆ appUdmaCopyDeinit()

int32_t appUdmaCopyDeinit ( void  )

DMA copy deinit function.

This function frees up the default DMA channel allocated during init.

Returns
0 incase of success else returns failure code

◆ appUdmaCopyCreate()

app_udma_ch_handle_t appUdmaCopyCreate ( const app_udma_create_prms_t prms)

DMA copy create channel function.

This function allocates a memcpy DMA channel and initialize the DMA channel for data transfer. This is an optional function which can be used to create more DMA channel apart from the default DMA channel allocated during init.

Parameters
prms[IN] Pointer to channel params. Caller should initialize this structure using appUdmaCreatePrms_Init before modifying the content to ensure backward compatibility.
Returns
Pointer to channel object which will get initialized and contexts are stored. The channel object memory is allocated by this call and returned. This API returns NULL incase of failure.

◆ appUdmaCopyDelete()

int32_t appUdmaCopyDelete ( app_udma_ch_handle_t  ch_handle)

DMA copy delete channel function.

This function frees-up DMA channel and all associated resources.

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate
Returns
0 incase of success else returns failure code

◆ appUdmaCopy1D()

int32_t appUdmaCopy1D ( app_udma_ch_handle_t  ch_handle,
const app_udma_copy_1d_prms_t prms_1d 
)

DMA copy 1D DMA copy function.

This function will initiate a 1D DMA copy operation.

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate. If NULL is passed, the API will use the default handle created during init.
prms_1d[IN] Pointer to 1D transfer params. This can't be NULL.
Returns
0 incase of success else returns failure code

◆ appUdmaCopy2D()

int32_t appUdmaCopy2D ( app_udma_ch_handle_t  ch_handle,
const app_udma_copy_2d_prms_t prms_2d,
uint32_t  num_transfers 
)

DMA copy 2D DMA copy function.

This function will initiate a 2D DMA copy operation.

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate. If NULL is passed, the API will use the default handle created during init.
prms_2d[IN] Pointer to 2D transfer params. This can't be NULL. This could be an array of params depending on num_transfers parameter
num_transfers[IN] The API will iterate through this many number of transfers.
Returns
0 incase of success else returns failure code

◆ appUdmaFill2D()

int32_t appUdmaFill2D ( app_udma_ch_handle_t  ch_handle,
const app_udma_copy_2d_prms_t prms_2d,
uint32_t  num_transfers 
)

DMA copy 2D DMA memfill function.

This function will initiate a 2D DMA memfill operation. The only difference between this and appUdmaCopy2D is that this API assumes that the source buffer is just oneline worth of data and will setup the DMA parameter such that the DMA keeps reading the same one line source buffer and fill the destination buffer

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate. If NULL is passed, the API will use the default handle created during init.
prms_2d[IN] Pointer to 2D transfer params. This can't be NULL. This could be an array of params depending on num_transfers parameter
num_transfers[IN] The API will iterate through this many number of transfers.
Returns
0 incase of success else returns failure code

◆ appUdmaCopyNDGetHandle()

app_udma_ch_handle_t appUdmaCopyNDGetHandle ( uint32_t  ch_idx)

Return handle to ND copy channel, if not already created, CH is created here.

Parameters
ch_idx[IN] channel index to use, upto APP_UDMA_ND_CHANNELS_MAX are allowed
Returns
Pointer to channel object, if unable to create CH then NULL is returned;

◆ appUdmaCopyNDReleaseHandle()

int32_t appUdmaCopyNDReleaseHandle ( uint32_t  ch_idx)

Releases reference to channel handle, if found to be last reference deletes the handle.

Parameters
ch_idx[IN] channel index to use, upto APP_UDMA_ND_CHANNELS_MAX are allowed
Returns
0 incase of success else returns failure code

◆ appUdmaCopyNDInit()

int32_t appUdmaCopyNDInit ( app_udma_ch_handle_t  ch_handle,
const app_udma_copy_nd_prms_t prms_nd 
)

DMA copy ND init function.

This function will setup a N-Dimension (upto 4) DMA copy operation based on "prms_nd" transfer params.

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate. If NULL is passed, the API will use the default handle created during init.
prms_nd[IN] Pointer to ND transfer params. This can't be NULL.
Returns
0 incase of success else returns failure code

◆ appUdmaCopyNDDeinit()

int32_t appUdmaCopyNDDeinit ( app_udma_ch_handle_t  ch_handle)

DMA copy ND de-init function.

This function will setup a N-Dimension (upto 4) DMA copy operation based on "prms_nd" transfer params.

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate. If NULL is passed, the API will use the default handle created during init.
Returns
0 incase of success else returns failure code

◆ appUdmaCopyNDTrigger()

int32_t appUdmaCopyNDTrigger ( app_udma_ch_handle_t  ch_handle)

DMA copy ND trigger function.

This function will initiate a N-Dimension (upto 4) DMA copy operation based on "copy_mode" option set in prms_nd transfer params.

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate. If NULL is passed, the API will use the default handle created during init.
Returns
0 incase of success else returns failure code

◆ appUdmaCopyNDWait()

int32_t appUdmaCopyNDWait ( app_udma_ch_handle_t  ch_handle)

DMA copy ND wait function.

This function will wait for a N-Dimension (upto 4) DMA copy operation based on "copy_mode" option set in prms_nd transfer params.

Parameters
ch_handle[IN] Pointer to channel object already created through appUdmaCopyCreate. If NULL is passed, the API will use the default handle created during init.
Returns
0 incase of success else returns failure code

◆ appUdmaCopyNDPrmsPrint()

void appUdmaCopyNDPrmsPrint ( app_udma_copy_nd_prms_t prm,
char *  name 
)

Prints params values.

◆ appUdmaCreatePrms_Init()

static void appUdmaCreatePrms_Init ( app_udma_create_prms_t prms)
inlinestatic

Set defaults for app_udma_create_prms_t structure.

Parameters
prms[OUT] Parameters to init to default value

◆ appUdmaCopy1DPrms_Init()

static void appUdmaCopy1DPrms_Init ( app_udma_copy_1d_prms_t prms_1d)
inlinestatic

Set defaults for app_udma_copy_1d_prms_t structure.

Parameters
prms_1d[OUT] Parameters to init to default value

◆ appUdmaCopy2DPrms_Init()

static void appUdmaCopy2DPrms_Init ( app_udma_copy_2d_prms_t prms_2d)
inlinestatic

Set defaults for app_udma_copy_2d_prms_t structure.

Parameters
prms_2d[OUT] Parameters to init to default value

◆ appUdmaCopyNDPrms_Init()

static void appUdmaCopyNDPrms_Init ( app_udma_copy_nd_prms_t prms_nd)
inlinestatic

Set defaults for app_udma_copy_nd_prms_t structure.

Parameters
prms_nd[OUT] Parameters to init to default value