?? unlinkc2.c
字號:
/*
* timer/unlink_c2.c
*
* Copyright (C) SGS-THOMSON Microelectronics Ltd. 1998
*
* Unlink a task from a timer.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "task.h"
#include "os20i.h"
void timer_unlink(tdesc_t* tdesc)
{
descriptor_t wptr, front, pred;
/* We don't want to have to merge two queues, so prevent any
* other tasks running while we look at the queue.
*/
task_lock();
__asm {
ldab 1, 0x80000000;
swaptimer;
dup;
st front;
}
for ( wptr = front;
wptr != (descriptor_t)QUEUE_EMPTY;
wptr = (descriptor_t)wptr[PW_TLINK])
{
if ((tdesc_t*)wptr[PW_TDESC] == tdesc) {
/* Found it */
if (wptr == front) {
front = (descriptor_t)wptr[PW_TLINK];
} else {
pred[PW_TLINK] = wptr[PW_TLINK];
}
break; /* Can only be on a timer once */
}
pred = wptr;
}
__asm {
ldab 1, front;
swaptimer;
}
task_unlock();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -