Microchip® Advanced Software Framework

unit_tests.c File Reference

AT86RFx Wireless Module Unit Test.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdint.h>
#include <stdbool.h>
#include <asf.h>
#include <string.h>
#include "board.h"
#include "sysclk.h"
#include "conf_usb.h"
#include "stdio_usb.h"
#include "conf_test.h"
#include "unit_tests.h"
#include "common_sw_timer.h"
#include "tal.h"
#include "tfa.h"
#include "ieee_const.h"

Macros

#define DEFAULT_CHANNEL   (20)
 
#define DEFAULT_CHANNEL_PAGE   (0)
 

Functions

int main (void)
 Run Wireless Module unit tests. More...
 
void main_cdc_set_dtr (bool b_enable)
 Call back from USB to notify a terminal connection to the CDC driver. More...
 
static void run_tfa_pib_set_test (const struct test_case *test)
 Performs a initialization check on AT86RFx module. More...
 
void tal_ed_end_cb (uint8_t energy_level)
 User call back function for finished ED Scan. More...
 
void tal_rx_frame_cb (frame_info_t *rx_frame)
 User call back function for frame reception. More...
 
void tal_tx_frame_done_cb (retval_t status, frame_info_t *frame)
 User call back function for frame transmission. More...
 

#define DEFAULT_CHANNEL   (20)
#define DEFAULT_CHANNEL_PAGE   (0)

int main ( void  )

Run Wireless Module unit tests.

Initializes the clock system, board and USB. Then runs the wireless task continuously.

References board_init(), cpu_irq_enable, irq_initialize_vectors, stdio_usb_init(), sw_timer_init(), sysclk_init(), tal_task(), and tfa_init().

void main_cdc_set_dtr ( bool  b_enable)

Call back from USB to notify a terminal connection to the CDC driver.

Parameters
b_enableindication for connect/disconnect of terminal to CDC.

References DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_tfa_pib_set_test(), and test_suite_run().

static void run_tfa_pib_set_test ( const struct test_case test)
static

Performs a initialization check on AT86RFx module.

This function will simply test the output of the function at86rfx_init and returns an error in case of failure.

Parameters
testCurrent test case.

References MAC_SUCCESS, test_assert_true, TFA_PIB_RX_SENS, TFA_PIB_RX_SENS_DEF, and tfa_pib_set().

Referenced by main_cdc_set_dtr().

void tal_ed_end_cb ( uint8_t  energy_level)

User call back function for finished ED Scan.

Parameters
energy_levelMeasured energy level during ED Scan

Referenced by ed_scan_done().

void tal_rx_frame_cb ( frame_info_t rx_frame)

User call back function for frame reception.

Parameters
rx_framePointer to received frame structure of type frame_info_t or to received frame array

Referenced by process_incoming_frame().

void tal_tx_frame_done_cb ( retval_t  status,
frame_info_t frame 
)

User call back function for frame transmission.

Parameters
statusStatus of frame transmission attempt
framePointer to frame structure of type frame_info_t

Referenced by tx_done_handling().