comparison lc8951.h @ 2065:02a9846668d1 segacd

Implement transfer of data from CDC to elsewhere. Other miscellaneous CDD/CDC improvements
author Michael Pavone <pavone@retrodev.com>
date Sat, 29 Jan 2022 17:43:37 -0800
parents 07ed42bd7b4c
children a61a8a87410c
comparison
equal deleted inserted replaced
2064:91e4d2fe5cd9 2065:02a9846668d1
1 #ifndef LC8951_H_ 1 #ifndef LC8951_H_
2 #define LC8951_H_ 2 #define LC8951_H_
3 3
4 #include <stdint.h> 4 #include <stdint.h>
5 5
6 typedef uint8_t (*lcd8951_byte_recv_fun)(void *data, uint8_t byte);
7
6 typedef struct { 8 typedef struct {
9 lcd8951_byte_recv_fun byte_handler;
10 void *handler_data;
7 uint32_t cycle; 11 uint32_t cycle;
8 uint32_t clock_step; 12 uint32_t clock_step;
9 uint32_t decode_end; 13 uint32_t decode_end;
10 uint32_t transfer_end; 14 uint32_t transfer_end;
11 15
12 uint8_t buffer[0x4000]; 16 uint8_t buffer[0x4000];
13 17
14 uint8_t regs[16]; 18 uint8_t regs[16];
15 uint8_t comin[8]; 19 uint8_t comin[8];
16 20
17 uint16_t dac; 21 uint16_t dac;
18 uint8_t comin_write; 22 uint8_t comin_write;
19 uint8_t comin_count; 23 uint8_t comin_count;
20 uint8_t ifctrl; 24 uint8_t ifctrl;
21 uint8_t ctrl0; 25 uint8_t ctrl0;
22 uint8_t ctrl1; 26 uint8_t ctrl1;
23 uint8_t ar; 27 uint8_t ar;
24 uint8_t ar_mask; 28 uint8_t ar_mask;
25 uint8_t decoding; 29 uint8_t decoding;
26 uint16_t ptl_internal; 30 uint16_t ptl_internal;
27 } lc8951; 31 } lc8951;
28 32
29 void lc8951_init(lc8951 *context); 33 void lc8951_init(lc8951 *context, lcd8951_byte_recv_fun byte_handler, void *handler_data);
30 void lc8951_run(lc8951 *context, uint32_t cycle); 34 void lc8951_run(lc8951 *context, uint32_t cycle);
31 void lc8951_reg_write(lc8951 *context, uint8_t value); 35 void lc8951_reg_write(lc8951 *context, uint8_t value);
32 uint8_t lc8951_reg_read(lc8951 *context); 36 uint8_t lc8951_reg_read(lc8951 *context);
33 void lc8951_ar_write(lc8951 *context, uint8_t value); 37 void lc8951_ar_write(lc8951 *context, uint8_t value);
34 void lc8951_write_byte(lc8951 *context, uint32_t cycle, int sector_offset, uint8_t byte); 38 void lc8951_write_byte(lc8951 *context, uint32_t cycle, int sector_offset, uint8_t byte);
35 uint32_t lc8951_next_interrupt(lc8951 *context); 39 uint32_t lc8951_next_interrupt(lc8951 *context);
40 void lc8951_resume_transfer(lc8951 *context);
36 41
37 #endif //LC8951_H_ 42 #endif //LC8951_H_