Author: silverblade
Date: Tue Jul 1 21:16:51 2008
New Revision: 34245
URL:
http://svn.reactos.org/svn/reactos?rev=34245&view=rev
Log:
Splitting of audio support libraries, to avoid including un-needed code when
building actual audio drivers (eg, only NT4 requires named audio device files).
This allows sbdsp to be split into relevant source files rather than being a
single file.
Added:
branches/silverblade-audio/lib/drivers/sound/legacy/
branches/silverblade-audio/lib/drivers/sound/legacy/devname.c
- copied unchanged from r34242,
branches/silverblade-audio/lib/drivers/sound/devname.c
branches/silverblade-audio/lib/drivers/sound/legacy/hardware.c
- copied unchanged from r34242,
branches/silverblade-audio/lib/drivers/sound/hardware.c
branches/silverblade-audio/lib/drivers/sound/legacy/legacy.rbuild (with props)
branches/silverblade-audio/lib/drivers/sound/shared/
branches/silverblade-audio/lib/drivers/sound/shared/shared.rbuild (with props)
branches/silverblade-audio/lib/drivers/sound/shared/time.c
- copied unchanged from r34242, branches/silverblade-audio/lib/drivers/sound/time.c
branches/silverblade-audio/lib/drivers/sound/soundblaster/
branches/silverblade-audio/lib/drivers/sound/soundblaster/dsp_io.c (with props)
branches/silverblade-audio/lib/drivers/sound/soundblaster/mixer.c (with props)
branches/silverblade-audio/lib/drivers/sound/soundblaster/rate.c (with props)
branches/silverblade-audio/lib/drivers/sound/soundblaster/soundblaster.rbuild (with
props)
branches/silverblade-audio/lib/drivers/sound/soundblaster/speaker.c (with props)
branches/silverblade-audio/lib/drivers/sound/soundblaster/version.c (with props)
branches/silverblade-audio/lib/drivers/sound/uartmidi/
branches/silverblade-audio/lib/drivers/sound/uartmidi/midiuart.c
- copied unchanged from r34242,
branches/silverblade-audio/lib/drivers/sound/midiuart.c
branches/silverblade-audio/lib/drivers/sound/uartmidi/uartmidi.rbuild (with props)
Removed:
branches/silverblade-audio/lib/drivers/sound/devname.c
branches/silverblade-audio/lib/drivers/sound/hardware.c
branches/silverblade-audio/lib/drivers/sound/midiuart.c
branches/silverblade-audio/lib/drivers/sound/sbdsp.c
branches/silverblade-audio/lib/drivers/sound/time.c
Modified:
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.rbuild
branches/silverblade-audio/include/reactos/libs/sound/sbdsp.h
branches/silverblade-audio/lib/drivers/sound/sound.rbuild
Modified: branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/drivers/multi…
==============================================================================
--- branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.rbuild
[iso-8859-1] (original)
+++ branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.rbuild
[iso-8859-1] Tue Jul 1 21:16:51 2008
@@ -6,7 +6,8 @@
<include base="sb16_nt4">..</include>
<include base="ReactOS">include/reactos/libs/sound</include>
<importlibrary definition="sb16_nt4.def" />
- <library>sound</library>
+ <library>soundblaster</library>
+ <library>audio</library>
<library>ntoskrnl</library>
<library>hal</library>
<file>main.c</file>
Modified: branches/silverblade-audio/include/reactos/libs/sound/sbdsp.h
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
==============================================================================
--- branches/silverblade-audio/include/reactos/libs/sound/sbdsp.h [iso-8859-1] (original)
+++ branches/silverblade-audio/include/reactos/libs/sound/sbdsp.h [iso-8859-1] Tue Jul 1
21:16:51 2008
@@ -77,6 +77,44 @@
#define SB_DSP_SPEAKER_STATUS 0xD8
#define SB_DSP_VERSION 0xE1
+/*
+ Mixer lines (legacy)
+*/
+#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
+
+/*
+ Mixer lines
+*/
+#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_LEVEL 0x3D
+#define SB_MIX_INPUT_RIGHT_LEVEL 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
+
/*
Reset the Sound Blaster DSP.
Removed: branches/silverblade-audio/lib/drivers/sound/devname.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/devname.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/devname.c (removed)
@@ -1,385 +1,0 @@
-/*
- ReactOS Sound System
- Device naming & creation helper routines
-
- Author:
- Andrew Greenwood (silverblade(a)reactos.org)
-
- History:
- 25 May 2008 - Created
-*/
-
-#include <ntddk.h>
-#include <ntddsnd.h>
-#include <debug.h>
-
-
-/*
- Default device names
-
- Just to keep things tidy, we define a structure to hold both the \\Device
- and \\DosDevices names, and then fill this structure with the default
- device names that can be found in NTDDSND.H
-*/
-
-typedef struct _DEVICE_NAME_GROUP
-{
- PCWSTR DeviceName;
- PCWSTR DosDeviceName;
-} DEVICE_NAME_GROUP;
-
-DEVICE_NAME_GROUP SoundDeviceNameBodies[6] =
-{
- {
- DD_WAVE_IN_DEVICE_NAME_U,
- DD_WAVE_IN_DOS_DEVICE_NAME_U
- },
- {
- DD_WAVE_OUT_DEVICE_NAME_U,
- DD_WAVE_OUT_DOS_DEVICE_NAME_U
- },
- {
- DD_MIDI_IN_DEVICE_NAME_U,
- DD_MIDI_IN_DOS_DEVICE_NAME_U
- },
- {
- DD_MIDI_OUT_DEVICE_NAME_U,
- DD_MIDI_OUT_DOS_DEVICE_NAME_U
- },
- {
- DD_MIX_DEVICE_NAME_U,
- DD_MIX_DOS_DEVICE_NAME_U
- },
- {
- DD_AUX_DEVICE_NAME_U,
- DD_AUX_DOS_DEVICE_NAME_U
- }
-};
-
-
-/*
- ConstructDeviceName
-
- This takes a wide-character string containing the device name body (for
- example, "\\Device\\WaveOut") and appends the device index, forming a
- string like "\\Device\\WaveOut0", and so on.
-
- The resulting device name is a unicode string.
-*/
-
-NTSTATUS
-ConstructDeviceName(
- IN PCWSTR Path,
- IN UCHAR Index,
- OUT PUNICODE_STRING DeviceName)
-{
- UNICODE_STRING UnicodePath;
- UNICODE_STRING UnicodeIndex;
- WCHAR IndexStringBuffer[5];
- USHORT Size;
- USHORT LastCharacterIndex;
-
- /* Check for NULL parameters */
- if ( ( ! Path ) || ( ! DeviceName ) )
- {
- DPRINT("Unexpected NULL parameter");
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Range-check */
- if ( Index >= SOUND_MAX_DEVICES )
- {
- DPRINT("Device index %d out of range", Index);
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Initialise the unicode path string */
- RtlInitUnicodeString(&UnicodePath, Path);
-
- /* Calculate the length to hold the full string */
- Size = UnicodePath.Length +
- sizeof(IndexStringBuffer) +
- sizeof(UNICODE_NULL);
-
- /* Allocate memory for DeviceName */
- DeviceName->Buffer = ExAllocatePool(PagedPool, Size);
- DeviceName->MaximumLength = Size;
-
- if ( ! DeviceName->Buffer )
- {
- DPRINT("Couldn't allocate memory for device name string");
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- /* Copy the path */
- RtlCopyUnicodeString(DeviceName, &UnicodePath);
-
- /* Convert Index to string and append */
- UnicodeIndex.Buffer = IndexStringBuffer;
- UnicodeIndex.MaximumLength = sizeof(IndexStringBuffer);
-
- RtlIntegerToUnicodeString((ULONG)Index, 10, &UnicodeIndex);
- RtlAppendUnicodeStringToString(DeviceName, &UnicodeIndex);
-
- /* Terminate the string */
- LastCharacterIndex = DeviceName->Length / sizeof(UNICODE_NULL);
- DeviceName->Buffer[LastCharacterIndex] = UNICODE_NULL;
-
- return STATUS_SUCCESS;
-}
-
-
-/*
- FreeUnicodeStringBuffer
-
- A small helper routine to free a unicode string buffer, nullify the
- buffer and reset the lengths to zero.
-*/
-
-VOID
-FreeUnicodeStringBuffer(IN PUNICODE_STRING String)
-{
- ASSERT(String != NULL);
- ASSERT(String->Buffer != NULL);
-
- ExFreePool(String->Buffer);
-
- String->Buffer = NULL;
- String->Length = 0;
- String->MaximumLength = 0;
-}
-
-
-/*
- GetDefaultSoundDeviceNameBodies
-
- Simply accesses the SoundDeviceNameBodies struct defined earlier and
- fills the DeviceNameBody and DosDeviceNameBody parameters accordingly.
-
- Basically a "safe" way to access the array and perform two assignments
- with one call, as this will assign the name and DOS name if a valid
- DeviceType is passed, otherwise it will fail with STATUS_INVALID_PARAMETER.
-*/
-
-NTSTATUS
-GetDefaultSoundDeviceNameBodies(
- IN UCHAR DeviceType,
- OUT PCWSTR* DeviceNameBody,
- OUT PCWSTR* DosDeviceNameBody)
-{
- ASSERT(DeviceNameBody != NULL);
- ASSERT(DosDeviceNameBody != NULL);
-
- if ( DeviceType > MAX_DEVICE_TYPE )
- {
- DPRINT("Invalid device type");
- return STATUS_INVALID_PARAMETER;
- }
-
- *DeviceNameBody = SoundDeviceNameBodies[DeviceType].DeviceName;
- *DosDeviceNameBody = SoundDeviceNameBodies[DeviceType].DosDeviceName;
-
- return STATUS_SUCCESS;
-}
-
-
-/*
- ConstructSoundDeviceNames
-
- Given two wide-character strings and a device index, convert these into
- two unicode strings with the index appended to the end.
-
- This is intended for converting a device name and a DOS device name at
- the same time.
-*/
-
-NTSTATUS
-ConstructSoundDeviceNames(
- IN PCWSTR DeviceNameBody,
- IN PCWSTR DosDeviceNameBody,
- IN UCHAR Index,
- OUT PUNICODE_STRING FullDeviceName,
- OUT PUNICODE_STRING FullDosDeviceName)
-{
- NTSTATUS Status;
-
- /* Check for NULL parameters */
- if ( ( ! DeviceNameBody ) || ( ! DosDeviceNameBody ) ||
- ( ! FullDeviceName ) || ( ! FullDosDeviceName ) )
- {
- DPRINT("Unexpected NULL parameter");
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Range-check */
- if ( Index >= SOUND_MAX_DEVICES )
- {
- DPRINT("Device %d exceeds maximum", Index);
- return STATUS_INVALID_PARAMETER;
- }
-
- Status = ConstructDeviceName(DeviceNameBody, Index, FullDeviceName);
-
- if ( ! NT_SUCCESS(Status) )
- {
- /* No need to clean up on failure here */
- return Status;
- }
-
- Status = ConstructDeviceName(DosDeviceNameBody, Index, FullDosDeviceName);
-
- if ( ! NT_SUCCESS(Status) )
- {
- /* We need to free the string we successfully got earlier */
- FreeUnicodeStringBuffer(FullDeviceName);
- return Status;
- }
-
- return STATUS_SUCCESS;
-}
-
-
-/*
- CreateSoundDevice
-
- Creates a device and symbolically-links a DOS device to this. Use this
- when you want to specify alternative device names to the defaults
- (eg: "\\Device\\MySoundDev" rather than "\\Device\\WaveOut")
-*/
-
-NTSTATUS
-CreateSoundDevice(
- IN PDRIVER_OBJECT DriverObject,
- IN PCWSTR WideDeviceName,
- IN PCWSTR WideDosDeviceName,
- IN UCHAR Index,
- IN ULONG ExtensionSize,
- OUT PDEVICE_OBJECT DeviceObject)
-{
- NTSTATUS Status;
-
- UNICODE_STRING DeviceName;
- UNICODE_STRING DosDeviceName;
-
- /* Check for NULL parameters */
- if ( ( ! DriverObject ) || ( ! DeviceObject ) ||
- ( ! WideDeviceName ) || ( ! WideDosDeviceName ) )
- {
- DPRINT("Unexpected NULL parameter");
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Range-check */
- if ( Index >= SOUND_MAX_DEVICES )
- {
- DPRINT("Device index %d exceeds maximum", Index);
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Construct the device and DOS device names */
- Status = ConstructSoundDeviceNames(WideDeviceName,
- WideDosDeviceName,
- Index,
- &DeviceName,
- &DosDeviceName);
-
- if ( ! NT_SUCCESS(Status) )
- {
- return Status;
- }
-
- /* Now create the device */
- Status = IoCreateDevice(DriverObject,
- ExtensionSize,
- &DeviceName,
- FILE_DEVICE_SOUND,
- 0,
- FALSE,
- &DeviceObject);
-
- if ( ! NT_SUCCESS(Status) )
- {
- /* These will have been allocated by ConstructSoundDeviceNames */
- FreeUnicodeStringBuffer(&DeviceName);
- FreeUnicodeStringBuffer(&DosDeviceName);
-
- return Status;
- }
-
- /* Create a symbolic link for the DOS deviec name */
- Status = IoCreateSymbolicLink(&DosDeviceName, &DeviceName);
-
- if ( ! NT_SUCCESS(Status) )
- {
- /* IoDeleteDevice( --- What are we deleting? */
-
- /* These will have been allocated by ConstructSoundDeviceNames */
- FreeUnicodeStringBuffer(&DeviceName);
- FreeUnicodeStringBuffer(&DosDeviceName);
-
- return Status;
- }
-
- return STATUS_SUCCESS;
-}
-
-
-/*
- CreateSoundDeviceWithDefaultName
-
- Similar to CreateSoundDevice, except this uses the default device names
- ("\\Device\\WaveOut" etc.) based on the DeviceType parameter.
-*/
-
-NTSTATUS
-CreateSoundDeviceWithDefaultName(
- IN PDRIVER_OBJECT DriverObject,
- IN UCHAR DeviceType,
- IN UCHAR Index,
- IN ULONG ExtensionSize,
- OUT PDEVICE_OBJECT DeviceObject)
-{
- NTSTATUS Status;
- PCWSTR WideDeviceName = NULL;
- PCWSTR WideDosDeviceName = NULL;
-
- /* Check for NULL parameters */
- if ( ( ! DriverObject ) || ( ! DeviceObject ) )
- {
- DPRINT("Unexpected NULL parameter");
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Range-check */
- if ( Index >= SOUND_MAX_DEVICES )
- {
- DPRINT("Device index %d exceeds maximum", Index);
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Look-up the default name based on the device type */
- Status = GetDefaultSoundDeviceNameBodies(DeviceType,
- &WideDeviceName,
- &WideDosDeviceName);
-
- if ( ! NT_SUCCESS(Status) )
- {
- return Status;
- }
-
- /* Go create the device! */
- Status = CreateSoundDevice(DriverObject,
- WideDeviceName,
- WideDosDeviceName,
- Index,
- ExtensionSize,
- DeviceObject);
-
- if ( ! NT_SUCCESS(Status) )
- {
- /* No clean-up to do */
- return Status;
- }
-
- return STATUS_SUCCESS;
-}
Removed: branches/silverblade-audio/lib/drivers/sound/hardware.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/hardware.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/hardware.c (removed)
@@ -1,66 +1,0 @@
-/*
- ReactOS Sound System
- Hardware interaction helper
-
- Author:
- Andrew Greenwood (silverblade(a)reactos.org)
-
- History:
- 25 May 2008 - Created
-
- Notes:
- This uses some obsolete calls (eg: HalGetInterruptVector).
- Might be worth updating this in future to use some of the
- recommended functions like IoReportDetectedDevice and
- IoReportResourceForDetection...
-*/
-
-#include <ntddk.h>
-#include <ntddsnd.h>
-#include <debug.h>
-
-/* NOTE: Disconnect using IoDisconnectInterrupt */
-
-NTSTATUS
-LegacyAttachInterrupt(
- IN PDEVICE_OBJECT DeviceObject,
- IN UCHAR Irq,
- IN PKSERVICE_ROUTINE ServiceRoutine,
- OUT PKINTERRUPT* InterruptObject)
-{
- NTSTATUS Status;
- ULONG Vector;
- KIRQL IrqLevel;
- KAFFINITY Affinity;
-
- DPRINT("Obtaining interrupt vector");
-
- Vector = HalGetInterruptVector(Isa,
- 0,
- Irq,
- Irq,
- &IrqLevel,
- &Affinity);
-
- DPRINT("Vector %d", Vector);
- DPRINT("Connecting IRQ %d", Irq);
-
- Status = IoConnectInterrupt(InterruptObject,
- ServiceRoutine,
- DeviceObject,
- NULL,
- Vector,
- IrqLevel,
- IrqLevel,
- Latched,
- FALSE,
- Affinity,
- FALSE);
-
- if ( Status == STATUS_INVALID_PARAMETER )
- {
- Status = STATUS_DEVICE_CONFIGURATION_ERROR;
- }
-
- return Status;
-}
Added: branches/silverblade-audio/lib/drivers/sound/legacy/legacy.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/legacy/legacy.rbuild (added)
+++ branches/silverblade-audio/lib/drivers/sound/legacy/legacy.rbuild [iso-8859-1] Tue Jul
1 21:16:51 2008
@@ -1,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
+<module name="audioleg" type="staticlibrary"
allowwarnings="true">
+ <define name="__NTDRIVER__"/>
+ <define name="KERNEL"/>
+ <include base="soundblaster">.</include>
+ <include base="ReactOS">include/reactos/libs/sound</include>
+ <file>devname.c</file>
+ <file>hardware.c</file>
+</module>
Propchange: branches/silverblade-audio/lib/drivers/sound/legacy/legacy.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Removed: branches/silverblade-audio/lib/drivers/sound/midiuart.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/midiuart.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/midiuart.c (removed)
@@ -1,93 +1,0 @@
-/*
- ReactOS Sound System
- MIDI UART support
-
- Author:
- Andrew Greenwood (silverblade(a)reactos.org)
-
- History:
- 26 May 2008 - Created
-
- Notes:
- Functions documented in midiuart.h
-*/
-
-#include <ntddk.h>
-#include "midiuart.h"
-
-BOOLEAN
-WaitForMidiUartStatus(
- IN PUCHAR UartBasePort,
- IN UCHAR StatusFlags,
- IN ULONG Timeout)
-{
- ULONG RemainingTime = Timeout;
-
- while ( RemainingTime -- )
- {
- if ( READ_MIDIUART_STATUS(UartBasePort) & StatusFlags )
- {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-BOOLEAN
-WriteMidiUartByte(
- IN PUCHAR UartBasePort,
- IN UCHAR Data,
- IN ULONG Timeout)
-{
- if ( ! WaitForMidiUartCTS(UartBasePort, Timeout) )
- {
- return FALSE;
- }
-
- WRITE_MIDIUART_DATA(UartBasePort, Data);
-
- return TRUE;
-}
-
-BOOLEAN
-WriteMidiUartMulti(
- IN PUCHAR UartBasePort,
- IN PUCHAR Data,
- IN ULONG DataLength,
- IN ULONG Timeout)
-{
- ULONG DataIndex;
-
- for ( DataIndex = 0; DataIndex < DataLength; ++ DataIndex )
- {
- if ( ! WriteMidiUartByte(UartBasePort, Data[DataIndex], Timeout) )
- {
- /* We failed - don't try writing any more */
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-BOOLEAN
-ReadMidiUartByte(
- IN PUCHAR UartBasePort,
- OUT UCHAR* Data,
- IN ULONG Timeout)
-{
- if ( ! Data )
- {
- return FALSE;
- }
-
- if ( ! WaitForMidiUartDTR(UartBasePort, Timeout) )
- {
- return FALSE;
- }
-
- *Data = READ_MIDIUART_DATA(UartBasePort);
-
- return TRUE;
-}
Removed: branches/silverblade-audio/lib/drivers/sound/sbdsp.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/sbdsp.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/sbdsp.c (removed)
@@ -1,359 +1,0 @@
-/*
- ReactOS Sound System
- Sound Blaster DSP support
-
- Author:
- Andrew Greenwood (silverblade(a)reactos.org)
-
- History:
- 26 May 2008 - Created
-
- Notes:
- Functions documented in sbdsp.h
-*/
-
-#include <ntddk.h>
-#include <debug.h>
-
-#include <time.h>
-#include <sbdsp.h>
-
-NTSTATUS
-SbDspReset(
- IN PUCHAR BasePort,
- IN ULONG Timeout)
-{
- ULONG Expiry;
- KIRQL CurrentIrqLevel = KeGetCurrentIrql();
- BOOLEAN DataAvailable = FALSE;
-
- /* Should be called from DriverEntry with this IRQL */
- ASSERT(CurrentIrqLevel == PASSIVE_LEVEL);
-
- WRITE_SB_DSP_RESET(BasePort, 0x01);
- SleepMs(50); /* Should be enough */
- WRITE_SB_DSP_RESET(BasePort, 0x00);
-
- Expiry = QuerySystemTimeMs() + Timeout;
-
- /* Wait for data to be available */
- while ( (QuerySystemTimeMs() < Expiry) || ( Timeout == 0) )
- {
- if ( SB_DSP_DATA_AVAILABLE(BasePort) )
- {
- DataAvailable = TRUE;
- break;
- }
- }
-
- if ( ! DataAvailable )
- {
- return STATUS_TIMEOUT;
- }
-
- /* Data is available - wait for the "DSP ready" code */
- while ( (QuerySystemTimeMs() < Expiry) || ( Timeout == 0) )
- {
- if ( READ_SB_DSP_DATA(BasePort) == SB_DSP_READY )
- {
- return STATUS_SUCCESS;
- }
- }
-
- return STATUS_TIMEOUT;
-}
-
-NTSTATUS
-SbDspWaitToWrite(
- IN PUCHAR BasePort,
- IN ULONG Timeout)
-{
- ULONG Expiry = QuerySystemTimeMs() + Timeout;
-
- while ( (QuerySystemTimeMs() < Expiry) || (Timeout == 0) )
- {
- if ( SB_DSP_CLEAR_TO_SEND(BasePort) )
- {
- return STATUS_SUCCESS;
- }
- }
-
- return STATUS_TIMEOUT;
-}
-
-NTSTATUS
-SbDspWaitToRead(
- IN PUCHAR BasePort,
- IN ULONG Timeout)
-{
- ULONG Expiry = QuerySystemTimeMs() + Timeout;
-
- while ( (QuerySystemTimeMs() < Expiry) || (Timeout == 0) )
- {
- if ( SB_DSP_DATA_AVAILABLE(BasePort) )
- {
- return STATUS_SUCCESS;
- }
- }
-
- return STATUS_TIMEOUT;
-}
-
-NTSTATUS
-SbDspWrite(
- IN PUCHAR BasePort,
- IN UCHAR DataByte,
- IN ULONG Timeout)
-{
- NTSTATUS Status;
-
- Status = SbDspWaitToWrite(BasePort, Timeout);
-
- if ( Status != STATUS_SUCCESS )
- {
- return Status;
- }
-
- DbgPrint("SBDSP - Writing %02x\n", DataByte);
- WRITE_SB_DSP_DATA(BasePort, DataByte);
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-SbDspRead(
- IN PUCHAR BasePort,
- OUT PUCHAR DataByte,
- IN ULONG Timeout)
-{
- NTSTATUS Status;
-
- if ( ! DataByte )
- {
- return STATUS_INVALID_PARAMETER_2;
- }
-
- Status = SbDspWaitToRead(BasePort, Timeout);
-
- if ( Status != STATUS_SUCCESS )
- {
- return Status;
- }
-
- *DataByte = READ_SB_DSP_DATA(BasePort);
- DbgPrint("SBDSP - Read %02x\n", *DataByte);
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-SbDspGetVersion(
- IN PUCHAR BasePort,
- OUT PUCHAR MajorVersion,
- OUT PUCHAR MinorVersion,
- IN ULONG Timeout)
-{
- NTSTATUS Status;
-
- /* Make sure our parameters are sane */
- if ( ! MajorVersion )
- return STATUS_INVALID_PARAMETER_2;
-
- if ( ! MinorVersion )
- return STATUS_INVALID_PARAMETER_3;
-
- /* Send version request */
- Status = SbDspWrite(BasePort, SB_DSP_VERSION, Timeout);
- if ( Status != STATUS_SUCCESS )
- return Status;
-
- /* Get the major version */
- Status = SbDspRead(BasePort, MajorVersion, Timeout);
- if ( Status != STATUS_SUCCESS )
- return FALSE;
-
- /* Get the minor version */
- Status = SbDspRead(BasePort, MinorVersion, Timeout);
- return Status;
-}
-
-NTSTATUS
-SbDspEnableSpeaker(
- IN PUCHAR BasePort,
- IN ULONG Timeout)
-{
- return SbDspWrite(BasePort, SB_DSP_SPEAKER_ON, Timeout);
-}
-
-NTSTATUS
-SbDspDisableSpeaker(
- IN PUCHAR BasePort,
- IN ULONG Timeout)
-{
- return SbDspWrite(BasePort, SB_DSP_SPEAKER_OFF, Timeout);
-}
-
-/*
- VirtualBox doesn't seem to support this.
-*/
-NTSTATUS
-SbDspIsSpeakerEnabled(
- IN PUCHAR BasePort,
- OUT PBOOLEAN IsEnabled,
- IN ULONG Timeout)
-{
- NTSTATUS Status;
- UCHAR SpeakerStatus = 0;
-
- if ( ! IsEnabled )
- return STATUS_INVALID_PARAMETER_2;
-
- /* Request the speaker status */
- Status = SbDspWrite(BasePort, SB_DSP_SPEAKER_STATUS, Timeout);
- if ( Status != STATUS_SUCCESS )
- return Status;
-
- /* Obtain the status */
- Status = SbDspRead(BasePort, &SpeakerStatus, Timeout);
- if ( Status != STATUS_SUCCESS )
- return Status;
-
- DbgPrint("SBDSP - SpeakerStatus is %02x\n", SpeakerStatus);
- *IsEnabled = (SpeakerStatus == 0xFF);
-
- return STATUS_SUCCESS;
-}
-
-BOOLEAN
-SbDspIsValidInputRate(
- IN UCHAR MajorVersion,
- IN UCHAR MinorVersion,
- IN USHORT Rate,
- IN BOOLEAN Stereo)
-{
- if ( MajorVersion == 1 )
- {
- if ( Stereo )
- return FALSE;
-
- return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
- }
- else if ( MajorVersion == 2 )
- {
- if ( Stereo )
- return FALSE;
-
- if ( MinorVersion == 0 )
- return ( ( Rate >= 4000 ) && ( Rate <= 15000 ) );
- else
- return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
- }
- else if ( MajorVersion == 3 )
- {
- if ( Stereo )
- return FALSE;
-
- return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
- }
- else /* 4.00 and above */
- {
- return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
- }
-}
-
-BOOLEAN
-SbDspIsValidOutputRate(
- IN UCHAR MajorVersion,
- IN UCHAR MinorVersion,
- IN USHORT Rate,
- IN BOOLEAN Stereo)
-{
- if ( MajorVersion == 1 )
- {
- if ( Stereo )
- return FALSE;
-
- return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
- }
- else if ( MajorVersion == 2 )
- {
- if ( Stereo )
- return FALSE;
-
- if ( MinorVersion == 0 )
- return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
- else
- return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
- }
- else if ( MajorVersion == 3 )
- {
- if ( ! Stereo )
- return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
- else
- return ( ( Rate >= 11025 ) && ( Rate <= 22050 ) );
- }
- else /* 4.00 and above */
- {
- return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
- }
-}
-
-/* Internal routine - call only after submitting one of the rate commands */
-NTSTATUS
-SbDsp4WriteRate(
- IN PUCHAR BasePort,
- IN USHORT Rate,
- IN ULONG Timeout)
-{
- NTSTATUS Status;
-
- /* NOTE - No check for validity of rate! */
-
- /* Write high byte */
- Status = SbDspWrite(BasePort, (Rate & 0xff00) >> 8, Timeout);
- if ( Status != STATUS_SUCCESS )
- return Status;
-
- /* Write low byte */
- Status = SbDspWrite(BasePort, Rate & 0xff, Timeout);
- if ( Status != STATUS_SUCCESS )
- return Status;
-
- return Status;
-}
-
-NTSTATUS
-SbDsp4SetOutputRate(
- IN PUCHAR BasePort,
- IN USHORT Rate,
- IN ULONG Timeout)
-{
- NTSTATUS Status;
-
- /* NOTE - No check for validity of rate! */
-
- /* Prepare to write the output rate */
- Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
- if ( Status != STATUS_SUCCESS )
- return Status;
-
- return SbDsp4WriteRate(BasePort, Rate, Timeout);
-}
-
-NTSTATUS
-SbDsp4SetInputRate(
- IN PUCHAR BasePort,
- IN USHORT Rate,
- IN ULONG Timeout)
-{
- NTSTATUS Status;
-
- /* NOTE - No check for validity of rate! */
-
- /* Prepare to write the input rate */
- Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
- if ( Status != STATUS_SUCCESS )
- return Status;
-
- return SbDsp4WriteRate(BasePort, Rate, Timeout);
-}
Added: branches/silverblade-audio/lib/drivers/sound/shared/shared.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/shared/shared.rbuild (added)
+++ branches/silverblade-audio/lib/drivers/sound/shared/shared.rbuild [iso-8859-1] Tue Jul
1 21:16:51 2008
@@ -1,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
+<module name="audio" type="staticlibrary"
allowwarnings="true">
+ <define name="__NTDRIVER__"/>
+ <define name="KERNEL"/>
+ <include base="soundblaster">.</include>
+ <include base="ReactOS">include/reactos/libs/sound</include>
+ <file>time.c</file>
+</module>
Propchange: branches/silverblade-audio/lib/drivers/sound/shared/shared.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/silverblade-audio/lib/drivers/sound/sound.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/sound.rbuild [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/sound.rbuild [iso-8859-1] Tue Jul 1
21:16:51 2008
@@ -1,13 +1,16 @@
<?xml version="1.0"?>
-<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="sound" type="staticlibrary"
allowwarnings="true">
- <define name="__NTDRIVER__"/>
- <define name="KERNEL"/>
- <include base="sound">.</include>
- <include base="ReactOS">include/reactos/libs/sound</include>
- <file>devname.c</file>
- <file>hardware.c</file>
- <file>midiuart.c</file>
- <file>sbdsp.c</file>
- <file>time.c</file>
-</module>
+<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
+<group
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <directory name="legacy">
+ <xi:include href="legacy/legacy.rbuild" />
+ </directory>
+ <directory name="shared">
+ <xi:include href="shared/shared.rbuild" />
+ </directory>
+ <directory name="soundblaster">
+ <xi:include href="soundblaster/soundblaster.rbuild" />
+ </directory>
+ <directory name="uartmidi">
+ <xi:include href="uartmidi/uartmidi.rbuild" />
+ </directory>
+</group>
Added: branches/silverblade-audio/lib/drivers/sound/soundblaster/dsp_io.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/soundblaster/dsp_io.c (added)
+++ branches/silverblade-audio/lib/drivers/sound/soundblaster/dsp_io.c [iso-8859-1] Tue
Jul 1 21:16:51 2008
@@ -1,0 +1,148 @@
+/*
+ ReactOS Sound System
+ Sound Blaster DSP support
+ General I/O
+
+ Author:
+ Andrew Greenwood (silverblade(a)reactos.org)
+
+ History:
+ 2 July 2008 - Created (split from sbdsp.c)
+
+ Notes:
+ Functions documented in sbdsp.h
+*/
+
+#include <ntddk.h>
+#include <debug.h>
+
+#include <time.h>
+#include <sbdsp.h>
+
+NTSTATUS
+SbDspReset(
+ IN PUCHAR BasePort,
+ IN ULONG Timeout)
+{
+ ULONG Expiry;
+ KIRQL CurrentIrqLevel = KeGetCurrentIrql();
+ BOOLEAN DataAvailable = FALSE;
+
+ /* Should be called from DriverEntry with this IRQL */
+ ASSERT(CurrentIrqLevel == PASSIVE_LEVEL);
+
+ WRITE_SB_DSP_RESET(BasePort, 0x01);
+ SleepMs(50); /* Should be enough */
+ WRITE_SB_DSP_RESET(BasePort, 0x00);
+
+ Expiry = QuerySystemTimeMs() + Timeout;
+
+ /* Wait for data to be available */
+ while ( (QuerySystemTimeMs() < Expiry) || ( Timeout == 0) )
+ {
+ if ( SB_DSP_DATA_AVAILABLE(BasePort) )
+ {
+ DataAvailable = TRUE;
+ break;
+ }
+ }
+
+ if ( ! DataAvailable )
+ {
+ return STATUS_TIMEOUT;
+ }
+
+ /* Data is available - wait for the "DSP ready" code */
+ while ( (QuerySystemTimeMs() < Expiry) || ( Timeout == 0) )
+ {
+ if ( READ_SB_DSP_DATA(BasePort) == SB_DSP_READY )
+ {
+ return STATUS_SUCCESS;
+ }
+ }
+
+ return STATUS_TIMEOUT;
+}
+
+NTSTATUS
+SbDspWaitToWrite(
+ IN PUCHAR BasePort,
+ IN ULONG Timeout)
+{
+ ULONG Expiry = QuerySystemTimeMs() + Timeout;
+
+ while ( (QuerySystemTimeMs() < Expiry) || (Timeout == 0) )
+ {
+ if ( SB_DSP_CLEAR_TO_SEND(BasePort) )
+ {
+ return STATUS_SUCCESS;
+ }
+ }
+
+ return STATUS_TIMEOUT;
+}
+
+NTSTATUS
+SbDspWaitToRead(
+ IN PUCHAR BasePort,
+ IN ULONG Timeout)
+{
+ ULONG Expiry = QuerySystemTimeMs() + Timeout;
+
+ while ( (QuerySystemTimeMs() < Expiry) || (Timeout == 0) )
+ {
+ if ( SB_DSP_DATA_AVAILABLE(BasePort) )
+ {
+ return STATUS_SUCCESS;
+ }
+ }
+
+ return STATUS_TIMEOUT;
+}
+
+NTSTATUS
+SbDspWrite(
+ IN PUCHAR BasePort,
+ IN UCHAR DataByte,
+ IN ULONG Timeout)
+{
+ NTSTATUS Status;
+
+ Status = SbDspWaitToWrite(BasePort, Timeout);
+
+ if ( Status != STATUS_SUCCESS )
+ {
+ return Status;
+ }
+
+ DbgPrint("SBDSP - Writing %02x\n", DataByte);
+ WRITE_SB_DSP_DATA(BasePort, DataByte);
+
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+SbDspRead(
+ IN PUCHAR BasePort,
+ OUT PUCHAR DataByte,
+ IN ULONG Timeout)
+{
+ NTSTATUS Status;
+
+ if ( ! DataByte )
+ {
+ return STATUS_INVALID_PARAMETER_2;
+ }
+
+ Status = SbDspWaitToRead(BasePort, Timeout);
+
+ if ( Status != STATUS_SUCCESS )
+ {
+ return Status;
+ }
+
+ *DataByte = READ_SB_DSP_DATA(BasePort);
+ DbgPrint("SBDSP - Read %02x\n", *DataByte);
+
+ return STATUS_SUCCESS;
+}
Propchange: branches/silverblade-audio/lib/drivers/sound/soundblaster/dsp_io.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/silverblade-audio/lib/drivers/sound/soundblaster/mixer.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/soundblaster/mixer.c (added)
+++ branches/silverblade-audio/lib/drivers/sound/soundblaster/mixer.c [iso-8859-1] Tue Jul
1 21:16:51 2008
@@ -1,0 +1,21 @@
+/*
+ ReactOS Sound System
+ Sound Blaster DSP support
+ Mixer routines
+
+ Author:
+ Andrew Greenwood (silverblade(a)reactos.org)
+
+ History:
+ 2 July 2008 - Created
+
+ Notes:
+ Functions documented in sbdsp.h
+*/
+
+#include <ntddk.h>
+#include <debug.h>
+
+#include <sbdsp.h>
+
+/* Stub... */
Propchange: branches/silverblade-audio/lib/drivers/sound/soundblaster/mixer.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/silverblade-audio/lib/drivers/sound/soundblaster/rate.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/soundblaster/rate.c (added)
+++ branches/silverblade-audio/lib/drivers/sound/soundblaster/rate.c [iso-8859-1] Tue Jul
1 21:16:51 2008
@@ -1,0 +1,154 @@
+/*
+ ReactOS Sound System
+ Sound Blaster DSP support
+ Sample rate routines
+
+ Author:
+ Andrew Greenwood (silverblade(a)reactos.org)
+
+ History:
+ 2 July 2008 - Created (split from sbdsp.c)
+
+ Notes:
+ Functions documented in sbdsp.h
+*/
+
+#include <ntddk.h>
+#include <debug.h>
+
+#include <sbdsp.h>
+
+BOOLEAN
+SbDspIsValidInputRate(
+ IN UCHAR MajorVersion,
+ IN UCHAR MinorVersion,
+ IN USHORT Rate,
+ IN BOOLEAN Stereo)
+{
+ if ( MajorVersion == 1 )
+ {
+ if ( Stereo )
+ return FALSE;
+
+ return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
+ }
+ else if ( MajorVersion == 2 )
+ {
+ if ( Stereo )
+ return FALSE;
+
+ if ( MinorVersion == 0 )
+ return ( ( Rate >= 4000 ) && ( Rate <= 15000 ) );
+ else
+ return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
+ }
+ else if ( MajorVersion == 3 )
+ {
+ if ( Stereo )
+ return FALSE;
+
+ return ( ( Rate >= 4000 ) && ( Rate <= 13000 ) );
+ }
+ else /* 4.00 and above */
+ {
+ return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
+ }
+}
+
+BOOLEAN
+SbDspIsValidOutputRate(
+ IN UCHAR MajorVersion,
+ IN UCHAR MinorVersion,
+ IN USHORT Rate,
+ IN BOOLEAN Stereo)
+{
+ if ( MajorVersion == 1 )
+ {
+ if ( Stereo )
+ return FALSE;
+
+ return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
+ }
+ else if ( MajorVersion == 2 )
+ {
+ if ( Stereo )
+ return FALSE;
+
+ if ( MinorVersion == 0 )
+ return ( ( Rate >= 4000 ) && ( Rate <= 23000 ) );
+ else
+ return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
+ }
+ else if ( MajorVersion == 3 )
+ {
+ if ( ! Stereo )
+ return ( ( Rate >= 4000 ) && ( Rate <= 44100 ) );
+ else
+ return ( ( Rate >= 11025 ) && ( Rate <= 22050 ) );
+ }
+ else /* 4.00 and above */
+ {
+ return ( ( Rate >= 5000 ) && ( Rate <= 44100 ) );
+ }
+}
+
+/* Internal routine - call only after submitting one of the rate commands */
+NTSTATUS
+SbDsp4WriteRate(
+ IN PUCHAR BasePort,
+ IN USHORT Rate,
+ IN ULONG Timeout)
+{
+ NTSTATUS Status;
+
+ /* NOTE - No check for validity of rate! */
+
+ /* Write high byte */
+ Status = SbDspWrite(BasePort, (Rate & 0xff00) >> 8, Timeout);
+ if ( Status != STATUS_SUCCESS )
+ return Status;
+
+ /* Write low byte */
+ Status = SbDspWrite(BasePort, Rate & 0xff, Timeout);
+ if ( Status != STATUS_SUCCESS )
+ return Status;
+
+ return Status;
+}
+
+NTSTATUS
+SbDsp4SetOutputRate(
+ IN PUCHAR BasePort,
+ IN USHORT Rate,
+ IN ULONG Timeout)
+{
+ NTSTATUS Status;
+
+ /* NOTE - No check for validity of rate! */
+
+ /* Prepare to write the output rate */
+ Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
+ if ( Status != STATUS_SUCCESS )
+ return Status;
+
+ return SbDsp4WriteRate(BasePort, Rate, Timeout);
+}
+
+NTSTATUS
+SbDsp4SetInputRate(
+ IN PUCHAR BasePort,
+ IN USHORT Rate,
+ IN ULONG Timeout)
+{
+ NTSTATUS Status;
+
+ /* NOTE - No check for validity of rate! */
+
+ /* Prepare to write the input rate */
+ Status = SbDspWrite(BasePort, SB_DSP_OUTPUT_RATE, (Rate & 0xff00) >> 8);
+ if ( Status != STATUS_SUCCESS )
+ return Status;
+
+ return SbDsp4WriteRate(BasePort, Rate, Timeout);
+}
+
Propchange: branches/silverblade-audio/lib/drivers/sound/soundblaster/rate.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/silverblade-audio/lib/drivers/sound/soundblaster/soundblaster.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/soundblaster/soundblaster.rbuild (added)
+++ branches/silverblade-audio/lib/drivers/sound/soundblaster/soundblaster.rbuild
[iso-8859-1] Tue Jul 1 21:16:51 2008
@@ -1,0 +1,13 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
+<module name="soundblaster" type="staticlibrary"
allowwarnings="true">
+ <define name="__NTDRIVER__"/>
+ <define name="KERNEL"/>
+ <include base="soundblaster">.</include>
+ <include base="ReactOS">include/reactos/libs/sound</include>
+ <file>dsp_io.c</file>
+ <file>version.c</file>
+ <file>speaker.c</file>
+ <file>rate.c</file>
+ <file>mixer.c</file>
+</module>
Propchange: branches/silverblade-audio/lib/drivers/sound/soundblaster/soundblaster.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/silverblade-audio/lib/drivers/sound/soundblaster/speaker.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/soundblaster/speaker.c (added)
+++ branches/silverblade-audio/lib/drivers/sound/soundblaster/speaker.c [iso-8859-1] Tue
Jul 1 21:16:51 2008
@@ -1,0 +1,66 @@
+/*
+ ReactOS Sound System
+ Sound Blaster DSP support
+ Speaker commands
+
+ Author:
+ Andrew Greenwood (silverblade(a)reactos.org)
+
+ History:
+ 2 July 2008 - Created (split from sbdsp.c)
+
+ Notes:
+ Functions documented in sbdsp.h
+*/
+
+#include <ntddk.h>
+#include <debug.h>
+
+#include <sbdsp.h>
+
+NTSTATUS
+SbDspEnableSpeaker(
+ IN PUCHAR BasePort,
+ IN ULONG Timeout)
+{
+ return SbDspWrite(BasePort, SB_DSP_SPEAKER_ON, Timeout);
+}
+
+NTSTATUS
+SbDspDisableSpeaker(
+ IN PUCHAR BasePort,
+ IN ULONG Timeout)
+{
+ return SbDspWrite(BasePort, SB_DSP_SPEAKER_OFF, Timeout);
+}
+
+/*
+ VirtualBox doesn't seem to support this.
+*/
+NTSTATUS
+SbDspIsSpeakerEnabled(
+ IN PUCHAR BasePort,
+ OUT PBOOLEAN IsEnabled,
+ IN ULONG Timeout)
+{
+ NTSTATUS Status;
+ UCHAR SpeakerStatus = 0;
+
+ if ( ! IsEnabled )
+ return STATUS_INVALID_PARAMETER_2;
+
+ /* Request the speaker status */
+ Status = SbDspWrite(BasePort, SB_DSP_SPEAKER_STATUS, Timeout);
+ if ( Status != STATUS_SUCCESS )
+ return Status;
+
+ /* Obtain the status */
+ Status = SbDspRead(BasePort, &SpeakerStatus, Timeout);
+ if ( Status != STATUS_SUCCESS )
+ return Status;
+
+ DbgPrint("SBDSP - SpeakerStatus is %02x\n", SpeakerStatus);
+ *IsEnabled = (SpeakerStatus == 0xFF);
+
+ return STATUS_SUCCESS;
+}
Propchange: branches/silverblade-audio/lib/drivers/sound/soundblaster/speaker.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/silverblade-audio/lib/drivers/sound/soundblaster/version.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/soundblaster/version.c (added)
+++ branches/silverblade-audio/lib/drivers/sound/soundblaster/version.c [iso-8859-1] Tue
Jul 1 21:16:51 2008
@@ -1,0 +1,50 @@
+/*
+ ReactOS Sound System
+ Sound Blaster DSP support
+ Version routine
+
+ Author:
+ Andrew Greenwood (silverblade(a)reactos.org)
+
+ History:
+ 2 July 2008 - Created (split from sbdsp.c)
+
+ Notes:
+ Functions documented in sbdsp.h
+*/
+
+#include <ntddk.h>
+#include <debug.h>
+
+#include <sbdsp.h>
+
+NTSTATUS
+SbDspGetVersion(
+ IN PUCHAR BasePort,
+ OUT PUCHAR MajorVersion,
+ OUT PUCHAR MinorVersion,
+ IN ULONG Timeout)
+{
+ NTSTATUS Status;
+
+ /* Make sure our parameters are sane */
+ if ( ! MajorVersion )
+ return STATUS_INVALID_PARAMETER_2;
+
+ if ( ! MinorVersion )
+ return STATUS_INVALID_PARAMETER_3;
+
+ /* Send version request */
+ Status = SbDspWrite(BasePort, SB_DSP_VERSION, Timeout);
+ if ( Status != STATUS_SUCCESS )
+ return Status;
+
+ /* Get the major version */
+ Status = SbDspRead(BasePort, MajorVersion, Timeout);
+ if ( Status != STATUS_SUCCESS )
+ return FALSE;
+
+ /* Get the minor version */
+ Status = SbDspRead(BasePort, MinorVersion, Timeout);
+ return Status;
+}
Propchange: branches/silverblade-audio/lib/drivers/sound/soundblaster/version.c
------------------------------------------------------------------------------
svn:eol-style = native
Removed: branches/silverblade-audio/lib/drivers/sound/time.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/time.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/time.c (removed)
@@ -1,49 +1,0 @@
-/*
- ReactOS Sound System
- Timing helper
-
- Author:
- Andrew Greenwood (silverblade(a)reactos.org)
-
- History:
- 31 May 2008 - Created
-
- Notes:
- Have checked timing in DebugView. A 10,000ms delay covered a period
- of 124.305 sec to 134.308 sec. Not 100% accurate but likely down to
- the delays in submitting the debug strings?
-*/
-
-/*
- Nanoseconds are fun! You must try some!
- 1 ns = .000000001 seconds = .0000001 ms
- 100 ns = .0000001 seconds = .00001 ms
- 10000 ns = .00001 seconds = .001 ms
- 1000000 ns = .001 seconds = 1 ms
-*/
-
-#include <ntddk.h>
-
-VOID
-SleepMs(ULONG Milliseconds)
-{
- LARGE_INTEGER Period;
-
- Period.QuadPart = -Milliseconds;
- Period.QuadPart *= 10000;
-
- KeDelayExecutionThread(KernelMode, FALSE, &Period);
-}
-
-ULONG
-QuerySystemTimeMs()
-{
- LARGE_INTEGER Time;
-
- KeQuerySystemTime(&Time);
-
- Time.QuadPart /= 10000;
-
- return (ULONG) Time.QuadPart;
-}
-
Added: branches/silverblade-audio/lib/drivers/sound/uartmidi/uartmidi.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/uartmidi/uartmidi.rbuild (added)
+++ branches/silverblade-audio/lib/drivers/sound/uartmidi/uartmidi.rbuild [iso-8859-1] Tue
Jul 1 21:16:51 2008
@@ -1,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
+<module name="uartmidi" type="staticlibrary"
allowwarnings="true">
+ <define name="__NTDRIVER__"/>
+ <define name="KERNEL"/>
+ <include base="soundblaster">.</include>
+ <include base="ReactOS">include/reactos/libs/sound</include>
+ <file>midiuart.c</file>
+</module>
Propchange: branches/silverblade-audio/lib/drivers/sound/uartmidi/uartmidi.rbuild
------------------------------------------------------------------------------
svn:eol-style = native