Microchip® Advanced Software Framework

qs_usart_dma_use.c File Reference

SAM Sercom Usart driver with DMA quick start.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>

Macros

#define BUFFER_LEN   8
 [dma_resource] More...
 

Functions

static void configure_dma_resource_rx (struct dma_resource *resource)
 [transfer_done_tx] More...
 
static void configure_dma_resource_tx (struct dma_resource *resource)
 [setup_dma_transfer_rx_descriptor] More...
 
static void configure_usart (void)
 [setup_dma_transfer_tx_descriptor] More...
 
int main (void)
 [setup_usart] [setup] More...
 
static void setup_transfer_descriptor_rx (DmacDescriptor *descriptor)
 [config_dma_resource_rx] More...
 
static void setup_transfer_descriptor_tx (DmacDescriptor *descriptor)
 [config_dma_resource_tx] More...
 
static void transfer_done_rx (struct dma_resource *const resource)
 [transfer_descriptor] More...
 
static void transfer_done_tx (struct dma_resource *const resource)
 [transfer_done_rx] More...
 

Variables

DmacDescriptor
example_descriptor_rx 
SECTION_DMAC_DESCRIPTOR
 [usart_buffer] More...
 
static uint16_t string [BUFFER_LEN]
 
struct dma_resource usart_dma_resource_rx
 [module_inst] More...
 
struct dma_resource usart_dma_resource_tx
 
struct usart_module usart_instance
 [module_inst] More...
 

#define BUFFER_LEN   8

static void configure_dma_resource_rx ( struct dma_resource resource)
static

[transfer_done_tx]

[config_dma_resource_rx]

[setup_rx_1]

[setup_rx_1]

[setup_rx_2]

[setup_rx_2]

[setup_rx_3]

[setup_rx_3]

[setup_rx_4]

[setup_rx_4]

References dma_allocate(), dma_get_config_defaults(), DMA_TRIGGER_ACTION_BEAT, dma_resource_config::peripheral_trigger, and dma_resource_config::trigger_action.

Referenced by main().

static void configure_dma_resource_tx ( struct dma_resource resource)
static

[setup_dma_transfer_rx_descriptor]

[config_dma_resource_tx]

[setup_tx_1]

[setup_tx_1]

[setup_tx_2]

[setup_tx_2]

[setup_tx_3]

[setup_tx_3]

[setup_tx_4]

[setup_tx_4]

References dma_allocate(), dma_get_config_defaults(), DMA_TRIGGER_ACTION_BEAT, dma_resource_config::peripheral_trigger, and dma_resource_config::trigger_action.

Referenced by main().

static void configure_usart ( void  )
static

[setup_dma_transfer_tx_descriptor]

[setup_usart]

[setup_config]

[setup_config] [setup_config_defaults]

[setup_config_defaults]

[setup_change_config]

[setup_set_config]

[setup_set_config]

[setup_enable]

[setup_enable]

References usart_config::baudrate, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, STATUS_OK, usart_enable(), usart_get_config_defaults(), usart_init(), and usart_instance.

int main ( void  )

[setup_usart] [setup]

[setup_init] [setup_usart]

[setup_usart]

[setup_dma_resource]

[setup_dma_resource]

[setup_transfer_descriptor]

[setup_transfer_descriptor]

[add_descriptor_to_resource]

[add_descriptor_to_resource]

[setup_callback_register]

[setup_callback_register]

[setup_enable_callback]

[setup_enable_callback] [setup_init]

[main] [main_1]

[main_1]

[endless_loop]

[endless_loop] [main]

References configure_dma_resource_rx(), configure_dma_resource_tx(), configure_usart(), dma_add_descriptor(), DMA_CALLBACK_TRANSFER_DONE, dma_enable_callback(), dma_register_callback(), dma_start_transfer_job(), setup_transfer_descriptor_rx(), setup_transfer_descriptor_tx(), system_init(), transfer_done_rx(), transfer_done_tx(), usart_dma_resource_rx, and usart_dma_resource_tx.

static void setup_transfer_descriptor_rx ( DmacDescriptor *  descriptor)
static

[config_dma_resource_rx]

[setup_dma_transfer_rx_descriptor]

[setup_rx_5]

[setup_rx_5]

[setup_rx_6]

[setup_rx_6]

[setup_rx_7]

[setup_rx_7]

[setup_rx_8]

[setup_rx_8]

References dma_descriptor_config::beat_size, dma_descriptor_config::block_transfer_count, BUFFER_LEN, dma_descriptor_config::destination_address, DMA_BEAT_SIZE_HWORD, dma_descriptor_create(), dma_descriptor_get_config_defaults(), dma_descriptor_config::source_address, dma_descriptor_config::src_increment_enable, and usart_instance.

Referenced by main().

static void setup_transfer_descriptor_tx ( DmacDescriptor *  descriptor)
static

[config_dma_resource_tx]

[setup_dma_transfer_tx_descriptor]

[setup_tx_5]

[setup_tx_5]

[setup_tx_6]

[setup_tx_6]

[setup_tx_7]

[setup_tx_7]

[setup_tx_8]

[setup_tx_8]

References dma_descriptor_config::beat_size, dma_descriptor_config::block_transfer_count, BUFFER_LEN, dma_descriptor_config::destination_address, DMA_BEAT_SIZE_HWORD, dma_descriptor_create(), dma_descriptor_get_config_defaults(), dma_descriptor_config::dst_increment_enable, dma_descriptor_config::source_address, and usart_instance.

Referenced by main().

static void transfer_done_rx ( struct dma_resource *const  resource)
static

[transfer_descriptor]

[setup] [transfer_done_rx]

References dma_start_transfer_job(), and usart_dma_resource_tx.

Referenced by main().

static void transfer_done_tx ( struct dma_resource *const  resource)
static

[transfer_done_rx]

[transfer_done_tx]

References dma_start_transfer_job(), and usart_dma_resource_rx.

Referenced by main().

DmacDescriptor example_descriptor_tx SECTION_DMAC_DESCRIPTOR

[usart_buffer]

[transfer_descriptor]

uint16_t string[BUFFER_LEN]
static
struct dma_resource usart_dma_resource_rx

[module_inst]

[dma_resource]

Referenced by main(), and transfer_done_tx().

struct dma_resource usart_dma_resource_tx

Referenced by main(), and transfer_done_rx().

struct usart_module usart_instance

[module_inst]