1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49#ifndef _LINUX_3780I_H
50#define _LINUX_3780I_H
51
52#include <asm/io.h>
53
54
55#define DSP_IsaSlaveControl 0x0000
56#define DSP_IsaSlaveStatus 0x0001
57#define DSP_ConfigAddress 0x0002
58#define DSP_ConfigData 0x0003
59#define DSP_HBridgeControl 0x0002
60#define DSP_MsaAddrLow 0x0004
61#define DSP_MsaAddrHigh 0x0006
62#define DSP_MsaDataDSISHigh 0x0008
63#define DSP_MsaDataISLow 0x000A
64#define DSP_ReadAndClear 0x000C
65#define DSP_Interrupt 0x000E
66
67typedef struct {
68 unsigned char ClockControl:1;
69 unsigned char SoftReset:1;
70 unsigned char ConfigMode:1;
71 unsigned char Reserved:5;
72} DSP_ISA_SLAVE_CONTROL;
73
74
75typedef struct {
76 unsigned short EnableDspInt:1;
77 unsigned short MemAutoInc:1;
78 unsigned short IoAutoInc:1;
79 unsigned short DiagnosticMode:1;
80 unsigned short IsaPacingTimer:12;
81} DSP_HBRIDGE_CONTROL;
82
83
84
85#define DSP_UartCfg1Index 0x0003
86#define DSP_UartCfg2Index 0x0004
87#define DSP_HBridgeCfg1Index 0x0007
88#define DSP_HBridgeCfg2Index 0x0008
89#define DSP_BusMasterCfg1Index 0x0009
90#define DSP_BusMasterCfg2Index 0x000A
91#define DSP_IsaProtCfgIndex 0x000F
92#define DSP_PowerMgCfgIndex 0x0010
93#define DSP_HBusTimerCfgIndex 0x0011
94
95typedef struct {
96 unsigned char IrqActiveLow:1;
97 unsigned char IrqPulse:1;
98 unsigned char Irq:3;
99 unsigned char BaseIO:2;
100 unsigned char Reserved:1;
101} DSP_UART_CFG_1;
102
103typedef struct {
104 unsigned char Enable:1;
105 unsigned char Reserved:7;
106} DSP_UART_CFG_2;
107
108typedef struct {
109 unsigned char IrqActiveLow:1;
110 unsigned char IrqPulse:1;
111 unsigned char Irq:3;
112 unsigned char AccessMode:1;
113 unsigned char Reserved:2;
114} DSP_HBRIDGE_CFG_1;
115
116typedef struct {
117 unsigned char Enable:1;
118 unsigned char Reserved:7;
119} DSP_HBRIDGE_CFG_2;
120
121
122typedef struct {
123 unsigned char Dma:3;
124 unsigned char NumTransfers:2;
125 unsigned char ReRequest:2;
126 unsigned char MEMCS16:1;
127} DSP_BUSMASTER_CFG_1;
128
129typedef struct {
130 unsigned char IsaMemCmdWidth:2;
131 unsigned char Reserved:6;
132} DSP_BUSMASTER_CFG_2;
133
134
135typedef struct {
136 unsigned char GateIOCHRDY:1;
137 unsigned char Reserved:7;
138} DSP_ISA_PROT_CFG;
139
140typedef struct {
141 unsigned char Enable:1;
142 unsigned char Reserved:7;
143} DSP_POWER_MGMT_CFG;
144
145typedef struct {
146 unsigned char LoadValue:8;
147} DSP_HBUS_TIMER_CFG;
148
149
150
151
152#define DSP_ChipID 0x80000000
153#define DSP_MspBootDomain 0x80000580
154#define DSP_LBusTimeoutDisable 0x80000580
155#define DSP_ClockControl_1 0x8000058A
156#define DSP_ClockControl_2 0x8000058C
157#define DSP_ChipReset 0x80000588
158#define DSP_GpioModeControl_15_8 0x80000082
159#define DSP_GpioDriverEnable_15_8 0x80000076
160#define DSP_GpioOutputData_15_8 0x80000072
161
162typedef struct {
163 unsigned short NMI:1;
164 unsigned short Halt:1;
165 unsigned short ResetCore:1;
166 unsigned short Reserved:13;
167} DSP_BOOT_DOMAIN;
168
169typedef struct {
170 unsigned short DisableTimeout:1;
171 unsigned short Reserved:15;
172} DSP_LBUS_TIMEOUT_DISABLE;
173
174typedef struct {
175 unsigned short Memory:1;
176 unsigned short SerialPort1:1;
177 unsigned short SerialPort2:1;
178 unsigned short SerialPort3:1;
179 unsigned short Gpio:1;
180 unsigned short Dma:1;
181 unsigned short SoundBlaster:1;
182 unsigned short Uart:1;
183 unsigned short Midi:1;
184 unsigned short IsaMaster:1;
185 unsigned short Reserved:6;
186} DSP_CHIP_RESET;
187
188typedef struct {
189 unsigned short N_Divisor:6;
190 unsigned short Reserved1:2;
191 unsigned short M_Multiplier:6;
192 unsigned short Reserved2:2;
193} DSP_CLOCK_CONTROL_1;
194
195typedef struct {
196 unsigned short PllBypass:1;
197 unsigned short Reserved:15;
198} DSP_CLOCK_CONTROL_2;
199
200typedef struct {
201 unsigned short Latch8:1;
202 unsigned short Latch9:1;
203 unsigned short Latch10:1;
204 unsigned short Latch11:1;
205 unsigned short Latch12:1;
206 unsigned short Latch13:1;
207 unsigned short Latch14:1;
208 unsigned short Latch15:1;
209 unsigned short Mask8:1;
210 unsigned short Mask9:1;
211 unsigned short Mask10:1;
212 unsigned short Mask11:1;
213 unsigned short Mask12:1;
214 unsigned short Mask13:1;
215 unsigned short Mask14:1;
216 unsigned short Mask15:1;
217} DSP_GPIO_OUTPUT_DATA_15_8;
218
219typedef struct {
220 unsigned short Enable8:1;
221 unsigned short Enable9:1;
222 unsigned short Enable10:1;
223 unsigned short Enable11:1;
224 unsigned short Enable12:1;
225 unsigned short Enable13:1;
226 unsigned short Enable14:1;
227 unsigned short Enable15:1;
228 unsigned short Mask8:1;
229 unsigned short Mask9:1;
230 unsigned short Mask10:1;
231 unsigned short Mask11:1;
232 unsigned short Mask12:1;
233 unsigned short Mask13:1;
234 unsigned short Mask14:1;
235 unsigned short Mask15:1;
236} DSP_GPIO_DRIVER_ENABLE_15_8;
237
238typedef struct {
239 unsigned short GpioMode8:2;
240 unsigned short GpioMode9:2;
241 unsigned short GpioMode10:2;
242 unsigned short GpioMode11:2;
243 unsigned short GpioMode12:2;
244 unsigned short GpioMode13:2;
245 unsigned short GpioMode14:2;
246 unsigned short GpioMode15:2;
247} DSP_GPIO_MODE_15_8;
248
249
250#define MW_ADC_MASK 0x0001
251#define MW_AIC2_MASK 0x0006
252#define MW_MIDI_MASK 0x0008
253#define MW_CDDAC_MASK 0x8001
254#define MW_AIC1_MASK 0xE006
255#define MW_UART_MASK 0xE00A
256#define MW_ACI_MASK 0xE00B
257
258
259
260
261
262
263
264typedef struct _DSP_3780I_CONFIG_SETTINGS {
265
266
267 unsigned short usBaseConfigIO;
268
269
270 int bDSPEnabled;
271 int bModemEnabled;
272 int bInterruptClaimed;
273
274
275 unsigned short usDspIrq;
276 unsigned short usDspDma;
277 unsigned short usDspBaseIO;
278 unsigned short usUartIrq;
279 unsigned short usUartBaseIO;
280
281
282 int bDspIrqActiveLow;
283 int bUartIrqActiveLow;
284 int bDspIrqPulse;
285 int bUartIrqPulse;
286
287
288 unsigned uIps;
289 unsigned uDStoreSize;
290 unsigned uIStoreSize;
291 unsigned uDmaBandwidth;
292
293
294 unsigned short usNumTransfers;
295 unsigned short usReRequest;
296 int bEnableMEMCS16;
297 unsigned short usIsaMemCmdWidth;
298 int bGateIOCHRDY;
299 int bEnablePwrMgmt;
300 unsigned short usHBusTimerLoadValue;
301 int bDisableLBusTimeout;
302 unsigned short usN_Divisor;
303 unsigned short usM_Multiplier;
304 int bPllBypass;
305 unsigned short usChipletEnable;
306
307
308 int bUartSaved;
309 unsigned char ucIER;
310 unsigned char ucFCR;
311 unsigned char ucLCR;
312 unsigned char ucMCR;
313 unsigned char ucSCR;
314 unsigned char ucDLL;
315 unsigned char ucDLM;
316} DSP_3780I_CONFIG_SETTINGS;
317
318
319
320int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
321 unsigned short *pIrqMap,
322 unsigned short *pDmaMap);
323int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings);
324int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings);
325int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings);
326int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
327 unsigned uCount, unsigned long ulDSPAddr);
328int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO,
329 void __user *pvBuffer, unsigned uCount,
330 unsigned long ulDSPAddr);
331int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
332 unsigned uCount, unsigned long ulDSPAddr);
333int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
334 unsigned uCount, unsigned long ulDSPAddr);
335int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
336 unsigned uCount, unsigned long ulDSPAddr);
337unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO,
338 unsigned long ulMsaAddr);
339void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO,
340 unsigned long ulMsaAddr, unsigned short usValue);
341int dsp3780I_GetIPCSource(unsigned short usDspBaseIO,
342 unsigned short *pusIPCSource);
343
344
345#define MKWORD(var) (*((unsigned short *)(&var)))
346#define MKBYTE(var) (*((unsigned char *)(&var)))
347
348#define WriteMsaCfg(addr,value) dsp3780I_WriteMsaCfg(usDspBaseIO,addr,value)
349#define ReadMsaCfg(addr) dsp3780I_ReadMsaCfg(usDspBaseIO,addr)
350#define WriteGenCfg(index,value) dsp3780I_WriteGenCfg(usDspBaseIO,index,value)
351#define ReadGenCfg(index) dsp3780I_ReadGenCfg(usDspBaseIO,index)
352
353#define InWordDsp(index) inw(usDspBaseIO+index)
354#define InByteDsp(index) inb(usDspBaseIO+index)
355#define OutWordDsp(index,value) outw(value,usDspBaseIO+index)
356#define OutByteDsp(index,value) outb(value,usDspBaseIO+index)
357
358#endif
359