This file contains TAL API function declaration for multi trx support.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include "pal.h"
#include "return_val.h"
#include "tal_generic.h"
Functions | |
retval_t | tal_pib_get (trx_id_t trx_id, uint8_t attribute, uint8_t *value) |
Gets a TAL PIB attribute. More... | |
retval_t | tal_pib_set (trx_id_t trx_id, uint8_t attribute, pib_value_t *value) |
Sets a TAL PIB attribute. More... | |
retval_t | tal_pib_set_all (uint8_t attribute, pib_value_t *value) |
Sets a TAL PIB attribute for all existing trx Ids for this device. More... | |
retval_t | tal_reset (trx_id_t trx_id, bool set_default_pib) |
Resets TAL state machine and sets the default PIB values if requested. More... | |
uint8_t | tal_rx_enable (trx_id_t trx_id, uint8_t state) |
Switches receiver on or off. More... | |
void | tal_rx_frame_cb (trx_id_t trx_id, frame_info_t *rx_frame) |
User call back function for frame reception. More... | |
retval_t | tal_trx_sleep (trx_id_t trx_id) |
Sets the transceiver to sleep. More... | |
retval_t | tal_trx_wakeup (trx_id_t trx_id) |
Wakes up the transceiver from sleep. More... | |
retval_t | tal_tx_frame (trx_id_t trx_id, frame_info_t *tx_frame, csma_mode_t csma_mode, bool perform_frame_retry) |
Requests to TAL to transmit frame. More... | |
void | tal_tx_frame_done_cb (trx_id_t trx_id, retval_t status, frame_info_t *frame) |
User call back function for frame transmission. More... | |
Gets a TAL PIB attribute.
This function is called to retrieve the transceiver information base attributes.
trx_id | Transceiver identifier | |
[in] | attribute | TAL infobase attribute ID |
[out] | value | TAL infobase attribute value |
This function is called to retrieve the transceiver information base attributes.
[in] | trx_id | Transceiver identifier |
[in] | attribute | TAL infobase attribute ID |
[out] | value | TAL infobase attribute value |
References Assert, LEG_OQPSK, mac_i_pan_coordinator, MAC_SUCCESS, MAC_UNSUPPORTED_ATTRIBUTE, macACKTiming, macAckWaitDuration, macAdaptDataRateForACK, macFCSType, macFrameFilterFrameTypes, macFrameFilterFrameVersions, macIeeeAddress, macMaxBE, macMaxCSMABackoffs, macMaxFrameRetries, macMaxNumRxFramesDuringBackoff, macMinBE, macPANId, macPromiscuousMode, macShortAddress, NUM_TRX, phyCCADuration, phyCCAMode, phyCCAThreshold, phyCCATimeMethod, phyChannelsSupported, phyCurrentChannel, phyCurrentPage, phyCurrentSUNPageEntry, phyFSKFECEnabled, phyFSKFECInterleavingRSC, phyFSKFECScheme, phyFSKModeSwitchEnabled, phyFSKPreambleLength, phyFSKRawModeEnabled, phyFSKRawModeRxLength, phyFSKScramblePSDU, phyHighRateEnabled, phyMaxFrameDuration, phyModeSwitchDuration, phyModeSwitchNewMode, phyModeSwitchSettlingDelay, phyMRFSKSFD, phyOFDMInterleaving, phyOFDMMCS, phyOnAirDuration, phyOQPSKRateMode, phyRPCEnabled, phySetting, phySymbolsPerOctet, phyTransmitPower, status, and tal_pib.
retval_t tal_pib_set | ( | trx_id_t | trx_id, |
uint8_t | attribute, | ||
pib_value_t * | value | ||
) |
Sets a TAL PIB attribute.
This function is called to set the transceiver information base attributes.
trx_id | Transceiver identifier |
attribute | TAL infobase attribute ID |
value | TAL infobase attribute value to be set |
References Assert, calculate_cca_duration_us(), calculate_pib_values(), CCA_MODE_1_ED, conf_trx_modulation(), config_fsk_rpc(), config_phy(), FCS_TYPE_4_OCTETS, FSK, get_supported_channels_tuple(), LEG_OQPSK, mac_i_pan_coordinator, MAC_INVALID_PARAMETER, MAC_SUCCESS, MAC_UNSUPPORTED_ATTRIBUTE, macACKTiming, macAckWaitDuration, macAdaptDataRateForACK, macFCSType, macFrameFilterFrameTypes, macFrameFilterFrameVersions, macIeeeAddress, macMaxBE, macMaxCSMABackoffs, macMaxFrameRetries, macMaxNumRxFramesDuringBackoff, macMinBE, macPANId, macPromiscuousMode, macShortAddress, NUM_TRX, OFDM, OQPSK, PHY_RX_ON, PHY_TRX_OFF, phyCCADuration, phyCCAMode, phyCCAThreshold, phyCCATimeMethod, phyCurrentChannel, phyCurrentPage, phyFSKFECEnabled, phyFSKFECInterleavingRSC, phyFSKFECScheme, phyFSKModeSwitchEnabled, phyFSKPreambleLength, phyFSKRawModeEnabled, phyFSKRawModeRxLength, phyFSKScramblePSDU, phyHighRateEnabled, phyModeSwitchDuration, phyModeSwitchNewMode, phyModeSwitchSettlingDelay, phyMRFSKSFD, phyOFDMInterleaving, phyOFDMMCS, phyOnAirDuration, phyOQPSKRateMode, phyRPCEnabled, phySetting, phyTransmitPower, pib_value_t::pib_value_16bit, pib_value_t::pib_value_32bit, pib_value_t::pib_value_64bit, pib_value_t::pib_value_8bit, pib_value_t::pib_value_bool, RF_BASE_ADDR_OFFSET, RF_RX, RG_BBC0_AFFTM, RG_BBC0_AMEDT, RG_BBC0_FSKRRXFLL, RG_BBC0_MACEA0, RG_BBC0_MACPID0F0, RG_BBC0_MACSHA0F0, set_channel(), set_ed_sample_duration(), set_phy_based_on_channel_page(), set_sfd(), set_tx_pwr(), SR_BBC0_AFC0_PM, SR_BBC0_AFC1_PANC0, SR_BBC0_AFFVM_AFFVM, SR_BBC0_AMCS_AACK, SR_BBC0_AMCS_AACKDR, SR_BBC0_FSKC2_FECIE, SR_BBC0_FSKC2_FECS, SR_BBC0_FSKC2_MSE, SR_BBC0_FSKPHRTX_DW, SR_BBC0_FSKPHRTX_SFD, SR_BBC0_OFDMC_POI, SR_BBC0_OFDMPHRTX_MCS, SR_BBC0_OQPSKC2_RPC, SR_BBC0_OQPSKC3_HRLEG, SR_BBC0_OQPSKPHRTX_MOD, SR_BBC0_PC_FCST, status, TAL_BUSY, TAL_IDLE, tal_pib, tal_rx_enable(), TAL_SLEEP, tal_state, TAL_TRX_ASLEEP, trx_bit_write(), trx_default_state, and trx_reg_write().
retval_t tal_pib_set_all | ( | uint8_t | attribute, |
pib_value_t * | value | ||
) |
Sets a TAL PIB attribute for all existing trx Ids for this device.
This function is called to set the transceiver information base attributes for all transceivers on this device. This function simply calls function tal_pib_set() for all existing trx Ids.
attribute | TAL infobase attribute ID |
value | TAL infobase attribute value to be set |
References MAC_SUCCESS, NUM_TRX, status, and tal_pib_set().
Resets TAL state machine and sets the default PIB values if requested.
trx_id | Transceiver identifier |
set_default_pib | Defines whether PIB values need to be set to its default values |
References calculate_pib_values(), cleanup_tal(), config_phy(), FAILURE, FUNC_PTR, init_tal_pib(), MAC_SUCCESS, NUM_TRX, pal_trx_irq_en, RF09, RF24, RF_SLEEP, RFBOTH, TAL_IDLE, tal_state, trx_config(), trx_init(), trx_irq_handler_cb(), trx_irq_init(), trx_reset(), trx_state, TX_IDLE, tx_state, and write_all_tal_pib_to_trx().
uint8_t tal_rx_enable | ( | trx_id_t | trx_id, |
uint8_t | state | ||
) |
Switches receiver on or off.
This function switches the receiver on (PHY_RX_ON) or off (PHY_TRX_OFF).
trx_id | Transceiver identifier |
state | New state of receiver |
References Assert, NUM_TRX, pal_is_timer_running(), PHY_RX_ON, PHY_TRX_OFF, RF09, RF_BASE_ADDR_OFFSET, RF_RX, RF_TRXOFF, RG_RF09_CMD, start_rpc(), stop_rpc(), switch_to_rx(), switch_to_txprep(), tal_buf_shortage, TAL_BUSY, TAL_IDLE, TAL_SLEEP, tal_state, TAL_TRX_ASLEEP, trx_default_state, trx_reg_write(), and trx_state.
Sets the transceiver to sleep.
This function sets the transceiver to sleep state.
trx_id | Transceiver identifier |
Sets the transceiver to sleep.
This function sets the entire device to state DEEP_SLEEP.
trx_id | Transceiver identifier |
mode | Defines sleep mode of transceiver (Not used for 215 trx) |
References Assert, MAC_SUCCESS, NULL, NUM_TRX, RF09, RF24, RF_BASE_ADDR_OFFSET, RF_SLEEP, RF_TRXOFF, RG_RF09_CMD, TAL_BB_IRQ_CLR_ALL, tal_buf_shortage, TAL_BUSY, TAL_IDLE, TAL_RF_IRQ_CLR_ALL, tal_rx_buffer, TAL_SLEEP, tal_state, TAL_TRX_ASLEEP, trx_reg_write(), and trx_state.
Wakes up the transceiver from sleep.
This function awakes the transceiver from sleep state.
trx_id | Transceiver identifier |
Wakes up the transceiver from sleep.
This function awakes the transceiver from state SLEEP.
trx_id | Transceiver identifier |
References Assert, config_phy(), FAILURE, MAC_SUCCESS, NULL, NUM_TRX, pal_get_current_time(), pal_sub_time_us(), RF09, RF24, RF_BASE_ADDR_OFFSET, RF_IRQ_WAKEUP, RF_TRXOFF, RG_RF09_CMD, start_time, TAL_IDLE, TAL_RF_IRQ_CLR, TAL_RF_IS_IRQ_SET, tal_rx_buffer, TAL_SLEEP, tal_state, TAL_TRX_AWAKE, TAL_WAKING_UP, trx_config(), trx_reg_write(), trx_state, and write_all_tal_pib_to_trx().
retval_t tal_tx_frame | ( | trx_id_t | trx_id, |
frame_info_t * | tx_frame, | ||
csma_mode_t | csma_mode, | ||
bool | perform_frame_retry | ||
) |
Requests to TAL to transmit frame.
This function is called by the MAC to deliver a frame to the TAL to be transmitted by the transceiver.
trx_id | Transceiver identifier |
tx_frame | Pointer to the frame_info_t structure or to frame array to be transmitted |
csma_mode | Indicates mode of csma-ca to be performed for this frame |
perform_frame_retry | Indicates whether to retries are to be performed for this frame |
This function is called by the MAC to deliver a frame to the TAL to be transmitted by the transceiver.
trx_id | Transceiver identifier |
tx_frame | Pointer to the frame_info_t structure updated by the MAC layer |
csma_mode | Indicates mode of csma-ca to be performed for this frame |
perform_frame_retry | Indicates whether to retries are to be performed for this frame |
References ack_requested, Assert, CSMA_SLOTTED, csma_start(), CSMA_UNSLOTTED, FCF_ACK_REQUEST, frame_buf_filled, global_csma_mode, handle_ifs(), mac_frame_ptr, MAC_INVALID_PARAMETER, MAC_SUCCESS, frame_info_tag::mpdu, NO_CCA, NO_CSMA_WITH_IFS, NULL, NUM_TRX, number_of_tx_retries, TAL_BUSY, tal_frame_to_tx, TAL_IDLE, tal_pib, TAL_SLEEP, tal_state, TAL_TRX_ASLEEP, TAL_TX, and transmit_frame().