This file implements the TAL state machine and provides general functionality used by the TAL.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include "return_val.h"
#include "tal.h"
#include "ieee_const.h"
#include "tal_pib.h"
#include "tal_irq_handler.h"
#include "atmega256rfr2.h"
#include "stack_config.h"
#include "bmm.h"
#include "qmm.h"
#include "tal_rx.h"
#include "tal_tx.h"
#include "tal_constants.h"
#include "tal_internal.h"
#include "mac_build_config.h"
Macros | |
#define | PLL_LOCK_ATTEMPTS (3) |
Functions | |
tal_trx_status_t | set_trx_state (trx_cmd_t trx_cmd) |
Sets transceiver state. More... | |
static void | switch_pll_on (void) |
Switches the PLL on. More... | |
uint32_t | tal_convert_symbols_to_us_def (uint32_t symbols) |
Conversion of symbols to microseconds. More... | |
uint32_t | tal_convert_us_to_symbols_def (uint32_t time) |
Conversion of microseconds to symbols. More... | |
void | tal_task (void) |
TAL task handling. More... | |
Variables | |
uint8_t | last_frame_length |
frame_info_t * | mac_frame_ptr |
Frame pointer for the frame structure provided by the MCL. More... | |
volatile bool | tal_awake_end_flag |
uint8_t * | tal_frame_to_tx |
Pointer to the 15.4 frame created by the TAL to be handed over to the transceiver. More... | |
queue_t | tal_incoming_frame_queue |
Queue that contains all frames that are uploaded from the trx, but have not be processed by the MCL yet. More... | |
tal_pib_t | tal_pib |
buffer_t * | tal_rx_buffer = NULL |
Pointer to receive buffer that can be used to upload a frame from the trx. More... | |
bool | tal_rx_on_required |
Indicates if the transceiver needs to switch on its receiver by tal_task(), because it could not be switched on due to buffer shortage. More... | |
tal_state_t | tal_state |
Current state of the TAL state machine. More... | |
tal_trx_status_t | tal_trx_status |
Current state of the transceiver. More... | |
#define PLL_LOCK_ATTEMPTS (3) |
Referenced by switch_pll_on().
tal_trx_status_t set_trx_state | ( | trx_cmd_t | trx_cmd | ) |
Sets transceiver state.
trx_cmd | needs to be one of the trx commands |
References ANT_EXT_SW_DISABLE, ANT_EXT_SW_ENABLE, Assert, BUSY_RX, BUSY_RX_AACK, BUSY_TX, BUSY_TX_ARET, CMD_FORCE_PLL_ON, CMD_FORCE_TRX_OFF, CMD_PLL_ON, CMD_RX_AACK_ON, CMD_RX_ON, CMD_SLEEP, CMD_TRX_OFF, CMD_TX_ARET_ON, ENABLE_GLOBAL_IRQ, ENTER_CRITICAL_REGION, FUNC_PTR, LEAVE_CRITICAL_REGION, pal_timer_delay, pal_trx_irq_init_awake(), PAL_WAIT_1_US, PLL_ON, RG_CSMA_SEED_0, RG_IRQ_MASK, RG_IRQ_STATUS, RG_TRX_STATE, RX_AACK_ON, RX_ON, SR_ANT_EXT_SW_EN, SR_CSMA_SEED_1, SR_TRX_STATUS, STATE_TRANSITION_IN_PROGRESS, switch_pll_on(), tal_awake_end_flag, tal_trx_status, trx_awake_handler_cb(), trx_bit_read, trx_bit_write, TRX_IRQ_AWAKE_ONLY, TRX_IRQ_DEFAULT, TRX_OFF, TRX_OFF_TO_SLEEP_TIME_CLKM_CYCLES, trx_reg_write, TRX_SLEEP, TRX_SLP_TR_HIGH, TRX_SLP_TR_LOW, and TX_ARET_ON.
Referenced by config_rpc_mode(), ed_scan_done(), handle_tx_end_irq(), per_mode_initiator_init(), per_mode_receptor_tx_done_cb(), rx_on_test(), send_frame(), set_antenna_diversity_settings(), set_transceiver_state(), tal_ed_start(), tal_generate_rand_seed(), tal_pib_set(), tal_rx_enable(), tal_set_frequency(), tal_set_frequency_regs(), tal_task(), tal_trx_sleep(), tal_trx_wakeup(), tfa_cca_perform(), tfa_continuous_tx_start(), tfa_ed_sample(), tfa_get_batmon_voltage(), and write_all_tal_pib_to_trx().
uint32_t tal_convert_symbols_to_us_def | ( | uint32_t | symbols | ) |
uint32_t tal_convert_us_to_symbols_def | ( | uint32_t | time | ) |
Conversion of microseconds to symbols.
References TAL_CONVERT_US_TO_SYMBOLS.
void tal_task | ( | void | ) |
TAL task handling.
This function
References Assert, bmm_buffer_alloc(), CMD_RX_AACK_ON, CMD_RX_ON, ed_scan_done(), LARGE_BUFFER_SIZE, pal_timer_delay, process_incoming_frame(), qmm_queue_remove(), RX_SAFE_MODE_DISABLE, RX_SAFE_MODE_ENABLE, set_trx_state(), queue_tag::size, SR_RX_SAFE_MODE, TAL_ED_DONE, TAL_ED_RUNNING, TAL_IDLE, tal_pib, tal_rx_on_required, tal_state, TAL_TX_AUTO, TAL_TX_DONE, trx_bit_write, and tx_done_handling().
Referenced by performance_analyzer_task().
uint8_t last_frame_length |
Referenced by process_incoming_frame(), send_frame(), and tal_tx_frame().
frame_info_t* mac_frame_ptr |
Frame pointer for the frame structure provided by the MCL.
Referenced by tal_tx_frame(), and tx_done_handling().
volatile bool tal_awake_end_flag |
Referenced by set_trx_state(), and trx_awake_handler_cb().
uint8_t* tal_frame_to_tx |
Pointer to the 15.4 frame created by the TAL to be handed over to the transceiver.
Referenced by send_frame(), and tal_tx_frame().
queue_t tal_incoming_frame_queue |
Queue that contains all frames that are uploaded from the trx, but have not be processed by the MCL yet.
Referenced by handle_received_frame_irq(), tal_init(), and tal_reset().
tal_pib_t tal_pib |
Referenced by apply_channel_page_configuration(), configure_frame_sending(), configure_pibs(), configure_pkt_stream_frames(), configure_range_test_frame_sending(), get_board_details(), get_node_info(), handle_received_frame_irq(), init_tal_pib(), process_incoming_frame(), send_frame(), send_peer_conf(), start_ed_scan(), tal_get_rssi_base_val(), tal_init(), tal_pib_get(), tal_pib_set(), tal_rx_enable(), tal_set_tx_pwr(), tal_task(), tal_tx_frame(), transmit_frame(), and write_all_tal_pib_to_trx().
buffer_t* tal_rx_buffer = NULL |
Pointer to receive buffer that can be used to upload a frame from the trx.
Referenced by handle_received_frame_irq(), handle_tx_end_irq(), tal_init(), tal_pib_set(), and tal_rx_enable().