mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-13 14:48:33 -04:00
Add faster version code.
This commit is contained in:
parent
f7a168e184
commit
31606543da
7 changed files with 2060 additions and 1685 deletions
|
@ -44,11 +44,11 @@
|
|||
*
|
||||
* $Id: timer.c,v 1.2 2006/06/12 08:00:30 adam Exp $
|
||||
*/
|
||||
|
||||
#include "clock.h"
|
||||
#include "uip_timer.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Set a timer.
|
||||
*
|
||||
|
@ -60,13 +60,14 @@
|
|||
* \param interval The interval before the timer expires.
|
||||
*
|
||||
*/
|
||||
void
|
||||
timer_set(struct timer *t, clock_time_t interval)
|
||||
void timer_set( struct timer *t, clock_time_t interval )
|
||||
{
|
||||
t->interval = interval;
|
||||
t->start = clock_time();
|
||||
t->interval = interval;
|
||||
t->start = clock_time();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Reset the timer with the same interval.
|
||||
*
|
||||
|
@ -80,12 +81,13 @@ timer_set(struct timer *t, clock_time_t interval)
|
|||
*
|
||||
* \sa timer_restart()
|
||||
*/
|
||||
void
|
||||
timer_reset(struct timer *t)
|
||||
void timer_reset( struct timer *t )
|
||||
{
|
||||
t->start += t->interval;
|
||||
t->start += t->interval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Restart the timer from the current point in time
|
||||
*
|
||||
|
@ -100,12 +102,13 @@ timer_reset(struct timer *t)
|
|||
*
|
||||
* \sa timer_reset()
|
||||
*/
|
||||
void
|
||||
timer_restart(struct timer *t)
|
||||
void timer_restart( struct timer *t )
|
||||
{
|
||||
t->start = clock_time();
|
||||
t->start = clock_time();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Check if a timer has expired.
|
||||
*
|
||||
|
@ -117,11 +120,11 @@ timer_restart(struct timer *t)
|
|||
* \return Non-zero if the timer has expired, zero otherwise.
|
||||
*
|
||||
*/
|
||||
int
|
||||
timer_expired(struct timer *t)
|
||||
int timer_expired( struct timer *t )
|
||||
{
|
||||
return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval;
|
||||
return( clock_time_t ) ( clock_time() - t->start ) >= ( clock_time_t ) t->interval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue