DbgPrint -> DPRINT

svn path=/trunk/; revision=8910
This commit is contained in:
Filip Navara 2004-03-28 20:44:09 +00:00
parent 9447d23bc1
commit 741870b134
7 changed files with 45 additions and 60 deletions

View file

@ -5,14 +5,12 @@
*/ */
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <debug.h>
#include "sndblst.h" #include "sndblst.h"
VOID SetOutputSampleRate(UINT BasePort, UINT SampleRate) VOID SetOutputSampleRate(UINT BasePort, UINT SampleRate)
{ {
// This only works for DSP v4.xx ONLY - need a workaround! // This only works for DSP v4.xx ONLY - need a workaround!
DbgPrint("Setting output sample rate\n"); DPRINT("Setting output sample rate\n");
// WAIT // WAIT
// if (! WaitToSend(BasePort)) // if (! WaitToSend(BasePort))
@ -26,7 +24,7 @@ VOID SetOutputSampleRate(UINT BasePort, UINT SampleRate)
VOID EnableSpeaker(UINT BasePort, BOOLEAN SpeakerOn) VOID EnableSpeaker(UINT BasePort, BOOLEAN SpeakerOn)
{ {
DbgPrint("Setting speaker status %d\n", SpeakerOn); DPRINT("Setting speaker status %d\n", SpeakerOn);
// if (! WaitForWrite(BasePort)) // if (! WaitForWrite(BasePort))
// return; // return;
@ -37,7 +35,7 @@ VOID EnableSpeaker(UINT BasePort, BOOLEAN SpeakerOn)
BOOLEAN IsSpeakerEnabled(UINT BasePort) BOOLEAN IsSpeakerEnabled(UINT BasePort)
{ {
DbgPrint("Obtaining speaker status\n"); DPRINT("Obtaining speaker status\n");
// if (! WaitToSend(BasePort)) // if (! WaitToSend(BasePort))
// return FALSE; // return FALSE;
@ -54,7 +52,7 @@ VOID BeginPlayback(UINT BasePort, UINT BitDepth, UINT Channels, UINT BlockSize)
{ {
CHAR Command; CHAR Command;
DbgPrint("BeginPlayback(%d, %d, %d, %d)\n", BasePort, BitDepth, Channels, BlockSize); DPRINT("BeginPlayback(%d, %d, %d, %d)\n", BasePort, BitDepth, Channels, BlockSize);
// switch(BitDepth) // switch(BitDepth)
// { // {
@ -63,7 +61,7 @@ VOID BeginPlayback(UINT BasePort, UINT BitDepth, UINT Channels, UINT BlockSize)
// default : Command = 0xc0; // default : Command = 0xc0;
// } // }
DbgPrint("Initiating playback\n"); DPRINT("Initiating playback\n");
// TEMPORARY: // TEMPORARY:
SB_WRITE_BYTE(BasePort, 0xc6); SB_WRITE_BYTE(BasePort, 0xc6);

View file

@ -3,9 +3,6 @@
*/ */
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <debug.h>
#include "sndblst.h" #include "sndblst.h"
@ -46,7 +43,7 @@ IO_ALLOCATION_ACTION STDCALL SoundProgramDMA(
UINT zzz; UINT zzz;
PUCHAR VirtualAddress = (PUCHAR) MmGetMdlVirtualAddress(Device->Mdl); PUCHAR VirtualAddress = (PUCHAR) MmGetMdlVirtualAddress(Device->Mdl);
DbgPrint("IoMapTransfer\n"); DPRINT("IoMapTransfer\n");
IoMapTransfer(Device->Adapter, IoMapTransfer(Device->Adapter,
Device->Mdl, Device->Mdl,
MapRegisterBase, MapRegisterBase,
@ -54,14 +51,14 @@ IO_ALLOCATION_ACTION STDCALL SoundProgramDMA(
&Device->BufferSize, // is this right? &Device->BufferSize, // is this right?
TRUE); TRUE);
DbgPrint("VBuffer == 0x%x (really 0x%x?) Bufsize == %u\n", Device->VirtualBuffer, MmGetPhysicalAddress(Device->VirtualBuffer), Device->BufferSize); DPRINT("VBuffer == 0x%x (really 0x%x?) Bufsize == %u\n", Device->VirtualBuffer, MmGetPhysicalAddress(Device->VirtualBuffer), Device->BufferSize);
DbgPrint("Writing %u bytes of garbage...\n", Device->BufferSize); DPRINT("Writing %u bytes of garbage...\n", Device->BufferSize);
// Write some garbage: // Write some garbage:
for (zzz = 0; zzz < Device->BufferSize; zzz ++) for (zzz = 0; zzz < Device->BufferSize; zzz ++)
*(VirtualAddress + zzz) = (UCHAR) zzz % 200; *(VirtualAddress + zzz) = (UCHAR) zzz % 200;
DbgPrint("done\n"); DPRINT("done\n");
KeSetEvent(Context, 0, FALSE); KeSetEvent(Context, 0, FALSE);
@ -79,7 +76,7 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
// Buffersize should already be set but it isn't yet ! // Buffersize should already be set but it isn't yet !
Device->BufferSize = SB_BUFSIZE; Device->BufferSize = SB_BUFSIZE;
DbgPrint("Bufsize == %u\n", Device->BufferSize); DPRINT("Bufsize == %u\n", Device->BufferSize);
RtlZeroMemory(&Desc, sizeof(DEVICE_DESCRIPTION)); RtlZeroMemory(&Desc, sizeof(DEVICE_DESCRIPTION));
@ -102,74 +99,74 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
// Desc.MinimumLength = 0; // Desc.MinimumLength = 0;
Desc.DmaPort = 0; Desc.DmaPort = 0;
DbgPrint("Calling HalGetAdapter(), asking for %d mapped regs\n", MappedRegs); DPRINT("Calling HalGetAdapter(), asking for %d mapped regs\n", MappedRegs);
Device->Adapter = HalGetAdapter(&Desc, &MappedRegs); Device->Adapter = HalGetAdapter(&Desc, &MappedRegs);
DbgPrint("Called\n"); DPRINT("Called\n");
if (! Device->Adapter) if (! Device->Adapter)
{ {
DbgPrint("HalGetAdapter() FAILED\n"); DPRINT("HalGetAdapter() FAILED\n");
return FALSE; return FALSE;
} }
DbgPrint("Bufsize == %u\n", Device->BufferSize); DPRINT("Bufsize == %u\n", Device->BufferSize);
if (MappedRegs < BYTES_TO_PAGES(Device->BufferSize)) if (MappedRegs < BYTES_TO_PAGES(Device->BufferSize))
{ {
DbgPrint("Could only allocate %u mapping registers\n", MappedRegs); DPRINT("Could only allocate %u mapping registers\n", MappedRegs);
if (MappedRegs == 0) if (MappedRegs == 0)
return FALSE; return FALSE;
Device->BufferSize = MappedRegs * PAGE_SIZE; Device->BufferSize = MappedRegs * PAGE_SIZE;
DbgPrint("Bufsize == %u\n", Device->BufferSize); DPRINT("Bufsize == %u\n", Device->BufferSize);
} }
DbgPrint("Allocated %u mapping registers\n", MappedRegs); DPRINT("Allocated %u mapping registers\n", MappedRegs);
// Check if we already have memory here... // Check if we already have memory here...
// Check to make sure we're >= minimum // Check to make sure we're >= minimum
DbgPrint("Allocating buffer\n"); DPRINT("Allocating buffer\n");
DbgPrint("Bufsize == %u\n", Device->BufferSize); DPRINT("Bufsize == %u\n", Device->BufferSize);
Device->VirtualBuffer = HalAllocateCommonBuffer(Device->Adapter, Device->BufferSize, Device->VirtualBuffer = HalAllocateCommonBuffer(Device->Adapter, Device->BufferSize,
&Device->Buffer, FALSE); &Device->Buffer, FALSE);
// For some reason BufferSize == 0 here?! // For some reason BufferSize == 0 here?!
DbgPrint("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize); DPRINT("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize);
if (! Device->VirtualBuffer) if (! Device->VirtualBuffer)
{ {
DbgPrint("Could not allocate buffer :(\n"); DPRINT("Could not allocate buffer :(\n");
// should try again with smaller buffer... // should try again with smaller buffer...
return FALSE; return FALSE;
} }
DbgPrint("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize); DPRINT("Buffer == 0x%x Bufsize == %u\n", Device->Buffer, Device->BufferSize);
DbgPrint("Calling IoAllocateMdl()\n"); DPRINT("Calling IoAllocateMdl()\n");
Device->Mdl = IoAllocateMdl(Device->VirtualBuffer, Device->BufferSize, FALSE, FALSE, NULL); Device->Mdl = IoAllocateMdl(Device->VirtualBuffer, Device->BufferSize, FALSE, FALSE, NULL);
DbgPrint("Bufsize == %u\n", Device->BufferSize); DPRINT("Bufsize == %u\n", Device->BufferSize);
// IS THIS RIGHT: // IS THIS RIGHT:
if (! Device->VirtualBuffer) if (! Device->VirtualBuffer)
{ {
DbgPrint("IoAllocateMdl() FAILED\n"); DPRINT("IoAllocateMdl() FAILED\n");
// Free the HAL buffer // Free the HAL buffer
return FALSE; return FALSE;
} }
DbgPrint("VBuffer == 0x%x Mdl == %u Bufsize == %u\n", Device->VirtualBuffer, Device->Mdl, Device->BufferSize); DPRINT("VBuffer == 0x%x Mdl == %u Bufsize == %u\n", Device->VirtualBuffer, Device->Mdl, Device->BufferSize);
DbgPrint("Calling MmBuildMdlForNonPagedPool\n"); DPRINT("Calling MmBuildMdlForNonPagedPool\n");
MmBuildMdlForNonPagedPool(Device->Mdl); MmBuildMdlForNonPagedPool(Device->Mdl);
DbgPrint("Bufsize == %u\n", Device->BufferSize); DPRINT("Bufsize == %u\n", Device->BufferSize);
// part II: // part II:
KeInitializeEvent(&DMAEvent, SynchronizationEvent, FALSE); KeInitializeEvent(&DMAEvent, SynchronizationEvent, FALSE);
@ -177,7 +174,7 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
IoAllocateAdapterChannel(Device->Adapter, DeviceObject, IoAllocateAdapterChannel(Device->Adapter, DeviceObject,
BYTES_TO_PAGES(Device->BufferSize), BYTES_TO_PAGES(Device->BufferSize),
SoundProgramDMA, &DMAEvent); SoundProgramDMA, &DMAEvent);
DbgPrint("VBuffer == 0x%x Bufsize == %u\n", Device->VirtualBuffer, Device->BufferSize); DPRINT("VBuffer == 0x%x Bufsize == %u\n", Device->VirtualBuffer, Device->BufferSize);
// Lower IRQL // Lower IRQL
KeWaitForSingleObject(&DMAEvent, Executive, KernelMode, FALSE, NULL); KeWaitForSingleObject(&DMAEvent, Executive, KernelMode, FALSE, NULL);

View file

@ -1,7 +1,4 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <debug.h>
#include "sndblst.h" #include "sndblst.h"
@ -65,7 +62,7 @@ BOOLEAN ISR(
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)Context; PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)Context;
PDEVICE_EXTENSION Parameters = DeviceObject->DeviceExtension; PDEVICE_EXTENSION Parameters = DeviceObject->DeviceExtension;
DbgPrint("*** Processing ISR ***\n"); DPRINT("*** Processing ISR ***\n");
// What do we do here then? // What do we do here then?

View file

@ -13,12 +13,11 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include "sndblst.h" #include "sndblst.h"
BOOLEAN WaitToSend(UINT BasePort) BOOLEAN WaitToSend(UINT BasePort)
{ {
int TimeOut; int TimeOut;
DbgPrint("WaitToSend "); DPRINT("WaitToSend ");
// Check if it's OK to send // Check if it's OK to send
for (TimeOut = SB_TIMEOUT; for (TimeOut = SB_TIMEOUT;
@ -28,11 +27,11 @@ BOOLEAN WaitToSend(UINT BasePort)
// If a time-out occurs, we report failure // If a time-out occurs, we report failure
if (! TimeOut) if (! TimeOut)
{ {
DbgPrint("FAILED\n"); DPRINT("FAILED\n");
return FALSE; return FALSE;
} }
DbgPrint("SUCCEEDED\n"); DPRINT("SUCCEEDED\n");
return TRUE; return TRUE;
} }
@ -41,7 +40,7 @@ BOOLEAN WaitToReceive(UINT BasePort)
{ {
int TimeOut; int TimeOut;
DbgPrint("WaitToReceive "); DPRINT("WaitToReceive ");
// Check if it's OK to receive // Check if it's OK to receive
for (TimeOut = SB_TIMEOUT; for (TimeOut = SB_TIMEOUT;
@ -51,11 +50,11 @@ BOOLEAN WaitToReceive(UINT BasePort)
// If a time-out occurs, we report failure // If a time-out occurs, we report failure
if (! TimeOut) if (! TimeOut)
{ {
DbgPrint("FAILED\n"); DPRINT("FAILED\n");
return FALSE; return FALSE;
} }
DbgPrint("SUCCEEDED\n"); DPRINT("SUCCEEDED\n");
return TRUE; return TRUE;
} }
@ -67,9 +66,9 @@ WORD InitSoundCard(UINT BasePort)
BOOLEAN Status; BOOLEAN Status;
UCHAR DSP_Major, DSP_Minor; UCHAR DSP_Major, DSP_Minor;
DbgPrint("InitSoundCard() called\n"); DPRINT("InitSoundCard() called\n");
DbgPrint("Resetting sound card\n"); DPRINT("Resetting sound card\n");
// if (!WaitToSend(BasePort)) // if (!WaitToSend(BasePort))
// return FALSE; // return FALSE;
@ -79,7 +78,7 @@ WORD InitSoundCard(UINT BasePort)
// Check if it's OK to receive (some cards will ignore the above reset // Check if it's OK to receive (some cards will ignore the above reset
// command and so will not issue an ACK, so time out is NOT an error) // command and so will not issue an ACK, so time out is NOT an error)
DbgPrint("Waiting for an ACK\n"); DPRINT("Waiting for an ACK\n");
if (WaitToReceive(BasePort)) if (WaitToReceive(BasePort))
{ {
// Check to make sure the reset was acknowledged: // Check to make sure the reset was acknowledged:
@ -88,7 +87,7 @@ WORD InitSoundCard(UINT BasePort)
TimeOut --); TimeOut --);
} }
DbgPrint("Querying DSP version\n"); DPRINT("Querying DSP version\n");
if (! WaitToSend(BasePort)) if (! WaitToSend(BasePort))
return FALSE; return FALSE;
@ -100,9 +99,9 @@ WORD InitSoundCard(UINT BasePort)
DSP_Major = SB_READ_DATA(BasePort); DSP_Major = SB_READ_DATA(BasePort);
DSP_Minor = SB_READ_DATA(BasePort); DSP_Minor = SB_READ_DATA(BasePort);
DbgPrint("DSP v%d.%d\n", DSP_Major, DSP_Minor); DPRINT("DSP v%d.%d\n", DSP_Major, DSP_Minor);
DbgPrint("Sound card initialized!\n"); DPRINT("Sound card initialized!\n");
return (DSP_Major * 256) + DSP_Minor; return (DSP_Major * 256) + DSP_Minor;
} }

View file

@ -11,11 +11,7 @@
#include <ntddk.h> #include <ntddk.h>
#include <windows.h> #include <windows.h>
#include "sndblst.h" #include "sndblst.h"
// #define NDEBUG
#include <debug.h>
#include "sbdebug.h" // our own debug helper #include "sbdebug.h" // our own debug helper

View file

@ -12,12 +12,7 @@
/* INCLUDES ****************************************************************/ /* INCLUDES ****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
//#include <ddk/ntddbeep.h>
//#define NDEBUG
#include <debug.h>
#include <rosrtl/string.h> #include <rosrtl/string.h>
#include "sndblst.h" #include "sndblst.h"

View file

@ -14,6 +14,9 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#define NDEBUG
#include <debug.h>
#define DEFAULT_PORT 0x220 #define DEFAULT_PORT 0x220
#define DEFAULT_IRQ 5 #define DEFAULT_IRQ 5
#define DEFAULT_DMA 1 #define DEFAULT_DMA 1