Microchip® Advanced Software Framework

atmegarfr2/src/tal_irq_handler.c File Reference
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "return_val.h"
#include "tal.h"
#include "ieee_const.h"
#include "stack_config.h"
#include "bmm.h"
#include "qmm.h"
#include "tal_irq_handler.h"
#include "tal_rx.h"
#include "atmega256rfr2.h"
#include "tal_internal.h"
#include "tal_constants.h"
#include "tal_tx.h"
#include "mac_build_config.h"

Macros

#define CONCAT(a, b)   a ## b
 String concatenation by preprocessor used to create proper register names. More...
 
#define PAL_US_PER_SYMBOLS   (16)
 Conversion factor: us per symbol for 2,4 GHz. More...
 
#define SC_READ32(reg)
 Creates proper subregister names and reads the corresponding values. More...
 
#define SC_WRITE32(reg, val)
 Creates proper subregister names and writes the corresponding values. More...
 

Functions

 ISR (TRX24_TX_END_vect)
 ISR for transceiver's transmit end interrupt. More...
 
 ISR (TRX24_RX_END_vect)
 ISR for transceiver's receive end interrupt. More...
 
 ISR (TRX24_CCA_ED_DONE_vect)
 ISR for transceiver's CCA/ED measurement done interrupt. More...
 
 ISR (TRX24_AWAKE_vect)
 ISR for transceiver's Awake interrupt. More...
 
 ISR (TRX24_RX_START_vect)
 ISR for transceiver's rx start interrupt. More...
 
 ISR (TRX24_PLL_LOCK_vect)
 ISR for transceiver's PLL lock interrupt. More...
 
 ISR (TRX24_PLL_UNLOCK_vect)
 ISR for transceiver's PLL unlock interrupt. More...
 
 ISR (TRX24_XAH_AMI_vect)
 ISR for transceiver's address match interrupt. More...
 
 ISR (BAT_LOW_vect)
 ISR for transceiver's battery low interrupt. More...
 
 ISR (AES_READY_vect)
 ISR for transceiver's AES interrupt. More...
 
 ISR (TRX24_TX_START_vect)
 ISR for transceiver's TX_START interrupt. More...
 
 ISR (TRX24_AMI0_vect)
 ISR for transceiver's AMI0 interrupt. More...
 
 ISR (TRX24_AMI1_vect)
 ISR for transceiver's AMI1 interrupt. More...
 
 ISR (TRX24_AMI2_vect)
 ISR for transceiver's AMI2 interrupt. More...
 
 ISR (TRX24_AMI3_vect)
 ISR for transceiver's AMI3 interrupt. More...
 
void pal_trx_irq_init_aes_ready (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_ami (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_awake (FUNC_PTR trx_irq_cb)
 Initializes the transceiver AWAKE interrupt. More...
 
void pal_trx_irq_init_batmon (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_cca_ed (FUNC_PTR trx_irq_cb)
 Initializes the transceiver CCA ED END interrupt. More...
 
void pal_trx_irq_init_maf_0_ami (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_maf_1_ami (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_maf_2_ami (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_maf_3_ami (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_pll_lock (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_pll_unlock (FUNC_PTR trx_irq_cb)
 
void pal_trx_irq_init_rx_end (FUNC_PTR trx_irq_cb)
 Initializes the transceiver RX END interrupt. More...
 
void pal_trx_irq_init_tstamp (FUNC_PTR trx_irq_cb)
 Initializes the transceiver timestamp interrupt. More...
 
void pal_trx_irq_init_tx_end (FUNC_PTR trx_irq_cb)
 Initializes the transceiver TX END interrupt. More...
 
void pal_trx_irq_init_tx_start (FUNC_PTR trx_irq_cb)
 
static uint32_t sc_read32 (volatile uint8_t *hh, volatile uint8_t *hl, volatile uint8_t *lh, volatile uint8_t *ll)
 Reads the 32-bit timer register in the required order of bytes. More...
 
void trx_awake_handler_cb (void)
 
void trx_irq_timestamp_handler_cb (void)
 Timestamp interrupt handler. More...
 
void trx_rx_end_handler_cb (void)
 Transceiver interrupt handler. More...
 
void trx_tx_end_handler_cb (void)
 Transceiver interrupt handler. More...
 

Variables

static irq_handler_t irq_hdl_trx_aes_ready
 Function pointer to store callback for transceiver AES_READY interrupt. More...
 
static irq_handler_t irq_hdl_trx_ami
 Function pointer to store callback for transceiver AMI interrupt. More...
 
static irq_handler_t irq_hdl_trx_ami0
 Function pointer to store callback for transceiver AMI0 interrupt. More...
 
static irq_handler_t irq_hdl_trx_ami1
 Function pointer to store callback for transceiver AMI1 interrupt. More...
 
static irq_handler_t irq_hdl_trx_ami2
 Function pointer to store callback for transceiver AMI2 interrupt. More...
 
static irq_handler_t irq_hdl_trx_ami3
 Function pointer to store callback for transceiver AMI3 interrupt. More...
 
static irq_handler_t irq_hdl_trx_awake
 Function pointer to store callback for transceiver AWAKE interrupt. More...
 
static irq_handler_t irq_hdl_trx_batmon
 Function pointer to store callback for transceiver BATMON interrupt. More...
 
static irq_handler_t irq_hdl_trx_cca_ed
 Function pointer to store callback for transceiver CCA_ED interrupt. More...
 
static irq_handler_t irq_hdl_trx_pll_lock
 Function pointer to store callback for transceiver PLL_LOCK interrupt. More...
 
static irq_handler_t irq_hdl_trx_pll_unlock
 Function pointer to store callback for transceiver PLL_UNLOCK interrupt. More...
 
static irq_handler_t irq_hdl_trx_rx_end
 Function pointer to store callback for transceiver RX_END interrupt. More...
 
static irq_handler_t irq_hdl_trx_tstamp
 Function pointer to store callback for transceiver timestamp (RX_START) interrupt. More...
 
static irq_handler_t irq_hdl_trx_tx_end
 Function pointer to store callback for transceiver TX_END interrupt. More...
 
static irq_handler_t irq_hdl_trx_tx_start
 Function pointer to store callback for transceiver TX_START interrupt. More...
 
uint32_t pal_tx_timestamp
 Timestamp of the last frame transmission (including auto-ACK) More...
 

#define CONCAT (   a,
 
)    a ## b

String concatenation by preprocessor used to create proper register names.

#define PAL_US_PER_SYMBOLS   (16)

Conversion factor: us per symbol for 2,4 GHz.

Referenced by ISR().

#define SC_READ32 (   reg)
Value:
sc_read32(&CONCAT(reg, HH), \
&CONCAT(reg, HL), \
&CONCAT(reg, LH), \
&CONCAT(reg, LL))
static uint32_t sc_read32(volatile uint8_t *hh, volatile uint8_t *hl, volatile uint8_t *lh, volatile uint8_t *ll)
Reads the 32-bit timer register in the required order of bytes.
#define CONCAT(a, b)
String concatenation by preprocessor used to create proper register names.
Definition: atmegarfr2/src/tal_irq_handler.c:107

Creates proper subregister names and reads the corresponding values.

Referenced by ISR().

#define SC_WRITE32 (   reg,
  val 
)
Value:
do { \
union { uint8_t a[4]; uint32_t v; } \
x; \
x.v = val; \
CONCAT(reg, HH) = x.a[3]; \
CONCAT(reg, HL) = x.a[2]; \
CONCAT(reg, LH) = x.a[1]; \
CONCAT(reg, LL) = x.a[0]; \
} \
while (0)
#define CONCAT(a, b)
String concatenation by preprocessor used to create proper register names.
Definition: atmegarfr2/src/tal_irq_handler.c:107

Creates proper subregister names and writes the corresponding values.

ISR ( TRX24_TX_END_vect  )

ISR for transceiver's transmit end interrupt.

References irq_hdl_trx_tx_end.

ISR ( TRX24_RX_END_vect  )

ISR for transceiver's receive end interrupt.

References irq_hdl_trx_rx_end.

ISR ( TRX24_CCA_ED_DONE_vect  )

ISR for transceiver's CCA/ED measurement done interrupt.

References irq_hdl_trx_cca_ed.

ISR ( TRX24_AWAKE_vect  )

ISR for transceiver's Awake interrupt.

References irq_hdl_trx_awake.

ISR ( TRX24_RX_START_vect  )

ISR for transceiver's rx start interrupt.

By the time the SFD is detected, the hardware timestamps the current frame in the SCTSR register.

References irq_hdl_trx_tstamp.

ISR ( TRX24_PLL_LOCK_vect  )

ISR for transceiver's PLL lock interrupt.

References irq_hdl_trx_pll_lock.

ISR ( TRX24_PLL_UNLOCK_vect  )

ISR for transceiver's PLL unlock interrupt.

References irq_hdl_trx_pll_unlock.

ISR ( TRX24_XAH_AMI_vect  )

ISR for transceiver's address match interrupt.

References irq_hdl_trx_ami.

ISR ( BAT_LOW_vect  )

ISR for transceiver's battery low interrupt.

References irq_hdl_trx_batmon.

ISR ( AES_READY_vect  )

ISR for transceiver's AES interrupt.

References irq_hdl_trx_aes_ready.

ISR ( TRX24_TX_START_vect  )

ISR for transceiver's TX_START interrupt.

References irq_hdl_trx_tx_start, pal_tx_timestamp, PAL_US_PER_SYMBOLS, and SC_READ32.

ISR ( TRX24_AMI0_vect  )

ISR for transceiver's AMI0 interrupt.

References irq_hdl_trx_ami0.

ISR ( TRX24_AMI1_vect  )

ISR for transceiver's AMI1 interrupt.

References irq_hdl_trx_ami1.

ISR ( TRX24_AMI2_vect  )

ISR for transceiver's AMI2 interrupt.

References irq_hdl_trx_ami2.

ISR ( TRX24_AMI3_vect  )

ISR for transceiver's AMI3 interrupt.

References irq_hdl_trx_ami3.

void pal_trx_irq_init_aes_ready ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_aes_ready.

void pal_trx_irq_init_ami ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_ami.

void pal_trx_irq_init_awake ( FUNC_PTR  trx_irq_cb)

Initializes the transceiver AWAKE interrupt.

This function sets the microcontroller specific registers responsible for handling the transceiver AWAKE interrupt

Parameters
trx_irq_cbCallback function for the transceiver AWAKE interrupt

Referenced by set_trx_state(), and tal_init().

void pal_trx_irq_init_batmon ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_batmon.

void pal_trx_irq_init_cca_ed ( FUNC_PTR  trx_irq_cb)

Initializes the transceiver CCA ED END interrupt.

This function sets the microcontroller specific registers responsible for handling the transceiver CCA ED END interrupt

Parameters
trx_irq_cbCallback function for the transceiver CCA ED END interrupt
void pal_trx_irq_init_maf_0_ami ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_ami0.

void pal_trx_irq_init_maf_1_ami ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_ami1.

void pal_trx_irq_init_maf_2_ami ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_ami2.

void pal_trx_irq_init_maf_3_ami ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_ami3.

void pal_trx_irq_init_pll_lock ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_pll_lock.

void pal_trx_irq_init_pll_unlock ( FUNC_PTR  trx_irq_cb)
void pal_trx_irq_init_rx_end ( FUNC_PTR  trx_irq_cb)

Initializes the transceiver RX END interrupt.

This function sets the microcontroller specific registers responsible for handling the transceiver RX END interrupt

Parameters
trx_irq_cbCallback function for the transceiver RX END interrupt

Referenced by tal_init().

void pal_trx_irq_init_tx_end ( FUNC_PTR  trx_irq_cb)

Initializes the transceiver TX END interrupt.

This function sets the microcontroller specific registers responsible for handling the transceiver TX END interrupt

Parameters
trx_irq_cbCallback function for the transceiver TX END interrupt

Referenced by tal_init().

void pal_trx_irq_init_tx_start ( FUNC_PTR  trx_irq_cb)

References irq_hdl_trx_tx_start.

static uint32_t sc_read32 ( volatile uint8_t *  hh,
volatile uint8_t *  hl,
volatile uint8_t *  lh,
volatile uint8_t *  ll 
)
inlinestatic

Reads the 32-bit timer register in the required order of bytes.

Parameters
hhhh octet of 32-bit register
hlhl octet of 32-bit register
lhlh octet of 32-bit register
llll octet of 32-bit register
Returns
uint32_t Value of timer register

irq_handler_t irq_hdl_trx_aes_ready
static

Function pointer to store callback for transceiver AES_READY interrupt.

Referenced by ISR(), and pal_trx_irq_init_aes_ready().

irq_handler_t irq_hdl_trx_ami
static

Function pointer to store callback for transceiver AMI interrupt.

Referenced by ISR(), and pal_trx_irq_init_ami().

irq_handler_t irq_hdl_trx_ami0
static

Function pointer to store callback for transceiver AMI0 interrupt.

Referenced by ISR(), and pal_trx_irq_init_maf_0_ami().

irq_handler_t irq_hdl_trx_ami1
static

Function pointer to store callback for transceiver AMI1 interrupt.

Referenced by ISR(), and pal_trx_irq_init_maf_1_ami().

irq_handler_t irq_hdl_trx_ami2
static

Function pointer to store callback for transceiver AMI2 interrupt.

Referenced by ISR(), and pal_trx_irq_init_maf_2_ami().

irq_handler_t irq_hdl_trx_ami3
static

Function pointer to store callback for transceiver AMI3 interrupt.

Referenced by ISR(), and pal_trx_irq_init_maf_3_ami().

irq_handler_t irq_hdl_trx_awake
static

Function pointer to store callback for transceiver AWAKE interrupt.

Referenced by ISR(), and pal_trx_irq_init_awake().

irq_handler_t irq_hdl_trx_batmon
static

Function pointer to store callback for transceiver BATMON interrupt.

Referenced by ISR(), and pal_trx_irq_init_batmon().

irq_handler_t irq_hdl_trx_cca_ed
static

Function pointer to store callback for transceiver CCA_ED interrupt.

Referenced by ISR(), and pal_trx_irq_init_cca_ed().

irq_handler_t irq_hdl_trx_pll_lock
static

Function pointer to store callback for transceiver PLL_LOCK interrupt.

Referenced by ISR(), and pal_trx_irq_init_pll_lock().

irq_handler_t irq_hdl_trx_pll_unlock
static

Function pointer to store callback for transceiver PLL_UNLOCK interrupt.

Referenced by ISR(), and pal_trx_irq_init_pll_unlock().

irq_handler_t irq_hdl_trx_rx_end
static

Function pointer to store callback for transceiver RX_END interrupt.

Referenced by ISR(), and pal_trx_irq_init_rx_end().

irq_handler_t irq_hdl_trx_tstamp
static

Function pointer to store callback for transceiver timestamp (RX_START) interrupt.

Referenced by ISR(), and pal_trx_irq_init_tstamp().

irq_handler_t irq_hdl_trx_tx_end
static

Function pointer to store callback for transceiver TX_END interrupt.

Referenced by ISR(), and pal_trx_irq_init_tx_end().

irq_handler_t irq_hdl_trx_tx_start
static

Function pointer to store callback for transceiver TX_START interrupt.

Referenced by ISR(), and pal_trx_irq_init_tx_start().

uint32_t pal_tx_timestamp

Timestamp of the last frame transmission (including auto-ACK)

Referenced by ISR(), and tx_done_handling().