Implements the tickless OS

This commit is contained in:
Gregory Nutt
2014-08-07 11:39:16 -06:00
parent 317b66ca37
commit 520a51a3e1
16 changed files with 823 additions and 316 deletions
+34 -72
View File
@@ -948,13 +948,11 @@ int up_prioritize_irq(int irq, int priority);
*
* void up_timer_initialize(void): Initializes the timer facilities. Called
* early in the intialization sequence (by up_intialize()).
* int up_timer_gettime(FAR struct timespec *tp): Returns the current
* int up_timer_gettime(FAR struct timespec *ts): Returns the current
* time from the platform specific time source.
* int up_timer_cancel(void): Cancels the interval timer.
* int up_timer_start(FAR const struct timespec *tp): Start (or re-starts)
* int up_timer_start(FAR const struct timespec *ts): Start (or re-starts)
* the interval timer.
* int up_timer_resolution(FAR struct timespec *tp): Returns the
* resolution of the interval timer.
*
* The RTOS will provide the following interfaces for use by the platform-
* specific interval timer implementation:
@@ -998,17 +996,21 @@ void up_timer_initialize(void);
*
* Description:
* Return the elapsed time since power-up (or, more correctly, since
* up_timer_initialize() was called). This function is functionally equivalent
* to:
* up_timer_initialize() was called). This function is functionally
* equivalent to:
*
* int clock_gettime(clockid_t clockid, FAR struct timespec *tp);
* int clock_gettime(clockid_t clockid, FAR struct timespec *ts);
*
* when clockid is CLOCK_MONOTONIC.
*
* This function provides the basis for reporting the current time and
* also is used to eliminate error build-up from small erros in interval
* time calculations.
*
* Provided by platform-specific code and called from the RTOS base code.
*
* Input Parameters:
* tp - Provides the location in which to return the up-time.
* ts - Provides the location in which to return the up-time.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
@@ -1023,73 +1025,27 @@ void up_timer_initialize(void);
****************************************************************************/
#ifdef CONFIG_SCHED_TICKLESS
int up_timer_gettime(FAR struct timespec *tp);
int up_timer_gettime(FAR struct timespec *ts);
#endif
/****************************************************************************
* Name: up_timer_cancel
*
* Description:
* Cancel the interval timer. up_timer_expiration() will not be called.
* Cancel the interval timer and return the time remaining on the timer.
* These two steps need to be as nearly atomic as possible.
* up_timer_expiration() will not be called unless the timer is restarted
* with up_timer_start().
*
* If, as a race condition, the timer has already expired when this
* function is called, then that pending interrupt must be cleared so
* that up_timer_start() and the remaining time of zero should be
* returned.
*
* Provided by platform-specific code and called from the RTOS base code.
*
* Input Parameters:
* None
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure.
*
* Assumptions:
* May be called from interrupt level handling or from the normal tasking
* level. Interrupts may need to be disabled internally to assure
* non-reentrancy.
*
****************************************************************************/
#ifdef CONFIG_SCHED_TICKLESS
int up_timer_cancel(void);
#endif
/****************************************************************************
* Name: up_timer_start
*
* Description:
* Start the interval timer. up_timer_expiration() will be called at the
* completion of the timeout (unless up_timer_cancel is called to stop
* the timing.
*
* Provided by platform-specific code and called from the RTOS base code.
*
* Input Parameters:
* tp - Provides the time interval until up_timer_expiration() is called.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure.
*
* Assumptions:
* May be called from interrupt level handling or from the normal tasking
* level. Interrupts may need to be disabled internally to assure
* non-reentrancy.
*
****************************************************************************/
#ifdef CONFIG_SCHED_TICKLESS
int up_timer_start(FAR const struct timespec *tp);
#endif
/****************************************************************************
* Name: up_timer_remaining
*
* Description:
* Return the time remaining until the next timer expiratino.
*
* Provided by platform-specific code and called from the RTOS base code.
*
* Input Parameters:
* tp - Location to return the remaining time. Zero should be returned
* ts - Location to return the remaining time. Zero should be returned
* if the timer is not active.
*
* Returned Value:
@@ -1104,23 +1060,25 @@ int up_timer_start(FAR const struct timespec *tp);
****************************************************************************/
#ifdef CONFIG_SCHED_TICKLESS
int up_timer_remaining(FAR struct timespec *tp);
int up_timer_cancel(FAR struct timespec *ts);
#endif
/****************************************************************************
* Name: up_timer_resolution
* Name: up_timer_start
*
* Description:
* Returns the resolution of the interval timer. This defines the minimal
* time separation between two events and is used for scheduling and for
* setting up timed events.
* Start the interval timer. up_timer_expiration() will be called at the
* completion of the timeout (unless up_timer_cancel is called to stop
* the timing.
*
* Provided by platform-specific code and called from the RTOS base code.
*
* Input Parameters:
* tp - Provides the location in which to return the timer resolution.
* ts - Provides the time interval until up_timer_expiration() is called.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure.
*
* Assumptions:
* May be called from interrupt level handling or from the normal tasking
@@ -1130,7 +1088,7 @@ int up_timer_remaining(FAR struct timespec *tp);
****************************************************************************/
#ifdef CONFIG_SCHED_TICKLESS
int up_timer_resolution(FAR struct timespec *tp);
int up_timer_start(FAR const struct timespec *ts);
#endif
/****************************************************************************
@@ -1234,8 +1192,12 @@ void sched_process_timer(void);
* interval timer used to implemented the tick-less OS expires.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
* Assumptions/Limitations:
* Base code implementation assumes that this function is called from
* interrupt handling logic with interrupts disabled.
*