Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / diskimage / include / scsicmd.h
blob5575d997cd3800ab463544b720c601f7877fd93a
1 /* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved.
2 **
3 ** Redistribution and use in source and binary forms, with or without
4 ** modification, are permitted provided that the following conditions
5 ** are met:
6 **
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer.
9 **
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
14 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
15 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 ** POSSIBILITY OF SUCH DAMAGE.
27 #ifndef SCSICMD_H
28 #define SCSICMD_H
30 #ifndef DEVICES_SCSIDISK_H
31 #include <devices/scsidisk.h>
32 #endif
34 /* command codes */
35 #define SCSICMD_TEST_UNIT_READY 0x00
36 #define SCSICMD_INQUIRY 0x12
37 #define SCSICMD_READ_CAPACITY 0x25
38 #define SCSICMD_READ_TOC 0x43
39 #define SCSICMD_READ_CD 0xbe
40 #define SCSICMD_READ_CD_MSF 0xb9
42 /* status codes */
43 #define SCSI_Good 0x00
44 #define SCSI_CheckCondition 0x02
45 #define SCSI_ConditionMet 0x04
46 #define SCSI_Busy 0x08
47 #define SCSI_Intermediate 0x10
48 #define SCSI_Intermediate_ConditionMet 0x14
49 #define SCSI_ReservationConflict 0x18
50 #define SCSI_CommandTerminated 0x22
51 #define SCSI_TaskSetFull 0x28
52 #define SCSI_ACAActive 0x30
54 /* sense key codes */
55 #define SENSEKEY_NoSense 0x0
56 #define SENSEKEY_RecoveredError 0x1
57 #define SENSEKEY_NotReady 0x2
58 #define SENSEKEY_MediumError 0x3
59 #define SENSEKEY_HardwareError 0x4
60 #define SENSEKEY_IllegalRequest 0x5
61 #define SENSEKEY_UnitAttention 0x6
62 #define SENSEKEY_DataProtect 0x7
63 #define SENSEKEY_BlankCheck 0x8
64 #define SENSEKEY_VendorSpecific 0x9
65 #define SENSEKEY_CopyAborted 0xA
66 #define SENSEKEY_AbortedCommand 0xB
67 #define SENSEKEY_VolumeOverflow 0xD
68 #define SENSEKEY_Miscompare 0xE
70 #define SAMPLESPERFRAME (2352UL / 4UL)
72 #define ADDR2MSF(x,m,s,f) do { \
73 m = ((x) / 75UL) / 60UL; \
74 s = ((x) / 75UL) % 60UL; \
75 f = (x) % 75UL; \
76 } while (0)
77 #define MSF2ADDR(m,s,f) \
78 (((ULONG)(m) * (75UL*60UL)) + \
79 ((ULONG)(s) * 75UL) + \
80 (ULONG)(f))
82 #define ADDR2HMSF(x,h,m,s,f) do { \
83 h = (((x) / 75UL) / 60UL) / 60UL; \
84 m = (((x) / 75UL) / 60UL) % 60UL; \
85 s = ((x) / 75UL) % 60UL; \
86 f = (x) % 75UL; \
87 } while (0)
88 #define HMSF2ADDR(h,m,s,f) \
89 (((ULONG)(h) * (75UL*60UL*60UL)) + \
90 ((ULONG)(m) * (75UL*60UL)) + \
91 ((ULONG)(s) * 75UL) + \
92 (ULONG)(f))
94 #define MS2FRAMES(ms) (((ULONG)(ms) * 75UL) / 1000UL)
95 #define FRAMES2MS(fr) (((ULONG)(ms) * 1000UL) / 75UL)
96 #define MS2MSF(ms) do { \
97 minute = ((ULONG)(ms) / 1000UL) / 60UL; \
98 second = ((ULONG)(ms) / 1000UL) % 60UL; \
99 frame = MS2FRAMES((ULONG)(ms) % 1000UL); \
100 } while (0)
101 #define MSF2MS(m,s,f) (((ULONG)(m) * (60UL * 1000UL)) \
102 ((ULONG)(s) * 1000UL) + FRAMES2MS(f))
104 #endif