Copyright (c) 2013-2018 Microchip Technology Inc.
and its subsidiaries.
#include "compiler.h"
#include "conf_common_sw_timer.h"
#include "common_hw_timer.h"
#include "common_sw_timer.h"
#include "system.h"
#include "board.h"
Functions | |
static bool | compare_time (uint32_t t1, uint32_t t2) |
static uint32_t | gettime (void) |
void | hw_expiry_cb (void) |
void | hw_overflow_cb (void) |
static void | internal_timer_handler (void) |
static void | load_hw_timer (uint8_t timer_id) |
static void | prog_ocr (void) |
static void | start_absolute_timer (uint8_t timer_id, uint32_t point_in_time, FUNC_PTR handler_cb, void *parameter) |
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... | |
void | wakeup_cb (void *parameter) |
Variables | |
static uint8_t | alloc_timer_id = 0 |
static uint_fast8_t | expired_timer_queue_head |
static uint_fast8_t | expired_timer_queue_tail |
static uint_fast8_t | running_timer_queue_head |
static uint8_t | running_timers |
bool | sys_sleep |
volatile uint16_t | sys_time |
This is the most significant part of the system time. More... | |
timer_info_t | timer_array [TOTAL_NUMBER_OF_SW_TIMERS] |
volatile bool | timer_trigger |
|
inlinestatic |
Referenced by load_hw_timer(), and start_absolute_timer().
|
inlinestatic |
References common_tc_read_count(), and sys_time.
Referenced by load_hw_timer(), sw_timer_get_residual_time(), sw_timer_get_time(), and sw_timer_start().
|
static |
References expired_timer_queue_head, expired_timer_queue_tail, load_hw_timer(), NO_TIMER, running_timer_queue_head, running_timers, and timer_trigger.
Referenced by start_absolute_timer(), sw_timer_service(), and sw_timer_stop().
|
static |
References timer_info_tag::abs_exp_timer, common_tc_compare_stop(), common_tc_delay(), compare_time(), gettime(), timer_info_tag::loaded, NO_TIMER, and timer_trigger.
Referenced by internal_timer_handler(), start_absolute_timer(), and sw_timer_stop().
|
static |
References timer_info_tag::abs_exp_timer, common_tc_delay(), cpu_irq_restore(), cpu_irq_save(), HW_TIME_MASK, timer_info_tag::loaded, NO_TIMER, running_timer_queue_head, sys_time, and SYS_TIME_SHIFT_MASK.
Referenced by hw_overflow_cb().
|
static |
References timer_info_tag::abs_exp_timer, compare_time(), cpu_irq_restore(), cpu_irq_save(), FUNC_PTR, internal_timer_handler(), load_hw_timer(), timer_info_tag::loaded, timer_info_tag::next_timer_in_queue, NO_TIMER, timer_info_tag::param_cb, running_timer_queue_head, running_timers, and timer_info_tag::timer_cb.
Referenced by sw_timer_start().
void wakeup_cb | ( | void * | parameter | ) |
|
static |
Referenced by sw_timer_get_id(), and sw_timer_init().
|
static |
Referenced by internal_timer_handler(), sw_timer_init(), sw_timer_service(), and sw_timer_stop().
|
static |
Referenced by internal_timer_handler(), sw_timer_init(), sw_timer_service(), and sw_timer_stop().
|
static |
|
static |
Referenced by hw_expiry_cb(), internal_timer_handler(), start_absolute_timer(), sw_timer_init(), and sw_timer_stop().
bool sys_sleep |
Referenced by hw_expiry_cb(), hw_overflow_cb(), and tmr_init().
volatile uint16_t sys_time |
This is the most significant part of the system time.
The least one is timer1 itself. Exported since input capture units might want to know about this value as well.
Referenced by gettime(), hw_overflow_cb(), prog_ocr(), and sw_timer_init().
timer_info_t timer_array[TOTAL_NUMBER_OF_SW_TIMERS] |
volatile bool timer_trigger |
Referenced by hw_expiry_cb(), internal_timer_handler(), load_hw_timer(), and sw_timer_init().