Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Common SW Timer

Implements the software Algorithm for Timer Handling in the Stack.

Modules

 Group_pal_common_hw_timer
 Implements a common api interface for accessing timer drivers of all architectures.
 

Data Structures

struct  timer_info_tag
 

Macros

#define ADD_TIME(a, b)   ((a) + (b))
 Adds two time values. More...
 
#define HW_TIME_MASK   (0xFFFF)
 
#define MAX_NO_OF_TIMERS   (25)
 
#define MAX_TIMEOUT   (0x7FFFFFFF)
 
#define MIN_TIMEOUT   (0x80)
 
#define NO_TIMER   (0xFF)
 
#define SUB_TIME(a, b)   ((a) - (b))
 Subtracts two time values. More...
 
#define SYS_TIME_SHIFT_MASK   (16)
 
#define TOTAL_TIMERS   TOTAL_NUMBER_OF_TIMERS
 

Typedefs

typedef enum sw_timeout_type_tag sw_timeout_type_t
 Timeout type. More...
 
typedef void(* timer_expiry_cb_t )(void *)
 
typedef struct timer_info_tag timer_info_t
 

Enumerations

enum  sw_timeout_type_tag {
  SW_TIMEOUT_RELATIVE,
  SW_TIMEOUT_ABSOLUTE
}
 Timeout type. More...
 

Functions

status_code_t sw_timer_get_id (uint8_t *timer_id)
 Returns a timer id to be used before starting a timer. More...
 
uint32_t sw_timer_get_residual_time (uint8_t timer_id)
 
uint32_t sw_timer_get_time (void)
 Gets current time. More...
 
void sw_timer_init (void)
 Initializes the Software Timer module. More...
 
bool sw_timer_is_running (uint8_t timer_id)
 Checks whether a given timer is running or not. More...
 
uint32_t sw_timer_next_timer_expiry_duration (void)
 
void sw_timer_run_residual_time (uint32_t offset)
 
void sw_timer_service (void)
 Handles Queues and Callbacks for Expired Timers. More...
 
status_code_t sw_timer_start (uint8_t timer_id, uint32_t timer_count, sw_timeout_type_t timeout_type, FUNC_PTR timer_cb, void *param_cb)
 Starts a timer. More...
 
status_code_t sw_timer_stop (uint8_t timer_id)
 Stops a running timer. More...
 

Variables

uint32_t timer_info_tag::abs_exp_timer
 
bool timer_info_tag::loaded
 
uint8_t timer_info_tag::next_timer_in_queue
 
void * timer_info_tag::param_cb
 
FUNC_PTR timer_info_tag::timer_cb
 

#define ADD_TIME (   a,
 
)    ((a) + (b))

Adds two time values.

Referenced by pal_add_time_us().

#define HW_TIME_MASK   (0xFFFF)
#define MAX_NO_OF_TIMERS   (25)
#define MAX_TIMEOUT   (0x7FFFFFFF)
#define MIN_TIMEOUT   (0x80)
#define NO_TIMER   (0xFF)

Referenced by sw_timer_init(), and sw_timer_service().

#define SUB_TIME (   a,
 
)    ((a) - (b))

Subtracts two time values.

Referenced by calculate_time_duration(), and pal_sub_time_us().

#define SYS_TIME_SHIFT_MASK   (16)
#define TOTAL_TIMERS   TOTAL_NUMBER_OF_TIMERS

Timeout type.

typedef void(* timer_expiry_cb_t)(void *)
typedef struct timer_info_tag timer_info_t

Timeout type.

Enumerator
SW_TIMEOUT_RELATIVE 

The timeout is relative to the current time.

SW_TIMEOUT_ABSOLUTE 

The timeout is an absolute value.

status_code_t sw_timer_get_id ( uint8_t *  timer_id)

Returns a timer id to be used before starting a timer.

Parameters
timer_idValue of the id returned by the function

Referenced by app_timers_init(), main(), and pal_timer_get_id().

uint32_t sw_timer_get_residual_time ( uint8_t  timer_id)
uint32_t sw_timer_get_time ( void  )

Gets current time.

This function returns the current time.

Parameters
[out]current_timeReturns current system time

Referenced by app_task(), pal_get_current_time(), pal_trx_read_timestamp(), per_mode_initiator_tx_done_cb(), and start_test().

bool sw_timer_is_running ( uint8_t  timer_id)

Checks whether a given timer is running or not.

Parameters
[out]Trueif the timer is running else False

Referenced by pal_is_timer_running(), peer_req_send_task(), per_mode_initiator_rx_cb(), and stop_pkt_streaming().

uint32_t sw_timer_next_timer_expiry_duration ( void  )
void sw_timer_run_residual_time ( uint32_t  offset)
void sw_timer_service ( void  )

Handles Queues and Callbacks for Expired Timers.

References callback, cpu_irq_restore(), cpu_irq_save(), timer_info_tag::loaded, NO_TIMER, NULL, timer_info_tag::param_cb, and timer_info_tag::timer_cb.

Referenced by pal_task(), and wpan_task().

uint32_t timer_info_tag::abs_exp_timer
bool timer_info_tag::loaded

Referenced by sw_timer_service().

uint8_t timer_info_tag::next_timer_in_queue

Referenced by sw_timer_init().

void* timer_info_tag::param_cb

Referenced by sw_timer_service().

FUNC_PTR timer_info_tag::timer_cb

Referenced by sw_timer_init(), and sw_timer_service().