Mercurial > repos > blastem
annotate cdd_mcu.h @ 2166:3a6680e9204a
xcftools is no longer packaged by Debian/Ubuntu so switched to imagemagick
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 23 Jul 2022 10:54:07 -0700 |
parents | c3ee42c89b27 |
children | 9ead0fe69d9b |
rev | line source |
---|---|
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #ifndef CDD_MCU_H_ |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #define CDD_MCU_H_ |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 #include "system.h" |
2062
07ed42bd7b4c
Some progress on CDC and CDD emulation. Now passes first 3 "CDC INIT" tests in mcd-verificator
Michael Pavone <pavone@retrodev.com>
parents:
2061
diff
changeset
|
4 #include "lc8951.h" |
2080 | 5 #include "cdd_fader.h" |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 typedef enum { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 SF_ABSOLUTE, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 SF_RELATIVE, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 SF_TRACK, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 SF_TOCO, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 SF_TOCT, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 SF_TOCN, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 SF_E, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 SF_NOTREADY = 0xF |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 } status_format; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 typedef enum { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 CMD_NOP, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 CMD_STOP, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 CMD_REPORT_REQUEST, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 CMD_READ, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 CMD_SEEK, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 CMD_INVALID, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 CMD_PAUSE, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 CMD_PLAY, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 CMD_FFWD, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 CMD_RWD, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 CMD_TRACK_SKIP, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 CMD_TRACK_CUE, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 CMD_DOOR_CLOSE, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 CMD_DOOR_OPEN |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 } host_cmd; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 typedef enum { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 DS_STOP, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 DS_PLAY, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 DS_SEEK, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 DS_SCAN, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 DS_PAUSE, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 DS_DOOR_OPEN, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 DS_SUM_ERROR, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 DS_CMD_ERROR, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 DS_FUNC_ERROR, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 DS_TOC_READ, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 DS_TRACKING, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 DS_NO_DISC, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 DS_DISC_LEADOUT, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 DS_DISC_LEADIN, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 DS_TRAY_MOVING, |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 } drive_status; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 typedef struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 uint8_t status; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 uint8_t format; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 union { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 uint8_t min_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 uint8_t min_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 uint8_t sec_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 uint8_t sec_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 uint8_t frame_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 uint8_t frame_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 uint8_t flags; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 } time; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 uint8_t track_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 uint8_t track_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 uint8_t padding0; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 uint8_t padding1; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 uint8_t control; |
2065
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2064
diff
changeset
|
73 uint8_t adr; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 uint8_t flags; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
75 } track; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
76 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 uint8_t first_track_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 uint8_t first_track_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 uint8_t last_track_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
80 uint8_t last_track_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
81 uint8_t version; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
82 uint8_t padding; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
83 uint8_t flags; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 } toct; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 uint8_t min_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 uint8_t min_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
88 uint8_t sec_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
89 uint8_t sec_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
90 uint8_t frame_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
91 uint8_t frame_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
92 uint8_t track_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
93 } tocn; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
94 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
95 } error; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
96 } b; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
97 uint8_t checksum; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
98 } cdd_status; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
99 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
100 typedef struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
101 uint8_t cmd_type; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
102 uint8_t must_be_zero; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
103 union { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
104 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
105 uint8_t min_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
106 uint8_t min_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
107 uint8_t sec_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
108 uint8_t sec_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
109 uint8_t frame_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
110 uint8_t frame_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
111 } time; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
112 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
113 uint8_t padding; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
114 uint8_t status_type; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
115 uint8_t track_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
116 uint8_t track_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
117 } format; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
118 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
119 uint8_t padding; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
120 uint8_t direction; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
121 uint8_t tracks_highest; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
122 uint8_t tracks_midhigh; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
123 uint8_t tracks_midlow; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
124 uint8_t tracks_lowest; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
125 } skip; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
126 struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
127 uint8_t track_high; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
128 uint8_t track_low; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
129 } track; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
130 } b; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
131 uint8_t padding; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
132 uint8_t checksum; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
133 } cdd_cmd; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
134 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
135 typedef struct { |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
136 system_media *media; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
137 uint32_t cycle; //this is in CD block CLKS |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
138 uint32_t next_int_cycle; //this is in SCD MCLKS |
2116
cd057d6fe030
Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents:
2095
diff
changeset
|
139 uint32_t next_subcode_int_cycle; |
cd057d6fe030
Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents:
2095
diff
changeset
|
140 uint32_t last_sector_cycle; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
141 uint32_t last_nibble_cycle; |
2089
0db3af42dd72
Fix some byte order stuff for audio tracks
Michael Pavone <pavone@retrodev.com>
parents:
2080
diff
changeset
|
142 uint32_t next_byte_cycle; |
2116
cd057d6fe030
Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents:
2095
diff
changeset
|
143 uint32_t next_subcode_cycle; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
144 int current_status_nibble; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
145 int current_cmd_nibble; |
2062
07ed42bd7b4c
Some progress on CDC and CDD emulation. Now passes first 3 "CDC INIT" tests in mcd-verificator
Michael Pavone <pavone@retrodev.com>
parents:
2061
diff
changeset
|
146 int current_sector_byte; |
2116
cd057d6fe030
Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents:
2095
diff
changeset
|
147 int current_subcode_byte; |
cd057d6fe030
Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents:
2095
diff
changeset
|
148 int current_subcode_dest; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
149 uint32_t head_pba; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
150 uint32_t seek_pba; |
2095
c732dcc9c61b
Better simulation of CDD pause behavior
Michael Pavone <pavone@retrodev.com>
parents:
2089
diff
changeset
|
151 uint32_t pause_pba; |
2152
c3ee42c89b27
More accurate seek times and basic emulation of extended time between CDD interrupts during coarse seeking
Michael Pavone <pavone@retrodev.com>
parents:
2116
diff
changeset
|
152 uint32_t coarse_seek; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
153 cdd_status status_buffer; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
154 cdd_cmd cmd_buffer; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
155 status_format requested_format; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
156 drive_status status; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
157 drive_status error_status; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
158 uint8_t requested_track; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
159 uint8_t cmd_recv_wait; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
160 uint8_t cmd_recv_pending; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
161 uint8_t int_pending; |
2116
cd057d6fe030
Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents:
2095
diff
changeset
|
162 uint8_t subcode_int_pending; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
163 uint8_t toc_valid; |
2064
91e4d2fe5cd9
Get CDD working well enough to get into BIOS CD player
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
164 uint8_t first_cmd_received; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
165 uint8_t seeking; |
2062
07ed42bd7b4c
Some progress on CDC and CDD emulation. Now passes first 3 "CDC INIT" tests in mcd-verificator
Michael Pavone <pavone@retrodev.com>
parents:
2061
diff
changeset
|
166 uint8_t in_fake_pregap; |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
167 } cdd_mcu; |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
168 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
169 void cdd_mcu_init(cdd_mcu *context, system_media *media); |
2080 | 170 void cdd_mcu_run(cdd_mcu *context, uint32_t cycle, uint16_t *gate_array, lc8951 *cdc, cdd_fader *fader); |
2061
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
171 void cdd_hock_enabled(cdd_mcu *context); |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
172 void cdd_hock_disabled(cdd_mcu *context); |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
173 void cdd_mcu_start_cmd_recv(cdd_mcu *context, uint16_t *gate_array); |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
174 void cdd_mcu_adjust_cycle(cdd_mcu *context, uint32_t deduction); |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
175 |
7c1760b5b3e5
Implemented basic TOC functionality of CDD MCU
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
176 #endif //CD_MCU_H_ |