Microchip® Advanced Software Framework

sam/drivers/i2sc/unit_tests/unit_tests.c File Reference

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

static bool check_samples ( bool  right)
static
static void start_transfer ( struct i2s_dev_inst dev_inst)
static

Start transfer for test.

Referenced by run_i2s_test().

static void stop_transfer ( struct i2s_dev_inst dev_inst)
static

Stop transfer for test.

Referenced by run_i2s_test().

static void wait_transfer ( struct i2s_dev_inst dev_inst)
static

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().