comparison cdd_mcu.h @ 2062:07ed42bd7b4c segacd

Some progress on CDC and CDD emulation. Now passes first 3 "CDC INIT" tests in mcd-verificator
author Michael Pavone <pavone@retrodev.com>
date Fri, 28 Jan 2022 00:50:17 -0800
parents 7c1760b5b3e5
children 91e4d2fe5cd9
comparison
equal deleted inserted replaced
2061:7c1760b5b3e5 2062:07ed42bd7b4c
1 #ifndef CDD_MCU_H_ 1 #ifndef CDD_MCU_H_
2 #define CDD_MCU_H_ 2 #define CDD_MCU_H_
3 #include "system.h" 3 #include "system.h"
4 4 #include "lc8951.h"
5 5
6 typedef enum { 6 typedef enum {
7 SF_ABSOLUTE, 7 SF_ABSOLUTE,
8 SF_RELATIVE, 8 SF_RELATIVE,
9 SF_TRACK, 9 SF_TRACK,
135 system_media *media; 135 system_media *media;
136 uint32_t cycle; //this is in CD block CLKS 136 uint32_t cycle; //this is in CD block CLKS
137 uint32_t next_int_cycle; //this is in SCD MCLKS 137 uint32_t next_int_cycle; //this is in SCD MCLKS
138 uint32_t last_subcode_cycle; 138 uint32_t last_subcode_cycle;
139 uint32_t last_nibble_cycle; 139 uint32_t last_nibble_cycle;
140 uint32_t last_byte_cycle;
140 int current_status_nibble; 141 int current_status_nibble;
141 int current_cmd_nibble; 142 int current_cmd_nibble;
143 int current_sector_byte;
142 uint32_t head_pba; 144 uint32_t head_pba;
143 uint32_t seek_pba; 145 uint32_t seek_pba;
144 cdd_status status_buffer; 146 cdd_status status_buffer;
145 cdd_cmd cmd_buffer; 147 cdd_cmd cmd_buffer;
146 status_format requested_format; 148 status_format requested_format;
150 uint8_t cmd_recv_wait; 152 uint8_t cmd_recv_wait;
151 uint8_t cmd_recv_pending; 153 uint8_t cmd_recv_pending;
152 uint8_t int_pending; 154 uint8_t int_pending;
153 uint8_t toc_valid; 155 uint8_t toc_valid;
154 uint8_t seeking; 156 uint8_t seeking;
157 uint8_t in_fake_pregap;
155 } cdd_mcu; 158 } cdd_mcu;
156 159
157 void cdd_mcu_init(cdd_mcu *context, system_media *media); 160 void cdd_mcu_init(cdd_mcu *context, system_media *media);
158 void cdd_mcu_run(cdd_mcu *context, uint32_t cycle, uint16_t *gate_array); 161 void cdd_mcu_run(cdd_mcu *context, uint32_t cycle, uint16_t *gate_array, lc8951* cdc);
159 void cdd_hock_enabled(cdd_mcu *context); 162 void cdd_hock_enabled(cdd_mcu *context);
160 void cdd_hock_disabled(cdd_mcu *context); 163 void cdd_hock_disabled(cdd_mcu *context);
161 void cdd_mcu_start_cmd_recv(cdd_mcu *context, uint16_t *gate_array); 164 void cdd_mcu_start_cmd_recv(cdd_mcu *context, uint16_t *gate_array);
162 void cdd_mcu_adjust_cycle(cdd_mcu *context, uint32_t deduction); 165 void cdd_mcu_adjust_cycle(cdd_mcu *context, uint32_t deduction);
163 166