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