add tos_slist.h, rename tos.h to tos_k.h
This commit is contained in:
@@ -15,27 +15,25 @@
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <tos.h>
|
||||
#include "tos_k.h"
|
||||
|
||||
#if TOS_CFG_TIMER_EN > 0u
|
||||
|
||||
__STATIC__ void timer_place(k_timer_t *tmr)
|
||||
{
|
||||
TOS_CPU_CPSR_ALLOC();
|
||||
k_list_t *curr;
|
||||
k_timer_t *iter = K_NULL;
|
||||
|
||||
TOS_CPU_INT_DISABLE();
|
||||
|
||||
tmr->expires += k_tick_count;
|
||||
|
||||
TOS_LIST_FOR_EACH(curr, &k_timer_ctl.list) {
|
||||
iter = TOS_LIST_ENTRY(curr, k_timer_t, list);
|
||||
TOS_LIST_FOR_EACH_ENTRY(iter, k_timer_t, list, &k_timer_ctl.list) {
|
||||
if (tmr->expires < iter->expires) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
tos_list_add_tail(&tmr->list, curr);
|
||||
tos_list_add_tail(&tmr->list, &iter->list);
|
||||
|
||||
if (k_timer_ctl.list.next == &tmr->list) {
|
||||
// we are the first guy now
|
||||
@@ -281,8 +279,7 @@ __KERNEL__ k_tick_t timer_next_expires_get(void)
|
||||
|
||||
__KERNEL__ void timer_update(void)
|
||||
{
|
||||
k_timer_t *tmr;
|
||||
k_list_t *curr, *next;
|
||||
k_timer_t *tmr, *tmp;
|
||||
|
||||
if (k_timer_ctl.next_expires < k_tick_count) {
|
||||
return;
|
||||
@@ -290,8 +287,7 @@ __KERNEL__ void timer_update(void)
|
||||
|
||||
tos_knl_sched_lock();
|
||||
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &k_timer_ctl.list) {
|
||||
tmr = TOS_LIST_ENTRY(curr, k_timer_t, list);
|
||||
TOS_LIST_FOR_EACH_ENTRY_SAFE(tmr, tmp, k_timer_t, list, &k_timer_ctl.list) {
|
||||
if (tmr->expires > k_tick_count) {
|
||||
break;
|
||||
}
|
||||
@@ -316,8 +312,7 @@ __KERNEL__ void timer_update(void)
|
||||
|
||||
__STATIC__ void timer_task_entry(void *arg)
|
||||
{
|
||||
k_timer_t *tmr;
|
||||
k_list_t *curr, *next;
|
||||
k_timer_t *tmr, *tmp;
|
||||
k_tick_t next_expires;
|
||||
|
||||
arg = arg; // make compiler happy
|
||||
@@ -331,8 +326,7 @@ __STATIC__ void timer_task_entry(void *arg)
|
||||
|
||||
tos_knl_sched_lock();
|
||||
|
||||
TOS_LIST_FOR_EACH_SAFE(curr, next, &k_timer_ctl.list) {
|
||||
tmr = TOS_LIST_ENTRY(curr, k_timer_t, list);
|
||||
TOS_LIST_FOR_EACH_ENTRY_SAFE(tmr, tmp, k_timer_t, list, &k_timer_ctl.list) {
|
||||
if (tmr->expires > k_tick_count) { // not yet
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user