Unit tests for I2S driver.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <conf_test.h>
#include <string.h>
Macros | |
#define | CMP_BLOCK 32 |
#define | SOUND_SAMPLES 0x100 |
#define | TEST_OUT_LOOP 10 |
Functions | |
static bool | check_samples (bool right) |
Return true if samples check is good. More... | |
int | main (void) |
Run I2SC driver unit tests. More... | |
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 | |
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] |
#define CMP_BLOCK 32 |
#define SOUND_SAMPLES 0x100 |
Referenced by check_samples(), and wait_transfer().
#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().
int main | ( | void | ) |
Run I2SC driver unit tests.
References uart_rs232_options::baudrate, board_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, run_i2s_test(), stdio_serial_init(), sysclk_init(), test_suite_run(), and usart_serial_options.
|
static |
Test audio data transfer and receive.
test | Current test case. |
References check_samples(), 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.
Referenced by run_i2s_test().
|
static |
Stop transfer for test.
Referenced by run_i2s_test().
|
static |
Wait transfer done for test.
References i2s_read(), i2s_write(), input_samples_left, input_samples_right, output_samples_left, output_samples_right, and SOUND_SAMPLES.
Referenced by run_i2s_test().
int16_t input_samples_left[SOUND_SAMPLES *2] |
Referenced by check_samples(), and wait_transfer().
int16_t input_samples_right[SOUND_SAMPLES *2] |
Referenced by check_samples(), and wait_transfer().
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(), and wait_transfer().
int16_t output_samples_right[SOUND_SAMPLES *2] |
Referenced by check_samples(), and wait_transfer().