mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-03 13:39:53 +00:00
Merge "timer: Add timestamp_expired() to check for expiry"
This commit is contained in:
@@ -37,6 +37,12 @@ static void expire_timer(task_id_t tskid)
|
||||
task_set_event(tskid, TASK_EVENT_TIMER, 0);
|
||||
}
|
||||
|
||||
int timestamp_expired(timestamp_t deadline)
|
||||
{
|
||||
timestamp_t now = get_time();
|
||||
|
||||
return ((int64_t)(now.val - deadline.val) >= 0);
|
||||
}
|
||||
|
||||
void process_timers(int overflow)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,14 @@ int timer_arm(timestamp_t tstamp, task_id_t tskid);
|
||||
/* Cancel a running timer for the specified task id. */
|
||||
int timer_cancel(task_id_t tskid);
|
||||
|
||||
/**
|
||||
* Check if a timestamp has passed / expired
|
||||
*
|
||||
* @param deadline deadline timer value to check
|
||||
* @return 0 if deadline has not yet passed, 1 if it has passed
|
||||
*/
|
||||
int timestamp_expired(timestamp_t deadline);
|
||||
|
||||
/* Busy-wait the selected number of microseconds. Note that calling this
|
||||
* with us>1000 may impact system performance; use usleep for longer delays. */
|
||||
void udelay(unsigned us);
|
||||
|
||||
Reference in New Issue
Block a user