Microchip® Advanced Software Framework

tal_init.c File Reference

This file implements functions for initializing TAL and reset.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#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
retval_t tal_init ( void  )

Initializes the TAL.

This function is called to initialize the TAL. The transceiver is initialized, the TAL PIBs are set to their default values, and the TAL state machine is set to TAL_IDLE state.

Returns
MAC_SUCCESS if the transceiver state is changed to TRX_OFF and the current device part number and version number are correct; FAILURE otherwise

References bmm_buffer_alloc(), bmm_buffer_init(), BMM_BUFFER_POINTER, calculate_pib_values(), config_phy(), FAILURE, FUNC_PTR, init_tal_pib(), LARGE_BUFFER_SIZE, MAC_SUCCESS, NUM_TRX, pal_init(), pal_trx_irq_en, pal_trx_irq_flag_clr, qmm_queue_init(), RFBOTH, RG_RF_PN, RG_RF_VN, tal_generate_rand_seed(), TAL_IDLE, tal_incoming_frame_queue, tal_pib, tal_rx_buffer, tal_state, tal_timer_init(), trx_config(), frame_info_tag::trx_id, trx_init(), trx_irq_handler_cb(), trx_irq_init(), trx_reg_read(), trx_reset(), TX_IDLE, tx_state, and write_all_tal_pib_to_trx().

Referenced by init_state_init().

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_irq_init(), trx_reset(), trx_state, TX_IDLE, tx_state, and write_all_tal_pib_to_trx().

Referenced by set_transceiver_state().

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

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, trx_bit_write(), and TRX_CLOCK_OUTPUT_SELECTION.

Referenced by tal_init(), and tal_reset().