sndblst fixes based on patch by Sylvain Petreolle.

svn path=/trunk/; revision=9875
This commit is contained in:
Steven Edwards 2004-06-25 23:30:22 +00:00
parent d5255272ce
commit 75fa578ba6
6 changed files with 26 additions and 10 deletions

View file

@ -73,6 +73,7 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
NTSTATUS Status;
PDEVICE_EXTENSION Device = DeviceObject->DeviceExtension;
KEVENT DMAEvent;
KIRQL OldIrql;
// Buffersize should already be set but it isn't yet !
Device->BufferSize = SB_BUFSIZE;
@ -138,7 +139,9 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
&Device->Buffer, FALSE);
// For some reason BufferSize == 0 here?!
DPRINT("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize);
// DPRINT("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize);
DPRINT("Bufsize == %u,", Device->BufferSize);
DPRINT("Buffer == 0x%x\n", Device->Buffer);
if (! Device->VirtualBuffer)
{
@ -147,14 +150,16 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
return FALSE;
}
DPRINT("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize);
// DPRINT("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize);
DPRINT("Bufsize == %u,", Device->BufferSize);
DPRINT("Buffer == 0x%x\n", Device->Buffer);
DPRINT("Calling IoAllocateMdl()\n");
Device->Mdl = IoAllocateMdl(Device->VirtualBuffer, Device->BufferSize, FALSE, FALSE, NULL);
DPRINT("Bufsize == %u\n", Device->BufferSize);
// IS THIS RIGHT:
if (! Device->VirtualBuffer)
if (! Device->Mdl)
{
DPRINT("IoAllocateMdl() FAILED\n");
// Free the HAL buffer
@ -171,11 +176,13 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
// part II:
KeInitializeEvent(&DMAEvent, SynchronizationEvent, FALSE);
// Raise IRQL
KeRaiseIrql(DISPATCH_LEVEL,&OldIrql);
IoAllocateAdapterChannel(Device->Adapter, DeviceObject,
BYTES_TO_PAGES(Device->BufferSize),
SoundProgramDMA, &DMAEvent);
DPRINT("VBuffer == 0x%x Bufsize == %u\n", Device->VirtualBuffer, Device->BufferSize);
// Lower IRQL
KeLowerIrql(OldIrql);
DPRINT("VBuffer == 0x%x Bufsize == %u\n", Device->VirtualBuffer, Device->BufferSize);
KeWaitForSingleObject(&DMAEvent, Executive, KernelMode, FALSE, NULL);

View file

@ -2,6 +2,8 @@ PATH_TO_TOP = ../../..
TARGET_BOOTSTRAP = yes
TARGET_CFLAGS = -Wall #-Werror
TARGET_TYPE = driver
TARGET_NAME = sndblst

View file

@ -101,6 +101,11 @@ WORD InitSoundCard(UINT BasePort)
DPRINT("DSP v%d.%d\n", DSP_Major, DSP_Minor);
// if audio is disabled,
// version tests return 0xFF everywhere
if (DSP_Major == 0xFF && DSP_Minor == 0xFF)
return FALSE;
DPRINT("Sound card initialized!\n");
return (DSP_Major * 256) + DSP_Minor;

View file

@ -17,7 +17,7 @@
else if (s == STATUS_ACCESS_DENIED) \
DPRINT("NTSTATUS == ACCESS_DENIED\n") \
else \
DPRINT("NTSTATUS == FAILURE (???)\n"); \
DPRINT("NTSTATUS == FAILURE (Unknown)\n"); \
}
#else
#define TEST_STATUS(s)

View file

@ -107,10 +107,10 @@ NTSTATUS InitDevice(
s = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, RegistryPath, Table,
&Parameters, NULL);
*/
if (! NT_SUCCESS(s))
return s;
*/
DPRINT("Port 0x%x IRQ %d DMA %d\n", Parameters->Port, Parameters->IRQ, Parameters->DMA);
@ -124,6 +124,7 @@ NTSTATUS InitDevice(
// Set state indication somehow
// Failure - what error code do we give?!
// return STATUS_????
return STATUS_UNSUCCESSFUL;
}
DSP_Major = DSP_Version / 256;
@ -453,7 +454,8 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
// DeviceExtension = DeviceObject->DeviceExtension;
// DeviceExtension->BeepOn = FALSE;
return(STATUS_SUCCESS);
// return(STATUS_SUCCESS);
return(Status);
}
/* EOF */

View file

@ -46,9 +46,9 @@
#define IOCTL_SOUND_BASE FILE_DEVICE_SOUND
#define IOCTL_WAVE_BASE 0x0000 // CORRECT?
//#define IOCTL_MIDI_PLAY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0006, \
// METHOD_BUFFERED, FILE_WRITE_ACCESS)
/* #define IOCTL_MIDI_PLAY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0006, \
* METHOD_BUFFERED, FILE_WRITE_ACCESS)
*/
// Some constants