mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-05-03 19:33:10 +08:00
加快中断处理(1)
This commit is contained in:
@@ -49,7 +49,7 @@ void timer_init(struct TIMER *timer, struct FIFO8 *fifo, unsigned char data)
|
|||||||
|
|
||||||
void timer_settime(struct TIMER *timer, unsigned int timeout)
|
void timer_settime(struct TIMER *timer, unsigned int timeout)
|
||||||
{
|
{
|
||||||
timer->timeout = timeout;
|
timer->timeout = timeout + timerctl.count;
|
||||||
timer->flags = TIMER_FLAGS_USING;
|
timer->flags = TIMER_FLAGS_USING;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -61,8 +61,7 @@ void inthandler20(int *esp)
|
|||||||
timerctl.count++;
|
timerctl.count++;
|
||||||
for (i = 0; i < MAX_TIMER; i++) {
|
for (i = 0; i < MAX_TIMER; i++) {
|
||||||
if (timerctl.timer[i].flags == TIMER_FLAGS_USING) {
|
if (timerctl.timer[i].flags == TIMER_FLAGS_USING) {
|
||||||
timerctl.timer[i].timeout--;
|
if (timerctl.timer[i].timeout <= timerctl.count) {
|
||||||
if (timerctl.timer[i].timeout == 0) {
|
|
||||||
timerctl.timer[i].flags = TIMER_FLAGS_ALLOC;
|
timerctl.timer[i].flags = TIMER_FLAGS_ALLOC;
|
||||||
fifo8_put(timerctl.timer[i].fifo, timerctl.timer[i].data);
|
fifo8_put(timerctl.timer[i].fifo, timerctl.timer[i].data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user