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 "pal.h"
#include "return_val.h"
#include "tal.h"
#include "ieee_const.h"
#include "tal_pib.h"
#include "tal_irq_handler.h"
#include "at86rf212b.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 "tal_slotted_csma.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 |
bool | tal_beacon_transmission |
csma_state_t | tal_csma_state |
CSMA state machine variable. More... | |
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... | |
uint32_t | tal_rx_timestamp |
Timestamp The timestamping is only required for beaconing networks or if timestamping is explicitly enabled. 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().
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, process_incoming_frame(), qmm_queue_remove(), set_trx_state(), queue_tag::size, slotted_csma_state_handling(), TAL_ED_DONE, TAL_ED_RUNNING, TAL_IDLE, tal_pib, tal_rx_on_required, TAL_SLOTTED_CSMA, tal_state, TAL_TX_AUTO, TAL_TX_DONE, and tx_done_handling().
Referenced by wpan_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 calculate_transaction_duration(), handle_tx_end_irq(), tal_tx_frame(), tx_done(), and tx_done_handling().
volatile bool tal_awake_end_flag |
Referenced by set_trx_state(), and trx_irq_awake_handler_cb().
bool tal_beacon_transmission |
Referenced by handle_tx_end_irq(), internal_tal_reset(), perform_cca_twice(), tal_tx_beacon(), and trx_irq_handler_cb().
csma_state_t tal_csma_state |
CSMA state machine variable.
Referenced by beacon_loss_timer_cb(), cca_timer_handler_cb(), csma_backoff_calculation(), handle_tx_end_irq(), internal_tal_reset(), process_incoming_frame(), send_frame_at_next_backoff_boundary(), slotted_csma_state_handling(), and tx_done().
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 calculate_transaction_duration(), send_frame(), tal_tx_frame(), and tx_done_handling().
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(), mac_ready_to_sleep(), tal_init(), and tal_reset().
tal_pib_t tal_pib |
Referenced by apply_channel_page_configuration(), build_data_frame(), build_null_data_frame(), check_beacon_reception(), check_for_pan_id_conflict_as_pc(), check_for_pan_id_conflict_non_pc(), convert_phyTransmitPower_to_reg_value(), csma_backoff_calculation(), csma_param_init(), handle_gts_data_req(), handle_gts_sync_loss(), handle_received_frame_irq(), init_tal_pib(), limit_tx_pwr(), mac_awake_disassociate(), mac_awake_scan(), mac_build_and_tx_beacon(), mac_build_and_tx_data_req(), mac_coord_realignment_command_tx_success(), mac_gts_allocate(), mac_mlme_comm_status(), mac_parse_bcn_gts_info(), mac_prep_disassoc_conf(), mac_process_beacon_frame(), mac_process_beacon_request(), mac_process_tal_data_ind(), mac_sleep_trans(), mac_start_beacon_timer(), mac_start_missed_beacon_timer(), mac_start_persistence_timer(), mac_sync_loss(), mac_t_beacon_cb(), mac_t_gts_cb(), mac_tx_coord_realignment_command(), mcps_data_request(), mlme_associate_request(), mlme_associate_response(), mlme_disassociate_request(), mlme_get(), mlme_gts_request(), mlme_orphan_response(), mlme_rx_enable_request(), mlme_scan_request(), mlme_start_request(), normalize_lqi(), parse_mpdu(), process_data_ind_not_transient(), process_incoming_frame(), recalc_macMaxFrameTotalWaitTime(), reset_gts_expiry(), send_frame(), send_scan_cmd(), set_default_tx_pwr(), slotted_csma_start(), slotted_csma_state_handling(), start_beacon_loss_timer(), tal_get_rssi_base_val(), tal_init(), tal_pib_set(), tal_rx_enable(), tal_task(), tal_tx_frame(), tx_done_handling(), tx_pan_id_conf_notif(), 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().
uint32_t tal_rx_timestamp |
Timestamp The timestamping is only required for beaconing networks or if timestamping is explicitly enabled.
Referenced by handle_received_frame_irq(), and trx_irq_handler_cb().