Microchip® Advanced Software Framework

at86rf215/src/tal_init.c File Reference
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.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 "pal.h"
#include "tal_internal.h"
#include "tal_config.h"
#include "tfa.h"
#include "mac_build_config.h"

Functions

static void cleanup_tal (trx_id_t trx_id)
 Stops all initialized TAL timers. More...
 
retval_t tal_init (void)
 Initializes the TAL. More...
 
retval_t tal_reset (trx_id_t trx_id, bool set_default_pib)
 Resets TAL state machine and sets the default PIB values if requested. More...
 
static retval_t tal_timer_init (void)
 Initializes all timers used by the TAL module by assigning id's to each of them. More...
 
void trx_config (trx_id_t trx_id)
 Configures the transceiver. More...
 
static void trx_init (void)
 Initializes the transceiver. More...
 
retval_t trx_reset (trx_id_t trx_id)
 Resets transceiver(s) More...
 

Variables

uint8_t TAL_T_0
 
uint8_t TAL_T_1
 

static void cleanup_tal ( trx_id_t  trx_id)
static

Stops all initialized TAL timers.

Cleanup TAL.

Parameters
trx_idTransceiver identifier

References ENTER_CRITICAL_REGION, LEAVE_CRITICAL_REGION, NULL, stop_tal_timer(), tal_buf_shortage, tal_incoming_frame_queue, and tal_rx_buffer.

Referenced by tal_reset().

retval_t tal_reset ( trx_id_t  trx_id,
bool  set_default_pib 
)

Resets TAL state machine and sets the default PIB values if requested.

Parameters
trx_idTransceiver identifier
set_default_pibDefines whether PIB values need to be set to its default values
Returns

References calculate_pib_values(), cleanup_tal(), config_phy(), FAILURE, FUNC_PTR, init_tal_pib(), MAC_SUCCESS, NUM_TRX, pal_trx_irq_en, RF09, RF24, RF_SLEEP, RFBOTH, TAL_IDLE, tal_state, trx_config(), trx_init(), trx_irq_handler_cb(), trx_reset(), trx_state, TX_IDLE, tx_state, and write_all_tal_pib_to_trx().

static retval_t tal_timer_init ( void  )
static

Initializes all timers used by the TAL module by assigning id's to each of them.

References FAILURE, MAC_SUCCESS, pal_timer_get_id(), TAL_T_0, and TAL_T_1.

Referenced by tal_init().

void trx_config ( trx_id_t  trx_id)
static void trx_init ( void  )
static

Initializes the transceiver.

This function is called to initialize the general transceiver functionality after power or IC reset.

References SR_RF_CFG_IRQP, SR_RF_CLKO_OS, and TRX_CLOCK_OUTPUT_SELECTION.

Referenced by tal_init(), and tal_reset().

retval_t trx_reset ( trx_id_t  trx_id)

Resets transceiver(s)

Parameters
trx_idTransceiver identifier
Returns
MAC_SUCCESS if the transceiver returns TRX_OFF FAILURE otherwise

References FAILURE, HIGH, MAC_SUCCESS, NUM_TRX, pal_get_current_time(), pal_sub_time_us(), pal_trx_irq_flag_clr, PAL_WAIT_1_US, RF09, RF24, RF_BASE_ADDR_OFFSET, RF_IRQ_WAKEUP, RF_RESET, RF_TRXOFF, RFBOTH, RG_RF09_CMD, RG_RF09_STATE, start_time, status, TAL_RESET, TAL_RF_IRQ_CLR, TAL_RF_IRQ_CLR_ALL, tal_state, trx_irq_handler_cb(), and trx_state.

Referenced by init_after_disconnect(), tal_init(), and tal_reset().