Limit exposure of non-public microkernel timer APIs
Hides the existence of these APIs from everyone but the microkernel's timer subsystem itself. Change-Id: I49482a6e16fee28f1ed3e2244e47df401854c9fc Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
parent
067a47558f
commit
6ecfc66152
2 changed files with 37 additions and 36 deletions
|
@ -46,45 +46,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int K_ticker(int event);
|
extern int K_ticker(int event);
|
||||||
extern K_TIMER _k_timer_blocks[]; /* array of microkernel timer objects */
|
|
||||||
|
|
||||||
extern void scheduler_time_slice_set(int32_t t, kpriority_t p);
|
extern void scheduler_time_slice_set(int32_t t, kpriority_t p);
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
*
|
|
||||||
* _timer_id_to_ptr - convert timer pointer to timer object identifier
|
|
||||||
*
|
|
||||||
* This routine converts a timer pointer into a timer object identifier.
|
|
||||||
*
|
|
||||||
* This algorithm relies on the fact that subtracting two pointers that point
|
|
||||||
* to elements of an array returns the difference between the array subscripts
|
|
||||||
* of those elements. (That is, "&a[j]-&a[i]" returns "j-i".)
|
|
||||||
*
|
|
||||||
* This algorithm also set the upper 16 bits of the object identifier
|
|
||||||
* to the same value utilized by the microkernel system generator.
|
|
||||||
*
|
|
||||||
* RETURNS: timer object identifier
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline ktimer_t _timer_ptr_to_id(K_TIMER *timer)
|
|
||||||
{
|
|
||||||
return (ktimer_t)(0x00010000u + (uint32_t)(timer - &_k_timer_blocks[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
*
|
|
||||||
* _timer_id_to_ptr - convert timer object identifier to timer pointer
|
|
||||||
*
|
|
||||||
* This routine converts a timer object identifier into a timer pointer.
|
|
||||||
*
|
|
||||||
* RETURNS: timer pointer
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline K_TIMER *_timer_id_to_ptr(ktimer_t timer)
|
|
||||||
{
|
|
||||||
return &_k_timer_blocks[OBJ_INDEX(timer)];
|
|
||||||
}
|
|
||||||
|
|
||||||
extern uint32_t task_cycle_get_32(void);
|
extern uint32_t task_cycle_get_32(void);
|
||||||
extern int32_t task_tick_get_32(void);
|
extern int32_t task_tick_get_32(void);
|
||||||
extern int64_t task_tick_get(void);
|
extern int64_t task_tick_get(void);
|
||||||
|
|
|
@ -38,9 +38,46 @@
|
||||||
#include <minik.h>
|
#include <minik.h>
|
||||||
#include <drivers/system_timer.h>
|
#include <drivers/system_timer.h>
|
||||||
|
|
||||||
|
extern K_TIMER _k_timer_blocks[];
|
||||||
|
|
||||||
K_TIMER *_k_timer_list_head = NULL;
|
K_TIMER *_k_timer_list_head = NULL;
|
||||||
K_TIMER *_k_timer_list_tail = NULL;
|
K_TIMER *_k_timer_list_tail = NULL;
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* _timer_id_to_ptr - convert timer pointer to timer object identifier
|
||||||
|
*
|
||||||
|
* This routine converts a timer pointer into a timer object identifier.
|
||||||
|
*
|
||||||
|
* This algorithm relies on the fact that subtracting two pointers that point
|
||||||
|
* to elements of an array returns the difference between the array subscripts
|
||||||
|
* of those elements. (That is, "&a[j]-&a[i]" returns "j-i".)
|
||||||
|
*
|
||||||
|
* This algorithm also set the upper 16 bits of the object identifier
|
||||||
|
* to the same value utilized by the microkernel system generator.
|
||||||
|
*
|
||||||
|
* RETURNS: timer object identifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline ktimer_t _timer_ptr_to_id(K_TIMER *timer)
|
||||||
|
{
|
||||||
|
return (ktimer_t)(0x00010000u + (uint32_t)(timer - &_k_timer_blocks[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* _timer_id_to_ptr - convert timer object identifier to timer pointer
|
||||||
|
*
|
||||||
|
* This routine converts a timer object identifier into a timer pointer.
|
||||||
|
*
|
||||||
|
* RETURNS: timer pointer
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline K_TIMER *_timer_id_to_ptr(ktimer_t timer)
|
||||||
|
{
|
||||||
|
return &_k_timer_blocks[OBJ_INDEX(timer)];
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* enlist_timer - insert a timer into the timer queue
|
* enlist_timer - insert a timer into the timer queue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue