Microchip® Advanced Software Framework

common/components/wireless/unit_tests/unit_tests.c File Reference

AT86RFx Wireless Module Unit Test.

Copyright (c) 2011-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 "at86rfx_driver.h"
#include "conf_test.h"
#include "unit_tests.h"

Functions

void at86rfx_tal_tx_status_cb (uint8_t status)
 Callback that is called once tx is done. More...
 
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_at86rfx_init_test (const struct test_case *test)
 Performs a initialization check on AT86RFx module. More...
 
static void run_at86rfx_reg_access_test (const struct test_case *test)
 Test the read and write of register on AT86RFx module. More...
 
static void run_at86rfx_tx_test (const struct test_case *test)
 Test the frame transmission on AT86RFx module. More...
 

Variables

static struct test_casetemp_test
 

void at86rfx_tal_tx_status_cb ( uint8_t  status)

Callback that is called once tx is done.

Parameters
statusStatus of the transmission procedure
int main ( void  )

Run Wireless Module unit tests.

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

References at86rfx_task(), board_init(), cpu_irq_enable, irq_initialize_vectors, stdio_usb_init(), and sysclk_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, NULL, run_at86rfx_init_test(), run_at86rfx_reg_access_test(), run_at86rfx_tx_test(), and test_suite_run().

static void run_at86rfx_init_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 at86rfx_init(), AT86RFX_SUCCESS, status, and test_assert_true.

Referenced by main_cdc_set_dtr().

static void run_at86rfx_reg_access_test ( const struct test_case test)
static

Test the read and write of register on AT86RFx module.

This function will test the read and write functionalities of register It will first write a known value (state) to register and reads the register to confirm the same value.

Parameters
testCurrent test case.

References CMD_RX_ON, pal_trx_reg_read(), pal_trx_reg_write(), RG_TRX_STATE, status, and test_assert_true.

Referenced by main_cdc_set_dtr().

static void run_at86rfx_tx_test ( const struct test_case test)
static

Test the frame transmission on AT86RFx module.

This function will form a frame with length followed by payload. Then call the at86rfx_tx_frame for frame transmission at86rfx_tal_tx_status_cb gives the status of this transmission

Parameters
testCurrent test case.

References at86rfx_tx_frame(), FCS_LEN, and tx_buffer.

Referenced by main_cdc_set_dtr().

struct test_case* temp_test
static