Mercurial > repos > blastem
annotate lc8951.h @ 2195:40290a923886
Implement Game Gear start button and region register
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 21 Aug 2022 22:56:32 -0700 |
parents | 10e4439d8f13 |
children | 8e6fb2c06024 |
rev | line source |
---|---|
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #ifndef LC8951_H_ |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #define LC8951_H_ |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #include <stdint.h> |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 |
2065
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
6 typedef uint8_t (*lcd8951_byte_recv_fun)(void *data, uint8_t byte); |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
7 |
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 typedef struct { |
2065
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
9 lcd8951_byte_recv_fun byte_handler; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
10 void *handler_data; |
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:
2058
diff
changeset
|
11 uint32_t cycle; |
07ed42bd7b4c
Some progress on CDC and CDD emulation. Now passes first 3 "CDC INIT" tests in mcd-verificator
Michael Pavone <pavone@retrodev.com>
parents:
2058
diff
changeset
|
12 uint32_t clock_step; |
2144
10e4439d8f13
Fix speed of CDC to PCM RAM DMA
Michael Pavone <pavone@retrodev.com>
parents:
2130
diff
changeset
|
13 uint32_t cycles_per_byte; |
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:
2058
diff
changeset
|
14 uint32_t decode_end; |
07ed42bd7b4c
Some progress on CDC and CDD emulation. Now passes first 3 "CDC INIT" tests in mcd-verificator
Michael Pavone <pavone@retrodev.com>
parents:
2058
diff
changeset
|
15 uint32_t transfer_end; |
2144
10e4439d8f13
Fix speed of CDC to PCM RAM DMA
Michael Pavone <pavone@retrodev.com>
parents:
2130
diff
changeset
|
16 uint32_t next_byte_cycle; |
2130
28b6453cf7e3
Emulate CDC sync detection and sync insertion rather than relying on external knowledge about sector offset
Michael Pavone <pavone@retrodev.com>
parents:
2067
diff
changeset
|
17 uint16_t sector_counter; |
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 |
2065
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
19 uint8_t buffer[0x4000]; |
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 |
2065
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
21 uint8_t regs[16]; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
22 uint8_t comin[8]; |
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 uint16_t dac; |
2065
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
25 uint8_t comin_write; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
26 uint8_t comin_count; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
27 uint8_t ifctrl; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
28 uint8_t ctrl0; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
29 uint8_t ctrl1; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
30 uint8_t ar; |
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
31 uint8_t ar_mask; |
2130
28b6453cf7e3
Emulate CDC sync detection and sync insertion rather than relying on external knowledge about sector offset
Michael Pavone <pavone@retrodev.com>
parents:
2067
diff
changeset
|
32 uint8_t sync_counter; |
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 } lc8951; |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 |
2065
02a9846668d1
Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
Michael Pavone <pavone@retrodev.com>
parents:
2062
diff
changeset
|
35 void lc8951_init(lc8951 *context, lcd8951_byte_recv_fun byte_handler, void *handler_data); |
2144
10e4439d8f13
Fix speed of CDC to PCM RAM DMA
Michael Pavone <pavone@retrodev.com>
parents:
2130
diff
changeset
|
36 void lc8951_set_dma_multiple(lc8951 *context, uint32_t multiple); |
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:
2058
diff
changeset
|
37 void lc8951_run(lc8951 *context, uint32_t cycle); |
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 void lc8951_reg_write(lc8951 *context, uint8_t value); |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 uint8_t lc8951_reg_read(lc8951 *context); |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 void lc8951_ar_write(lc8951 *context, uint8_t value); |
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:
2058
diff
changeset
|
41 void lc8951_write_byte(lc8951 *context, uint32_t cycle, int sector_offset, uint8_t byte); |
07ed42bd7b4c
Some progress on CDC and CDD emulation. Now passes first 3 "CDC INIT" tests in mcd-verificator
Michael Pavone <pavone@retrodev.com>
parents:
2058
diff
changeset
|
42 uint32_t lc8951_next_interrupt(lc8951 *context); |
2066
a61a8a87410c
Fix a bunch of CDC/CDD related mcd-verificator failures
Michael Pavone <pavone@retrodev.com>
parents:
2065
diff
changeset
|
43 void lc8951_resume_transfer(lc8951 *context, uint32_t cycle); |
a61a8a87410c
Fix a bunch of CDC/CDD related mcd-verificator failures
Michael Pavone <pavone@retrodev.com>
parents:
2065
diff
changeset
|
44 void lc8951_adjust_cycles(lc8951 *context, uint32_t deduction); |
2058
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 |
70260f6051dd
Initial work on CDC emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 #endif //LC8951_H_ |