Create variables
- Create a module software instance structure for the USART module to store the USART driver state while it is in use.
struct
usart_module usart_instance;
Note: This should never go out of scope as long as the module is in use. In most cases, this should be global. - Create module software instance structures for DMA resources to store the DMA resource state while it is in use.
struct
dma_resource usart_dma_resource_rx;
struct
dma_resource usart_dma_resource_tx;
Note: This should never go out of scope as long as the module is in use. In most cases, this should be global. - Create a buffer to store the data to be transferred /received.
#define BUFFER_LEN 8
static
uint16_t
string
[BUFFER_LEN];
- Create DMA transfer descriptors for RX/TX.
COMPILER_ALIGNED(16)
DmacDescriptor example_descriptor_rx;
DmacDescriptor example_descriptor_tx;