ReactOS 0.4.16-dev-306-g647d351
sbdsp.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SOUND_BLASTER_1_0   L"Sound Blaster 1.0"
 
#define SOUND_BLASTER_1_5   L"Sound Blaster 1.5"
 
#define SOUND_BLASTER_2_0   L"Sound Blaster 2.0"
 
#define SOUND_BLASTER_PRO   L"Sound Blaster Pro"
 
#define SOUND_BLASTER_16   L"Sound Blaster 16"
 
#define READ_SB_FM1_STATUS(bp)   READ_PORT_UCHAR((PUCHAR) bp)
 
#define WRITE_SB_FM1_REGISTER(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp, x)
 
#define WRITE_SB_FM1_DATA(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x01, x)
 
#define READ_SB_AFM_STATUS(bp)   READ_PORT_UCHAR((PUCHAR) bp+0x02)
 
#define WRITE_SB_AFM_REGISTER(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x02, x)
 
#define WRITE_SB_AFM_DATA(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x03, x)
 
#define WRITE_SB_MIXER_REGISTER(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x04, x)
 
#define READ_SB_MIXER_DATA(bp)   READ_PORT_UCHAR((PUCHAR) bp+0x05)
 
#define WRITE_SB_MIXER_DATA(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x05, x)
 
#define WRITE_SB_DSP_RESET(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x06, x)
 
#define READ_SB_FM2_STATUS(bp)   READ_PORT_UCHAR((PUCHAR) bp+0x08)
 
#define WRITE_SB_FM2_REGISTER(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x08, x)
 
#define WRITE_SB_FM2_DATA(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x09, x)
 
#define READ_SB_DSP_DATA(bp)   READ_PORT_UCHAR((PUCHAR) bp+0x0A)
 
#define WRITE_SB_DSP_DATA(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x0C, x)
 
#define WRITE_SB_DSP_COMMAND(bp, x)   WRITE_PORT_UCHAR((PUCHAR) bp+0x0C, x)
 
#define SB_DSP_CLEAR_TO_SEND(bp)    ( ! (READ_PORT_UCHAR((PUCHAR) bp+0x0C) & 0x80 ) )
 
#define SB_DSP_DATA_AVAILABLE(bp)    ( READ_PORT_UCHAR((PUCHAR) bp+0x0E) & 0x80 )
 
#define SB_DSP_READY   0xAA
 
#define SB_DSP_OUTPUT_RATE   0x41
 
#define SB_DSP_INPUT_RATE   0x42
 
#define SB_DSP_BLOCK_SIZE   0x48
 
#define SB_DSP_SPEAKER_ON   0xD1
 
#define SB_DSP_SPEAKER_OFF   0xD3
 
#define SB_DSP_SPEAKER_STATUS   0xD8
 
#define SB_DSP_VERSION   0xE1
 
#define SB_MIX_VOC_LEVEL   0x04
 
#define SB_MIX_LEGACY_MIC_LEVEL   0x0A
 
#define SB_MIX_MASTER_LEVEL   0x22
 
#define SB_MIX_FM_LEVEL   0x26
 
#define SB_MIX_CD_LEVEL   0x28
 
#define SB_MIX_LINE_LEVEL   0x2E
 
#define SB_MIX_RESET   0x00
 
#define SB_MIX_MASTER_LEFT_LEVEL   0x30
 
#define SB_MIX_MASTER_RIGHT_LEVEL   0x31
 
#define SB_MIX_VOC_LEFT_LEVEL   0x32
 
#define SB_MIX_VOC_RIGHT_LEVEL   0x33
 
#define SB_MIX_MIDI_LEFT_LEVEL   0x34
 
#define SB_MIX_MIDI_RIGHT_LEVEL   0x35
 
#define SB_MIX_CD_LEFT_LEVEL   0x36
 
#define SB_MIX_CD_RIGHT_LEVEL   0x37
 
#define SB_MIX_LINE_LEFT_LEVEL   0x38
 
#define SB_MIX_LINE_RIGHT_LEVEL   0x39
 
#define SB_MIX_MIC_LEVEL   0x3A
 
#define SB_MIX_PC_SPEAKER_LEVEL   0x3B
 
#define SB_MIX_OUTPUT_SWITCHES   0x3C
 
#define SB_MIX_INPUT_LEFT_SWITCHES   0x3D
 
#define SB_MIX_INPUT_RIGHT_SWITCHES   0x3E
 
#define SB_MIX_INPUT_LEFT_GAIN   0x3F
 
#define SB_MIX_INPUT_RIGHT_GAIN   0x40
 
#define SB_MIX_OUTPUT_LEFT_GAIN   0x41
 
#define SB_MIX_OUTPUT_RIGHT_GAIN   0x42
 
#define SB_MIX_AGC   0x43
 
#define SB_MIX_TREBLE_LEFT_LEVEL   0x44
 
#define SB_MIX_TREBLE_RIGHT_LEVEL   0x45
 
#define SB_MIX_BASS_LEFT_LEVEL   0x46
 
#define SB_MIX_BASS_RIGHT_LEVEL   0x47
 
#define SB_MIX_MIDI_LEFT_SWITCH   0x01
 
#define SB_MIX_MIDI_RIGHT_SWITCH   0x02
 
#define SB_MIX_LINE_LEFT_SWITCH   0x04
 
#define SB_MIX_LINE_RIGHT_SWITCH   0x08
 
#define SB_MIX_CD_LEFT_SWITCH   0x10
 
#define SB_MIX_CD_RIGHT_SWITCH   0x20
 
#define SB_MIX_MIC_SWITCH   0x40
 

Functions

NTSTATUS SbDspReset (IN PUCHAR BasePort, IN ULONG Timeout)
 
NTSTATUS SbDspWaitToWrite (IN PUCHAR BasePort, IN ULONG Timeout)
 
NTSTATUS SbDspWaitToRead (IN PUCHAR BasePort, IN ULONG Timeout)
 
NTSTATUS SbDspWrite (IN PUCHAR BasePort, IN UCHAR DataByte, IN ULONG Timeout)
 
NTSTATUS SbDspRead (IN PUCHAR BasePort, OUT PUCHAR DataByte, IN ULONG Timeout)
 
NTSTATUS SbDspGetVersion (IN PUCHAR BasePort, OUT PUCHAR MajorVersion, OUT PUCHAR MinorVersion, IN ULONG Timeout)
 
NTSTATUS SbDspEnableSpeaker (IN PUCHAR BasePort, IN ULONG Timeout)
 
NTSTATUS SbDspDisableSpeaker (IN PUCHAR BasePort, IN ULONG Timeout)
 
NTSTATUS SbDspIsSpeakerEnabled (IN PUCHAR BasePort, OUT PBOOLEAN IsEnabled, IN ULONG Timeout)
 
BOOLEAN SbDspIsValidInputRate (IN UCHAR MajorVersion, IN UCHAR MinorVersion, IN USHORT Rate, IN BOOLEAN Stereo)
 
BOOLEAN SbDspIsValidOutputRate (IN UCHAR MajorVersion, IN UCHAR MinorVersion, IN USHORT Rate, IN BOOLEAN Stereo)
 
NTSTATUS SbDsp4SetOutputRate (IN PUCHAR BasePort, IN USHORT Rate, IN ULONG Timeout)
 
NTSTATUS SbDsp4SetInputRate (IN PUCHAR BasePort, IN USHORT Rate, IN ULONG Timeout)
 
VOID SbMixerReset (IN PUCHAR BasePort)
 
NTSTATUS SbMixerPackLevelData (IN UCHAR Line, IN UCHAR Level, OUT PUCHAR PackedLevel)
 
NTSTATUS SbMixerUnpackLevelData (IN UCHAR Line, IN UCHAR PackedLevel, OUT PUCHAR Level)
 
NTSTATUS SbMixerSetLevel (IN PUCHAR BasePort, IN UCHAR Line, IN UCHAR Level)
 
NTSTATUS SbMixerGetLevel (IN PUCHAR BasePort, IN UCHAR Line, OUT PUCHAR Level)
 
VOID SbMixerEnableAGC (IN PUCHAR BasePort)
 
VOID SbMixerDisableAGC (IN PUCHAR BasePort)
 
BOOLEAN SbMixerIsAGCEnabled (IN PUCHAR BasePort)
 

Macro Definition Documentation

◆ READ_SB_AFM_STATUS

#define READ_SB_AFM_STATUS (   bp)    READ_PORT_UCHAR((PUCHAR) bp+0x02)

Definition at line 39 of file sbdsp.h.

◆ READ_SB_DSP_DATA

#define READ_SB_DSP_DATA (   bp)    READ_PORT_UCHAR((PUCHAR) bp+0x0A)

Definition at line 53 of file sbdsp.h.

◆ READ_SB_FM1_STATUS

#define READ_SB_FM1_STATUS (   bp)    READ_PORT_UCHAR((PUCHAR) bp)

Definition at line 35 of file sbdsp.h.

◆ READ_SB_FM2_STATUS

#define READ_SB_FM2_STATUS (   bp)    READ_PORT_UCHAR((PUCHAR) bp+0x08)

Definition at line 49 of file sbdsp.h.

◆ READ_SB_MIXER_DATA

#define READ_SB_MIXER_DATA (   bp)    READ_PORT_UCHAR((PUCHAR) bp+0x05)

Definition at line 44 of file sbdsp.h.

◆ SB_DSP_BLOCK_SIZE

#define SB_DSP_BLOCK_SIZE   0x48

Definition at line 74 of file sbdsp.h.

◆ SB_DSP_CLEAR_TO_SEND

#define SB_DSP_CLEAR_TO_SEND (   bp)     ( ! (READ_PORT_UCHAR((PUCHAR) bp+0x0C) & 0x80 ) )

Definition at line 58 of file sbdsp.h.

◆ SB_DSP_DATA_AVAILABLE

#define SB_DSP_DATA_AVAILABLE (   bp)     ( READ_PORT_UCHAR((PUCHAR) bp+0x0E) & 0x80 )

Definition at line 62 of file sbdsp.h.

◆ SB_DSP_INPUT_RATE

#define SB_DSP_INPUT_RATE   0x42

Definition at line 73 of file sbdsp.h.

◆ SB_DSP_OUTPUT_RATE

#define SB_DSP_OUTPUT_RATE   0x41

Definition at line 72 of file sbdsp.h.

◆ SB_DSP_READY

#define SB_DSP_READY   0xAA

Definition at line 66 of file sbdsp.h.

◆ SB_DSP_SPEAKER_OFF

#define SB_DSP_SPEAKER_OFF   0xD3

Definition at line 76 of file sbdsp.h.

◆ SB_DSP_SPEAKER_ON

#define SB_DSP_SPEAKER_ON   0xD1

Definition at line 75 of file sbdsp.h.

◆ SB_DSP_SPEAKER_STATUS

#define SB_DSP_SPEAKER_STATUS   0xD8

Definition at line 77 of file sbdsp.h.

◆ SB_DSP_VERSION

#define SB_DSP_VERSION   0xE1

Definition at line 78 of file sbdsp.h.

◆ SB_MIX_AGC

#define SB_MIX_AGC   0x43

Definition at line 113 of file sbdsp.h.

◆ SB_MIX_BASS_LEFT_LEVEL

#define SB_MIX_BASS_LEFT_LEVEL   0x46

Definition at line 116 of file sbdsp.h.

◆ SB_MIX_BASS_RIGHT_LEVEL

#define SB_MIX_BASS_RIGHT_LEVEL   0x47

Definition at line 117 of file sbdsp.h.

◆ SB_MIX_CD_LEFT_LEVEL

#define SB_MIX_CD_LEFT_LEVEL   0x36

Definition at line 100 of file sbdsp.h.

◆ SB_MIX_CD_LEFT_SWITCH

#define SB_MIX_CD_LEFT_SWITCH   0x10

Definition at line 127 of file sbdsp.h.

◆ SB_MIX_CD_LEVEL

#define SB_MIX_CD_LEVEL   0x28

Definition at line 87 of file sbdsp.h.

◆ SB_MIX_CD_RIGHT_LEVEL

#define SB_MIX_CD_RIGHT_LEVEL   0x37

Definition at line 101 of file sbdsp.h.

◆ SB_MIX_CD_RIGHT_SWITCH

#define SB_MIX_CD_RIGHT_SWITCH   0x20

Definition at line 128 of file sbdsp.h.

◆ SB_MIX_FM_LEVEL

#define SB_MIX_FM_LEVEL   0x26

Definition at line 86 of file sbdsp.h.

◆ SB_MIX_INPUT_LEFT_GAIN

#define SB_MIX_INPUT_LEFT_GAIN   0x3F

Definition at line 109 of file sbdsp.h.

◆ SB_MIX_INPUT_LEFT_SWITCHES

#define SB_MIX_INPUT_LEFT_SWITCHES   0x3D

Definition at line 107 of file sbdsp.h.

◆ SB_MIX_INPUT_RIGHT_GAIN

#define SB_MIX_INPUT_RIGHT_GAIN   0x40

Definition at line 110 of file sbdsp.h.

◆ SB_MIX_INPUT_RIGHT_SWITCHES

#define SB_MIX_INPUT_RIGHT_SWITCHES   0x3E

Definition at line 108 of file sbdsp.h.

◆ SB_MIX_LEGACY_MIC_LEVEL

#define SB_MIX_LEGACY_MIC_LEVEL   0x0A

Definition at line 84 of file sbdsp.h.

◆ SB_MIX_LINE_LEFT_LEVEL

#define SB_MIX_LINE_LEFT_LEVEL   0x38

Definition at line 102 of file sbdsp.h.

◆ SB_MIX_LINE_LEFT_SWITCH

#define SB_MIX_LINE_LEFT_SWITCH   0x04

Definition at line 125 of file sbdsp.h.

◆ SB_MIX_LINE_LEVEL

#define SB_MIX_LINE_LEVEL   0x2E

Definition at line 88 of file sbdsp.h.

◆ SB_MIX_LINE_RIGHT_LEVEL

#define SB_MIX_LINE_RIGHT_LEVEL   0x39

Definition at line 103 of file sbdsp.h.

◆ SB_MIX_LINE_RIGHT_SWITCH

#define SB_MIX_LINE_RIGHT_SWITCH   0x08

Definition at line 126 of file sbdsp.h.

◆ SB_MIX_MASTER_LEFT_LEVEL

#define SB_MIX_MASTER_LEFT_LEVEL   0x30

Definition at line 94 of file sbdsp.h.

◆ SB_MIX_MASTER_LEVEL

#define SB_MIX_MASTER_LEVEL   0x22

Definition at line 85 of file sbdsp.h.

◆ SB_MIX_MASTER_RIGHT_LEVEL

#define SB_MIX_MASTER_RIGHT_LEVEL   0x31

Definition at line 95 of file sbdsp.h.

◆ SB_MIX_MIC_LEVEL

#define SB_MIX_MIC_LEVEL   0x3A

Definition at line 104 of file sbdsp.h.

◆ SB_MIX_MIC_SWITCH

#define SB_MIX_MIC_SWITCH   0x40

Definition at line 129 of file sbdsp.h.

◆ SB_MIX_MIDI_LEFT_LEVEL

#define SB_MIX_MIDI_LEFT_LEVEL   0x34

Definition at line 98 of file sbdsp.h.

◆ SB_MIX_MIDI_LEFT_SWITCH

#define SB_MIX_MIDI_LEFT_SWITCH   0x01

Definition at line 123 of file sbdsp.h.

◆ SB_MIX_MIDI_RIGHT_LEVEL

#define SB_MIX_MIDI_RIGHT_LEVEL   0x35

Definition at line 99 of file sbdsp.h.

◆ SB_MIX_MIDI_RIGHT_SWITCH

#define SB_MIX_MIDI_RIGHT_SWITCH   0x02

Definition at line 124 of file sbdsp.h.

◆ SB_MIX_OUTPUT_LEFT_GAIN

#define SB_MIX_OUTPUT_LEFT_GAIN   0x41

Definition at line 111 of file sbdsp.h.

◆ SB_MIX_OUTPUT_RIGHT_GAIN

#define SB_MIX_OUTPUT_RIGHT_GAIN   0x42

Definition at line 112 of file sbdsp.h.

◆ SB_MIX_OUTPUT_SWITCHES

#define SB_MIX_OUTPUT_SWITCHES   0x3C

Definition at line 106 of file sbdsp.h.

◆ SB_MIX_PC_SPEAKER_LEVEL

#define SB_MIX_PC_SPEAKER_LEVEL   0x3B

Definition at line 105 of file sbdsp.h.

◆ SB_MIX_RESET

#define SB_MIX_RESET   0x00

Definition at line 93 of file sbdsp.h.

◆ SB_MIX_TREBLE_LEFT_LEVEL

#define SB_MIX_TREBLE_LEFT_LEVEL   0x44

Definition at line 114 of file sbdsp.h.

◆ SB_MIX_TREBLE_RIGHT_LEVEL

#define SB_MIX_TREBLE_RIGHT_LEVEL   0x45

Definition at line 115 of file sbdsp.h.

◆ SB_MIX_VOC_LEFT_LEVEL

#define SB_MIX_VOC_LEFT_LEVEL   0x32

Definition at line 96 of file sbdsp.h.

◆ SB_MIX_VOC_LEVEL

#define SB_MIX_VOC_LEVEL   0x04

Definition at line 83 of file sbdsp.h.

◆ SB_MIX_VOC_RIGHT_LEVEL

#define SB_MIX_VOC_RIGHT_LEVEL   0x33

Definition at line 97 of file sbdsp.h.

◆ SOUND_BLASTER_16

#define SOUND_BLASTER_16   L"Sound Blaster 16"

Definition at line 29 of file sbdsp.h.

◆ SOUND_BLASTER_1_0

#define SOUND_BLASTER_1_0   L"Sound Blaster 1.0"

Definition at line 25 of file sbdsp.h.

◆ SOUND_BLASTER_1_5

#define SOUND_BLASTER_1_5   L"Sound Blaster 1.5"

Definition at line 26 of file sbdsp.h.

◆ SOUND_BLASTER_2_0

#define SOUND_BLASTER_2_0   L"Sound Blaster 2.0"

Definition at line 27 of file sbdsp.h.

◆ SOUND_BLASTER_PRO

#define SOUND_BLASTER_PRO   L"Sound Blaster Pro"

Definition at line 28 of file sbdsp.h.

◆ WRITE_SB_AFM_DATA

#define WRITE_SB_AFM_DATA (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x03, x)

Definition at line 41 of file sbdsp.h.

◆ WRITE_SB_AFM_REGISTER

#define WRITE_SB_AFM_REGISTER (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x02, x)

Definition at line 40 of file sbdsp.h.

◆ WRITE_SB_DSP_COMMAND

#define WRITE_SB_DSP_COMMAND (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x0C, x)

Definition at line 55 of file sbdsp.h.

◆ WRITE_SB_DSP_DATA

#define WRITE_SB_DSP_DATA (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x0C, x)

Definition at line 54 of file sbdsp.h.

◆ WRITE_SB_DSP_RESET

#define WRITE_SB_DSP_RESET (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x06, x)

Definition at line 47 of file sbdsp.h.

◆ WRITE_SB_FM1_DATA

#define WRITE_SB_FM1_DATA (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x01, x)

Definition at line 37 of file sbdsp.h.

◆ WRITE_SB_FM1_REGISTER

#define WRITE_SB_FM1_REGISTER (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp, x)

Definition at line 36 of file sbdsp.h.

◆ WRITE_SB_FM2_DATA

#define WRITE_SB_FM2_DATA (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x09, x)

Definition at line 51 of file sbdsp.h.

◆ WRITE_SB_FM2_REGISTER

#define WRITE_SB_FM2_REGISTER (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x08, x)

Definition at line 50 of file sbdsp.h.

◆ WRITE_SB_MIXER_DATA

#define WRITE_SB_MIXER_DATA (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x05, x)

Definition at line 45 of file sbdsp.h.

◆ WRITE_SB_MIXER_REGISTER

#define WRITE_SB_MIXER_REGISTER (   bp,
  x 
)    WRITE_PORT_UCHAR((PUCHAR) bp+0x04, x)

Definition at line 43 of file sbdsp.h.

Function Documentation

◆ SbDsp4SetInputRate()

NTSTATUS SbDsp4SetInputRate ( IN PUCHAR  BasePort,
IN USHORT  Rate,
IN ULONG  Timeout 
)

Definition at line 135 of file rate.c.

139{
141
142 /* NOTE - No check for validity of rate! */
143
144 /* Prepare to write the input rate */
145 Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
146 if ( Status != STATUS_SUCCESS )
147 return Status;
148
149 return SbDsp4WriteRate(BasePort, Rate, Timeout);
150}
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:25
static ULONG Timeout
Definition: ping.c:61
NTSTATUS SbDsp4WriteRate(IN PUCHAR BasePort, IN USHORT Rate, IN ULONG Timeout)
Definition: rate.c:94
NTSTATUS SbDspWrite(IN PUCHAR BasePort, IN UCHAR DataByte, IN ULONG Timeout)
Definition: dsp_io.c:99
#define SB_DSP_OUTPUT_RATE
Definition: sbdsp.h:72
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ SbDsp4SetOutputRate()

NTSTATUS SbDsp4SetOutputRate ( IN PUCHAR  BasePort,
IN USHORT  Rate,
IN ULONG  Timeout 
)

Definition at line 117 of file rate.c.

121{
123
124 /* NOTE - No check for validity of rate! */
125
126 /* Prepare to write the output rate */
127 Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
128 if ( Status != STATUS_SUCCESS )
129 return Status;
130
131 return SbDsp4WriteRate(BasePort, Rate, Timeout);
132}

◆ SbDspDisableSpeaker()

NTSTATUS SbDspDisableSpeaker ( IN PUCHAR  BasePort,
IN ULONG  Timeout 
)

Definition at line 27 of file speaker.c.

30{
31 return SbDspWrite(BasePort, SB_DSP_SPEAKER_OFF, Timeout);
32}
#define SB_DSP_SPEAKER_OFF
Definition: sbdsp.h:76

◆ SbDspEnableSpeaker()

NTSTATUS SbDspEnableSpeaker ( IN PUCHAR  BasePort,
IN ULONG  Timeout 
)

Definition at line 19 of file speaker.c.

22{
23 return SbDspWrite(BasePort, SB_DSP_SPEAKER_ON, Timeout);
24}
#define SB_DSP_SPEAKER_ON
Definition: sbdsp.h:75

◆ SbDspGetVersion()

NTSTATUS SbDspGetVersion ( IN PUCHAR  BasePort,
OUT PUCHAR  MajorVersion,
OUT PUCHAR  MinorVersion,
IN ULONG  Timeout 
)

Definition at line 19 of file version.c.

24{
26
27 /* Make sure our parameters are sane */
28 if ( ! MajorVersion )
30
31 if ( ! MinorVersion )
33
34 /* Send version request */
36 if ( Status != STATUS_SUCCESS )
37 return Status;
38
39 /* Get the major version */
41 if ( Status != STATUS_SUCCESS )
42 return FALSE;
43
44 /* Get the minor version */
46 return Status;
47}
#define FALSE
Definition: types.h:117
ULONG MajorVersion
Definition: ros_glue.cpp:4
ULONG MinorVersion
Definition: ros_glue.cpp:5
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
NTSTATUS SbDspRead(IN PUCHAR BasePort, OUT PUCHAR DataByte, IN ULONG Timeout)
Definition: dsp_io.c:120
#define SB_DSP_VERSION
Definition: sbdsp.h:78

◆ SbDspIsSpeakerEnabled()

NTSTATUS SbDspIsSpeakerEnabled ( IN PUCHAR  BasePort,
OUT PBOOLEAN  IsEnabled,
IN ULONG  Timeout 
)

Definition at line 38 of file speaker.c.

42{
44 UCHAR SpeakerStatus = 0;
45
46 if ( ! IsEnabled )
48
49 /* Request the speaker status */
51 if ( Status != STATUS_SUCCESS )
52 return Status;
53
54 /* Obtain the status */
55 Status = SbDspRead(BasePort, &SpeakerStatus, Timeout);
56 if ( Status != STATUS_SUCCESS )
57 return Status;
58
59 DbgPrint("SBDSP - SpeakerStatus is %02x\n", SpeakerStatus);
60 *IsEnabled = (SpeakerStatus == 0xFF);
61
62 return STATUS_SUCCESS;
63}
return pProvider IsEnabled(ProviderControl)
#define DbgPrint
Definition: hal.h:12
#define SB_DSP_SPEAKER_STATUS
Definition: sbdsp.h:77
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ SbDspIsValidInputRate()

BOOLEAN SbDspIsValidInputRate ( IN UCHAR  MajorVersion,
IN UCHAR  MinorVersion,
IN USHORT  Rate,
IN BOOLEAN  Stereo 
)

Definition at line 19 of file rate.c.

24{
25 if ( MajorVersion == 1 )
26 {
27 if ( Stereo )
28 return FALSE;
29
30 return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
31 }
32 else if ( MajorVersion == 2 )
33 {
34 if ( Stereo )
35 return FALSE;
36
37 if ( MinorVersion == 0 )
38 return ( ( Rate >= 4000 ) && ( Rate <= 15000 ) );
39 else
40 return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
41 }
42 else if ( MajorVersion == 3 )
43 {
44 if ( Stereo )
45 return FALSE;
46
47 return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
48 }
49 else /* 4.00 and above */
50 {
51 return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
52 }
53}

◆ SbDspIsValidOutputRate()

BOOLEAN SbDspIsValidOutputRate ( IN UCHAR  MajorVersion,
IN UCHAR  MinorVersion,
IN USHORT  Rate,
IN BOOLEAN  Stereo 
)

Definition at line 56 of file rate.c.

61{
62 if ( MajorVersion == 1 )
63 {
64 if ( Stereo )
65 return FALSE;
66
67 return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
68 }
69 else if ( MajorVersion == 2 )
70 {
71 if ( Stereo )
72 return FALSE;
73
74 if ( MinorVersion == 0 )
75 return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
76 else
77 return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
78 }
79 else if ( MajorVersion == 3 )
80 {
81 if ( ! Stereo )
82 return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
83 else
84 return ( ( Rate >= 11025 ) && ( Rate <= 22050 ) );
85 }
86 else /* 4.00 and above */
87 {
88 return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
89 }
90}

◆ SbDspRead()

NTSTATUS SbDspRead ( IN PUCHAR  BasePort,
OUT PUCHAR  DataByte,
IN ULONG  Timeout 
)

Definition at line 120 of file dsp_io.c.

124{
126
127 if ( ! DataByte )
128 {
130 }
131
132 Status = SbDspWaitToRead(BasePort, Timeout);
133
134 if ( Status != STATUS_SUCCESS )
135 {
136 return Status;
137 }
138
139 *DataByte = READ_SB_DSP_DATA(BasePort);
140 DbgPrint("SBDSP - Read %02x\n", *DataByte);
141
142 return STATUS_SUCCESS;
143}
NTSTATUS SbDspWaitToRead(IN PUCHAR BasePort, IN ULONG Timeout)
Definition: dsp_io.c:81
#define READ_SB_DSP_DATA(bp)
Definition: sbdsp.h:53

Referenced by SbDspGetVersion(), and SbDspIsSpeakerEnabled().

◆ SbDspReset()

NTSTATUS SbDspReset ( IN PUCHAR  BasePort,
IN ULONG  Timeout 
)

Definition at line 19 of file dsp_io.c.

22{
23 ULONG Expiry;
24 BOOLEAN DataAvailable = FALSE;
25
26 /* Should be called from DriverEntry with this IRQL */
28
29 WRITE_SB_DSP_RESET(BasePort, 0x01);
30 SleepMs(50); /* Should be enough */
31 WRITE_SB_DSP_RESET(BasePort, 0x00);
32
33 Expiry = QuerySystemTimeMs() + Timeout;
34
35 /* Wait for data to be available */
36 while ( (QuerySystemTimeMs() < Expiry) || ( Timeout == 0) )
37 {
38 if ( SB_DSP_DATA_AVAILABLE(BasePort) )
39 {
40 DataAvailable = TRUE;
41 break;
42 }
43 }
44
45 if ( ! DataAvailable )
46 {
47 return STATUS_TIMEOUT;
48 }
49
50 /* Data is available - wait for the "DSP ready" code */
51 while ( (QuerySystemTimeMs() < Expiry) || ( Timeout == 0) )
52 {
53 if ( READ_SB_DSP_DATA(BasePort) == SB_DSP_READY )
54 {
55 return STATUS_SUCCESS;
56 }
57 }
58
59 return STATUS_TIMEOUT;
60}
unsigned char BOOLEAN
#define STATUS_TIMEOUT
Definition: d3dkmdt.h:49
#define TRUE
Definition: types.h:120
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define ASSERT(a)
Definition: mode.c:44
#define SB_DSP_READY
Definition: sndblst.h:19
#define WRITE_SB_DSP_RESET(bp, x)
Definition: sbdsp.h:47
#define SB_DSP_DATA_AVAILABLE(bp)
Definition: sbdsp.h:62
VOID SleepMs(ULONG Milliseconds)
Definition: time.c:28
ULONG QuerySystemTimeMs()
Definition: time.c:39
uint32_t ULONG
Definition: typedefs.h:59

◆ SbDspWaitToRead()

NTSTATUS SbDspWaitToRead ( IN PUCHAR  BasePort,
IN ULONG  Timeout 
)

Definition at line 81 of file dsp_io.c.

84{
85 ULONG Expiry = QuerySystemTimeMs() + Timeout;
86
87 while ( (QuerySystemTimeMs() < Expiry) || (Timeout == 0) )
88 {
89 if ( SB_DSP_DATA_AVAILABLE(BasePort) )
90 {
91 return STATUS_SUCCESS;
92 }
93 }
94
95 return STATUS_TIMEOUT;
96}

Referenced by SbDspRead().

◆ SbDspWaitToWrite()

NTSTATUS SbDspWaitToWrite ( IN PUCHAR  BasePort,
IN ULONG  Timeout 
)

Definition at line 63 of file dsp_io.c.

66{
67 ULONG Expiry = QuerySystemTimeMs() + Timeout;
68
69 while ( (QuerySystemTimeMs() < Expiry) || (Timeout == 0) )
70 {
71 if ( SB_DSP_CLEAR_TO_SEND(BasePort) )
72 {
73 return STATUS_SUCCESS;
74 }
75 }
76
77 return STATUS_TIMEOUT;
78}
#define SB_DSP_CLEAR_TO_SEND(bp)
Definition: sbdsp.h:58

Referenced by SbDspWrite().

◆ SbDspWrite()

NTSTATUS SbDspWrite ( IN PUCHAR  BasePort,
IN UCHAR  DataByte,
IN ULONG  Timeout 
)

Definition at line 99 of file dsp_io.c.

103{
105
106 Status = SbDspWaitToWrite(BasePort, Timeout);
107
108 if ( Status != STATUS_SUCCESS )
109 {
110 return Status;
111 }
112
113 DbgPrint("SBDSP - Writing %02x\n", DataByte);
114 WRITE_SB_DSP_DATA(BasePort, DataByte);
115
116 return STATUS_SUCCESS;
117}
NTSTATUS SbDspWaitToWrite(IN PUCHAR BasePort, IN ULONG Timeout)
Definition: dsp_io.c:63
#define WRITE_SB_DSP_DATA(bp, x)
Definition: sbdsp.h:54

Referenced by SbDsp4SetInputRate(), SbDsp4SetOutputRate(), SbDsp4WriteRate(), SbDspDisableSpeaker(), SbDspEnableSpeaker(), SbDspGetVersion(), and SbDspIsSpeakerEnabled().

◆ SbMixerDisableAGC()

VOID SbMixerDisableAGC ( IN PUCHAR  BasePort)

Definition at line 230 of file mixer.c.

231{
232 /* Untested... */
234 WRITE_SB_MIXER_DATA(BasePort, 0);
235}
#define WRITE_SB_MIXER_DATA(bp, x)
Definition: sbdsp.h:45
#define WRITE_SB_MIXER_REGISTER(bp, x)
Definition: sbdsp.h:43
#define SB_MIX_AGC
Definition: sbdsp.h:113

◆ SbMixerEnableAGC()

VOID SbMixerEnableAGC ( IN PUCHAR  BasePort)

Definition at line 222 of file mixer.c.

223{
224 /* Untested... */
226 WRITE_SB_MIXER_DATA(BasePort, 1);
227}

◆ SbMixerGetLevel()

NTSTATUS SbMixerGetLevel ( IN PUCHAR  BasePort,
IN UCHAR  Line,
OUT PUCHAR  Level 
)

Definition at line 185 of file mixer.c.

189{
190 UCHAR PackedLevel = 0;
192
193 if ( ! Level )
195
196 WRITE_SB_MIXER_REGISTER(BasePort, Line);
197 PackedLevel = READ_SB_MIXER_DATA(BasePort);
198
199 Status = SbMixerUnpackLevelData(Line, PackedLevel, Level);
200
201 switch ( Status )
202 {
203 case STATUS_SUCCESS :
204 break;
205
208
211
212 default :
213 return Status;
214 };
215
216 DbgPrint("SbMixerGetLevel: Line 0x%x, raw level 0x%x, packed 0x%x\n", Line, Level, PackedLevel);
217
218 return STATUS_SUCCESS;
219}
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define READ_SB_MIXER_DATA(bp)
Definition: sbdsp.h:44
NTSTATUS SbMixerUnpackLevelData(IN UCHAR Line, IN UCHAR PackedLevel, OUT PUCHAR Level)
Definition: mixer.c:96
Definition: ncftp.h:79
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

◆ SbMixerIsAGCEnabled()

BOOLEAN SbMixerIsAGCEnabled ( IN PUCHAR  BasePort)

Definition at line 238 of file mixer.c.

239{
240 /* Untested... */
242 return (READ_SB_MIXER_DATA(BasePort) != 0);
243}

◆ SbMixerPackLevelData()

NTSTATUS SbMixerPackLevelData ( IN UCHAR  Line,
IN UCHAR  Level,
OUT PUCHAR  PackedLevel 
)

Definition at line 31 of file mixer.c.

35{
36 if ( ! PackedLevel )
38
39 switch ( Line )
40 {
51 case SB_MIX_MIC_LEVEL :
52 case SB_MIX_LEGACY_MIC_LEVEL : /* is this correct? */
53 {
54 if ( Level >= 0x20 )
56
57 *PackedLevel = Level << 3;
58 return STATUS_SUCCESS;
59 }
60
65 {
66 if ( Level >= 0x04 )
68
69 *PackedLevel = Level << 6;
70 return STATUS_SUCCESS;
71 }
72
73 case SB_MIX_VOC_LEVEL : /* legacy */
75 case SB_MIX_FM_LEVEL :
76 case SB_MIX_CD_LEVEL :
78 case SB_MIX_TREBLE_LEFT_LEVEL : /* bass/treble */
82 {
83 if ( Level >= 0x10 )
85
86 *PackedLevel = Level << 4;
87 return STATUS_SUCCESS;
88 }
89
90 default :
92 };
93}
#define SB_MIX_LINE_LEVEL
Definition: sbdsp.h:88
#define SB_MIX_CD_RIGHT_LEVEL
Definition: sbdsp.h:101
#define SB_MIX_MIDI_LEFT_LEVEL
Definition: sbdsp.h:98
#define SB_MIX_INPUT_LEFT_GAIN
Definition: sbdsp.h:109
#define SB_MIX_MIC_LEVEL
Definition: sbdsp.h:104
#define SB_MIX_BASS_RIGHT_LEVEL
Definition: sbdsp.h:117
#define SB_MIX_MASTER_LEFT_LEVEL
Definition: sbdsp.h:94
#define SB_MIX_CD_LEVEL
Definition: sbdsp.h:87
#define SB_MIX_INPUT_RIGHT_GAIN
Definition: sbdsp.h:110
#define SB_MIX_MASTER_LEVEL
Definition: sbdsp.h:85
#define SB_MIX_VOC_LEFT_LEVEL
Definition: sbdsp.h:96
#define SB_MIX_BASS_LEFT_LEVEL
Definition: sbdsp.h:116
#define SB_MIX_LINE_RIGHT_LEVEL
Definition: sbdsp.h:103
#define SB_MIX_MASTER_RIGHT_LEVEL
Definition: sbdsp.h:95
#define SB_MIX_LEGACY_MIC_LEVEL
Definition: sbdsp.h:84
#define SB_MIX_VOC_LEVEL
Definition: sbdsp.h:83
#define SB_MIX_OUTPUT_LEFT_GAIN
Definition: sbdsp.h:111
#define SB_MIX_TREBLE_LEFT_LEVEL
Definition: sbdsp.h:114
#define SB_MIX_OUTPUT_RIGHT_GAIN
Definition: sbdsp.h:112
#define SB_MIX_TREBLE_RIGHT_LEVEL
Definition: sbdsp.h:115
#define SB_MIX_VOC_RIGHT_LEVEL
Definition: sbdsp.h:97
#define SB_MIX_LINE_LEFT_LEVEL
Definition: sbdsp.h:102
#define SB_MIX_FM_LEVEL
Definition: sbdsp.h:86
#define SB_MIX_CD_LEFT_LEVEL
Definition: sbdsp.h:100
#define SB_MIX_MIDI_RIGHT_LEVEL
Definition: sbdsp.h:99

Referenced by SbMixerSetLevel().

◆ SbMixerReset()

VOID SbMixerReset ( IN PUCHAR  BasePort)

Definition at line 24 of file mixer.c.

25{
27 /* Are we meant to send anything else? */
28}
#define SB_MIX_RESET
Definition: sbdsp.h:93

◆ SbMixerSetLevel()

NTSTATUS SbMixerSetLevel ( IN PUCHAR  BasePort,
IN UCHAR  Line,
IN UCHAR  Level 
)

Definition at line 151 of file mixer.c.

155{
156 UCHAR PackedLevel = 0;
158
159 Status = SbMixerPackLevelData(Line, Level, &PackedLevel);
160
161 switch ( Status )
162 {
163 case STATUS_SUCCESS :
164 break;
165
168
171
172 default :
173 return Status;
174 };
175
176 DbgPrint("SbMixerSetLevel: Line 0x%x, raw level 0x%x, packed 0x%x\n", Line, Level, PackedLevel);
177
178 WRITE_SB_MIXER_REGISTER(BasePort, Line);
179 WRITE_SB_MIXER_DATA(BasePort, PackedLevel);
180
181 return STATUS_SUCCESS;
182}
NTSTATUS SbMixerPackLevelData(IN UCHAR Line, IN UCHAR Level, OUT PUCHAR PackedLevel)
Definition: mixer.c:31

◆ SbMixerUnpackLevelData()

NTSTATUS SbMixerUnpackLevelData ( IN UCHAR  Line,
IN UCHAR  PackedLevel,
OUT PUCHAR  Level 
)

Definition at line 96 of file mixer.c.

100{
101 if ( ! Level )
103
104 switch ( Line )
105 {
116 case SB_MIX_MIC_LEVEL :
117 {
118 *Level = PackedLevel >> 3;
119 return STATUS_SUCCESS;
120 }
121
126 {
127 *Level = PackedLevel >> 6;
128 return STATUS_SUCCESS;
129 }
130
131 case SB_MIX_VOC_LEVEL : /* legacy */
133 case SB_MIX_FM_LEVEL :
134 case SB_MIX_CD_LEVEL :
135 case SB_MIX_LINE_LEVEL :
136 case SB_MIX_TREBLE_LEFT_LEVEL : /* bass/treble */
140 {
141 *Level = PackedLevel >> 4;
142 return STATUS_SUCCESS;
143 }
144
145 default :
147 };
148}

Referenced by SbMixerGetLevel().