Unit tests for I2S driver.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | CMP_BLOCK 32 |
#define | DMA_CH_FLAG_IN_L (XDMAC_GS_ST0 << CONF_DMA_CH_IN_L) |
#define | DMA_CH_FLAG_IN_R (XDMAC_GS_ST0 << CONF_DMA_CH_IN_R) |
#define | DMA_CH_FLAG_OUT_L (XDMAC_GS_ST0 << CONF_DMA_CH_OUT_L) |
#define | DMA_CH_FLAG_OUT_R (XDMAC_GS_ST0 << CONF_DMA_CH_OUT_R) |
#define | DMA_CH_FLAGS |
#define | DMA_DWIDTH XDMAC_CC_DWIDTH_HALFWORD |
#define | SOUND_SAMPLES 0x100 |
#define | TEST_OUT_LOOP 10 |
Functions | |
static bool | check_samples (bool right) |
Return true if samples check is good. More... | |
static void | config_dma_channel_xfr (uint8_t ch) |
int | main (void) |
Run I2SC driver unit tests. More... | |
static void | prepare_dma_channel (uint8_t ch) |
static void | run_i2s_test (const struct test_case *test) |
Test audio data transfer and receive. More... | |
static void | start_transfer (struct i2s_dev_inst *dev_inst) |
Start transfer for test. More... | |
static void | stop_transfer (struct i2s_dev_inst *dev_inst) |
Stop transfer for test. More... | |
static void | wait_transfer (struct i2s_dev_inst *dev_inst) |
Wait transfer done for test. More... | |
Variables | |
static const uint32_t | g_dma_dst [4] |
static const uint32_t | g_dma_perid [4] |
static const uint32_t | g_dma_src [4] |
int16_t | input_samples_left [SOUND_SAMPLES *2] |
int16_t | input_samples_right [SOUND_SAMPLES *2] |
int16_t | off_cmp_left [SOUND_SAMPLES/CMP_BLOCK] |
int16_t | off_cmp_right [SOUND_SAMPLES/CMP_BLOCK] |
int16_t | output_samples_left [SOUND_SAMPLES *2] |
int16_t | output_samples_right [SOUND_SAMPLES *2] |
static xdmac_channel_config_t | xdmac_channel_cfg |
XDMA channel configuration. More... | |
#define CMP_BLOCK 32 |
#define DMA_CH_FLAG_IN_L (XDMAC_GS_ST0 << CONF_DMA_CH_IN_L) |
#define DMA_CH_FLAG_IN_R (XDMAC_GS_ST0 << CONF_DMA_CH_IN_R) |
#define DMA_CH_FLAG_OUT_L (XDMAC_GS_ST0 << CONF_DMA_CH_OUT_L) |
#define DMA_CH_FLAG_OUT_R (XDMAC_GS_ST0 << CONF_DMA_CH_OUT_R) |
#define DMA_CH_FLAGS |
Referenced by start_transfer(), stop_transfer(), and wait_transfer().
#define DMA_DWIDTH XDMAC_CC_DWIDTH_HALFWORD |
Referenced by config_dma_channel_xfr().
#define SOUND_SAMPLES 0x100 |
Referenced by check_samples(), and config_dma_channel_xfr().
#define TEST_OUT_LOOP 10 |
Return true if samples check is good.
References input_samples_left, input_samples_right, off_cmp_left, off_cmp_right, output_samples_left, output_samples_right, and SOUND_SAMPLES.
Referenced by run_i2s_test().
|
static |
References CONF_DMA, CONF_DMA_CH_IN_L, CONF_DMA_CH_IN_R, DMA_DWIDTH, xdmac_channel_config_t::mbr_bc, xdmac_channel_config_t::mbr_cfg, xdmac_channel_config_t::mbr_da, xdmac_channel_config_t::mbr_sa, xdmac_channel_config_t::mbr_ubc, SOUND_SAMPLES, xdmac_channel_set_descriptor_addr(), xdmac_channel_set_descriptor_control(), and xdmac_configure_transfer().
Referenced by start_transfer().
int main | ( | void | ) |
Run I2SC driver unit tests.
References uart_rs232_options::baudrate, board_init(), CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_i2s_test(), stdio_serial_init(), sysclk_init(), and test_suite_run().
|
static |
References CONF_DMA, CONF_DMA_ID, pmc_enable_periph_clk(), pmc_is_periph_clk_enabled(), xdmac_channel_disable(), xdmac_channel_disable_interrupt(), xdmac_channel_get_interrupt_status(), xdmac_channel_get_status(), xdmac_channel_set_block_control(), xdmac_channel_set_config(), xdmac_channel_set_descriptor_addr(), xdmac_channel_set_descriptor_control(), xdmac_channel_set_destination_addr(), xdmac_channel_set_source_addr(), xdmac_disable_interrupt(), and xdmac_get_interrupt_status().
Referenced by start_transfer().
|
static |
Test audio data transfer and receive.
test | Current test case. |
References check_samples(), CONF_I2SC, i2s_config::data_format, i2s_config::fs_ratio, I2S_DATA_16BIT, i2s_disable(), i2s_enable(), i2s_enable_clocks(), i2s_enable_reception(), i2s_enable_transmission(), I2S_FS_RATE_256, i2s_get_config_defaults(), i2s_init(), i2s_config::loopback, start_transfer(), stop_transfer(), test_assert_true, and wait_transfer().
Referenced by main().
|
static |
Start transfer for test.
References CONF_DMA, CONF_DMA_CH_IN_L, CONF_DMA_CH_IN_R, CONF_DMA_CH_OUT_L, CONF_DMA_CH_OUT_R, config_dma_channel_xfr(), DMA_CH_FLAGS, and prepare_dma_channel().
Referenced by run_i2s_test().
|
static |
|
static |
|
static |
|
static |
|
static |
int16_t input_samples_left[SOUND_SAMPLES *2] |
Referenced by check_samples().
int16_t input_samples_right[SOUND_SAMPLES *2] |
Referenced by check_samples().
int16_t off_cmp_left[SOUND_SAMPLES/CMP_BLOCK] |
Referenced by check_samples().
int16_t off_cmp_right[SOUND_SAMPLES/CMP_BLOCK] |
Referenced by check_samples().
int16_t output_samples_left[SOUND_SAMPLES *2] |
Referenced by check_samples().
int16_t output_samples_right[SOUND_SAMPLES *2] |
Referenced by check_samples().
|
static |
XDMA channel configuration.