Unit tests for DMAC driver.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include "asf.h"
#include "conf_test.h"
#include "conf_board.h"
#include "conf_clock.h"
Macros | |
#define | DMA_BUF_SIZE 32 |
#define | DMA_CH 0 |
Functions | |
void | DMAC_Handler (void) |
DMAC interrupt handler. More... | |
int | main (void) |
Run DMAC driver unit tests. More... | |
static void | run_multi_buf_xfer_test (const struct test_case *test) |
Test DMA multiple buffer transfer with interrupt mode. More... | |
static void | run_single_buf_xfer_test (const struct test_case *test) |
Test DMA single buffer transfer with polling mode. More... | |
Variables | |
uint32_t | g_dma_buf [6][DMA_BUF_SIZE] |
DMA buffer. More... | |
volatile uint32_t | g_xfer_done = 0 |
#define DMA_BUF_SIZE 32 |
Referenced by run_multi_buf_xfer_test(), and run_single_buf_xfer_test().
#define DMA_CH 0 |
Referenced by DMAC_Handler(), run_multi_buf_xfer_test(), and run_single_buf_xfer_test().
void DMAC_Handler | ( | void | ) |
DMAC interrupt handler.
References DMA_CH, dmac_get_status(), and g_xfer_done.
int main | ( | void | ) |
Run DMAC driver unit tests.
References uart_rs232_options::baudrate, board_init(), CONF_TEST_BAUDRATE, CONF_TEST_PARITY, CONF_TEST_UART, CONSOLE_UART_ID, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_multi_buf_xfer_test(), run_single_buf_xfer_test(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and test_suite_run().
|
static |
Test DMA multiple buffer transfer with interrupt mode.
test | Current test case. |
References DMA_BUF_SIZE, DMA_CH, dmac_channel_enable(), dmac_channel_multi_buf_transfer_init(), dmac_channel_set_configuration(), dmac_enable(), dmac_enable_interrupt(), dmac_init(), DMAC_PRIORITY_ROUND_ROBIN, dmac_set_priority_mode(), g_dma_buf, g_xfer_done, pmc_enable_periph_clk(), test_assert_true, dma_transfer_descriptor_t::ul_ctrlA, dma_transfer_descriptor_t::ul_ctrlB, dma_transfer_descriptor_t::ul_descriptor_addr, dma_transfer_descriptor_t::ul_destination_addr, and dma_transfer_descriptor_t::ul_source_addr.
Referenced by main().
|
static |
Test DMA single buffer transfer with polling mode.
test | Current test case. |
References DMA_BUF_SIZE, DMA_CH, dmac_channel_enable(), dmac_channel_is_transfer_done(), dmac_channel_set_configuration(), dmac_channel_single_buf_transfer_init(), dmac_enable(), dmac_init(), DMAC_PRIORITY_ROUND_ROBIN, dmac_set_priority_mode(), g_dma_buf, pmc_enable_periph_clk(), test_assert_true, dma_transfer_descriptor_t::ul_ctrlA, dma_transfer_descriptor_t::ul_ctrlB, dma_transfer_descriptor_t::ul_descriptor_addr, dma_transfer_descriptor_t::ul_destination_addr, and dma_transfer_descriptor_t::ul_source_addr.
Referenced by main().
uint32_t g_dma_buf[6][DMA_BUF_SIZE] |
DMA buffer.
Referenced by run_multi_buf_xfer_test(), and run_single_buf_xfer_test().
volatile uint32_t g_xfer_done = 0 |
Referenced by DMAC_Handler(), and run_multi_buf_xfer_test().