Microchip® Advanced Software Framework

mega/drivers/macsc/unit_tests/unit_tests.c File Reference

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

static void test_macsc_backoff ( const struct test_case test)
static

Backoff slot counter test.

This test starts the backoff slot counter and verifies that the timeout occurs as expected 10 times.

Parameters
testCurrent 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 void test_macsc_cmp ( const struct test_case test)
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

Parameters
testCurrent 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 void test_macsc_enable ( const struct test_case test)
static

Run MACSC enable test.

This test verifies that no timeouts are running after initialization

Parameters
testCurrent test case.

References is_macsc_enable(), success, and test_assert_true.

Referenced by main().

static void unit_test_backoff_slot_cntr_int_cb ( void  )
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 void unit_test_cmp1_int_cb ( void  )
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 void unit_test_cmp2_int_cb ( void  )
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 void unit_test_cmp3_int_cb ( void  )
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().

bool success = false
static