This module acts as a wrapper layer between the Wireless stack and the ASF drivers All hardwar level acess to the ASF drivers from the stack happens through this module.
Macros | |
#define | DISABLE_GLOBAL_IRQ() Disable_global_interrupt() |
#define | ENABLE_GLOBAL_IRQ() Enable_global_interrupt() |
#define | ENTER_CRITICAL_REGION() {uint8_t flags = cpu_irq_save(); |
#define | LEAVE_CRITICAL_REGION() cpu_irq_restore(flags); } |
#define | MIN_TIMEOUT (0x80) |
#define | pal_timer_delay(delay) delay_us(delay) |
Generates blocking delay. More... | |
#define | pal_trx_irq_dis() DISABLE_TRX_IRQ() |
Disables the transceiver main interrupt. More... | |
#define | pal_trx_irq_dis_tstamp() DISABLE_TRX_IRQ_TSTAMP() |
Disables the transceiver timestamp interrupt. More... | |
#define | pal_trx_irq_en() ENABLE_TRX_IRQ() |
Enables the transceiver main interrupt. More... | |
#define | pal_trx_irq_en_tstamp() ENABLE_TRX_IRQ_TSTAMP() |
Enables the transceiver timestamp interrupt. More... | |
#define | pal_trx_irq_flag_clr() CLEAR_TRX_IRQ() |
Clears the transceiver main interrupt. More... | |
#define | pal_trx_irq_flag_clr_tstamp() CLEAR_TRX_IRQ_TSTAMP() |
Clears the transceiver timestamp interrupt. More... | |
#define | PAL_WAIT_1_US() delay_us(1); |
#define | PAL_WAIT_65_NS() {nop(); nop(); } |
#define | STACK_FLASH_SIZE (1024) |
#define | TIMER_SRC_DURING_TRX_AWAKE() |
Timer clock source while radio is awake. More... | |
#define | TIMER_SRC_DURING_TRX_SLEEP() |
Timer clock source while radio is sleeping. More... | |
#define | U16_TO_TARGET(x) (x) |
This macro is used for handling endianness among the different CPUs. More... | |
Typedefs | |
typedef enum ps_id_tag | ps_id_t |
IDs for persistence storage access. More... | |
typedef enum pwr_mode_tag | pwr_mode_t |
Power modes. More... | |
typedef enum source_type_tag | source_type_t |
Timer clock source type. More... | |
Enumerations | |
enum | ps_id_tag { PS_IEEE_ADDR, PS_XTAL_TRIM } |
IDs for persistence storage access. More... | |
enum | pwr_mode_tag { SYSTEM_SLEEP } |
Power modes. More... | |
enum | source_type_tag { TMR_CLK_SRC_DURING_TRX_SLEEP, TMR_CLK_SRC_DURING_TRX_AWAKE } |
Timer clock source type. More... | |
Functions | |
static uint32_t | pal_add_time_us (uint32_t a, uint32_t b) |
Adds two time values. More... | |
bool | pal_calibrate_rc_osc (void) |
Calibrates the internal RC oscillator. More... | |
static void | pal_global_irq_disable (void) |
Disables the global interrupt. More... | |
static void | pal_global_irq_enable (void) |
Enables the global interrupt. More... | |
retval_t | pal_init (void) |
Initialization of PAL. More... | |
static uint32_t | pal_sub_time_us (uint32_t a, uint32_t b) |
Subtracts two time values. More... | |
void | pal_timer_source_select (source_type_t source) |
Selects timer clock source. More... | |
void | pal_trx_irq_init (FUNC_PTR trx_irq_cb) |
Initializes the transceiver main interrupt. More... | |
void | pal_trx_irq_init_tstamp (FUNC_PTR trx_irq_cb) |
Initializes the transceiver timestamp interrupt. More... | |
void | pal_trx_read_timestamp (uint32_t *timestamp) |
Provides timestamp of the last received frame. More... | |
#define DISABLE_GLOBAL_IRQ | ( | ) | Disable_global_interrupt() |
Referenced by pal_global_irq_disable().
#define ENABLE_GLOBAL_IRQ | ( | ) | Enable_global_interrupt() |
Referenced by pal_global_irq_enable(), and set_trx_state().
#define ENTER_CRITICAL_REGION | ( | ) | {uint8_t flags = cpu_irq_save(); |
Referenced by cleanup_tal(), mac_add_gts_info(), mac_gts_allocate(), mac_gts_deallocate(), mac_soft_reset(), mac_t_gts_cb(), set_trx_state(), tal_reset(), and tal_task().
#define LEAVE_CRITICAL_REGION | ( | ) | cpu_irq_restore(flags); } |
Referenced by cleanup_tal(), mac_add_gts_info(), mac_gts_allocate(), mac_gts_deallocate(), mac_soft_reset(), mac_t_gts_cb(), set_trx_state(), tal_reset(), and tal_task().
#define MIN_TIMEOUT (0x80) |
#define pal_timer_delay | ( | delay | ) | delay_us(delay) |
Generates blocking delay.
This functions generates a blocking delay of specified time.
delay | in microseconds |
Referenced by handle_ifs(), perform_cca_twice(), send_frame(), set_trx_state(), switch_pll_on(), tal_generate_rand_seed(), tfa_cca_perform(), tfa_ed_sample(), tfa_get_batmon_voltage(), transmit_frame(), trx_init(), trx_reset(), wait_for_freq_settling(), and wait_for_txprep().
#define pal_trx_irq_dis | ( | ) | DISABLE_TRX_IRQ() |
Disables the transceiver main interrupt.
This macro is only available for non-single chip transceivers, since in single chip transceivers there is no separation between disabling transceiver interrupts at the transceiver, and clearing the IRQ mask at the MCU. Therefore the transceiver interrupts in single chips are disabled by clearing the MCU IRQ mask.
Referenced by send_frame(), and tfa_get_batmon_voltage().
#define pal_trx_irq_dis_tstamp | ( | ) | DISABLE_TRX_IRQ_TSTAMP() |
Disables the transceiver timestamp interrupt.
This macro is only available for non-single chip transceivers, since in single chip transceivers there is no separation between disabling transceiver interrupts at the transceiver, and clearing the IRQ mask at the MCU. Therefore the transceiver interrupts in single chips are disabled by clearing the MCU IRQ mask.
#define pal_trx_irq_en | ( | ) | ENABLE_TRX_IRQ() |
Enables the transceiver main interrupt.
This macro is only available for non-single chip transceivers, since in single chip transceivers there is no separation between enabling transceiver interrupts at the transceiver, and setting the IRQ mask at the MCU. Therefore the transceiver interrupts in single chips are enabled by setting the MCU IRQ mask.
Referenced by send_frame(), set_trx_state(), tal_init(), tal_reset(), and tfa_get_batmon_voltage().
#define pal_trx_irq_en_tstamp | ( | ) | ENABLE_TRX_IRQ_TSTAMP() |
Enables the transceiver timestamp interrupt.
This macro is only available for non-single chip transceivers, since in single chip transceivers there is no separation between enabling transceiver interrupts at the transceiver, and setting the IRQ mask at the MCU. Therefore the transceiver interrupts in single chips are enabled by setting the MCU IRQ mask.
Referenced by tal_init().
#define pal_trx_irq_flag_clr | ( | ) | CLEAR_TRX_IRQ() |
Clears the transceiver main interrupt.
Referenced by set_trx_state(), switch_pll_on(), tal_generate_rand_seed(), tal_init(), tal_reset(), and trx_reset().
#define pal_trx_irq_flag_clr_tstamp | ( | ) | CLEAR_TRX_IRQ_TSTAMP() |
Clears the transceiver timestamp interrupt.
#define PAL_WAIT_1_US | ( | ) | delay_us(1); |
Referenced by set_trx_state(), tal_generate_rand_seed(), and trx_reset().
Referenced by handle_tx_end_irq(), and send_frame().
#define STACK_FLASH_SIZE (1024) |
#define TIMER_SRC_DURING_TRX_AWAKE | ( | ) |
Timer clock source while radio is awake.
T0 & T1 of PORTC clk source is event channel 2 triggered by transceiver clock (CLKM, 1MHz)
#define TIMER_SRC_DURING_TRX_SLEEP | ( | ) |
Timer clock source while radio is sleeping.
T0 & T1 of PORTC clk source is event channel 0 triggered by system clock with corresponding event system prescaler (see function event_system_init()).
#define U16_TO_TARGET | ( | x | ) | (x) |
This macro is used for handling endianness among the different CPUs.
typedef enum pwr_mode_tag pwr_mode_t |
Power modes.
typedef enum source_type_tag source_type_t |
Timer clock source type.
enum ps_id_tag |
enum pwr_mode_tag |
enum source_type_tag |
|
inlinestatic |
Adds two time values.
a | Time value 1 |
b | Time value 2 |
Referenced by csma_backoff_calculation(), perform_cca_twice(), and send_frame_at_next_backoff_boundary().
bool pal_calibrate_rc_osc | ( | void | ) |
Calibrates the internal RC oscillator.
Referenced by mac_init().
|
inlinestatic |
Disables the global interrupt.
References DISABLE_GLOBAL_IRQ.
|
inlinestatic |
Enables the global interrupt.
References ENABLE_GLOBAL_IRQ.
retval_t pal_init | ( | void | ) |
Initialization of PAL.
This function initializes the PAL. The RC Oscillator is calibrated.
Initialization of PAL.
References INT_FLASH, MAC_SUCCESS, nvm_init(), PHY_ID_RX_QR_MODE_ID, PHY_ID_TX_QR_MODE_ID, phy_mac_crc_disable(), and phy_set_cfg_param().
Referenced by _prime_stack_process(), and tal_init().
|
inlinestatic |
Subtracts two time values.
a | Time value 1 |
b | Time value 2 |
Referenced by csma_backoff_calculation(), handle_tx_end_irq(), switch_pll_on(), tal_trx_wakeup(), and trx_reset().
void pal_timer_source_select | ( | source_type_t | source | ) |
Selects timer clock source.
This function selects the clock source of the timer.
source |
|
Referenced by mac_reset(), mac_trx_init_sleep(), mac_trx_wakeup(), tal_trx_sleep(), and tal_trx_wakeup().
void pal_trx_irq_init | ( | FUNC_PTR | trx_irq_cb | ) |
Initializes the transceiver main interrupt.
This function sets the microcontroller specific registers responsible for handling the transceiver main interrupt
trx_irq_cb | Callback function for the transceiver main interrupt |
void pal_trx_irq_init_tstamp | ( | FUNC_PTR | trx_irq_cb | ) |
Initializes the transceiver timestamp interrupt.
This function sets the microcontroller specific registers responsible for handling the transceiver timestamp interrupt
trx_irq_cb | Callback function for the transceiver timestamp interrupt |
Referenced by tal_init().
void pal_trx_read_timestamp | ( | uint32_t * | timestamp | ) |
Provides timestamp of the last received frame.
This function provides the timestamp (in microseconds) of the last received frame.
[out] | timestamp | in microseconds |
Referenced by handle_tx_end_irq(), and trx_irq_handler_cb().