revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-amiga / devs / cd / chinon.h
blob781b59008b521c0f9fed9f05ac591811f4d32a7d
1 /*
2 * Copyright (C) 2013, The AROS Development Team
3 * All right reserved.
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
7 */
9 #ifndef CHINON_H
10 #define CHINON_H
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 ]
20 Result = [ 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
29 0x03 - TOC 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
40 0x01 - LED on/off
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
48 0x80 - Door open
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
59 * 0x80 - Disk absent
62 #define CHERR_OK 0x00
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
80 struct chcd_msf {
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.
90 struct chcd_cmd {
91 BYTE cmd;
92 union {
93 struct {} noop;
94 struct {
95 BYTE resv;
96 } stop;
97 struct {} pause;
98 struct {} unpause;
99 struct {
100 struct chcd_msf start;
101 struct chcd_msf end;
102 BYTE mode; /* 0x80 for data read */
103 BYTE flags; /* 0x40 for 150 frames/sec, 0x00 for 75 frames/sec */
104 BYTE resv_1;
105 BYTE audio; /* 0x04 to play audio */
106 BYTE resv_2;
107 } multi;
108 struct {
109 BYTE state; /* 0x01 to turn on, 0x00 to turn off */
110 /* 0x80 to force a result code */
111 } led;
112 struct { } subq;
113 struct { } status;
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.
122 struct chcd_result {
123 BYTE cmd;
124 BYTE error;
125 union {
126 struct {} noop;
127 struct {} stop;
128 struct {} pause;
129 struct {} unpause;
130 struct {} multi;
131 struct {} led;
132 struct {
133 BYTE resv;
134 BYTE ctladr;
135 BYTE track;
136 BYTE index;
137 struct chcd_msf track_position;
138 BYTE resv_2;
139 struct chcd_msf disk_position;
140 BYTE resv_3;
141 BYTE resv_4;
142 } subq;
143 struct {
144 BYTE firmware[18];
145 } status;
149 #endif /* CHINON_H */