Microchip® Advanced Software Framework

2/src/perf_api_serial_handler.c File Reference
#include "tal.h"
#include "return_val.h"
#include "ieee_const.h"
#include "app_init.h"
#include "tal_helper_2.h"
#include "perf_msg_const.h"
#include "sio2host.h"
#include "sio2ncp.h"
#include "perf_api.h"
#include "perf_api_serial_handler.h"

Functions

UART COMMUNICATION FRAMING
void serial_data_handler (void)
 Function to handle the state machine serial data exchange. More...
 

UART COMMUNICATION FRAMING

#define SOT   (1)
 The start of transmission delimiter. More...
 
#define EOT   (4)
 The end of transmission delimiter. More...
 
#define UART_RX_STATE_SOT   (1)
 A UART state that expects a SOT to be received as the next character. More...
 
#define UART_RX_STATE_LENGTH   (2)
 A UART state that expects the length to be received as the next character. More...
 
#define UART_RX_STATE_DATA   (3)
 A UART state that expects the next data character to be received. More...
 
#define UART_RX_STATE_EOT   (4)
 A UART state that expects a EOT to be received as the next character. More...
 
#define SIO_BUF_COUNT   (3)
 
#define SIO_RX_BUF_SIZE   (32)
 
#define SIO_TX_BUF_SIZE   (156)
 
static uint8_t sio_rx_buf [NUM_TRX][SIO_RX_BUF_SIZE]
 This is the receive buffer of the UART. More...
 
static uint8_t sio_tx_buf [NUM_TRX][SIO_BUF_COUNT][SIO_TX_BUF_SIZE]
 This is the transmit buffer of the UART. More...
 
static uint8_t * sio_rx_ptr [NUM_TRX]
 This pointer points to the next free element inside the receive buffer of the UART. More...
 
static uint8_t sio_rx_state [NUM_TRX]
 This is the receiver state of the UART. More...
 
static uint8_t sio_rx_length [NUM_TRX]
 This is the transmit state of the UART. More...
 
static uint8_t data [NUM_TRX][SIO_RX_BUF_SIZE]
 This is the buffer to hold the frame received through serial interface. More...
 
static uint8_t data_length [NUM_TRX] = {0, 0}
 This is length variable to keep track of no of received bytes. More...
 
static uint8_t rx_index [NUM_TRX] = {0, 0}
 This is index used to validate the received bytes based on their position. More...
 
static uint8_t head [NUM_TRX] = {0, 0}
 This is head of the queue of buffers to be transmitted. More...
 
static uint8_t buf_count [NUM_TRX] = {0, 0}
 This is buffer count to keep track of the available bufer for transmission. More...
 
uint32_t rcvd_channel_mask [NUM_TRX] = {0, 0}
 
static uint8_t curr_tx_buffer_index [NUM_TRX] = {0, 0}
 
static void process_incoming_sio_data (trx_id_t trx)
 Process data received from SIO. More...
 
static uint8_t * get_next_tx_buffer (trx_id_t trx)
 get the new buffer for next transmission through serial More...
 
static void handle_incoming_msg (trx_id_t trx)
 Parses the Received Data in the Buffer and Process the Commands accordingly. More...
 
void init_sio (trx_id_t trx)
 This function does the initialization of the Serial handler state Machine. More...
 
void usr_perf_start_confirm (trx_id_t trx, uint8_t status, uint8_t start_mode, trx_config_params_t *trx_config_params, uint8_t peer_ic_type, char *peer_soc_mcu_name, char *peer_trx_name, char *peer_board_name, uint64_t peer_mac_address, float peer_fw_version, uint32_t peer_feature_mask)
 Function to generate Perf Start confirmation frame that must be sent to host application via serial interface. More...
 
void usr_per_test_start_confirm (trx_id_t trx, uint8_t status)
 Function to generate Per Test Start confirmation frame that must be sent to host application via serial interface. More...
 
void usr_range_test_beacon_tx (trx_id_t trx, frame_info_t *frame)
 Function to send the transmitted frame to the Host application. More...
 
void usr_range_test_beacon_rsp (trx_id_t trx, frame_info_t *frame, uint8_t lqi_h, int8_t ed_h, uint8_t lqi_r, int8_t ed_r)
 Function to send the Received Range Test Response frame to the Host application. More...
 
void usr_range_test_marker_ind (trx_id_t trx, frame_info_t *frame, uint8_t lqi, int8_t ed_value)
 Function to send the Marker Indication frame to the Host application. More...
 
void usr_range_test_start_confirm (trx_id_t trx, uint8_t status)
 Function to generate Range Test Start confirmation frame that must be sent to host application via serial interface. More...
 
void usr_range_test_stop_confirm (trx_id_t trx, uint8_t status)
 Function to generate Range Test Stop confirmation frame that must be sent to host application via serial interface. More...
 
void usr_perf_set_confirm (trx_id_t trx, uint8_t status, uint8_t param_type, param_value_t *param_value)
 Function to generate Perf Set confirmation frame that must be sent to host application via serial interface. More...
 
void usr_perf_get_confirm (trx_id_t trx, uint8_t status, uint8_t parameter_type, param_value_t *parame_value)
 Function to generate Perf Get confirmation frame that must be sent to host application via serial interface. More...
 
void usr_identify_peer_node_confirm (trx_id_t trx, uint8_t status)
 Function to generate Identify_peer_cnode_confirm that must be sent to host application via serial interface. More...
 
void usr_cont_pulse_tx_confirm (trx_id_t trx, uint8_t status)
 Function to generate cont_pulse_tx_confirm that must be sent to host application via serial interface. More...
 
void usr_cont_wave_tx_confirm (trx_id_t trx, uint8_t status, bool start_stop_param, uint8_t tx_mode)
 Function to generate cont_wave_tx_confirm that must be sent to host application via serial interface. More...
 
void usr_register_read_confirm (trx_id_t trx, uint8_t status, uint16_t reg_addr, uint8_t reg_val)
 Function to generate usr_register_read_confirm that must be sent to host application via serial interface. More...
 
void usr_register_write_confirm (trx_id_t trx, uint8_t status, uint16_t reg_addr, uint8_t reg_val)
 Function to generate usr_register_write_confirm that must be sent to host application via serial interface. More...
 
void usr_register_dump_confirm (trx_id_t trx, uint8_t status, uint16_t start_reg_addr, uint16_t end_reg_addr, uint8_t *reg_val)
 Function to generate usr_register_dump_confirm that must be sent to host application via serial interface. More...
 
void usr_per_test_end_indication (trx_id_t trx, uint8_t status, int8_t rssi_val, uint8_t aver_lqi, uint32_t frames_transmitted, uint32_t frames_received, uint32_t frames_failure, uint32_t frames_no_ack, uint32_t frames_channel_access_failure, uint32_t frames_with_wrong_crc, float test_duration_sec, float test_net_data_rate)
 Function to generate Per test End Indication frame that must be sent to host application via serial interface. More...
 
void usr_ed_scan_start_confirm (trx_id_t trx, uint8_t status, uint8_t scan_time_min, float scan_time_sec)
 Function to generate ED scan confirm test End Indication frame that must be sent to host application via serial interface. More...
 
void usr_ed_scan_end_indication (trx_id_t trx, uint8_t no_of_channels, ed_scan_result_t *ed_scan_result)
 Function to generate ED scan Indication frame that must be sent to host application via serial interface. More...
 
void usr_sensor_data_get_confirm (trx_id_t trx, uint8_t status, float bat_voltage, float temperature)
 Function to generate Sensor data confirm frame that must be sent to host application via serial interface. More...
 
void usr_peer_disconnect_confirm (trx_id_t trx, uint8_t status)
 Function to generate Disconnect Confirm frame that must be sent to host application via serial interface. More...
 
void usr_set_default_config_confirm (trx_id_t trx, uint8_t status, trx_config_params_t *default_trx_config_params)
 Function to generate Set default config Confirm frame that must be sent to host application via serial interface. More...
 
void usr_identify_board_confirm (trx_id_t trx, uint8_t status, uint8_t ic_type, const char *mcu_soc_name, const char *trx_name, const char *board_name, uint64_t mac_address, float fw_version, uint32_t fw_feature_mask)
 Function to generate Identify Board confirm frame that must be sent to host application via serial interface. More...
 
void usr_get_current_config_confirm (trx_id_t trx, uint8_t status, trx_config_params_t *curr_trx_conf_params)
 Function to generate Get Current config Confirm frame that must be sent to host application via serial interface. More...