Microchip® Advanced Software Framework

pal.h File Reference

PAL related APIs.

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

#include "compiler.h"
#include "pal_generic.h"
#include "return_val.h"
#include "common_sw_timer.h"
#include "board.h"
#include "asf.h"
#include "trx_access_2.h"

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