Microchip® Advanced Software Framework

tester.c File Reference

Tester application.

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

#include "config.h"
#include "phy.h"
#include "sys.h"
#include "nwk.h"
#include "led.h"
#include "sysclk.h"
#include "tester.h"
#include "commands.h"
#include "filter.h"
#include "events.h"
#include "time.h"
#include "sio2host.h"
#include "asf.h"

Typedefs

typedef enum AppState_t AppState_t
 
typedef enum AppUartState_t AppUartState_t
 

Enumerations

enum  AppState_t {
  APP_STATE_INITIAL,
  APP_STATE_SEND,
  APP_STATE_WAIT_CONF,
  APP_STATE_SENDING_DONE,
  APP_STATE_WAIT_SEND_TIMER,
  APP_STATE_WAIT_COMMAND_TIMER,
  APP_STATE_PREPARE_TO_SLEEP,
  APP_STATE_SLEEP,
  APP_STATE_WAKEUP,
  APP_STATE_INITIAL,
  APP_STATE_IDLE,
  APP_STATE_INITIAL,
  APP_STATE_MEASURE_ED,
  APP_STATE_WAIT_SCAN_TIMER,
  APP_STATE_INITIAL,
  APP_STATE_IDLE
}
 
enum  AppUartState_t {
  APP_UART_STATE_IDLE,
  APP_UART_STATE_READ_SIZE_1,
  APP_UART_STATE_READ_SIZE_2,
  APP_UART_STATE_READ_DATA,
  APP_UART_STATE_READ_CRC_1,
  APP_UART_STATE_READ_CRC_2
}
 

Functions

static void APP_TaskHandler (void)
 
static uint16_t appCrcCcittUpdate (uint16_t crc, uint8_t byte)
 
static void appUartSendAck (AppStatus_t status)
 
void appUartSendCommand (uint8_t *buf, uint16_t size)
 
static void appUartStateMachine (uint8_t byte)
 
int main (void)
 Main function. More...
 
static void Serial_Handler (void)
 

Variables

static AppState_t appState = APP_STATE_INITIAL
 
static uint8_t appUartBuffer [APP_UART_BUFFER_SIZE]
 
static uint16_t appUartBufferCrc
 
static uint16_t appUartBufferPtr
 
static uint16_t appUartCrc
 
static uint16_t appUartSize
 
static AppUartState_t appUartState = APP_UART_STATE_IDLE
 
static uint8_t rx_data [APP_RX_BUF_SIZE]
 
static uint8_t sio_rx_length
 

typedef enum AppState_t AppState_t

enum AppState_t
Enumerator
APP_STATE_INITIAL 
APP_STATE_SEND 
APP_STATE_WAIT_CONF 
APP_STATE_SENDING_DONE 
APP_STATE_WAIT_SEND_TIMER 
APP_STATE_WAIT_COMMAND_TIMER 
APP_STATE_PREPARE_TO_SLEEP 
APP_STATE_SLEEP 
APP_STATE_WAKEUP 
APP_STATE_INITIAL 
APP_STATE_IDLE 
APP_STATE_INITIAL 
APP_STATE_MEASURE_ED 
APP_STATE_WAIT_SCAN_TIMER 
APP_STATE_INITIAL 
APP_STATE_IDLE 
Enumerator
APP_UART_STATE_IDLE 
APP_UART_STATE_READ_SIZE_1 
APP_UART_STATE_READ_SIZE_2 
APP_UART_STATE_READ_DATA 
APP_UART_STATE_READ_CRC_1 
APP_UART_STATE_READ_CRC_2 

static void APP_TaskHandler ( void  )
static
static uint16_t appCrcCcittUpdate ( uint16_t  crc,
uint8_t  byte 
)
static
void appUartSendCommand ( uint8_t *  buf,
uint16_t  size 
)
int main ( void  )

Main function.

Main function.

This function initializes the MAC, initiates a MLME reset request (wpan_mlme_reset_req()), and implements a the main loop.

Main function.

The master example begins by initializing required board resources. The system clock, basic GPIO pin mapping, and interrupt vectors are established.

A memory location on a TWI slave is written with a fixed test pattern which is then read back into a separate buffer. As a basic sanity check, the original write-buffer values are compared with values read from the slave to a separate buffer. An LED on the development board is illuminated when there is a match between the written and read data.

Returns
Nothing.

Main function.

Main function.

Initializes the clock system, board and serial output, then sets up the Sleep Manager unit test suite and runs it.

Main function.

Initializes the clock system, board and serial output, then sets up the IOPORT Service unit test suite and runs it.

Main function.

Initializes the clock system, board and serial output, then sets up the USART unit test suite and runs it.

Main function.

Initializes the clock system, board and serial output, then sets up the TWI unit test suite and runs it.

Main function.

Returns
error code

The SAM3X_EK, SAM3X Arduino board and SAM4C_EK use two bytes length internal address EEPROM.

References APP_TaskHandler(), appTimeInit(), board_init(), cpu_irq_enable, delay_init, LED0, LED_On, Serial_Handler(), sio2host_init(), SYS_Init(), SYS_TaskHandler(), and sysclk_init().

void Serial_Handler ( void  )
static

AppState_t appState = APP_STATE_INITIAL
static

Referenced by APP_TaskHandler().

uint8_t appUartBuffer[APP_UART_BUFFER_SIZE]
static

Referenced by appUartStateMachine().

uint16_t appUartBufferCrc
static

Referenced by appUartStateMachine().

uint16_t appUartBufferPtr
static

Referenced by appUartStateMachine().

uint16_t appUartCrc
static

Referenced by appUartStateMachine().

uint16_t appUartSize
static

Referenced by appUartStateMachine().

AppUartState_t appUartState = APP_UART_STATE_IDLE
static

Referenced by appUartStateMachine().

uint8_t rx_data[APP_RX_BUF_SIZE]
static

Referenced by Serial_Handler().

uint8_t sio_rx_length
static

Referenced by Serial_Handler().