2 * Copyright (C) 2013, The AROS Development Team
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
12 #include <exec/types.h>
14 /* Chinon O-658-2 24 CD Commands
15 * 'msf' is [minutes seconds frame]
16 * ^- These are in BCD --^
19 #define CHCD_RESET 0 /* Cmd = [ 0x00 ]
21 #define CHCD_STOP 1 /* Cmd = [ 0x01 0x00 ]
22 Result = [ 0x01 errcode ] */
23 #define CHCD_PAUSE 2 /* Cmd = [ 0x02 ]
24 Result = [ 0x02 errcode ] */
25 #define CHCD_UNPAUSE 3 /* Cmd = [ 0x03 ]
26 Result = [ 0x03 errcode ] */
27 #define CHCD_MULTI 4 /* Cmd = [ 0x04 start_msf end_msf subcmd flags ?? audio ?? ]
28 subcmd: 0x80 - Data read
30 flags: 0x40 - Speed (0 = x1, 0x40 = x2)
31 audio: 0x04 - Play audio
32 Result = [ 0x04 0x01 ] // No Disk
33 [ 0x04 0x02 ] // Read in progress
34 [ 0x04 0x08 ] // Audio playing
35 [ 0x04 0x80 ] // Error
36 [ 0x04 0x00 ] // IO complete
38 #define CHCD_LED 5 /* Cmd = [ 0x05 led ]
39 led: 0x80 - Result wanted
41 Result = [ 0x05 led ] (if led & 0x80)
43 #define CHCD_SUBQ 6 /* Cmd = [ 0x06 ]
44 Result = [ 0x06 0x00 0x00 CtlAdr Track Index TrackPos_u24 DiskPos_u32 CurrPos_msf ] */
45 #define CHCD_STATUS 7 /* Cmd = [ 0x07 ]
46 Result = [ 0x07 code FirmwareString[18] ]
47 code: 0x01 - Door closed, disk present
50 #define CHCD_CMD8 8 /* Cmd = [ 0x08 ?? ?? ?? ]
51 Result = [ 0x08 ?? ?? ?? ]
53 #define CHCD_CMD9 9 /* Cmd = [ 0x09 ]
54 Result = [ 0x09 ?? ?? ?? ]
56 /* Received when there is a media change */
57 #define CHCD_MEDIA 10 /* Result = [ 0x0a status ]
58 * status: 0x83 - Disk present
63 #define CHERR_DISKPRESENT 0x01
64 #define CHERR_READING 0x02
65 #define CHERR_PLAYING 0x08
66 #define CHERR_BADCOMMAND 0x80
67 #define CHERR_CHECKSUM 0x88
68 #define CHERR_DRAWERSTUCK 0x90
69 #define CHERR_DISKUNREADABLE 0x98
70 #define CHERR_INVALIDADDRESS 0xa0
71 #define CHERR_WRONGDATA 0xa8
72 #define CHERR_FOCUS 0xc8
73 #define CHERR_SPINDLE 0xd0
74 #define CHERR_TRACKING 0xd8
75 #define CHERR_SLED 0xe0
76 #define CHERR_TRACKJUMP 0xe8
77 #define CHERR_ABNORMALSEEK 0xf0
78 #define CHERR_NODISK 0xf8
81 BYTE minute
; /* In BCD (up to 99) */
82 BYTE second
; /* In BCD (up to 59) */
83 BYTE frame
; /* In BCD (up to 74) */
86 /* NOTE: There is a checksum following all commands,
87 * regardless of length. The checksum is the inverse
88 * of the sum of all the bytes of the command.
100 struct chcd_msf start
;
102 BYTE mode
; /* 0x80 for data read */
103 BYTE flags
; /* 0x40 for 150 frames/sec, 0x00 for 75 frames/sec */
105 BYTE audio
; /* 0x04 to play audio */
109 BYTE state
; /* 0x01 to turn on, 0x00 to turn off */
110 /* 0x80 to force a result code */
118 /* NOTE: There is a checksum following all results,
119 * regardless of length. The checksum is the inverse
120 * of the sum of all the bytes of the result.
137 struct chcd_msf track_position
;
139 struct chcd_msf disk_position
;
149 #endif /* CHINON_H */