Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

This module handles the functionalities of the receptor in PER mode.

Macros

#define DELAY_BEFORE_APP_RESET_IN_MICRO_SEC   (5000)
 
#define DELAY_BEFORE_APP_RESET_IN_MICRO_SEC   (5000)
 
#define LED_BLINK_COUNT_FOR_BUTTON_PRESS   (10)
 
#define LED_BLINK_COUNT_FOR_BUTTON_PRESS   (10)
 
#define LED_BLINK_COUNT_FOR_IDENTIFY   (20)
 
#define LED_BLINK_RATE_IN_MICRO_SEC   (50000)
 

Functions

void app_reset (trx_id_t trx)
 
void app_reset (void)
 
static void app_reset_cb (void *parameter)
 Timer Callback function if disconnect command is received on air by a node in reflector configuration.This is used to do a software reset on the reflector side. More...
 
static void get_node_info (trx_id_t trx, peer_info_rsp_t *data)
 Function used to get the board details of peer node. More...
 
static void get_node_info (peer_info_rsp_t *data)
 Function used to get the board details of peer node. More...
 
static void identify_timer_handler_cb (void *parameter)
 Timer Callback function if identify command is received on air by a node in reflector configuration. More...
 
void marker_rsp_timer_handler_cb (void *parameter)
 Timer Callback function if marker command is received on air This is used to blink the LED and thus identify that the marker frame is received. More...
 
void marker_tx_timer_handler_cb (void *parameter)
 Timer Callback function if marker response command is transmitted on air This is used to blink the LED and thus identify that the transmission is done. More...
 
void per_mode_receptor_init (trx_id_t trx, void *parameter)
 Initialize the application in PER Measurement mode as Receptor. More...
 
void per_mode_receptor_init (void *parameter)
 Initialize the application in PER Measurement mode as Receptor. More...
 
void per_mode_receptor_rx_cb (trx_id_t trx, frame_info_t *frame)
 Callback that is called if data has been received by trx in the PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor. More...
 
void per_mode_receptor_rx_cb (frame_info_t *frame)
 Callback that is called if data has been received by trx in the PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor. More...
 
void per_mode_receptor_task (trx_id_t trx)
 The application task when the node is in PER_TEST_RECEPTOR state i.e.PER Measurement mode as Receptor. More...
 
void per_mode_receptor_task (void)
 The application task when the node is in PER_TEST_RECEPTOR state i.e.PER Measurement mode as Receptor. More...
 
void per_mode_receptor_tx_done_cb (trx_id_t trx, retval_t status, frame_info_t *frame)
 Callback that is called once tx is done in PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor. More...
 
void per_mode_receptor_tx_done_cb (retval_t status, frame_info_t *frame)
 Callback that is called once tx is done in PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor. More...
 
void pkt_stream_gap_timer (void *parameter)
 Timer used in Packet Streaming Mode to add gap in between consecutive frames. More...
 
float reverse_float (const float float_val)
 The reverse_float is used for reversing a float variable for supporting BIG ENDIAN systems. More...
 
static void send_peer_info_rsp (trx_id_t trx)
 Function used to send peer_info_rsp command. More...
 
static void send_peer_info_rsp (void)
 Function used to send peer_info_rsp command. More...
 
static bool send_range_test_marker_cmd (trx_id_t trx)
 Function to send the range test marker command to the initiator node. More...
 
static bool send_range_test_marker_cmd (void)
 Function to send the range test marker command to the initiator node. More...
 
static void send_range_test_rsp (trx_id_t trx, uint8_t seq_num, uint32_t frame_count, int8_t ed, uint8_t lqi)
 Function used to send response to the received range test packet. More...
 
static void send_range_test_rsp (uint8_t seq_num, uint32_t frame_count, int8_t ed, uint8_t lqi)
 Function used to send response to the received range test packet. More...
 
bool send_remote_reply_cmd (uint8_t *serial_buf, uint8_t len)
 This function is used to send a remote test response command back to the initiator. More...
 
static void send_result_rsp (trx_id_t trx)
 Function used to send PER test result. More...
 
static void send_result_rsp (void)
 Function used to send PER test result. More...
 
static void set_default_configuration_peer_node (trx_id_t trx)
 Function used to set default configurations on peer node on reception of set_default req. More...
 
static void set_paramter_on_recptor_node (trx_id_t trx, app_payload_t *msg)
 Extract the received command frame and set the parameters like channel, tx power etc on Receptor node. More...
 
static void set_paramter_on_recptor_node (app_payload_t *msg)
 Extract the received command frame and set the parameters like channel, tx power etc on Receptor node. More...
 
void stop_pkt_streaming (void *parameter)
 This function is called to abort the packet streaming mode in progress. More...
 

Variables

bool trx_config_params_t::ack_request
 
static uint32_t aver_lqi [NUM_TRX]
 
static uint32_t aver_lqi
 
static uint32_t aver_rssi [NUM_TRX]
 
static uint32_t aver_rssi
 
uint16_t trx_config_params_t::channel
 
uint8_t ed_scan_result_t::channel_no
 
uint8_t trx_config_params_t::channel_page
 
bool trx_config_params_t::csma_enabled
 
float trx_config_params_t::ism_frequency
 
static uint8_t marker_seq_num [NUM_TRX] = {0, 0}
 
static uint8_t marker_seq_num = 0
 
static uint32_t number_rx_frames [NUM_TRX]
 
static uint32_t number_rx_frames
 
uint32_t trx_config_params_t::number_test_frames
 
int8_t ed_scan_result_t::p_in
 
uint16_t trx_config_params_t::phy_frame_length
 
static bool range_test_in_progress = false
 
static bool range_test_in_progress [NUM_TRX] = {false, false}
 
static uint8_t remote_cmd_len
 
static uint8_t * remote_cmd_ptr
 
static bool remote_cmd_rx = false
 
bool trx_config_params_t::retry_enabled
 
bool trx_config_params_t::rpc_enable
 
static uint8_t seq_num_receptor [NUM_TRX]
 
static uint8_t seq_num_receptor
 
sun_phy_t trx_config_params_t::sun_phy_page
 
uint8_t trx_config_params_t::trx_state
 
int8_t trx_config_params_t::tx_power_dbm
 

#define DELAY_BEFORE_APP_RESET_IN_MICRO_SEC   (5000)

Referenced by per_mode_receptor_rx_cb().

#define DELAY_BEFORE_APP_RESET_IN_MICRO_SEC   (5000)

Referenced by per_mode_receptor_rx_cb().

#define LED_BLINK_COUNT_FOR_BUTTON_PRESS   (10)
#define LED_BLINK_COUNT_FOR_BUTTON_PRESS   (10)
#define LED_BLINK_COUNT_FOR_IDENTIFY   (20)

void app_reset ( trx_id_t  trx)
static void app_reset_cb ( void *  parameter)
static

Timer Callback function if disconnect command is received on air by a node in reflector configuration.This is used to do a software reset on the reflector side.

Parameters
parameterpass parameters to timer handler

References app_reset().

Referenced by per_mode_receptor_rx_cb().

static void identify_timer_handler_cb ( void *  parameter)
static

Timer Callback function if identify command is received on air by a node in reflector configuration.

This is used to blink the LED and thus identify itself

Parameters
parameterpass parameters to timer handler

References app_led_event(), APP_TIMER_TO_TX, FUNC_PTR, LED_BLINK_COUNT_FOR_IDENTIFY, LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_ALL_OFF, LED_EVENT_ALL_ON, LED_EVENT_PEER_SEARCH_DONE, NULL, SW_TIMEOUT_RELATIVE, sw_timer_start(), and sw_timer_stop().

Referenced by per_mode_receptor_rx_cb().

void marker_rsp_timer_handler_cb ( void *  parameter)

Timer Callback function if marker command is received on air This is used to blink the LED and thus identify that the marker frame is received.

Parameters
parameterpass parameters to timer handler

References app_led_event(), FUNC_PTR, LED_BLINK_COUNT_FOR_BUTTON_PRESS, LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_PEER_SEARCH_DONE, NULL, SW_TIMEOUT_RELATIVE, sw_timer_start(), sw_timer_stop(), and T_APP_TIMER.

Referenced by per_mode_initiator_rx_cb(), and per_mode_receptor_rx_cb().

void marker_tx_timer_handler_cb ( void *  parameter)

Timer Callback function if marker response command is transmitted on air This is used to blink the LED and thus identify that the transmission is done.

Parameters
parameterpass parameters to timer handler

References app_led_event(), APP_TIMER_TO_TX, FUNC_PTR, LED_BLINK_COUNT_FOR_BUTTON_PRESS, LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_PEER_SEARCH_DONE, NULL, SW_TIMEOUT_RELATIVE, sw_timer_start(), and sw_timer_stop().

Referenced by per_mode_receptor_task(), and send_range_test_marker_rsp().

void per_mode_receptor_init ( trx_id_t  trx,
void *  parameter 
)

Initialize the application in PER Measurement mode as Receptor.

Parameters
parameterPointer to the paramter to be carried, if any.

References phyTransmitPower, seq_num_receptor, tal_pib_set(), and TAL_TRANSMIT_POWER_DEFAULT.

void per_mode_receptor_init ( void *  parameter)

Initialize the application in PER Measurement mode as Receptor.

Parameters
parameterPointer to the paramter to be carried, if any.

References config_per_test_parameters(), PA_EXT_ENABLE, phyTransmitPower, pib_value_t::pib_value_8bit, seq_num_receptor, SR_PA_EXT_EN, tal_pib_set(), TAL_TRANSMIT_POWER_DEFAULT, and trx_bit_write().

void per_mode_receptor_rx_cb ( trx_id_t  trx,
frame_info_t frame 
)

Callback that is called if data has been received by trx in the PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor.

Parameters
framePointer to received frame

References AACK_PROM_DISABLE, AACK_PROM_ENABLE, app_led_event(), app_reset_cb(), APP_TIMER_TO_TX, aver_lqi, aver_rssi, CCPU_ENDIAN_TO_LE32, phy_tag::ch_spacing, app_payload_t::cmd_id, crc_check_ok(), general_pkt_t::crc_set_req_data, DELAY_BEFORE_APP_RESET_IN_MICRO_SEC, DISCONNECT_NODE, range_tx_t::frame_count, FRAME_OVERHEAD, phy_tag::freq_band, phy_tag::freq_f0, FSK, FUNC_PTR, IDENTIFY_NODE, identify_timer_handler_cb(), LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_PEER_SEARCH_DONE, LED_EVENT_RX_FRAME, LED_TOGGLE_COUNT_FOR_PER, LEG_OQPSK, MAC_SUCCESS, macShortAddress, marker_rsp_timer_handler_cb(), marker_seq_num, phy_tag::modulation, frame_info_tag::mpdu, NUM_TRX, number_rx_frames, OFDM, OQPSK, OQPSK_DATA_RATE_250, app_payload_t::payload, PEER_INFO_REQ, PER_TEST_PKT, PER_TEST_START_PKT, phy_tag::phy_mode, phyFSKFECEnabled, phyHighRateEnabled, phyOFDMMCS, phyOQPSKRateMode, phySetting, PL_POS_DST_ADDR_START, PL_POS_SEQ_NUM, range_test_in_progress, RANGE_TEST_MARKER_RSP, RANGE_TEST_PKT, RANGE_TEST_START_PKT, RANGE_TEST_STOP_PKT, general_pkt_t::range_tx_data, RESULT_REQ, send_peer_info_rsp(), send_range_test_rsp(), send_result_rsp(), app_payload_t::seq_num, set_default_configuration_peer_node(), SET_DEFAULT_REQ, SET_PARAM, set_paramter_on_recptor_node(), SET_SUN_PAGE, SHORT_ADDR_LEN, crc_set_req_t::status, SW_TIMEOUT_RELATIVE, sw_timer_start(), T_APP_TIMER, tal_pib, tal_pib_get(), tal_pib_set(), and tal_rxaack_prom_mode_ctrl().

void per_mode_receptor_rx_cb ( frame_info_t frame)

Callback that is called if data has been received by trx in the PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor.

Parameters
framePointer to received frame

References AACK_PROM_DISABLE, AACK_PROM_ENABLE, ANT_CTRL_1, ANT_CTRL_2, ANT_DIVERSITY_DISABLE, ANT_DIVERSITY_ENABLE, div_set_req_t::ant_sel, ANTENNA_DEFAULT, app_led_event(), app_reset_cb(), APP_TIMER_TO_TX, aver_lqi, aver_rssi, CCPU_ENDIAN_TO_LE32, app_payload_t::cmd_id, CMD_ID_LEN, config_per_test_parameters(), crc_check_ok(), general_pkt_t::crc_set_req_data, curr_trx_config_params, DELAY_BEFORE_APP_RESET_IN_MICRO_SEC, DISCONNECT_NODE, general_pkt_t::div_set_req_data, ED_VAL_LEN, FCS_LEN, range_tx_t::frame_count, FRAME_OVERHEAD, FUNC_PTR, IDENTIFY_NODE, LED_BLINK_RATE_IN_MICRO_SEC, led_blinker_timer_handler_cb(), LED_EVENT_PEER_SEARCH_DONE, LED_EVENT_RX_FRAME, LED_TOGGLE_COUNT_FOR_PER, LENGTH_FIELD_LEN, LQI_LEN, macShortAddress, marker_rsp_timer_handler_cb(), marker_seq_num, MESSAGE_ID_POS, frame_info_tag::mpdu, NULL, number_rx_frames, app_payload_t::payload, PEER_INFO_REQ, PER_TEST_PKT, PER_TEST_START_PKT, PL_POS_DST_ADDR_START, PL_POS_SEQ_NUM, range_test_in_progress, RANGE_TEST_MARKER_RSP, RANGE_TEST_PKT, RANGE_TEST_START_PKT, RANGE_TEST_STOP_PKT, general_pkt_t::range_tx_data, remote_cmd_len, REMOTE_CMD_MASK, remote_cmd_ptr, remote_cmd_rx, remote_test_req_t::remote_serial_data, REMOTE_TEST_CMD, general_pkt_t::remote_test_req_data, RESULT_REQ, rx_on_mode, RX_ON_REQ, send_peer_info_rsp(), send_range_test_rsp(), send_result_rsp(), app_payload_t::seq_num, SEQ_NUM_LEN, SET_DEFAULT_REQ, SET_PARAM, set_paramter_on_recptor_node(), SHORT_ADDR_LEN, div_set_req_t::status, crc_set_req_t::status, SW_TIMEOUT_RELATIVE, sw_timer_start(), T_APP_TIMER, tal_ant_div_config(), tal_get_rssi_base_val(), tal_pib_get(), and tal_rxaack_prom_mode_ctrl().

void per_mode_receptor_task ( trx_id_t  trx)

The application task when the node is in PER_TEST_RECEPTOR state i.e.PER Measurement mode as Receptor.

References app_debounce_button(), APP_TIMER_TO_TX, FUNC_PTR, LED_BLINK_RATE_IN_MICRO_SEC, marker_tx_timer_handler_cb(), range_test_in_progress, RF09, RF24, send_range_test_marker_cmd(), SW_TIMEOUT_RELATIVE, and sw_timer_start().

void per_mode_receptor_tx_done_cb ( trx_id_t  trx,
retval_t  status,
frame_info_t frame 
)

Callback that is called once tx is done in PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor.

Parameters
statusStatus of the transmission procedure
framePointer to the transmitted frame structure

References node_info, status, and node_ib_t::transmitting.

void per_mode_receptor_tx_done_cb ( retval_t  status,
frame_info_t frame 
)

Callback that is called once tx is done in PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor.

Parameters
statusStatus of the transmission procedure
framePointer to the transmitted frame structure

References CMD_RX_ON, cw_ack_sent, cw_start_mode, cw_tmr_val, node_info, remote_cw_start, remote_pulse_cw_start, rx_on_mode, set_trx_state(), status, and node_ib_t::transmitting.

void pkt_stream_gap_timer ( void *  parameter)

Timer used in Packet Streaming Mode to add gap in between consecutive frames.

References rdy_to_tx.

Referenced by per_mode_initiator_task(), per_mode_receptor_task(), and pktstream_test().

float reverse_float ( const float  float_val)

The reverse_float is used for reversing a float variable for supporting BIG ENDIAN systems.

Parameters
float_valFloat variable to be reversed
static void send_peer_info_rsp ( trx_id_t  trx)
static
static void send_peer_info_rsp ( void  )
static
static bool send_range_test_marker_cmd ( trx_id_t  trx)
static
static bool send_range_test_marker_cmd ( void  )
static
static void send_range_test_rsp ( trx_id_t  trx,
uint8_t  seq_num,
uint32_t  frame_count,
int8_t  ed,
uint8_t  lqi 
)
static

Function used to send response to the received range test packet.

Parameters
seq_numsequence number of the range test packet received
frame_countCount of the received Range Test Packet
edED value of the received range test packet which has to be uploaded into the response payload
lqiLQI value of the received range test packet which has to be uploaded into the response payload

References app_led_event(), app_transmit_frame(), app_payload_t::cmd_id, data, range_tx_t::ed, FCF_SHORT_ADDR, range_tx_t::frame_count, LED_EVENT_TX_FRAME, range_tx_t::lqi, node_info, app_payload_t::payload, RANGE_TEST_RSP, seq_num, app_payload_t::seq_num, and seq_num_receptor.

Referenced by per_mode_receptor_rx_cb().

static void send_range_test_rsp ( uint8_t  seq_num,
uint32_t  frame_count,
int8_t  ed,
uint8_t  lqi 
)
static

Function used to send response to the received range test packet.

Parameters
seq_numsequence number of the range test packet received
frame_countCount of the received Range Test Packet
edED value of the received range test packet which has to be uploaded into the response payload
lqiLQI value of the received range test packet which has to be uploaded into the response payload

References app_led_event(), app_payload_t::cmd_id, data, range_tx_t::ed, FCF_SHORT_ADDR, range_tx_t::frame_count, LED_EVENT_TX_FRAME, range_tx_t::lqi, node_info, app_payload_t::payload, node_ib_t::peer_short_addr, RANGE_TEST_RSP, seq_num, app_payload_t::seq_num, seq_num_receptor, and transmit_frame().

Referenced by per_mode_receptor_rx_cb().

bool send_remote_reply_cmd ( uint8_t *  serial_buf,
uint8_t  len 
)

This function is used to send a remote test response command back to the initiator.

This function is used to send a remote test repsonse command back to the initiator.

References app_payload_t::cmd_id, FCF_SHORT_ADDR, MAC_SUCCESS, node_info, app_payload_t::payload, node_ib_t::peer_short_addr, REMOTE_MSG_BUF_SIZE, remote_test_req_t::remote_serial_data, REMOTE_TEST_REPLY_CMD, general_pkt_t::remote_test_req_data, app_payload_t::seq_num, seq_num_receptor, and transmit_frame().

Referenced by serial_data_handler().

static void set_default_configuration_peer_node ( trx_id_t  trx)
static
static void set_paramter_on_recptor_node ( trx_id_t  trx,
app_payload_t msg 
)
static

Extract the received command frame and set the parameters like channel, tx power etc on Receptor node.

Parameters
pointerto cmd payload

References CHANNEL, CHANNEL_PAGE, MAC_SUCCESS, set_parm_req_t::param_type, set_parm_req_t::param_value, app_payload_t::payload, phyCurrentChannel, phyCurrentPage, phyTransmitPower, general_pkt_t::set_parm_req_data, status, tal_convert_reg_value_to_dBm(), tal_pib_set(), and TX_POWER_DBM.

Referenced by per_mode_receptor_rx_cb().

void stop_pkt_streaming ( void *  parameter)

This function is called to abort the packet streaming mode in progress.

This function is called to abort the packet streaming mode in progress.

References CW_TX_TIMER, FUNC_PTR, LED_BLINK_RATE_IN_MICRO_SEC, led_blinker_timer_handler_cb(), MAC_SUCCESS, node_ib_t::main_state, node_info, NULL, PER_TEST_RECEPTOR, pkt_stream_stop, SW_TIMEOUT_RELATIVE, sw_timer_is_running(), sw_timer_start(), sw_timer_stop(), T_APP_TIMER, and usr_pkt_stream_confirm().

Referenced by per_mode_receptor_task(), and pktstream_test().

uint32_t aver_lqi[NUM_TRX]
static
uint32_t aver_lqi
static
uint32_t aver_rssi[NUM_TRX]
static
uint32_t aver_rssi
static
uint8_t ed_scan_result_t::channel_no
uint8_t marker_seq_num[NUM_TRX] = {0, 0}
static
uint8_t marker_seq_num = 0
static
uint32_t number_rx_frames[NUM_TRX]
static
uint32_t number_rx_frames
static
int8_t ed_scan_result_t::p_in
bool range_test_in_progress = false
static
bool range_test_in_progress[NUM_TRX] = {false, false}
static
uint8_t remote_cmd_len
static
uint8_t* remote_cmd_ptr
static
bool remote_cmd_rx = false
static
sun_phy_t trx_config_params_t::sun_phy_page