ReactOS  0.4.13-dev-563-g0561610
sndblst.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <debug.h>
4 #include <ntddk.h>
5 
6 #define SB_WAVE_IN_DEVICE_NAME L"\\Device\\SBWaveIn"
7 #define SB_WAVE_OUT_DEVICE_NAME L"\\Device\\SBWaveOut"
8 /* TODO: MIDI */
9 #define SB_AUX_DEVICE_NAME L"\\Device\\SBAux"
10 #define SB_MIXER_DEVICE_NAME L"\\Device\\SBMixer"
11 
12 #define DEFAULT_PORT 0x220
13 #define DEFAULT_IRQ 5
14 #define DEFAULT_DMA 1
15 #define DEFAULT_BUFFER_SIZE 65535
16 
17 #define SB_TIMEOUT 1000000
18 
19 #define SB_DSP_READY 0xaa
20 
21 enum
22 {
30 };
31 
32 enum
33 {
34  SB_RESET_PORT = 0x06,
39 };
40 
41 enum
42 {
45  SbSetOutputRate = 0x41, /* DSP v4.xx */
46  SbSetInputRate = 0x42, /* DSP v4.xx */
47  SbSetBlockSize = 0x48, /* DSP v2.00 + */
48  SbPauseDac = 0x80,
52  SbGetSpeakerStatus = 0xd8, /* DSP v2.00 + */
54 };
55 
57 {
67 
68 
71 
72 
73 /*
74  Port I/O
75 */
76 
77 #define SbWrite(sbdevice, subport, data) \
78  WRITE_PORT_UCHAR((PUCHAR) sbdevice->port + subport, data)
79 
80 #define SbRead(sbdevice, subport) \
81  READ_PORT_UCHAR((PUCHAR) sbdevice->port + subport)
82 
83 #define SbWriteReset(sbdevice, data) \
84  SbWrite(sbdevice, SB_RESET_PORT, data)
85 
86 #define SbWriteDataWithoutWait(sbdevice, data) \
87  SbWrite(sbdevice, SB_WRITE_DATA_PORT, data)
88 
89 #define SbReadDataWithoutWait(sbdevice) \
90  SbRead(sbdevice, SB_READ_DATA_PORT)
91 
92 
93 #define SbGetWriteStatus(sbdevice) \
94  SbRead(sbdevice, SB_WRITE_STATUS_PORT)
95 
96 #define SbGetReadStatus(sbdevice) \
97  SbRead(sbdevice, SB_READ_STATUS_PORT)
98 
99 
100 
101 BOOLEAN
103  PSOUND_BLASTER_PARAMETERS SBDevice,
104  UCHAR Port);
105 
106 #define WaitToWrite(sbdevice) \
107  WaitForReady(sbdevice, SB_WRITE_STATUS_PORT)
108 
109 #define WaitToRead(sbdevice) \
110  WaitForReady(sbdevice, SB_READ_STATUS_PORT)
111 
112 BOOLEAN
114  PSOUND_BLASTER_PARAMETERS SBDevice);
115 
116 ULONG
118  PSOUND_BLASTER_PARAMETERS SBDevice);
119 
120 BOOLEAN
122  PSOUND_BLASTER_PARAMETERS SBDevice,
123  ULONG SampleRate);
124 
125 BOOLEAN
127  PSOUND_BLASTER_PARAMETERS SBDevice,
128  ULONG SampleRate);
129 
130 BOOLEAN
132  PSOUND_BLASTER_PARAMETERS SBDevice);
133 
134 BOOLEAN
136  PSOUND_BLASTER_PARAMETERS SBDevice);
137 
138 BOOLEAN
140  PSOUND_BLASTER_PARAMETERS SBDevice,
141  ULONG BitDepth,
142  ULONG Channels,
143  ULONG BlockSize);
144 
145 
146 /*
147  interrupt.c
148 */
149 
150 NTSTATUS
151 EnableIrq(
CPPORT Port[4]
Definition: headless.c:34
BOOLEAN EnableSpeaker(PSOUND_BLASTER_PARAMETERS SBDevice)
Definition: control.c:158
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN IsSampleRateCompatible(PSOUND_BLASTER_PARAMETERS SBDevice, ULONG SampleRate)
Definition: control.c:134
ULONG GetSoundBlasterModel(PSOUND_BLASTER_PARAMETERS SBDevice)
Definition: control.c:95
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
BOOLEAN WaitForReady(PSOUND_BLASTER_PARAMETERS SBDevice, UCHAR Port)
Definition: control.c:12
NTSTATUS EnableIrq(PDEVICE_OBJECT DeviceObject)
Definition: interrupt.c:27
unsigned char BOOLEAN
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
BOOLEAN ResetSoundBlaster(PSOUND_BLASTER_PARAMETERS SBDevice)
Definition: control.c:59
REGISTRY_CALLBACK_ROUTINE * PREGISTRY_CALLBACK_ROUTINE
Definition: sndblst.h:70
unsigned char UCHAR
Definition: xmlstorage.h:181
PDRIVER_OBJECT driver
Definition: sndblst.h:58
BOOLEAN StartSoundOutput(PSOUND_BLASTER_PARAMETERS SBDevice, ULONG BitDepth, ULONG Channels, ULONG BlockSize)
Definition: control.c:176
PKINTERRUPT interrupt
Definition: sndblst.h:60
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
unsigned short USHORT
Definition: pedump.c:61
struct _SOUND_BLASTER_PARAMETERS * PSOUND_BLASTER_PARAMETERS
BOOLEAN DisableSpeaker(PSOUND_BLASTER_PARAMETERS SBDevice)
Definition: control.c:167
unsigned int ULONG
Definition: retypes.h:1
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
NTAPI NTSTATUS REGISTRY_CALLBACK_ROUTINE(PDRIVER_OBJECT DriverObject, PWSTR RegistryPath)
Definition: sndblst.h:69
BOOLEAN SetOutputSampleRate(PSOUND_BLASTER_PARAMETERS SBDevice, ULONG SampleRate)
Definition: control.c:143
struct _SOUND_BLASTER_PARAMETERS SOUND_BLASTER_PARAMETERS