1 /* 存放中断的队列 */
2 typedef struct tagIntQueue
3 {
4 int intType; /* 中断类型 */
5 struct tagIntQueue *next;
6 }IntQueue;
7
8 IntQueue lpIntQueueHead;
9
10 __interrupt ISRexample ()
11 {
12 int intType;
13 intType = GetSystemType();
14 QueueAddTail(lpIntQueueHead, intType);/* 在队列尾加入新的中断 */
15 }
1 While(1)
2 {
3 If( !IsIntQueueEmpty() )
4 {
5 intType = GetFirstInt();
6 switch(intType) /* 是不是很象WIN32 程序的消息解析函数? */
7 {
8 /* 对,我们的中断类型解析很类似于消息驱动 */
9 case xxx: /* 我们称其为"中断驱动"吧? */
10 …
11 break;
12 case xxx:
13 …
14 break;
15 …
16 }
17 }
18 }