Author: silverblade
Date: Tue Jul 1 11:32:36 2008
New Revision: 34235
URL:
http://svn.reactos.org/svn/reactos?rev=34235&view=rev
Log:
Made header for sbdsp.c and begun adding some test code to sb16_nt4
Added:
branches/silverblade-audio/include/reactos/libs/sound/sbdsp.h (with props)
Modified:
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/main.c
branches/silverblade-audio/include/reactos/libs/sound/time.h
branches/silverblade-audio/lib/drivers/sound/sbdsp.c
Modified: branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/drivers/multi…
==============================================================================
--- branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/main.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/main.c [iso-8859-1] Tue
Jul 1 11:32:36 2008
@@ -14,6 +14,7 @@
#include <ntddsnd.h>
#include <debug.h>
+#include <sbdsp.h>
#include <devname.h>
typedef struct _SOUND_BLASTER_EXTENSION
@@ -92,12 +93,13 @@
INFO_(IHVAUDIO, "Sound Blaster driver being unloaded");
}
-
+/* This is to be moved into the sound library later */
#define SOUND_PARAMETERS_KEYNAME_W L"Parameters"
#define SOUND_DEVICES_KEYNAME_W L"Devices"
#define SOUND_DEVICE_KEYNAME_PREFIX_W L"Device"
/* NT4 */
+#if 0
ULONG
GetSoundDeviceCount(
IN PUNICODE_STRING RegistryPath)
@@ -132,6 +134,31 @@
//ZwEnumerateKey(Key
}
+#endif
+
+
+/*
+ This is purely for testing the sound library at present. Eventually this
+ should be re-formed to consider that some (admittedly slightly crazy)
+ users might have more than one sound blaster card, or perhaps might have
+ a different configuration.
+
+ ie, this is pretty much as non-PnP as you can get!
+*/
+STDCALL
+NTSTATUS
+ThisIsSparta(IN PDRIVER_OBJECT DriverObject)
+{
+ DEVICE_OBJECT device;
+ BOOLEAN result;
+ CreateSoundDeviceWithDefaultName(DriverObject, 0, 69, 0, &device);
+
+ INFO_(IHVAUDIO, "Resetting SB...");
+ result = ResetSoundBlasterDSP((PUCHAR)0x220, 10000);
+ INFO_(IHVAUDIO, "SB reset returns %d", result);
+
+ return STATUS_SUCCESS;
+}
@@ -153,9 +180,7 @@
DriverObject->MajorFunction[IRP_MJ_WRITE] = WriteSoundBlaster;
DriverObject->DriverUnload = UnloadSoundBlaster;
- DEVICE_OBJECT device;
- CreateSoundDeviceWithDefaultName(DriverObject, 0, 69, 0, &device);
-
- return STATUS_SUCCESS;
+ /* Hax */
+ return ThisIsSparta(DriverObject);
}
Added: 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 (added)
+++ branches/silverblade-audio/include/reactos/libs/sound/sbdsp.h [iso-8859-1] Tue Jul 1
11:32:36 2008
@@ -1,0 +1,87 @@
+/*
+ ReactOS Sound System
+ Sound Blaster DSP support
+
+ Author:
+ Andrew Greenwood (andrew.greenwood(a)silverblade.co.uk)
+
+ History:
+ 26 May 2008 - Created
+
+ Notes:
+ ...
+*/
+
+#ifndef ROS_SOUND_SBDSP_H
+#define ROS_SOUND_SBDSP_H
+
+#include <sound/time.h>
+
+/*
+ Sound Blaster ports I/O
+*/
+#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 READ_SB_DSP_WRITE_BUFFER_STATUS(bp) \
+ ( READ_PORT_UCHAR((PUCHAR) bp+0x0C) & 0x01 )
+
+#define READ_SB_DSP_READ_BUFFER_STATUS(bp) \
+ ( READ_PORT_UCHAR((PUCHAR) bp+0x0E) & 0x01 )
+
+
+#define SB_DSP_READY 0xAA
+
+/*
+ Sound Blaster DSP commands
+ (partial list)
+*/
+#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
+
+
+/*
+ Routines
+*/
+BOOLEAN
+ResetSoundBlasterDSP(
+ IN PUCHAR BasePort,
+ IN ULONG Timeout);
+
+BOOLEAN
+WaitForSoundBlasterDSPReady(
+ IN PUCHAR BasePort,
+ IN ULONG Timeout);
+
+NTSTATUS
+GetSoundBlasterDSPVersion(
+ IN PUCHAR BasePort,
+ OUT PUCHAR MajorVersion,
+ OUT PUCHAR MinorVersion,
+ IN ULONG Timeout);
+
+#endif
Propchange: branches/silverblade-audio/include/reactos/libs/sound/sbdsp.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/silverblade-audio/include/reactos/libs/sound/time.h
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
==============================================================================
--- branches/silverblade-audio/include/reactos/libs/sound/time.h [iso-8859-1] (original)
+++ branches/silverblade-audio/include/reactos/libs/sound/time.h [iso-8859-1] Tue Jul 1
11:32:36 2008
@@ -9,8 +9,8 @@
1 July 2008 - Created
*/
-#ifndef ROS_SOUND_TIME
-#define ROS_SOUND_TIME
+#ifndef ROS_SOUND_TIME_H
+#define ROS_SOUND_TIME_H
VOID
SleepMs(ULONG Milliseconds);
Modified: 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 [iso-8859-1] Tue Jul 1 11:32:36
2008
@@ -13,53 +13,9 @@
*/
#include <ntddk.h>
-#include <sound/time.h>
-/*
- Sound Blaster ports I/O
-*/
-#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 READ_SB_DSP_WRITE_BUFFER_STATUS(bp) \
- ( READ_PORT_UCHAR((PUCHAR) bp+0x0C) & 0x01 )
-
-#define READ_SB_DSP_READ_BUFFER_STATUS(bp) \
- ( READ_PORT_UCHAR((PUCHAR) bp+0x0E) & 0x01 )
-
-
-#define SB_DSP_READY 0xAA
-
-/*
- Sound Blaster DSP commands
- (partial list)
-*/
-#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
+#include <time.h>
+#include <sbdsp.h>
BOOLEAN
ResetSoundBlasterDSP(