Unit tests for MEGARF MAC Symbol Counter.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <conf_test.h>
#include <conf_macsc.h>
Data Structures | |
struct | cntstatus |
Functions | |
int | main (void) |
Run MACSC unit tests. More... | |
static void | test_macsc_backoff (const struct test_case *test) |
Backoff slot counter test. More... | |
static void | test_macsc_cmp (const struct test_case *test) |
Run MACSC compare test. More... | |
static void | test_macsc_enable (const struct test_case *test) |
Run MACSC enable test. More... | |
static void | unit_test_backoff_slot_cntr_int_cb (void) |
Symbol Counter back-off slot counter interrupt callback function. More... | |
static void | unit_test_cmp1_int_cb (void) |
Symbol Counter Compare 1 interrupt callback function. More... | |
static void | unit_test_cmp2_int_cb (void) |
Symbol Counter Compare 2 interrupt callback function. More... | |
static void | unit_test_cmp3_int_cb (void) |
Symbol Counter Compare 3 interrupt callback function. More... | |
Variables | |
static struct cntstatus | check |
static bool | success = false |
Variable to keep track of test results. More... | |
int main | ( | void | ) |
Run MACSC unit tests.
Main function.
The SAM3X_EK, SAM3X Arduino board and SAM4C_EK use two bytes length internal address EEPROM.
References usart_rs232_options::baudrate, board_init(), cpu_irq_enable, DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, ioport_init(), macsc_enable(), macsc_write_clock_source(), NULL, stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), test_macsc_backoff(), test_macsc_cmp(), test_macsc_enable(), test_suite_run(), and usart_serial_options.
|
static |
Backoff slot counter test.
This test starts the backoff slot counter and verifies that the timeout occurs as expected 10 times.
test | Current test case. |
References cntstatus::backoff, check, delay_us, is_macsc_backoff_enable(), macsc_backoff_slot_cnt_disable(), macsc_backoff_slot_cnt_enable(), macsc_set_backoff_slot_cntr_int_cb(), success, test_assert_true, and unit_test_backoff_slot_cntr_int_cb().
Referenced by main().
|
static |
Run MACSC compare test.
This test verifies compare channel functionality for all 3 cmp channels of the macsc and if cmp match occurs after set compare interval
test | Current test case. |
References check, cntstatus::cmp1, cntstatus::cmp2, cntstatus::cmp3, COMPARE_MODE, delay_ms, MACSC_CC1, MACSC_CC2, MACSC_CC3, macsc_enable_cmp_int(), MACSC_READ32, macsc_set_cmp1_int_cb(), macsc_set_cmp2_int_cb(), macsc_set_cmp3_int_cb(), macsc_use_cmp(), success, test_assert_true, unit_test_cmp1_int_cb(), unit_test_cmp2_int_cb(), and unit_test_cmp3_int_cb().
Referenced by main().
|
static |
Run MACSC enable test.
This test verifies that no timeouts are running after initialization
test | Current test case. |
References is_macsc_enable(), success, and test_assert_true.
Referenced by main().
|
static |
Symbol Counter back-off slot counter interrupt callback function.
This function is called when a slot counter interrupt has occured
References cntstatus::backoff, and check.
Referenced by test_macsc_backoff().
|
static |
Symbol Counter Compare 1 interrupt callback function.
This function is called when a compare match has occured on channel 1 of symbol counter.
References check, and cntstatus::cmp1.
Referenced by test_macsc_cmp().
|
static |
Symbol Counter Compare 2 interrupt callback function.
This function is called when a compare match has occured on channel 2 of symbol counter.
References check, and cntstatus::cmp2.
Referenced by test_macsc_cmp().
|
static |
Symbol Counter Compare 3 interrupt callback function.
This function is called when a compare match has occured on channel 3 of symbol counter.
References check, and cntstatus::cmp3.
Referenced by test_macsc_cmp().
|
static |
|
static |
Variable to keep track of test results.
Referenced by run_baudrate_test(), run_check_registers_test(), run_set_functions_test(), test_macsc_backoff(), test_macsc_cmp(), and test_macsc_enable().