mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-06 03:23:21 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de40053c3d |
@@ -278,5 +278,24 @@ void make_textbox8(struct SHEET *sht, int x0, int y0, int sx, int sy, int c)
|
||||
|
||||
void task_b_main(void)
|
||||
{
|
||||
for (;;) { io_hlt(); }
|
||||
struct FIFO32 fifo;
|
||||
struct TIMER *timer;
|
||||
int i, fifobuf[128];
|
||||
fifo32_init(&fifo, 128, fifobuf);
|
||||
timer = timer_alloc();
|
||||
timer_init(timer, &fifo, 1);
|
||||
timer_settime(timer, 500);
|
||||
|
||||
for (;;) {
|
||||
io_cli();
|
||||
if (fifo32_status(&fifo) == 0) {
|
||||
io_stihlt();
|
||||
} else {
|
||||
i = fifo32_get(&fifo);
|
||||
io_sti();
|
||||
if (i == 1) { /*超时时间为5秒 */
|
||||
taskswitch3(); /*返回任务A */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ void asm_inthandler21(void);
|
||||
void asm_inthandler27(void);
|
||||
void asm_inthandler2c(void);
|
||||
unsigned int memtest_sub(unsigned int start, unsigned int end);
|
||||
void taskswitch3(void);
|
||||
void taskswitch4(void);
|
||||
|
||||
/* fifo.c */
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
GLOBAL _asm_inthandler20, _asm_inthandler21
|
||||
GLOBAL _asm_inthandler27, _asm_inthandler2c
|
||||
GLOBAL _memtest_sub
|
||||
GLOBAL _taskswitch4
|
||||
GLOBAL _taskswitch3, _taskswitch4
|
||||
EXTERN _inthandler20, _inthandler21
|
||||
EXTERN _inthandler27, _inthandler2c
|
||||
|
||||
@@ -207,6 +207,10 @@ mts_fin:
|
||||
POP EDI
|
||||
RET
|
||||
|
||||
_taskswitch3: ; void taskswitch3(void);
|
||||
JMP 3*8:0
|
||||
RET
|
||||
|
||||
_taskswitch4: ; void taskswitch4(void);
|
||||
JMP 4*8:0
|
||||
RET
|
||||
|
||||
Reference in New Issue
Block a user