Microchip® Advanced Software Framework

usart_example_dmac.c File Reference

USART DMAC Example for SAM.

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

#include "asf.h"
#include "conf_example.h"

Macros

#define BOARD_USART_DMAC_RX_CH   0
 DMAC receive channel of master. More...
 
#define BOARD_USART_DMAC_TX_CH   1
 DMAC transmit channel of master. More...
 
#define BUFFER_SIZE   32
 Size of the receive buffer used by the DMAC, in bytes. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 
#define USART_RX_IDX   12
 
#define USART_TX_IDX   11
 DMAC Channel HW Interface Number for USART. More...
 

Functions

static void configure_console (void)
 Configure UART for debug message output. More...
 
static void configure_dmac (void)
 DMAC driver configuration. More...
 
static void configure_dmac_rx (void)
 DMAC rx channel configuration. More...
 
static void configure_dmac_tx (void)
 DMAC tx channel configuration. More...
 
static void configure_usart (void)
 Configure USART in normal (serial rs232) mode, asynchronous, 8 bits, 1 stop bit, no parity, 115200 bauds and enable its transmitter and receiver. More...
 
void DMAC_Handler (void)
 DMAC interrupt handler. More...
 
int main (void)
 Application entry point for usart_dmac_serial example. More...
 

Variables

static uint8_t gs_puc_buffer [BUFFER_SIZE]
 Receive buffer. More...
 

#define BOARD_USART_DMAC_RX_CH   0

DMAC receive channel of master.

Referenced by configure_dmac(), configure_dmac_rx(), and DMAC_Handler().

#define BOARD_USART_DMAC_TX_CH   1

DMAC transmit channel of master.

Referenced by configure_dmac_tx().

#define BUFFER_SIZE   32

Size of the receive buffer used by the DMAC, in bytes.

Referenced by configure_dmac_rx(), and configure_dmac_tx().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- USART DMAC Serial Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: fatfs_access_example.c:112
#define STRING_EOL
Definition: usart_example_dmac.c:99

Referenced by main().

#define USART_RX_IDX   12

Referenced by configure_dmac_rx().

#define USART_TX_IDX   11

DMAC Channel HW Interface Number for USART.

Referenced by configure_dmac_tx().

static void configure_console ( void  )
static

Configure UART for debug message output.

References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().

Referenced by main().

static void configure_dmac ( void  )
static
static void configure_usart ( void  )
static

Configure USART in normal (serial rs232) mode, asynchronous, 8 bits, 1 stop bit, no parity, 115200 bauds and enable its transmitter and receiver.

References sysclk_enable_peripheral_clock(), sysclk_get_peripheral_hz(), usart_enable_rx(), usart_enable_tx(), and usart_init_rs232().

Referenced by main().

void DMAC_Handler ( void  )
int main ( void  )

Application entry point for usart_dmac_serial example.

Returns
Unused (ANSI-C compatibility).

References board_init(), configure_console(), configure_dmac(), configure_dmac_rx(), configure_usart(), STRING_HEADER, and sysclk_init().

uint8_t gs_puc_buffer[BUFFER_SIZE]
static

Receive buffer.

Referenced by configure_dmac_rx(), and configure_dmac_tx().