Microchip® Advanced Software Framework

tal_auto_tx.c File Reference

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.

Parameters
trx_idTransceiver 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 void handle_ifs ( trx_id_t  trx_id)
static

Handles interframe spacing (IFS)

Parameters
trx_idTransceiver 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().

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.

Parameters
trx_idTransceiver identifier
tx_framePointer to the frame_info_t structure updated by the MAC layer
csma_modeIndicates mode of csma-ca to be performed for this frame
perform_frame_retryIndicates whether to retries are to be performed for this frame
Returns

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().

void transmit_frame ( trx_id_t  trx_id,
cca_use_t  cca 
)

Transmits frame.

Parameters
trx_idTransceiver identifier
ccaIf 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, TAL_BB_IRQ_CLR, tal_pib, TAL_RF_IRQ_CLR, trx_state, TX_CCATX, tx_done_handling(), tx_state, TX_TX, and WITH_CCA.

Referenced by cca_start(), continue_deferred_transmission(), csma_start(), handle_gts_data_req(), mac_tx_gts_data(), mcps_data_request(), mlme_gts_request(), process_deallocate_data_q(), range_test_frame_tx(), send_disconnect_command(), send_identify_command(), send_parameters_changed(), send_peer_conf(), send_peer_info_req(), send_peer_info_rsp(), send_peer_req(), send_peer_rsp(), send_per_test_start_cmd(), send_range_test_marker_cmd(), send_range_test_marker_rsp(), send_range_test_rsp(), send_range_test_start_cmd(), send_range_test_stop_cmd(), send_remote_cmd(), send_remote_reply_cmd(), send_result_req(), send_result_rsp(), send_set_default_config_command(), tal_tx_frame(), and tx_done_handling().

void tx_done_handling ( trx_id_t  trx_id,
retval_t  status 
)

Implements the handling of the transmission end.

This function handles the callback for the transmission end.

Parameters
trx_idTransceiver identifier
statusStatus 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_state, TX_IDLE, and tx_state.

bool frame_buf_filled[NUM_TRX]

Referenced by tal_tx_frame(), and transmit_frame().

uint16_t last_txframe_length[NUM_TRX]

Referenced by handle_ifs(), and transmit_frame().

uint8_t number_of_tx_retries[NUM_TRX]
static

Referenced by tal_tx_frame(), and tx_done_handling().