Author: silverblade
Date: Sun May 25 05:32:57 2008
New Revision: 33692
URL:
http://svn.reactos.org/svn/reactos?rev=33692&view=rev
Log:
Added NTDDSND.H which defines IOCTL codes, structures and other definitions
for NT4 style audio drivers.
Cleaned out sb16_nt4 directory in preparation of rewrite.
Added:
branches/silverblade-audio/include/ddk/ntddsnd.h (with props)
Removed:
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/control.c
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/interrupt.c
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/main.c
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sndblst.h
Modified:
branches/silverblade-audio/drivers/multimedia/audio/directory.rbuild
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.def
branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.rbuild
Modified: branches/silverblade-audio/drivers/multimedia/audio/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/drivers/multi…
==============================================================================
--- branches/silverblade-audio/drivers/multimedia/audio/directory.rbuild [iso-8859-1]
(original)
+++ branches/silverblade-audio/drivers/multimedia/audio/directory.rbuild [iso-8859-1] Sun
May 25 05:32:57 2008
@@ -1,11 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
<group
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <directory name="sb16_nt4">
+ <xi:include href="sb16_nt4/sb16_nt4.rbuild" />
+ </directory>
+
<!--directory name="mpu401_nt4">
<xi:include href="mpu401_nt4/mpu401.rbuild" />
- </directory>
- <directory name="sb16_nt4">
- <xi:include href="sb16_nt4/sb16_nt4.rbuild" />
</directory>
<directory name="sndblst">
<xi:include href="sndblst/sndblst.rbuild" />
Removed: branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/control.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/drivers/multi…
==============================================================================
--- branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/control.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/control.c (removed)
@@ -1,222 +1,0 @@
-#include <sndblst.h>
-
-/*
- TODO: MmMapIoSpace()
-*/
-
-/*
- This checks the read or write status port of the device.
-*/
-
-BOOLEAN
-WaitForReady(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- UCHAR Port)
-{
- ULONG timeout = SB_TIMEOUT;
- BOOL ready = FALSE;
-
- while ( ( ! ready ) && ( timeout > 0 ) )
- {
- if ( SbRead(SBDevice, Port) & 0x80 )
- return TRUE;
-
- timeout --;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-SbWriteData(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- UCHAR Data)
-{
- if ( ! WaitToWrite(SBDevice) )
- return FALSE;
-
- DPRINT("Writing 0x%x to Sound Blaster card (data)\n", Data);
- SbWrite(SBDevice, SB_WRITE_DATA_PORT, Data);
-
- return TRUE;
-}
-
-BOOLEAN
-SbReadData(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- PUCHAR Data)
-{
- if ( ! WaitToWrite(SBDevice) )
- return FALSE;
-
- *Data = SbRead(SBDevice, SB_READ_DATA_PORT);
- DPRINT("Read 0x%x from Sound Blaster card (data)\n", *Data);
-
- return TRUE;
-}
-
-BOOLEAN
-ResetSoundBlaster(
- PSOUND_BLASTER_PARAMETERS SBDevice)
-{
- BOOLEAN acked = FALSE;
- ULONG timeout;
-
- SbWriteReset(SBDevice, 0x01);
- for (timeout = 0; timeout < 30000; timeout ++ );
- SbWriteReset(SBDevice, 0x00);
-
- DPRINT("Waiting for SB to acknowledge our reset request\n");
-
- if ( ! WaitToRead(SBDevice) )
- {
- DPRINT("Didn't get an ACK :(\n");
- return FALSE;
- }
-
- timeout = 0;
-
- while ( ( ! acked ) && ( timeout < SB_TIMEOUT ) )
- {
- acked = ( SbReadDataWithoutWait(SBDevice) == SB_DSP_READY );
- timeout ++;
- }
-
- if ( ! acked )
- {
- DPRINT("Didn't get an ACK :(\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-ULONG
-GetSoundBlasterModel(
- PSOUND_BLASTER_PARAMETERS SBDevice)
-{
- UCHAR MajorVer, MinorVer;
-
- DPRINT("Querying DSP version\n");
-
- if ( ! SbWriteData(SBDevice, SbGetDspVersion) )
- return NotDetected;
-
- if ( ! WaitToRead(SBDevice) )
- return NotDetected;
-
- if ( SbReadData(SBDevice, &MajorVer) )
- {
- if ( SbReadData(SBDevice, &MinorVer) )
- {
- DPRINT("Version %d.%d\n", MajorVer, MinorVer);
-
- SBDevice->dsp_version = (MajorVer * 256) + MinorVer;
-
- if ( SBDevice->dsp_version < 0x0200 )
- return SoundBlaster;
- else if ( ( SBDevice->dsp_version & 0xFF00 ) == 0x0200 )
- return SoundBlaster2;
- else if ( ( SBDevice->dsp_version & 0xFF00 ) == 0x0300 )
- return SoundBlasterPro;
- else if ( SBDevice->dsp_version >= 0x0400 )
- return SoundBlaster16;
-
- return NotDetected;
- }
- }
-
- return NotDetected;
-}
-
-
-BOOLEAN
-IsSampleRateCompatible(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- ULONG SampleRate)
-{
- /* TODO */
- return TRUE;
-}
-
-BOOLEAN
-SetOutputSampleRate(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- ULONG SampleRate)
-{
- /* Only works for DSP v4.xx */
- DPRINT("Setting sample rate\n");
-
- SbWriteData(SBDevice, SbSetOutputRate);
- SbWriteData(SBDevice, SampleRate / 256);
- SbWriteData(SBDevice, SampleRate % 256);
-
- return TRUE;
-}
-
-BOOLEAN
-EnableSpeaker(
- PSOUND_BLASTER_PARAMETERS SBDevice)
-{
- DPRINT("Enabling speaker\n");
-
- return SbWriteData(SBDevice, SbEnableSpeaker);
-}
-
-BOOLEAN
-DisableSpeaker(
- PSOUND_BLASTER_PARAMETERS SBDevice)
-{
- DPRINT("Disabling speaker\n");
-
- return SbWriteData(SBDevice, SbDisableSpeaker);
-}
-
-BOOLEAN
-StartSoundOutput(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- ULONG BitDepth,
- ULONG Channels,
- ULONG BlockSize)
-{
- DPRINT("Initializing output with %d channels at %d bits/sample\n",
Channels, BitDepth);
-
- UCHAR command = 0xc6, mode = 0x00;
-
- if ( ( Channels < 1 ) || ( Channels > 2 ) )
- return FALSE;
-
- if ( ( BitDepth != 8 ) && ( BitDepth != 16 ) )
- return FALSE;
-
- switch ( BitDepth )
- {
- case 8 : command = 0xc6; break;
- case 16 : command = 0xb6; break;
- };
-
- switch ( Channels )
- {
- case 1 : mode = 0x00; break;
- case 2 : mode = 0x20; break;
- }
-#if 0
- first_byte = (BitDepth == 16) ? 0xb6 : 0xc6;
- second_byte = (Channels == 1) ? 0x20 : 0x00;
-#endif
-
- if ( SBDevice->dsp_version < 0x0400 )
- {
- /* TODO: Additional programming required */
- }
-
- /* Send freq */
- SbWriteData(SBDevice, command);
- SbWriteData(SBDevice, mode);
- SbWriteData(SBDevice, BlockSize % 256);
- SbWriteData(SBDevice, BlockSize / 256);
-
- DPRINT("Finished programming the DSP\n");
-
- return TRUE;
-}
Removed: branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/interrupt.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/drivers/multi…
==============================================================================
--- branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/interrupt.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/interrupt.c (removed)
@@ -1,61 +1,0 @@
-/*
-*/
-
-#include <sndblst.h>
-
-BOOLEAN
-CheckIrq(
- PDEVICE_OBJECT DeviceObject)
-{
-/* PSOUND_BLASTER_PARAMETERS parameters = DeviceObject->DriverExtension;*/
-
- /* TODO */
-
- return TRUE;
-}
-
-BOOLEAN NTAPI
-ServiceSoundBlasterInterrupt(
- IN PKINTERRUPT Interrupt,
- IN PVOID Context)
-{
- DPRINT("* Processing ISR *\n");
- return FALSE;
-}
-
-NTSTATUS
-EnableIrq(
- PDEVICE_OBJECT DeviceObject)
-{
- PSOUND_BLASTER_PARAMETERS parameters = DeviceObject->DeviceExtension;
- ULONG vector;
- KIRQL irq_level;
- KAFFINITY affinity;
- NTSTATUS status = STATUS_SUCCESS;
-
- vector = HalGetInterruptVector(Isa,
- 0,
- parameters->irq,
- parameters->irq,
- &irq_level,
- &affinity);
-
- DPRINT("Vector is 0x%x\n", vector);
-
- status = IoConnectInterrupt(¶meters->interrupt,
- ServiceSoundBlasterInterrupt,
- DeviceObject,
- (PKSPIN_LOCK) NULL,
- vector,
- irq_level,
- irq_level,
- Latched, /* Latched / LevelSensitive */
- FALSE, /* shareable */
- affinity,
- FALSE);
-
- if ( status == STATUS_INVALID_PARAMETER )
- status = STATUS_DEVICE_CONFIGURATION_ERROR;
-
- return status;
-}
Removed: 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 (removed)
@@ -1,491 +1,0 @@
-/*
- ReactOS
- Sound Blaster driver
-
- Programmers:
- Andrew Greenwood
-
- Notes:
- Compatible with NT4
-*/
-
-#define NDEBUG
-#include <sndblst.h>
-
-#define TAG(A, B, C, D) (IN ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) +
((D)<<24))
-
-/*
- IRP DISPATCH ROUTINES
-*/
-
-NTSTATUS STDCALL
-CreateSoundBlaster(
- PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
-
- DPRINT("CreateSoundBlaster() called - extension 0x%x\n", sb_device);
-
- EnableSpeaker(sb_device);
- /*SetOutputSampleRate(sb_device, 22*/
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS STDCALL
-CloseSoundBlaster(
- PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
-
- DPRINT("CloseSoundBlaster() called\n");
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS STDCALL
-CleanupSoundBlaster(
- PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
-
- DPRINT("CleanupSoundBlaster() called\n");
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS STDCALL
-ControlSoundBlaster(
- PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- PIO_STACK_LOCATION stack;
- //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
-
- DPRINT("ControlSoundBlaster() called\n");
-
- stack = IoGetCurrentIrpStackLocation(Irp);
-
- switch ( stack->Parameters.DeviceIoControl.IoControlCode)
- {
- /* TODO */
- };
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS STDCALL
-WriteSoundBlaster(
- PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- //PSOUND_BLASTER_PARAMETERS sb_device = DeviceObject->DeviceExtension;
-
- DPRINT("WriteSoundBlaster() called\n");
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
-}
-
-VOID STDCALL
-UnloadSoundBlaster(
- PDRIVER_OBJECT DriverObject)
-{
- DPRINT("Sound Blaster driver unload\n");
-}
-
-NTSTATUS STDCALL
-OpenSubkey(
- PUNICODE_STRING RegistryPath,
- PWSTR Subkey,
- ACCESS_MASK DesiredAccess,
- OUT HANDLE* DevicesKeyHandle)
-{
- NTSTATUS status;
- OBJECT_ATTRIBUTES attribs;
- UNICODE_STRING subkey_name;
- HANDLE key_handle;
-
- /* TODO: Check for NULL ptr in DevicesKeyHandle */
-
- InitializeObjectAttributes(&attribs,
- RegistryPath,
- OBJ_CASE_INSENSITIVE,
- NULL,
- (PSECURITY_DESCRIPTOR) NULL);
-
- status = ZwOpenKey(&key_handle, KEY_READ, &attribs);
-
- if ( ! NT_SUCCESS(status) )
- {
- DPRINT("Couldn't open subkey %wZ\n", Subkey);
- return status;
- }
-
- RtlInitUnicodeString(&subkey_name, Subkey);
-
- InitializeObjectAttributes(&attribs,
- &subkey_name,
- OBJ_CASE_INSENSITIVE,
- key_handle,
- (PSECURITY_DESCRIPTOR) NULL);
-
- status = ZwOpenKey(*DevicesKeyHandle, DesiredAccess, &attribs);
- ZwClose(key_handle);
-
- return status;
-}
-
-
-PWSTR STDCALL
-AllocateRegistryPathInfo(
- PUNICODE_STRING BasePath,
- PUNICODE_STRING ParametersPath,
- PKEY_BASIC_INFORMATION KeyInfo)
-{
- PWSTR name;
- PWSTR pos;
-
- DPRINT("Allocating memory for path info\n");
- name = ExAllocatePool(PagedPool,
- BasePath->Length + sizeof(WCHAR) +
- ParametersPath->Length + sizeof(WCHAR) +
- KeyInfo->NameLength + sizeof(UNICODE_NULL));
-
- if ( ! name )
- return NULL;
-
- DPRINT("Copying info\n");
- pos = name;
-
- RtlCopyMemory((PVOID)Pos, (PVOID)BasePath->Buffer, BasePath->Length);
- pos += BasePath->Length / sizeof(WCHAR);
- pos[0] = '\\';
- pos ++;
-
- RtlCopyMemory((PVOID)Pos, (PVOID)ParametersPath->Buffer,
ParametersPath->Length);
- pos += ParametersPath->Length / sizeof(WCHAR);
- pos[0] = '\\';
- pos ++;
-
- RtlCopyMemory((PVOID)Pos, (PVOID)ParametersPath->Buffer,
ParametersPath->Length);
- pos += KeyInfo->NameLength / sizeof(WCHAR);
- pos[0] = UNICODE_NULL;
-
- DPRINT("All OK\n");
- return name;
-}
-
-#define FreeRegistryPathInfo(ptr) \
- ExFreePool(ptr)
-
-
-#define TAG_REG_INFO TAG('I','g','e','R')
-#define TAG_REG_NAME TAG('N','g','e','R')
-
-NTSTATUS STDCALL
-EnumerateSubkey(
- PUNICODE_STRING RegistryPath,
- PWSTR Subkey,
- PREGISTRY_CALLBACK_ROUTINE Callback,
- PDRIVER_OBJECT DriverObject)
-{
- NTSTATUS status;
- UNICODE_STRING subkey_name;
- HANDLE devices_key_handle;
-
- ULONG key_index = 0;
- ULONG result_length;
-
- status = OpenSubkey(RegistryPath, Subkey, KEY_ENUMERATE_SUB_KEYS,
&devices_key_handle);
-
- if ( ! NT_SUCCESS(status) )
- return status;
-
- while ( TRUE )
- {
- KEY_BASIC_INFORMATION test_info;
- PKEY_BASIC_INFORMATION info;
- ULONG size;
- PWSTR name;
-
- status = ZwEnumerateKey(devices_key_handle,
- key_index,
- KeyBasicInformation,
- &test_info,
- sizeof(test_info),
- &result_length);
-
- if ( status == STATUS_NO_MORE_ENTRIES )
- break;
-
- size = result_length + FIELD_OFFSET(KEY_BASIC_INFORMATION, Name[0]);
-
- info = (PKEY_BASIC_INFORMATION) ExAllocatePoolWithTag(PagedPool, size,
TAG_REG_INFO);
-
- if ( ! info )
- {
- DPRINT("Out of memory\n");
- status = STATUS_INSUFFICIENT_RESOURCES;
- break;
- }
-
- status = ZwEnumerateKey(devices_key_handle,
- key_index,
- KeyBasicInformation,
- info,
- size,
- &result_length);
-
- if ( ! NT_SUCCESS(status) )
- {
- DPRINT("Unable to enumerate keys\n");
- ExFreePoolWithTag(info, TAG_REG_INFO);
- status = STATUS_INTERNAL_ERROR;
- break;
- }
-
- /* Is this ok? */
- RtlInitUnicodeString(&subkey_name, Subkey);
-
- name = AllocateRegistryPathInfo(RegistryPath, &subkey_name, info);
-
- if ( ! name )
- {
- DPRINT("Out of memory\n");
- ExFreePoolWithTag(info, TAG_REG_INFO);
- status = STATUS_INSUFFICIENT_RESOURCES;
- break;
- }
-
- ExFreePoolWithTag(info, TAG_REG_INFO);
-
- /* Call the callback */
- status = Callback(DriverObject, name);
-
- FreeRegistryPathInfo(name);
-
- if ( ! NT_SUCCESS(status) )
- {
- DPRINT("Callback FAILED\n");
- break;
- }
-
- key_index ++;
- }
-
- ZwClose(devices_key_handle);
-
- DPRINT("Found %d subkey entries\n", key_index);
-
- if ( ( key_index == 0 ) && ( status == STATUS_NO_MORE_ENTRIES ) )
- return STATUS_DEVICE_CONFIGURATION_ERROR;
-
- if ( status == STATUS_NO_MORE_ENTRIES )
- status = STATUS_SUCCESS;
-
- return status;
-}
-
-#define EnumerateDeviceKeys(path, callback, driver_obj) \
- EnumerateSubkey(path, L"Devices", callback, driver_obj)
-
-
-NTSTATUS
-CreateDeviceName(
- PCWSTR PrePrefix,
- PCWSTR Prefix,
- UCHAR Index,
- PUNICODE_STRING DeviceName)
-{
- UNICODE_STRING number;
- WCHAR number_buffer[5];
- UNICODE_STRING unicode_pre_prefix;
- UNICODE_STRING unicode_prefix;
- ULONG size;
-
- RtlInitUnicodeString(&unicode_pre_prefix, PrePrefix);
- RtlInitUnicodeString(&unicode_prefix, Prefix);
-
- size = unicode_pre_prefix.Length +
- unicode_prefix.Length +
- sizeof(number_buffer) +
- sizeof(UNICODE_NULL);
-
- DeviceName->Buffer = ExAllocatePool(PagedPool, size);
- DeviceName->MaximumLength = (USHORT) size;
-
- if ( ! DeviceName->Buffer )
- return STATUS_INSUFFICIENT_RESOURCES;
-
- RtlCopyUnicodeString(DeviceName, &unicode_pre_prefix);
- RtlAppendUnicodeStringToString(DeviceName, &unicode_prefix);
-
- if ( Index != 255 )
- {
- number.Buffer = number_buffer;
- number.MaximumLength = sizeof(number_buffer);
-
- RtlIntegerToUnicodeString((ULONG) Index, 10, &number);
- RtlAppendUnicodeStringToString(DeviceName, &number);
- }
-
- DeviceName->Buffer[DeviceName->Length / sizeof(UNICODE_NULL)] = UNICODE_NULL;
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS STDCALL
-InitializeSoundBlaster(
- PDRIVER_OBJECT DriverObject,
- PWSTR RegistryPath)
-{
- NTSTATUS status;
- PDEVICE_OBJECT device_object;
- PSOUND_BLASTER_PARAMETERS parameters = NULL;
- UNICODE_STRING device_name;
- UNICODE_STRING dos_device_name;
-
- UCHAR device_index = 0;
-
- DPRINT("Initializing a Sound Blaster device\n");
-
- /* Change these later */
- status = CreateDeviceName(L"",
- L"\\Device\\WaveOut",
- device_index,
- &device_name);
-
- if ( ! NT_SUCCESS(status) )
- return status;
-
- status = CreateDeviceName(L"\\DosDevices\\",
- L"\\Device\\WaveOut" +
wcslen(L"\\Device\\"),
- device_index,
- &dos_device_name);
-
- if ( ! NT_SUCCESS(status) )
- {
- /* TODO */
- return status;
- }
-
- DPRINT("Device: %wZ\n", device_name);
- DPRINT("Symlink: %wZ\n", dos_device_name);
-
- /*
- Create the device and DOS symlink
- */
-
- status = IoCreateDevice(DriverObject,
- sizeof(SOUND_BLASTER_PARAMETERS),
- &device_name,
- FILE_DEVICE_SOUND,
- 0,
- FALSE,
- &device_object);
-
- if ( ! NT_SUCCESS(status) )
- return status;
-
- DPRINT("Created a device extension at 0x%x\n",
device_object->DeviceExtension);
- parameters = device_object->DeviceExtension;
-
- status = IoCreateSymbolicLink(&dos_device_name, &device_name);
-
- ExFreePool(dos_device_name.Buffer);
- ExFreePool(device_name.Buffer);
-
- if ( ! NT_SUCCESS(status) )
- {
- IoDeleteDevice(device_object);
- device_object = NULL;
- return status;
- }
-
- /* IoRegisterShutdownNotification( */
-
- /*
- Settings
- */
-
- device_object->AlignmentRequirement = FILE_BYTE_ALIGNMENT;
-
- parameters->driver = DriverObject;
- parameters->registry_path = RegistryPath;
- parameters->port = DEFAULT_PORT;
- parameters->irq = DEFAULT_IRQ;
- parameters->dma = DEFAULT_DMA;
- parameters->buffer_size = DEFAULT_BUFFER_SIZE;
-
- /* TODO: Load the settings from the registry */
-
- DPRINT("Port %x IRQ %d DMA %d\n", parameters->port, parameters->irq,
parameters->dma);
-
- DPRINT("Resetting the sound card\n");
-
- if ( ! ResetSoundBlaster(parameters) )
- {
- /* TODO */
- return STATUS_UNSUCCESSFUL;
- }
-
- /*
- DPRINT("What kind of SB card is this?\n");
- GetSoundBlasterModel(parameters);
- */
-
- return STATUS_SUCCESS;
-}
-
-
-NTSTATUS STDCALL
-DriverEntry(
- PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath)
-{
- NTSTATUS status;
-
- DPRINT("Sound Blaster driver 0.1 by Silver Blade\n");
-
- DriverObject->Flags = 0;
- DriverObject->MajorFunction[IRP_MJ_CREATE] = CreateSoundBlaster;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = CloseSoundBlaster;
- DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CleanupSoundBlaster;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = ControlSoundBlaster;
- DriverObject->MajorFunction[IRP_MJ_WRITE] = WriteSoundBlaster;
- DriverObject->DriverUnload = UnloadSoundBlaster;
-
- DPRINT("Beginning device key enumeration\n");
-
- status = EnumerateDeviceKeys(RegistryPath, *InitializeSoundBlaster, DriverObject);
-
- return status;
-}
Modified: branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.def
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/drivers/multi…
==============================================================================
--- branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.def [iso-8859-1]
(original)
+++ branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sb16_nt4.def [iso-8859-1]
Sun May 25 05:32:57 2008
@@ -1,5 +1,5 @@
;
-; Exports definition file for sb16_ks.sys
+; Exports definition file for NT4 Sound Blaster driver
;
EXPORTS
DriverEntry@8
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] Sun May 25 05:32:57 2008
@@ -6,7 +6,5 @@
<importlibrary definition="sb16_nt4.def" />
<library>ntoskrnl</library>
<library>hal</library>
- <file>main.c</file>
- <file>control.c</file>
- <file>interrupt.c</file>
+ <file>test.c</file>
</module>
Removed: branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sndblst.h
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/drivers/multi…
==============================================================================
--- branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sndblst.h [iso-8859-1]
(original)
+++ branches/silverblade-audio/drivers/multimedia/audio/sb16_nt4/sndblst.h (removed)
@@ -1,155 +1,0 @@
-#ifndef SNDBLST_H
-#define SNDBLST_H
-
-#include <debug.h>
-#include <ntddk.h>
-
-#define SB_WAVE_IN_DEVICE_NAME L"\\Device\\SBWaveIn"
-#define SB_WAVE_OUT_DEVICE_NAME L"\\Device\\SBWaveOut"
-/* TODO: MIDI */
-#define SB_AUX_DEVICE_NAME L"\\Device\\SBAux"
-#define SB_MIXER_DEVICE_NAME L"\\Device\\SBMixer"
-
-#define DEFAULT_PORT 0x220
-#define DEFAULT_IRQ 5
-#define DEFAULT_DMA 1
-#define DEFAULT_BUFFER_SIZE 65535
-
-#define SB_TIMEOUT 1000000
-
-#define SB_DSP_READY 0xaa
-
-enum
-{
- NotDetected,
- SoundBlaster,
- SoundBlasterPro,
- SoundBlaster2,
- SoundBlasterPro2,
- SoundBlasterProMCV,
- SoundBlaster16
-};
-
-enum
-{
- SB_RESET_PORT = 0x06,
- SB_READ_DATA_PORT = 0x0a,
- SB_WRITE_DATA_PORT = 0x0c,
- SB_WRITE_STATUS_PORT = 0x0c,
- SB_READ_STATUS_PORT = 0x0e
-};
-
-enum
-{
- SbAutoInitDmaOutput = 0x1c,
- SbAutoInitDmaInput = 0x2c,
- SbSetOutputRate = 0x41, /* DSP v4.xx */
- SbSetInputRate = 0x42, /* DSP v4.xx */
- SbSetBlockSize = 0x48, /* DSP v2.00 + */
- SbPauseDac = 0x80,
- SbPauseDmaOutput = 0xd0,
- SbEnableSpeaker = 0xd1,
- SbDisableSpeaker = 0xd3,
- SbGetSpeakerStatus = 0xd8, /* DSP v2.00 + */
- SbGetDspVersion = 0xe1
-};
-
-typedef struct _SOUND_BLASTER_PARAMETERS
-{
- PDRIVER_OBJECT driver;
- PWSTR registry_path;
- PKINTERRUPT interrupt;
- ULONG port;
- ULONG irq;
- ULONG dma;
- ULONG buffer_size;
- USHORT dsp_version;
-} SOUND_BLASTER_PARAMETERS, *PSOUND_BLASTER_PARAMETERS;
-
-
-typedef STDCALL NTSTATUS REGISTRY_CALLBACK_ROUTINE(PDRIVER_OBJECT DriverObject, PWSTR
RegistryPath);
-typedef REGISTRY_CALLBACK_ROUTINE *PREGISTRY_CALLBACK_ROUTINE;
-
-
-/*
- Port I/O
-*/
-
-#define SbWrite(sbdevice, subport, data) \
- WRITE_PORT_UCHAR((PUCHAR) sbdevice->port + subport, data)
-
-#define SbRead(sbdevice, subport) \
- READ_PORT_UCHAR((PUCHAR) sbdevice->port + subport)
-
-#define SbWriteReset(sbdevice, data) \
- SbWrite(sbdevice, SB_RESET_PORT, data)
-
-#define SbWriteDataWithoutWait(sbdevice, data) \
- SbWrite(sbdevice, SB_WRITE_DATA_PORT, data)
-
-#define SbReadDataWithoutWait(sbdevice) \
- SbRead(sbdevice, SB_READ_DATA_PORT)
-
-
-#define SbGetWriteStatus(sbdevice) \
- SbRead(sbdevice, SB_WRITE_STATUS_PORT)
-
-#define SbGetReadStatus(sbdevice) \
- SbRead(sbdevice, SB_READ_STATUS_PORT)
-
-
-
-BOOLEAN
-WaitForReady(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- UCHAR Port);
-
-#define WaitToWrite(sbdevice) \
- WaitForReady(sbdevice, SB_WRITE_STATUS_PORT)
-
-#define WaitToRead(sbdevice) \
- WaitForReady(sbdevice, SB_READ_STATUS_PORT)
-
-BOOLEAN
-ResetSoundBlaster(
- PSOUND_BLASTER_PARAMETERS SBDevice);
-
-ULONG
-GetSoundBlasterModel(
- PSOUND_BLASTER_PARAMETERS SBDevice);
-
-BOOLEAN
-IsSampleRateCompatible(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- ULONG SampleRate);
-
-BOOLEAN
-SetOutputSampleRate(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- ULONG SampleRate);
-
-BOOLEAN
-EnableSpeaker(
- PSOUND_BLASTER_PARAMETERS SBDevice);
-
-BOOLEAN
-DisableSpeaker(
- PSOUND_BLASTER_PARAMETERS SBDevice);
-
-BOOLEAN
-StartSoundOutput(
- PSOUND_BLASTER_PARAMETERS SBDevice,
- ULONG BitDepth,
- ULONG Channels,
- ULONG BlockSize);
-
-
-/*
- interrupt.c
-*/
-
-NTSTATUS
-EnableIrq(
- PDEVICE_OBJECT DeviceObject);
-
-#endif
Added: branches/silverblade-audio/include/ddk/ntddsnd.h
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/ddk/n…
==============================================================================
--- branches/silverblade-audio/include/ddk/ntddsnd.h (added)
+++ branches/silverblade-audio/include/ddk/ntddsnd.h [iso-8859-1] Sun May 25 05:32:57
2008
@@ -1,0 +1,322 @@
+/*
+ ReactOS Sound System
+ NT4 Multimedia Audio Support (ntddsnd.h)
+
+ Author:
+ Andrew Greenwood (andrew.greenwood(a)silverblade.co.uk)
+
+ History:
+ 24 May 2008 - Created
+
+ This file contains definitions and structures for Windows NT4 style
+ multimedia drivers. The NT4 DDK has these split across multiple header
+ files: NTDDSND.H, NTDDWAVE.H, NTDDMIDI.H, NTDDMIX.H and NTDDAUX.H
+
+ Should you have an unstoppable urge to build an NT4 multimedia driver
+ against these headers, just create the other files listed above and make
+ them #include this one.
+*/
+
+#ifndef NTDDWAVE
+#define NTDDWAVE
+
+#define SOUND_MAX_DEVICES 100
+
+
+/*
+ Base device names
+
+ Each device name should be given a numerical suffix identifying that
+ unique device, eg:
+
+ \Device\WaveOut0 - First wave output device
+ \Device\WaveOut1 - Second wave output device
+*/
+
+#define SOUND_MAX_DEVICE_NAME 80
+
+#define DD_WAVE_IN_DEVICE_NAME "\\Device\\WaveIn"
+#define DD_WAVE_IN_DEVICE_NAME_U L"\\Device\\WaveIn"
+
+#define DD_WAVE_OUT_DEVICE_NAME "\\Device\\WaveOut"
+#define DD_WAVE_OUT_DEVICE_NAME_U L"\\Device\\WaveOut"
+
+#define DD_MIDI_IN_DEVICE_NAME "\\Device\\MidiIn"
+#define DD_MIDI_IN_DEVICE_NAME_U L"\\Device\\MidiIn"
+
+#define DD_MIDI_OUT_DEVICE_NAME "\\Device\\MidiOut"
+#define DD_MIDI_OUT_DEVICE_NAME_U L"\\Device\\MidiOut"
+
+#define DD_MIX_DEVICE_NAME "\\Device\\MMMix"
+#define DD_MIX_DEVICE_NAME_U L"\\Device\\MMMix"
+
+#define DD_AUX_DEVICE_NAME "\\Device\\MMAux"
+#define DD_AUX_DEVICE_NAME_U L"\\Device\\MMAux"
+
+/*
+ Base control codes
+*/
+
+#define IOCTL_SOUND_BASE FILE_DEVICE_SOUND
+#define IOCTL_WAVE_BASE 0x0000
+#define IOCTL_MIDI_BASE 0x0080
+#define IOCTL_AUX_BASE 0x0100
+#define IOCTL_MIX_BASE 0x0180
+
+
+/*
+ Helper macros for defining control codes
+*/
+
+#define WAVE_CTL_CODE(subcode, iomethod, access) \
+ CTL_CODE(FILE_DEVICE_SOUND, IOCTL_WAVE_BASE + subcode, iomethod, access)
+
+#define MIDI_CTL_CODE(subcode, iomethod, access) \
+ CTL_CODE(FILE_DEVICE_SOUND, IOCTL_MIDI_BASE + subcode, iomethod, access)
+
+#define MIX_CTL_CODE(subcode, iomethod, access) \
+ CTL_CODE(FILE_DEVICE_SOUND, IOCTL_MIX_BASE + subcode, iomethod, access)
+
+#define AUX_CTL_CODE(subcode, iomethod, access) \
+ CTL_CODE(FILE_DEVICE_SOUND, IOCTL_AUX_BASE + subcode, iomethod, access)
+
+
+/*
+ Wave device control codes
+*/
+
+#define IOCTL_WAVE_QUERY_FORMAT \
+ WAVE_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_WAVE_SET_FORMAT \
+ WAVE_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_GET_CAPABILITIES \
+ WAVE_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_WAVE_SET_STATE \
+ WAVE_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_GET_STATE \
+ WAVE_CTL_CODE(0x0005, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_GET_POSITION \
+ WAVE_CTL_CODE(0x0006, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_SET_VOLUME \
+ WAVE_CTL_CODE(0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_WAVE_GET_VOLUME \
+ WAVE_CTL_CODE(0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_WAVE_SET_PITCH \
+ WAVE_CTL_CODE(0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_GET_PITCH \
+ WAVE_CTL_CODE(0x000A, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_SET_PLAYBACK_RATE \
+ WAVE_CTL_CODE(0x000B, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_GET_PLAYBACK_RATE \
+ WAVE_CTL_CODE(0x000C, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_PLAY \
+ WAVE_CTL_CODE(0x000D, METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_RECORD \
+ WAVE_CTL_CODE(0x000E, METHOD_OUT_DIRECT, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_BREAK_LOOP \
+ WAVE_CTL_CODE(0x000F, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_WAVE_SET_LOW_PRIORITY \
+ WAVE_CTL_CODE(0x0010, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#if DBG
+ /* Debug-only control code */
+ #define IOCTL_WAVE_SET_DEBUG_LEVEL \
+ WAVE_CTL_CODE(0x0040, METHOD_BUFFERED, FILE_READ_ACCESS)
+#endif
+
+
+/*
+ MIDI device control codes
+*/
+
+#define IOCTL_MIDI_GET_CAPABILITIES \
+ MIDI_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MIDI_SET_STATE \
+ MIDI_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_MIDI_GET_STATE \
+ MIDI_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_MIDI_SET_VOLUME \
+ MIDI_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MIDI_GET_VOLUME \
+ MIDI_CTL_CODE(0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MIDI_PLAY \
+ MIDI_CTL_CODE(0x0006, METHOD_NEITHER, FILE_WRITE_ACCESS)
+
+#define IOCTL_MIDI_RECORD \
+ MIDI_CTL_CODE(0x0007, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_MIDI_CACHE_PATCHES \
+ MIDI_CTL_CODE(0x0008, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_MIDI_CACHE_DRUM_PATCHES \
+ MIDI_CTL_CODE(0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#if DBG
+ /* Debug-only control code */
+ #define IOCTL_MIDI_SET_DEBUG_LEVEL \
+ WAVE_CTL_CODE(0x0040, METHOD_BUFFERED, FILE_READ_ACCESS)
+#endif
+
+
+/*
+ Mixer device control codes
+*/
+
+#define IOCTL_MIX_GET_CONFIGURATION \
+ MIX_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MIX_GET_CONTROL_DATA \
+ MIX_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MIX_GET_LINE_DATA \
+ MIX_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MIX_REQUEST_NOTIFY \
+ MIX_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+
+/*
+ Auxiliary device control codes
+*/
+
+#define IOCTL_AUX_GET_CAPABILITIES \
+ AUX_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_AUX_SET_VOLUME \
+ AUX_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_AUX_GET_VOLUME \
+ AUX_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_SOUND_GET_CHANGED_VOLUME \
+ AUX_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+
+/*
+ Wave structures & states
+*/
+
+#define WAVE_DD_MAX_VOLUME 0xFFFFFFFF
+
+typedef struct _WAVE_DD_VOLUME
+{
+ ULONG Left;
+ ULONG Right;
+} WAVE_DD_VOLUME, *PWAVE_DD_VOLUME;
+
+typedef struct _WAVE_DD_PITCH
+{
+ ULONG Pitch;
+} WAVE_DD_PITCH, *PWAVE_DD_PITCH;
+
+typedef struct _WAVE_DD_PLAYBACK_RATE
+{
+ ULONG Rate;
+} WAVE_DD_PLAYBACK_RATE, *PWAVE_DD_PLAYBACK_RATE;
+
+/* IOCTL_WAVE_SET_STATE commands */
+#define WAVE_DD_STOP 0x0001
+#define WAVE_DD_PLAY 0x0002
+#define WAVE_DD_RECORD 0x0003
+#define WAVE_DD_RESET 0x0004
+
+/* IOCTL_WAVE_GET_STATE responses */
+#define WAVE_DD_IDLE 0x0000
+#define WAVE_DD_STOPPED 0x0001
+#define WAVE_DD_PLAYING 0x0002
+#define WAVE_DD_RECORDING 0x0003
+
+
+/*
+ MIDI structures & states
+*/
+
+typedef struct _MIDI_DD_INPUT_DATA
+{
+ LARGE_INTEGER Time;
+ UCHAR Data[sizeof(ULONG)];
+} MIDI_DD_INPUT_DATA, *PMIDI_DD_INPUT_DATA;
+
+typedef struct _MIDI_DD_VOLUME
+{
+ ULONG Left;
+ ULONG Right;
+} MIDI_DD_VOLUME, *PMIDI_DD_VOLUME;
+
+typedef struct _MIDI_DD_CACHE_PATCHES
+{
+ ULONG Bank;
+ ULONG Flags;
+ ULONG Patches[128];
+} MIDI_DD_CACHE_PATCHES, *PMIDI_DD_CACHE_PATCHES;
+
+typedef struct _MIDI_DD_CACHE_DRUM_PATCHES
+{
+ ULONG Patch;
+ ULONG Flags;
+ ULONG DrumPatches[128];
+} MIDI_DD_CACHE_DRUM_PATCHES, *PMIDI_DD_CACHE_DRUM_PATCHES;
+
+/* IOCTL_MIDI_SET_STATE commands */
+#define MIDI_DD_STOP 0x0001
+#define MIDI_DD_PLAY 0x0002
+#define MIDI_DD_RECORD 0x0003
+#define MIDI_DD_RESET 0x0004
+
+/* IOCTL_MIDI_GET_STATE responses */
+#define MIDI_DD_IDLE 0x0000
+#define MIDI_DD_STOPPED 0x0001
+#define MIDI_DD_PLAYING 0x0002
+#define MIDI_DD_RECORDING 0x0003
+
+
+/*
+ Mixer structures
+ TODO: This is incomplete (see NTDDMIX.H in NT4 DDK)
+*/
+
+typedef struct _MIXER_DD_READ_DATA
+{
+ ULONG Id;
+} MIXER_DD_READ_DATA, *PMIXER_DD_READ_DATA;
+
+typedef struct _MIXER_DD_LINE_DATA
+{
+ ULONG fdwLine;
+} MIXER_DD_LINE_DATA, *PMIXER_DD_LINE_DATA;
+
+
+/*
+ Auxiliary structures
+*/
+
+#define AUX_DD_MAX_VOLUME 0xFFFFFFFF
+
+typedef struct _AUX_DD_VOLUME
+{
+ ULONG Left;
+ ULONG Right;
+} AUX_DD_VOLUME, *PAUX_DD_VOLUME;
+
+
+#endif
Propchange: branches/silverblade-audio/include/ddk/ntddsnd.h
------------------------------------------------------------------------------
svn:eol-style = native