This file handles the frame transmission within the TAL.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
#include "tal_config.h"
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdio.h>
#include "pal.h"
#include "return_val.h"
#include "tal.h"
#include "ieee_const.h"
#include "tal_pib.h"
#include "stack_config.h"
#include "bmm.h"
#include "qmm.h"
#include "tal_internal.h"
#include "mac_build_config.h"
Functions | |
void | continue_deferred_transmission (trx_id_t trx_id) |
Confinues with a deferred transmission. More... | |
static void | handle_ifs (trx_id_t trx_id) |
Handles interframe spacing (IFS) More... | |
void | handle_tx_end_irq (trx_id_t trx_id) |
Handles interrupts issued due to end of transmission. 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 | transmit_frame (trx_id_t trx_id, cca_use_t cca) |
Transmits frame. More... | |
void | tx_done_handling (trx_id_t trx_id, retval_t status) |
Implements the handling of the transmission end. More... | |
Variables | |
static bool | ack_requested [NUM_TRX] |
bool | frame_buf_filled [NUM_TRX] |
static csma_mode_t | global_csma_mode [NUM_TRX] |
uint16_t | last_txframe_length [NUM_TRX] |
static uint8_t | number_of_tx_retries [NUM_TRX] |
void continue_deferred_transmission | ( | trx_id_t | trx_id | ) |
Confinues with a deferred transmission.
trx_id | Transceiver identifier |
References Assert, csma_start(), CSMA_UNSLOTTED, global_csma_mode, MAC_CHANNEL_ACCESS_FAILURE, NO_CCA, NUM_TRX, tal_pib, transmit_frame(), and tx_done_handling().
Referenced by ack_transmission_done().
|
static |
Handles interframe spacing (IFS)
trx_id | Transceiver identifier |
References aMaxSIFSFrameSize, last_txframe_length, macMinLIFSPeriod_def, macMinSIFSPeriod_def, pal_get_current_time(), pal_timer_delay, rxe_txe_tstamp, and tal_pib.
Referenced by tal_tx_frame(), and tx_done_handling().
void handle_tx_end_irq | ( | trx_id_t | trx_id | ) |
Handles interrupts issued due to end of transmission.
trx_id | Transceiver identifier |
References ack_requested, ack_transmission_done(), ack_transmitting, Assert, BB_CH_CLEAR, csma_continue(), fs_tstamp, MAC_SUCCESS, pal_sub_time_us(), RF_BASE_ADDR_OFFSET, RF_RX, RF_TXPREP, rxe_txe_tstamp, SR_BBC0_AMCS_CCAED, SR_BBC0_PC_BBEN, start_ack_wait_timer(), switch_to_rx(), switch_to_txprep(), tal_pib, trx_bit_read(), trx_bit_write(), trx_state, TX_CCATX, tx_done_handling(), tx_state, and TX_TX.
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 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().
Transmits frame.
trx_id | Transceiver identifier |
cca | If WITH_CCA CCA is enforced, else no CCA is applied before transmission. |
References ACK_FRAME_TYPE_ONLY, ack_requested, AMCS_CCATX_MASK, AMCS_TX2RX_MASK, BB_IRQ_TXFE, BB_TX_FRM_BUF_OFFSET, cancel_any_reception(), FAILURE, frame_buf_filled, fs_tstamp, last_txframe_length, mac_frame_ptr, pal_get_current_time(), pal_timer_delay, PC_BBEN_MASK, PC_TXAFCS_MASK, RF_BASE_ADDR_OFFSET, RF_EDSINGLE, RF_IRQ_EDC, RF_IRQ_TRXERR, RF_IRQ_TRXRDY, RF_RX, RF_TRXOFF, RF_TX, RG_BBC0_AFFTM, RG_BBC0_AMCS, RG_BBC0_FBTXS, RG_BBC0_PC, RG_BBC0_TXFLL, RG_RF09_CMD, RG_RF09_EDC, RG_RF09_STATE, SR_BBC0_PC_BBEN, SR_BBC0_PC_TXAFCS, SR_BBC0_PS_TXUR, state, TAL_BB_IRQ_CLR, tal_pib, TAL_RF_IRQ_CLR, trx_bit_read(), trx_bit_write(), trx_reg_read(), trx_reg_write(), trx_state, TX_CCATX, tx_done_handling(), tx_state, TX_TX, and WITH_CCA.
Implements the handling of the transmission end.
This function handles the callback for the transmission end.
trx_id | Transceiver identifier |
status | Status of the transmission: MAC_SUCCESS, MAC_NO_ACK, CHANNEL_ACCESS_FAILURE, FAILURE |
References ack_requested, AMCS_AACK_MASK, csma_start(), CSMA_UNSLOTTED, fs_tstamp, global_csma_mode, handle_ifs(), INVALID_TOF_VALUE, LEG_OQPSK, mac_frame_ptr, MAC_NO_ACK, MAC_SUCCESS, NO_CCA, NO_CSMA_WITH_IFS, number_of_tx_retries, RF_BASE_ADDR_OFFSET, RF_RX, RF_TRXOFF, RG_BBC0_AMCS, RG_RF09_CMD, start_rpc(), switch_to_rx(), TAL_IDLE, tal_pib, tal_state, tal_tx_frame_done_cb(), frame_info_tag::time_stamp, transmit_frame(), trx_default_state, trx_reg_write(), trx_state, TX_IDLE, and tx_state.
Referenced by handle_tx_end_irq(), tal_tx_frame(), transmit_frame(), and tx_done_handling().
Referenced by tal_tx_frame(), and transmit_frame().
|
static |
Referenced by continue_deferred_transmission(), tal_tx_frame(), and tx_done_handling().
uint16_t last_txframe_length[NUM_TRX] |
Referenced by handle_ifs(), and transmit_frame().
|
static |
Referenced by tal_tx_frame(), and tx_done_handling().