2 * /cygdrive/c/Sandbox/sdcc/sdcc/trunk/sdcc/bin/sdcc.exe -mr2k --nostdlib --nostdinc --fverbose-asm -I../include -c buggy_dequeue.c
7 typedef unsigned char u8
;
8 typedef unsigned short u16
;
10 #define TCB_STATE_RUN 0
13 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !defined(__SDCC_pic14) // Not enough RAM
23 } task_table
[NR_TASKS
];
27 u8 delaying_task_head
;
30 u16 delay_tick_cnts
[NR_TASKS
];
31 u8 delay_next
[NR_TASKS
];
34 void buggy_dequeue( void ) {
37 /* wake the task up */
38 task_table
[ delaying_task_head
].state
= TCB_STATE_RUN
;
40 next_head
= delay_next
[delaying_task_head
];
41 delay_next
[delaying_task_head
] = NULL_IDX
;
43 delaying_task_head
= next_head
;
49 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !defined(__SDCC_pic14) // Not enough RAM
50 delay_tick_cnts
[ 0] = 0x7FFF;
51 delay_tick_cnts
[ 7] = 0x0020;
52 delay_tick_cnts
[ 8] = 0x0290;
53 delay_tick_cnts
[10] = 0x1590;
57 delay_next
[ 8] = NULL_IDX
;
59 delaying_task_head
= 7;
63 ASSERT( delaying_task_head
== 10 );
64 ASSERT( delay_next
[ 7] == NULL_IDX
);
65 ASSERT( delay_next
[10] == 8 );
66 ASSERT( delay_next
[ 8] == NULL_IDX
);