Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Test / examine_ahi / examine_ahi.c
blobb921238ed95265ea2bfb9156f6553ed08ba8b6fb
3 #include <stdio.h>
4 #include <exec/execbase.h>
5 #include <proto/exec.h>
7 #include "ahi_def.h"
8 //#include "ahi_device.h"
10 extern struct ExecBase *SysBase;
12 void printlist(struct MinList *);
14 int main(void)
16 struct AHIBase *AHIBase;
17 struct AHIDevUnit *iounit;
19 Disable();
20 AHIBase = (struct AHIBase *) FindName(& SysBase->DeviceList, AHINAME);
21 Enable();
23 printf("Base: 0x%08lx\n", AHIBase);
24 if(AHIBase == NULL)
25 return -1;
27 iounit = AHIBase->ahib_DevUnits[0];
28 printf("iounit 0: 0x%08lx\n", iounit);
29 if(iounit != NULL) {
31 if(iounit->IsPlaying)
32 printf("Is playing.\n");
34 if(iounit->IsRecording)
35 printf("Is recording.\n");
37 printf("ReadList\n");
38 printlist(&iounit->ReadList);
39 printf("PlayingList\n");
40 printlist(&iounit->PlayingList);
41 printf("SilentList\n");
42 printlist(&iounit->SilentList);
43 printf("WaitingList\n");
44 printlist(&iounit->WaitingList);
46 printf("S: %ld, R: %ld, R:%ld\n", iounit->SampleSignal,
47 iounit->RecordSignal, iounit->PlaySignal);
50 iounit = AHIBase->ahib_DevUnits[1];
51 printf("iounit 1: 0x%08lx\n", iounit);
52 if(iounit != NULL) {
54 if(iounit->IsPlaying)
55 printf("Is playing.\n");
57 if(iounit->IsRecording)
58 printf("Is recording.\n");
60 printf("ReadList\n");
61 printlist(&iounit->ReadList);
62 printf("PlayingList\n");
63 printlist(&iounit->PlayingList);
64 printf("SilentList\n");
65 printlist(&iounit->SilentList);
66 printf("WaitingList\n");
67 printlist(&iounit->WaitingList);
69 printf("S: %ld, R: %ld, R:%ld\n", iounit->SampleSignal,
70 iounit->RecordSignal, iounit->PlaySignal);
73 return 0;
76 const static char * commands[] =
78 "CMD_INVALID",
79 "CMD_RESET",
80 "CMD_READ",
81 "CMD_WRITE",
82 "CMD_UPDATE",
83 "CMD_CLEAR",
84 "CMD_STOP",
85 "CMD_START",
86 "CMD_FLUSH"
89 void printlist(struct MinList *list)
91 struct AHIRequest *ioreq;
93 ioreq = (struct AHIRequest *) list->mlh_Head;
94 while (ioreq->ahir_Std.io_Message.mn_Node.ln_Succ)
96 printf("iorequest: 0x%08lx\n", ioreq);
97 printf("command : %s (0x%lx)\n",
98 (ioreq->ahir_Std.io_Command < CMD_NONSTD ?
99 commands[ioreq->ahir_Std.io_Command] :
100 "Annan..."),
101 ioreq->ahir_Std.io_Command);
102 ioreq = (struct AHIRequest *) ioreq->ahir_Std.io_Message.mn_Node.ln_Succ;