iLLD_TC22x
1.0
|
![]() |
The DMA interface driver provides a default configuration for data moves without intervention of the CPU or other on chip devices.
In the following sections it will be described, how to integrate the driver into the application framework for different use cases.
Include following header file into your C code:
Declare the dma handle as a global variable:
Initialize the DMA with following code:
This only has to be done once in the application.
The "IfxDma_Dma dma" handle should either be declared as a global variable (as shown in this example), or it can be created locally if desired:
A large amount of data should be copied between SRI based memories, e.g. from Flash into the DSPR of the current CPU. It's recommended to use 256 bit moves for this purpose for best performance.
This requires, that source and target locations are 256 bit (32 byte) aligned. With the GCC compiler this can be achieved by adding attribute ((aligned(64))) to the arrays:
Channel configuration and handling for the data move:
The content of 8 ADC result registers should be transfered to a memory location in DSPR whenever an VADC autoscan has been finished. After the DMA transaction, an interrupt should be triggered so that the CPU can process the conversion results.
We use following global variables:
Create an interrupt handler for the DMA channel request:
ADC configuration:
And finally the DMA channel configuration
In order to start the initial channel conversions, use:
DMA will transfer the results to DSPR during the autoscan (whenever a new result is availale), and invoke the dmaCh0ISR function once all channels have been converted.
The ISR will re-configure the DMA channel and re-start the autoscan.
Linked lists allow to initiate multiple DMA transactions from independent transaction sets which are typically stored in a DSPR memory location, and fetched and executed from the DMA channel without further CPU interaction.
Following example demonstrates, how 5 different transactions can be initiated from a single request. We copy the data of 5 CAN message objects to a DSPR location.
Includes and global variables:
Following code to prepare CAN for this demo:
Build a linked list
The transfer can be started via software with:
In order to synchronize with the end of linked list operations, it's recommended to poll the service request flag (triggered via linkedList[NUM_LINKED_LIST_ITEMS-1].CHCSR.B.SIT after the last word has been transfered), and not the transaction count as shown before, because a linked list will initiate multiple transactions.