1 #include <proto/exec.h>
2 #include <aros/debug.h>
3 #include <aros/macros.h>
4 #include <devices/scsidisk.h>
7 BOOL
openIO(struct DeviceIO
*dio
, STRPTR device
, ULONG unit
) {
9 dio
->mp
= CreateMsgPort();
12 dio
->iotd
= (struct IOExtTD
*)CreateIORequest(dio
->mp
, sizeof(struct IOExtTD
));
15 if (OpenDevice(device
, unit
, (struct IORequest
*)dio
->iotd
, 0)==0)
17 DeleteIORequest((struct IORequest
*)dio
->iotd
);
19 DeleteMsgPort(dio
->mp
);
24 void closeIO(struct DeviceIO
*dio
) {
25 CloseDevice((struct IORequest
*)dio
->iotd
);
26 DeleteIORequest((struct IORequest
*)dio
->iotd
);
27 DeleteMsgPort(dio
->mp
);
30 BOOL
iscorrectType(struct IOExtTD
*iotd
) {
32 struct DriveGeometry dg
;
34 iotd
->iotd_Req
.io_Command
= TD_GETGEOMETRY
;
35 iotd
->iotd_Req
.io_Data
= &dg
;
36 iotd
->iotd_Req
.io_Length
= sizeof(struct DriveGeometry
);
38 if (DoIO((struct IORequest
*)iotd
) == 0)
40 if (dg
.dg_DeviceType
== DG_CDROM
)
42 // if (dg.dg_Flags & DGF_REMOVABLE)
49 void w2strcpy(STRPTR name
, UWORD
*wstr
, ULONG len
) {
53 *((UWORD
*)name
) = AROS_BE2WORD(*wstr
);
54 name
+= sizeof(UWORD
);
59 while ((*name
==0) || (*name
==' '))
63 BOOL
identify(struct IOExtTD
*iotd
, STRPTR id
) {
64 struct SCSICmd scsicmd
;
66 UBYTE cmd
=0xEC; /* identify */
68 scsicmd
.scsi_Data
= data
;
69 scsicmd
.scsi_Length
= 512;
70 scsicmd
.scsi_Command
= &cmd
;
71 scsicmd
.scsi_CmdLength
= 1;
72 iotd
->iotd_Req
.io_Command
= HD_SCSICMD
;
73 iotd
->iotd_Req
.io_Data
= &scsicmd
;
74 iotd
->iotd_Req
.io_Length
= sizeof(struct SCSICmd
);
75 if (DoIO((struct IORequest
*)iotd
))
77 w2strcpy(id
, &data
[27], 40);