Microchip® Advanced Software Framework

tal_auto_csma.c File Reference

This file handles CSMA / CA before 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 "pal.h"
#include "return_val.h"
#include "tal.h"
#include "ieee_const.h"
#include "tal_internal.h"

Functions

static void cca_start (void *cb_timer_element)
 Start CCA. More...
 
void csma_continue (trx_id_t trx_id)
 Continues CSMA; handles next CSMA retry. More...
 
void csma_start (trx_id_t trx_id)
 Starts software-controlled CSMA. More...
 
static void start_backoff (trx_id_t trx_id)
 Starts the timer for the backoff period and enables receiver. More...
 

Variables

static uint8_t BE [NUM_TRX]
 
static uint8_t NB [NUM_TRX]
 

static void cca_start ( void *  cb_timer_element)
static

Start CCA.

Parameters
parameterPointer to timer element containing the trx_id

References ack_transmitting, Assert, csma_continue(), NUM_TRX, RF_BASE_ADDR_OFFSET, RF_RX, SR_RF09_AGCC_FRZS, tal_pib, transmit_frame(), trx_bit_read(), trx_state, and WITH_CCA.

Referenced by start_backoff().

void csma_continue ( trx_id_t  trx_id)

Continues CSMA; handles next CSMA retry.

Parameters
trx_idTransceiver identifier

References BE, MAC_CHANNEL_ACCESS_FAILURE, NB, start_backoff(), tal_pib, and tx_done_handling().

Referenced by cca_start(), handle_tx_end_irq(), and tal_task().

void csma_start ( trx_id_t  trx_id)

Starts software-controlled CSMA.

Parameters
trx_idTransceiver identifier

References BE, NB, NO_CCA, start_backoff(), tal_pib, and transmit_frame().

Referenced by continue_deferred_transmission(), tal_tx_frame(), and tx_done_handling().

static void start_backoff ( trx_id_t  trx_id)
static

Starts the timer for the backoff period and enables receiver.

Parameters
trx_idTransceiver identifier

References aUnitBackoffPeriod, BE, cca_start(), FUNC_PTR, MAC_SUCCESS, pal_timer_start(), RF09, RF_TRXOFF, RF_TXPREP, status, switch_to_txprep(), tal_pib, TAL_T_0, TAL_T_1, TIMEOUT_RELATIVE, trx_default_state, trx_state, TX_BACKOFF, tx_done_handling(), and tx_state.

Referenced by csma_continue(), and csma_start().

uint8_t BE[NUM_TRX]
static
uint8_t NB[NUM_TRX]
static

Referenced by csma_continue(), and csma_start().