Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TAL Initialization and reset

Performs initialization and reset functionalities of the transceiver.

Macros

#define P_ON_TO_CLKM_ATTEMPTS
 
#define P_ON_TO_TRX_OFF_ATTEMPTS
 
#define SLEEP_TO_TRX_OFF_ATTEMPTS
 
#define TRX_POLL_WAIT_TIME_US   (100)
 

Functions

static retval_t internal_tal_reset (bool set_default_pib)
 Internal TAL reset function. More...
 
void tal_generate_rand_seed (void)
 Generates a 16-bit random number used as initial seed for srand() More...
 
retval_t tal_init (void)
 Initializes the TAL. More...
 
retval_t tal_reset (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...
 
static void tal_timers_stop (void)
 Stops all initialized TAL timers. More...
 
void trx_config (void)
 Configures the transceiver. More...
 
static retval_t trx_init (void)
 Initializes the transceiver. More...
 
static retval_t trx_reset (void)
 Reset transceiver. More...
 

#define P_ON_TO_CLKM_ATTEMPTS
Value:
((uint8_t) \
#define TRX_POLL_WAIT_TIME_US
Definition: tal_init.c:86
#define P_ON_TO_CLKM_AVAILABLE_MAX_US
Definition: at86rf233.h:78

Referenced by trx_init().

#define P_ON_TO_TRX_OFF_ATTEMPTS
Value:
((uint8_t) \
#define TRX_POLL_WAIT_TIME_US
Definition: tal_init.c:86
#define P_ON_TO_TRX_OFF_AFTER_CLKM_AVAILABLE_MAX_US
Definition: at86rf233.h:92

Referenced by trx_init().

#define SLEEP_TO_TRX_OFF_ATTEMPTS
Value:
((uint8_t) \
#define TRX_POLL_WAIT_TIME_US
Definition: tal_init.c:86
#define SLEEP_TO_TRX_OFF_MAX_US
Definition: at86rf233.h:82

Referenced by trx_reset().

#define TRX_POLL_WAIT_TIME_US   (100)

Referenced by trx_init(), and trx_reset().

static retval_t internal_tal_reset ( bool  set_default_pib)
static

Internal TAL reset function.

Parameters
set_default_pibDefines whether PIB values need to be set to its default values
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 FAILURE, init_tal_pib(), MAC_SUCCESS, tal_generate_rand_seed(), TAL_IDLE, tal_rx_on_required, tal_state, trx_config(), trx_reset(), and write_all_tal_pib_to_trx().

Referenced by tal_init(), and tal_reset().

void tal_generate_rand_seed ( void  )

Generates a 16-bit random number used as initial seed for srand()

This function generates a 16-bit random number by means of using the Random Number Generator from the transceiver. The Random Number Generator generates 2-bit random values. These 2-bit random values are concatenated to the required 16-bit random seed. The generated random 16-bit number is feed into function srand() as initial seed. The transceiver state is initally set to RX_ON. After the completion of the random seed generation, the trancseiver is set to TRX_OFF.

References CMD_FORCE_TRX_OFF, CMD_RX_ON, ENTER_TRX_REGION, LEAVE_TRX_REGION, pal_trx_irq_flag_clr, PAL_WAIT_1_US, RG_IRQ_STATUS, RG_TRX_RPC, RX_ENABLE, RX_ON, set_trx_state(), SR_RND_VALUE, SR_RX_PDT_DIS, trx_bit_read(), trx_bit_write(), trx_reg_read(), and trx_reg_write().

Referenced by internal_tal_reset().

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(), EE_IEEE_ADDR, FAILURE, FUNC_PTR, INTERN_EEPROM, internal_tal_reset(), LARGE_BUFFER_SIZE, MAC_SUCCESS, pal_init(), pal_ps_get(), pal_ps_set(), pal_trx_irq_en, pal_trx_irq_en_tstamp, pal_trx_irq_init_tstamp(), qmm_queue_init(), tal_incoming_frame_queue, tal_pib, tal_rx_buffer, tal_timer_init(), trx_init(), trx_irq_handler_cb(), trx_irq_init(), and trx_irq_timestamp_handler_cb().

Referenced by mac_init().

retval_t tal_reset ( bool  set_default_pib)

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

Parameters
set_default_pibDefines whether PIB values need to be set to its default values
Returns
MAC_SUCCESS if the transceiver state is changed to TRX_OFF FAILURE otherwise

References bmm_buffer_free(), ENTER_CRITICAL_REGION, FAILURE, FUNC_PTR, internal_tal_reset(), LEAVE_CRITICAL_REGION, MAC_SUCCESS, pal_timer_start(), pal_trx_irq_en, pal_trx_irq_flag_clr, qmm_queue_remove(), queue_tag::size, tal_incoming_frame_queue, tal_timers_stop(), TIMEOUT_RELATIVE, trx_irq_handler_cb(), and trx_irq_init().

Referenced by mac_reset().

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

Referenced by tal_init().

static void tal_timers_stop ( void  )
static

Stops all initialized TAL timers.

References pal_timer_stop().

Referenced by tal_reset().

static retval_t trx_init ( void  )
static

Initializes the transceiver.

This function is called to initialize the transceiver.

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 Assert, CMD_TRX_OFF, FAILURE, MAC_SUCCESS, P_ON_TO_CLKM_ATTEMPTS, P_ON_TO_CLKM_AVAILABLE_TYP_US, P_ON_TO_TRX_OFF_ATTEMPTS, pal_timer_delay, PART_NUM_AT86RF233, RG_PART_NUM, RG_TRX_STATE, RST_PULSE_WIDTH_US, SR_TRX_STATUS, tal_trx_status, trx_bit_read(), TRX_OFF, TRX_POLL_WAIT_TIME_US, trx_reg_read(), trx_reg_write(), TRX_RST_HIGH, TRX_RST_LOW, and TRX_SLP_TR_LOW.

Referenced by tal_init().

static retval_t trx_reset ( void  )
static

Reset transceiver.

Returns
MAC_SUCCESS if the transceiver state is changed to TRX_OFF FAILURE otherwise

References Assert, FAILURE, MAC_SUCCESS, pal_timer_delay, RST_PULSE_WIDTH_US, SLEEP_TO_TRX_OFF_ATTEMPTS, SLEEP_TO_TRX_OFF_TYP_US, SR_TRX_STATUS, stb_restart(), tal_trx_status, trx_bit_read(), TRX_OFF, TRX_POLL_WAIT_TIME_US, TRX_RST_HIGH, TRX_RST_LOW, and TRX_SLP_TR_LOW.

Referenced by internal_tal_reset().