bugfixes, refactoring
[picodrive.git] / Pico / cd / LC89510.h
1 /***********************************************************\r
2  *                                                         *\r
3  * This source was taken from the Gens project             *\r
4  * Written by Stéphane Dallongeville                       *\r
5  * Copyright (c) 2002 by Stéphane Dallongeville            *\r
6  * Modified/adapted for PicoDrive by notaz, 2007           *\r
7  *                                                         *\r
8  ***********************************************************/\r
9 \r
10 #ifndef _LC89510_H\r
11 #define _LC89510_H\r
12 \r
13 #ifdef __cplusplus\r
14 extern "C" {\r
15 #endif\r
16 \r
17 typedef struct\r
18 {\r
19         unsigned char Buffer[(32 * 1024 * 2) + 2352];\r
20 //      unsigned int Host_Data;         // unused\r
21 //      unsigned int DMA_Adr;           // 0A\r
22 //      unsigned int Stop_Watch;        // 0C\r
23         unsigned int COMIN;\r
24         unsigned int IFSTAT;\r
25         union\r
26         {\r
27                 struct\r
28                 {\r
29                         unsigned char L;\r
30                         unsigned char H;\r
31                         unsigned short unused;\r
32                 } B;\r
33                 int N;\r
34         } DBC;\r
35         union\r
36         {\r
37                 struct\r
38                 {\r
39                         unsigned char L;\r
40                         unsigned char H;\r
41                         unsigned short unused;\r
42                 } B;\r
43                 int N;\r
44         } DAC;\r
45         union\r
46         {\r
47                 struct\r
48                 {\r
49                         unsigned char B0;\r
50                         unsigned char B1;\r
51                         unsigned char B2;\r
52                         unsigned char B3;\r
53                 } B;\r
54                 unsigned int N;\r
55         } HEAD;\r
56         union\r
57         {\r
58                 struct\r
59                 {\r
60                         unsigned char L;\r
61                         unsigned char H;\r
62                         unsigned short unused;\r
63                 } B;\r
64                 int N;\r
65         } PT;\r
66         union\r
67         {\r
68                 struct\r
69                 {\r
70                         unsigned char L;\r
71                         unsigned char H;\r
72                         unsigned short unused;\r
73                 } B;\r
74                 int N;\r
75         } WA;\r
76         union\r
77         {\r
78                 struct\r
79                 {\r
80                         unsigned char B0;\r
81                         unsigned char B1;\r
82                         unsigned char B2;\r
83                         unsigned char B3;\r
84                 } B;\r
85                 unsigned int N;\r
86         } STAT;\r
87         unsigned int SBOUT;\r
88         unsigned int IFCTRL;\r
89         union\r
90         {\r
91                 struct\r
92                 {\r
93                         unsigned char B0;\r
94                         unsigned char B1;\r
95                         unsigned char B2;\r
96                         unsigned char B3;\r
97                 } B;\r
98                 unsigned int N;\r
99         } CTRL;\r
100         unsigned int Decode_Reg_Read;\r
101 } CDC;\r
102 \r
103 typedef struct\r
104 {\r
105 //      unsigned short Fader;   // 34\r
106 //      unsigned short Control; // 36\r
107 //      unsigned short Cur_Comm;// unused\r
108 \r
109         // "Receive status"\r
110         unsigned short Status;\r
111         unsigned short Minute;\r
112         unsigned short Seconde;\r
113         unsigned short Frame;\r
114         unsigned char  Ext;\r
115         unsigned char  pad[3];\r
116 } CDD;\r
117 \r
118 \r
119 PICO_INTERNAL_ASM unsigned short Read_CDC_Host(int is_sub);\r
120 PICO_INTERNAL void LC89510_Reset(void);\r
121 PICO_INTERNAL void Update_CDC_TRansfer(int which);\r
122 PICO_INTERNAL void CDC_Update_Header(void);\r
123 \r
124 PICO_INTERNAL unsigned char CDC_Read_Reg(void);\r
125 PICO_INTERNAL void CDC_Write_Reg(unsigned char Data);\r
126 \r
127 PICO_INTERNAL void CDD_Export_Status(void);\r
128 PICO_INTERNAL void CDD_Import_Command(void);\r
129 \r
130 #ifdef __cplusplus\r
131 };\r
132 #endif\r
133 \r
134 #endif\r
135 \r