Microchip® Advanced Software Framework

example1/dma_example.c File Reference

AVR XMEGA DMA example.

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

#include <conf_example.h>
#include <string.h>
#include <asf.h>

Functions

static void example_dma_transfer_done (enum dma_channel_status status)
 Callback for DMA transfer complete. More...
 
static void fill_pattern (uint8_t *buffer, size_t len)
 Fill buffer with a specific pattern. More...
 
int main (void)
 main function More...
 
static bool verify_pattern (uint8_t *buffer, size_t len)
 Verify if buffer if filled by the specific pattern generated by the fill_pattern() function. More...
 

Variables

static uint8_t destination [DMA_BUFFER_SIZE]
 Destination buffer to use for DMA transfer. More...
 
static uint8_t source [DMA_BUFFER_SIZE]
 Source buffer to use for DMA transfer. More...
 

static void example_dma_transfer_done ( enum dma_channel_status  status)
static

Callback for DMA transfer complete.

Parameters
statusStatus of a completed (or failed) DMA transfer

References destination, DMA_CH_TRANSFER_COMPLETED, gpio_set_pin_low, source, and verify_pattern().

Referenced by main().

static void fill_pattern ( uint8_t *  buffer,
size_t  len 
)
static

Fill buffer with a specific pattern.

Parameters
bufferBuffer to fill with a specific pattern
lenLength of the buffer

Referenced by main().

static bool verify_pattern ( uint8_t *  buffer,
size_t  len 
)
static

Verify if buffer if filled by the specific pattern generated by the fill_pattern() function.

Parameters
bufferBuffer to verify
lenLength of the buffer
Return values
trueBuffer is equal to specific pattern
falseBuffer is not equal to specific pattern

Referenced by example_dma_transfer_done().

uint8_t destination[DMA_BUFFER_SIZE]
static

Destination buffer to use for DMA transfer.

Referenced by dma_channel_set_destination_address(), dma_channel_write_destination(), example_dma_transfer_done(), and main().