1 /*
2 ReactOS Operating System
3 Sound Blaster KS Driver
4
5 AUTHORS:
6 Andrew Greenwood
7
8 NOTES:
9 Ah, the Sound Blaster 16. I remember it well...
10 */
11
12 #include <portcls.h>
13 #include <stdunk.h>
14
15 #ifndef SB16_H
16 #define SB16_H
17
18 #define MAX_DMA_BUFFER_SIZE 65536
19
20 enum DspRegister
21 {
22 DspRegCMSD0 = 0x00,
23 DspRegCMSR0 = 0x01,
24 DspRegCMSD1 = 0x02,
25 DspRegCMSR1 = 0x03,
26 DspRegMixerReg = 0x04,
27 DspRegMixerData = 0x05,
28 DspRegReset = 0x06,
29 DspRegFMD0 = 0x08,
30 DspRegFMR0 = 0x09,
31 DspRegRead = 0x0a,
32 DspRegWrite = 0x0c,
33 DspRegDataAvailable = 0x0e,
34
35 DspRegAck8 = 0x0e,
36 DspRegAck16 = 0x0f
37 };
38
39 enum DspCommand
40 {
41 DspWriteWaveProgrammedIo = 0x10,
42 DspWriteWave = 0x14,
43 DspWriteWaveAuto = 0x1c,
44 DspReadWave = 0x24,
45 DspReadWaveAuto = 0x2C,
46 DspWriteHighSpeedWave = 0x90,
47 DspReadHighSpeedWave = 0x98,
48 DspSetSampleRate = 0x40,
49 DspSetBlockSize = 0x48,
50 DspEnableOutput = 0xd1,
51 DspDisableOutput = 0xd3,
52 DspOutputStatus = 0xd8,
53 DspPauseDma = 0xd0,
54 DspContinueDma = 0xd4,
55 DspHaltAutoDma = 0xda,
56 DspInverter = 0xe0,
57 DspGetVersion = 0xe1,
58 DspGenerateInterrupt = 0xf2,
59
60 /* SB16 only */
61 DspSetDacRate = 0x41,
62 DspSetAdcRate = 0x42,
63 DspStartDac16 = 0xb6,
64 DspStartAdc16 = 0xbe,
65 DspStartDac8 = 0xc6,
66 DspStartAdc8 = 0xc3,
67 DspPauseDma16 = 0xd5,
68 DspContinueDma16 = 0xd6,
69 DspHaltAutoDma16 = 0xd9
70 };
71
72 enum DspMixerRegister
73 {
74 DspMixMasterVolumeLeft = 0x00,
75 DspMixMasterVolumeRight = 0x01,
76 DspMixVoiceVolumeLeft = 0x02,
77 DspMixVoiceVolumeRight = 0x03,
78 /* ... */
79 DspMixIrqConfig = 0x80,
80 DspMixDmaConfig = 0x81
81 };
82
83
84 #define MPU401_OUTPUT_READY 0x40
85 #define MPU401_INPUT_READY 0x80
86
87 #define MPU401_RESET 0xff
88 #define MPU401_UART_MODE 0x3f
89
90 DEFINE_GUID(IID_IWaveMiniportSB16,
91 0xbe23b2d7, 0xa760, 0x43ab, 0xb7, 0x6e, 0xbc, 0x3e, 0x93, 0xe6, 0xff, 0x54);
92
DECLARE_INTERFACE_(IWaveMiniportSB16,IUnknown)93 DECLARE_INTERFACE_(IWaveMiniportSB16, IUnknown)
94 {
95 DEFINE_ABSTRACT_UNKNOWN()
96
97 STDMETHOD_(void, RestoreSampleRate)( THIS ) PURE;
98 STDMETHOD_(void, ServiceWaveISR)( THIS ) PURE;
99 };
100
101 typedef IWaveMiniportSB16 *PWAVEMINIPORTSB16;
102
103
104 DEFINE_GUID(IID_IAdapterSB16,
105 0xfba9052c, 0x0544, 0x4bc4, 0x97, 0x3f, 0x70, 0xb7, 0x06, 0x46, 0x81, 0xe5);
106
DECLARE_INTERFACE_(IAdapterSB16,IUnknown)107 DECLARE_INTERFACE_(IAdapterSB16, IUnknown)
108 {
109 DEFINE_ABSTRACT_UNKNOWN()
110
111 STDMETHOD_(NTSTATUS, Init)( THIS_
112 IN PRESOURCELIST ResourceList,
113 IN PDEVICE_OBJECT DeviceObject) PURE;
114
115 STDMETHOD_(PINTERRUPTSYNC, GetInterruptSync)( THIS ) PURE;
116
117 STDMETHOD_(void, SetWaveMiniport)( THIS_
118 IN PWAVEMINIPORTSB16 Miniport) PURE;
119
120 STDMETHOD_(BYTE, Read)( THIS ) PURE;
121
122 STDMETHOD_(BOOLEAN, Write)( THIS_
123 IN BYTE Value) PURE;
124
125 STDMETHOD_(NTSTATUS, Reset)( THIS ) PURE;
126
127 STDMETHOD_(void, SetMixerValue)( THIS_
128 IN BYTE Index,
129 IN BYTE Value) PURE;
130
131 STDMETHOD_(BYTE, GetMixerValue)( THIS_
132 IN BYTE Index) PURE;
133
134 STDMETHOD_(void, ResetMixer)( THIS ) PURE;
135
136 /* TODO - Save/load settings */
137 };
138
139 typedef IAdapterSB16 *PADAPTERSB16;
140
141 #endif
142