home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d169
/
src
/
suplib
/
aux
/
qint_test.c
Wrap
C/C++ Source or Header
|
1988-11-22
|
2KB
|
76 lines
/*
* QINT TEST ROUTINE
*
* 1> test
* Ctl D -quit
* Ctl E -cause test interrupt #1
* Ctl F -cause test interrupt #0
*
* (see printf's to understand what it is printing)
*
* Basic idea: Cycle through various priorities. The Q interrupts
* are both set for priority 16, and thus only work when the counter
* is 0...15
*
* If you set one of the Q interrupts to, say, 17, you would then
* have to worry about the level 17 Q interrupt interrupting the
* level 16 interrupt, and thus surround the level 16 interrupt
* with:
* char oldpri = SetQPri(127);
* puts("blah");
* SetQPri(oldpri);
*
* As it is, with both at level 16, they cannot interrupt each other
* (if one occurs while the other is running, it is queued till the
* other one finishes).
*/
#include <exec/types.h>
#include <exec/tasks.h>
typedef struct Task TASK;
extern TASK *FindTask();
int X;
int Enable_Abort;
void
myhan(sig)
{
++X;
printf("test# %ld\n", sig);
}
main()
{
short i;
int j;
Enable_Abort = 0;
printf("tcexcept: %08lx\n", FindTask(NULL)->tc_ExceptCode);
SetQVector(SIGBREAKB_CTRL_F, myhan, 0, 16);
SetQVector(SIGBREAKB_CTRL_E, myhan, 1, 16);
printf("tcexcept: %08lx\n", FindTask(NULL)->tc_ExceptCode);
printf("tcexmask: %08lx\n", FindTask(NULL)->tc_SigExcept);
for (i = 0; ; ++i) {
i &= 31;
SetQPri(127);
printf("i = %2ld rcvd: %08lx excp: %08lx cnt: %6ld\n", i,
FindTask(NULL)->tc_SigRecvd, FindTask(NULL)->tc_SigExcept,
X
);
SetQPri(i);
for (j = 0; j < 100; ++j);
if (SetSignal(0,SIGBREAKF_CTRL_D) & SIGBREAKF_CTRL_D)
break;
}
SetQVector(SIGBREAKB_CTRL_E, NULL, 0, 0);
SetQVector(SIGBREAKB_CTRL_F, NULL, 0, 0);
puts("exiting");
printf("tcexcept: %08lx\n", FindTask(NULL)->tc_ExceptCode);
}