2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
6 #include <proto/exec.h>
7 #include <exec/resident.h>
8 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <clib/exec_protos.h>
13 #include "dummydev_gcc.h"
15 extern const struct Resident resident
;
19 int r1
=0,r2
=0,r3
=0,e1
=0,e2
=0,e31
=0,e32
=0;
20 struct dummybase
*dummy
;
22 if(!(resident
.rt_Flags
&RTF_AUTOINIT
))
24 dummy
=(struct dummybase
*)MakeLibrary(((APTR
*)resident
.rt_Init
)[1],
25 ((APTR
*)resident
.rt_Init
)[2],
26 ((APTR
*)resident
.rt_Init
)[3],
27 (IPTR
)((APTR
*)resident
.rt_Init
)[0],1);
31 if(FindName(&SysBase
->DeviceList
,(STRPTR
)&dummy
->device
.dd_Library
.lib_Node
.ln_Name
)==NULL
)
33 AddDevice(&dummy
->device
);
36 struct dummyrequest
*dr
;
41 dr
=(struct dummyrequest
*)CreateIORequest(port
,sizeof(struct dummyrequest
));
44 if(!OpenDevice("dummy.device",0,(struct IORequest
*)dr
,0))
46 dr
->iorequest
.io_Command
=0x1;
47 DoIO((struct IORequest
*)dr
);
49 e1
=dr
->iorequest
.io_Error
;
50 dr
->iorequest
.io_Command
=0x1;
51 SendIO((struct IORequest
*)dr
);
52 WaitIO((struct IORequest
*)dr
);
54 e2
=dr
->iorequest
.io_Error
;
55 dr
->iorequest
.io_Command
=0x1;
56 SendIO((struct IORequest
*)dr
);
57 e31
=AbortIO((struct IORequest
*)dr
);
58 WaitIO((struct IORequest
*)dr
);
60 e32
=dr
->iorequest
.io_Error
;
62 CloseDevice((struct IORequest
*)dr
);
64 DeleteIORequest((struct IORequest
*)dr
);
69 /* Don't use RemLibrary() - it calls UnLoadSeg(). */
70 Remove(&dummy
->device
.dd_Library
.lib_Node
);
73 FreeMem((char *)dummy
-dummy
->device
.dd_Library
.lib_NegSize
,
74 dummy
->device
.dd_Library
.lib_NegSize
+dummy
->device
.dd_Library
.lib_PosSize
);
76 printf("Synchronous:\t%d (%d)\n",r1
,e1
);
77 printf("Asynchronous:\t%d (%d)\n",r2
,e2
);
78 printf("Aborted:\t%d (%d,%d)\n",r3
,e31
,e32
);