mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:33:01 +00:00
- get sndblst and sound compiling on msvc.
svn path=/trunk/; revision=20649
This commit is contained in:
parent
6b36b1e871
commit
f3b9f7739f
7 changed files with 46 additions and 48 deletions
|
@ -7,7 +7,7 @@
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
#include "sndblst.h"
|
#include "sndblst.h"
|
||||||
|
|
||||||
VOID SetOutputSampleRate(UINT BasePort, UINT SampleRate)
|
VOID SetOutputSampleRate(ULONG BasePort, ULONG SampleRate)
|
||||||
{
|
{
|
||||||
// This only works for DSP v4.xx ONLY - need a workaround!
|
// This only works for DSP v4.xx ONLY - need a workaround!
|
||||||
DPRINT("Setting output sample rate\n");
|
DPRINT("Setting output sample rate\n");
|
||||||
|
@ -22,7 +22,7 @@ VOID SetOutputSampleRate(UINT BasePort, UINT SampleRate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID EnableSpeaker(UINT BasePort, BOOLEAN SpeakerOn)
|
VOID EnableSpeaker(ULONG BasePort, BOOLEAN SpeakerOn)
|
||||||
{
|
{
|
||||||
DPRINT("Setting speaker status %d\n", SpeakerOn);
|
DPRINT("Setting speaker status %d\n", SpeakerOn);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ VOID EnableSpeaker(UINT BasePort, BOOLEAN SpeakerOn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN IsSpeakerEnabled(UINT BasePort)
|
BOOLEAN IsSpeakerEnabled(ULONG BasePort)
|
||||||
{
|
{
|
||||||
DPRINT("Obtaining speaker status\n");
|
DPRINT("Obtaining speaker status\n");
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ BOOLEAN IsSpeakerEnabled(UINT BasePort)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID BeginPlayback(UINT BasePort, UINT BitDepth, UINT Channels, UINT BlockSize)
|
VOID BeginPlayback(ULONG BasePort, ULONG BitDepth, ULONG Channels, ULONG BlockSize)
|
||||||
{
|
{
|
||||||
DPRINT("BeginPlayback(%d, %d, %d, %d)\n", BasePort, BitDepth, Channels, BlockSize);
|
DPRINT("BeginPlayback(%d, %d, %d, %d)\n", BasePort, BitDepth, Channels, BlockSize);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static IO_ALLOCATION_ACTION STDCALL SoundProgramDMA(
|
||||||
IN PVOID Context)
|
IN PVOID Context)
|
||||||
{
|
{
|
||||||
PDEVICE_EXTENSION Device = DeviceObject->DeviceExtension;
|
PDEVICE_EXTENSION Device = DeviceObject->DeviceExtension;
|
||||||
UINT zzz;
|
ULONG zzz;
|
||||||
PUCHAR VirtualAddress = (PUCHAR) MmGetMdlVirtualAddress(Device->Mdl);
|
PUCHAR VirtualAddress = (PUCHAR) MmGetMdlVirtualAddress(Device->Mdl);
|
||||||
|
|
||||||
DPRINT("IoMapTransfer\n");
|
DPRINT("IoMapTransfer\n");
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
#include "sndblst.h"
|
#include "sndblst.h"
|
||||||
|
|
||||||
BOOLEAN WaitToSend(UINT BasePort)
|
BOOLEAN WaitToSend(ULONG BasePort)
|
||||||
{
|
{
|
||||||
int TimeOut;
|
int TimeOut;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ BOOLEAN WaitToSend(UINT BasePort)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN WaitToReceive(UINT BasePort)
|
BOOLEAN WaitToReceive(ULONG BasePort)
|
||||||
{
|
{
|
||||||
int TimeOut;
|
int TimeOut;
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ BOOLEAN WaitToReceive(UINT BasePort)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WORD InitSoundCard(UINT BasePort)
|
USHORT InitSoundCard(ULONG BasePort)
|
||||||
{
|
{
|
||||||
UINT TimeOut;
|
ULONG TimeOut;
|
||||||
BOOLEAN Status;
|
BOOLEAN Status;
|
||||||
UCHAR DSP_Major, DSP_Minor;
|
UCHAR DSP_Major, DSP_Minor;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
/* INTERNAL VARIABLES ******************************************************/
|
/* INTERNAL VARIABLES ******************************************************/
|
||||||
|
|
||||||
UINT DeviceCount = 0;
|
ULONG DeviceCount = 0;
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
@ -38,7 +38,7 @@ static NTSTATUS InitDevice(
|
||||||
// CONFIG Config;
|
// CONFIG Config;
|
||||||
RTL_QUERY_REGISTRY_TABLE Table[2];
|
RTL_QUERY_REGISTRY_TABLE Table[2];
|
||||||
NTSTATUS s;
|
NTSTATUS s;
|
||||||
WORD DSP_Version = 0;
|
USHORT DSP_Version = 0;
|
||||||
UCHAR DSP_Major = 0, DSP_Minor = 0;
|
UCHAR DSP_Major = 0, DSP_Minor = 0;
|
||||||
|
|
||||||
// This is TEMPORARY, to ensure that we don't process more than 1 device.
|
// This is TEMPORARY, to ensure that we don't process more than 1 device.
|
||||||
|
@ -228,7 +228,7 @@ BlasterCleanup(PDEVICE_OBJECT DeviceObject,
|
||||||
* RETURNS: Success or failure
|
* RETURNS: Success or failure
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
UINT Channel;
|
ULONG Channel;
|
||||||
DPRINT("BlasterCleanup() called!\n");
|
DPRINT("BlasterCleanup() called!\n");
|
||||||
|
|
||||||
// Reset the device (should we do this?)
|
// Reset the device (should we do this?)
|
||||||
|
@ -255,8 +255,8 @@ BlasterWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION Stack;
|
PIO_STACK_LOCATION Stack;
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension;
|
||||||
UINT ByteCount;
|
ULONG ByteCount;
|
||||||
PBYTE Data;
|
PUCHAR Data;
|
||||||
|
|
||||||
DPRINT("BlasterWrite() called!\n");
|
DPRINT("BlasterWrite() called!\n");
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ BlasterWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
|
|
||||||
DPRINT("%d bytes\n", Stack->Parameters.Write.Length);
|
DPRINT("%d bytes\n", Stack->Parameters.Write.Length);
|
||||||
|
|
||||||
Data = (PBYTE) Irp->AssociatedIrp.SystemBuffer;
|
Data = (PUCHAR) Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
|
||||||
for (ByteCount = 0; ByteCount < Stack->Parameters.Write.Length; ByteCount ++)
|
for (ByteCount = 0; ByteCount < Stack->Parameters.Write.Length; ByteCount ++)
|
||||||
{
|
{
|
||||||
|
@ -307,7 +307,7 @@ BlasterDeviceControl(PDEVICE_OBJECT DeviceObject,
|
||||||
/* case IOCTL_MIDI_PLAY :
|
/* case IOCTL_MIDI_PLAY :
|
||||||
{
|
{
|
||||||
DPRINT("Received IOCTL_MIDI_PLAY\n");
|
DPRINT("Received IOCTL_MIDI_PLAY\n");
|
||||||
Data = (PBYTE) Irp->AssociatedIrp.SystemBuffer;
|
Data = (PUCHAR) Irp->AssociatedIrp.SystemBuffer;
|
||||||
|
|
||||||
DPRINT("Sending %d bytes of MIDI data to 0x%d:\n", Stack->Parameters.DeviceIoControl.InputBufferLength, DeviceExtension->Port);
|
DPRINT("Sending %d bytes of MIDI data to 0x%d:\n", Stack->Parameters.DeviceIoControl.InputBufferLength, DeviceExtension->Port);
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,9 @@ typedef struct _DEVICE_EXTENSION
|
||||||
{
|
{
|
||||||
PWSTR RegistryPath;
|
PWSTR RegistryPath;
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
UINT Port;
|
ULONG Port;
|
||||||
UINT IRQ;
|
ULONG IRQ;
|
||||||
UINT DMA;
|
ULONG DMA;
|
||||||
ULONG BufferSize;
|
ULONG BufferSize;
|
||||||
PADAPTER_OBJECT Adapter;
|
PADAPTER_OBJECT Adapter;
|
||||||
PMDL Mdl;
|
PMDL Mdl;
|
||||||
|
@ -123,8 +123,8 @@ typedef struct _DEVICE_INSTANCE
|
||||||
|
|
||||||
//typedef struct _CONFIG
|
//typedef struct _CONFIG
|
||||||
//{
|
//{
|
||||||
// UINT Port;
|
// ULONG Port;
|
||||||
// UINT IRQ;
|
// ULONG IRQ;
|
||||||
//} CONFIG, *PCONFIG;
|
//} CONFIG, *PCONFIG;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -139,9 +139,9 @@ typedef REGISTRY_CALLBACK_ROUTINE *PREGISTRY_CALLBACK_ROUTINE;
|
||||||
Prototypes for functions in portio.c :
|
Prototypes for functions in portio.c :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOLEAN WaitToSend(UINT BasePort);
|
BOOLEAN WaitToSend(ULONG BasePort);
|
||||||
BOOLEAN WaitToReceive(UINT BasePort);
|
BOOLEAN WaitToReceive(ULONG BasePort);
|
||||||
WORD InitSoundCard(UINT BasePort);
|
USHORT InitSoundCard(ULONG BasePort);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Prototypes for functions in settings.c :
|
Prototypes for functions in settings.c :
|
||||||
|
@ -168,9 +168,9 @@ BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID SetOutputSampleRate(UINT BasePort, UINT SampleRate);
|
VOID SetOutputSampleRate(ULONG BasePort, ULONG SampleRate);
|
||||||
VOID EnableSpeaker(UINT BasePort, BOOLEAN SpeakerOn);
|
VOID EnableSpeaker(ULONG BasePort, BOOLEAN SpeakerOn);
|
||||||
BOOLEAN IsSpeakerEnabled(UINT BasePort);
|
BOOLEAN IsSpeakerEnabled(ULONG BasePort);
|
||||||
VOID BeginPlayback(UINT BasePort, UINT BitDepth, UINT Channels, UINT BlockSize);
|
VOID BeginPlayback(ULONG BasePort, ULONG BitDepth, ULONG Channels, ULONG BlockSize);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
/* FUNCTIONS **************************************************************/
|
/* FUNCTIONS **************************************************************/
|
||||||
|
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
|
#include <halfuncs.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <devices.h>
|
#include <devices.h>
|
||||||
|
|
||||||
|
@ -38,7 +39,6 @@ static BOOLEAN STDCALL DMAOutputISR(PKINTERRUPT Interrupt, PVOID ServiceContext)
|
||||||
|
|
||||||
void sb16_play(WAVE_HDR* wave)
|
void sb16_play(WAVE_HDR* wave)
|
||||||
{
|
{
|
||||||
unsigned int eflags;
|
|
||||||
ULONG MappedIrq;
|
ULONG MappedIrq;
|
||||||
KIRQL Dirql;
|
KIRQL Dirql;
|
||||||
KAFFINITY Affinity;
|
KAFFINITY Affinity;
|
||||||
|
@ -64,9 +64,7 @@ void sb16_play(WAVE_HDR* wave)
|
||||||
* saving the previous state of the interrupt flag
|
* saving the previous state of the interrupt flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__asm__("pushf\n\tpop %0\n\tcli\n\t"
|
_disable();
|
||||||
: "=m" (eflags)
|
|
||||||
: );
|
|
||||||
|
|
||||||
memcpy(sb16.buffer,(&wave->data),wave->dLen);
|
memcpy(sb16.buffer,(&wave->data),wave->dLen);
|
||||||
|
|
||||||
|
@ -82,9 +80,7 @@ void sb16_play(WAVE_HDR* wave)
|
||||||
// outb(0x21,(mask&~newmask));
|
// outb(0x21,(mask&~newmask));
|
||||||
|
|
||||||
// Restore the interrupt flag
|
// Restore the interrupt flag
|
||||||
__asm__("push %0\n\tpopf\n\t"
|
_enable();
|
||||||
:
|
|
||||||
: "m" (eflags));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
KIRQL irql;
|
KIRQL irql;
|
||||||
KAFFINITY affinity;
|
KAFFINITY affinity;
|
||||||
|
|
||||||
|
#include <pshpack1.h>
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned char rID[4] __attribute__((packed)); //4 0
|
unsigned char rID[4] ; //4 0
|
||||||
unsigned int rLen __attribute__((packed)); //4 4
|
unsigned int rLen ; //4 4
|
||||||
unsigned char wID[4] __attribute__((packed)); //4 8
|
unsigned char wID[4] ; //4 8
|
||||||
unsigned char fID[4] __attribute__((packed)); //4 12
|
unsigned char fID[4] ; //4 12
|
||||||
unsigned int fLen __attribute__((packed)); //4 16
|
unsigned int fLen ; //4 16
|
||||||
unsigned short wFormatTag __attribute__((packed)); //2 18
|
unsigned short wFormatTag ; //2 18
|
||||||
unsigned short nChannels __attribute__((packed)); //2 20
|
unsigned short nChannels ; //2 20
|
||||||
unsigned int nSamplesPerSec __attribute__((packed)); //2 22
|
unsigned int nSamplesPerSec ; //2 22
|
||||||
unsigned int nAvgBytesPerSec __attribute__((packed)); //2 24
|
unsigned int nAvgBytesPerSec ; //2 24
|
||||||
unsigned short nBlockAlign __attribute__((packed)); //2 26
|
unsigned short nBlockAlign ; //2 26
|
||||||
unsigned short FormatSpecific __attribute__((packed)); //2 28
|
unsigned short FormatSpecific ; //2 28
|
||||||
unsigned char dID[4] __attribute__((packed)); //4 30
|
unsigned char dID[4] ; //4 30
|
||||||
unsigned int dLen __attribute__((packed));
|
unsigned int dLen ;
|
||||||
unsigned char* data;
|
unsigned char* data;
|
||||||
}WAVE_HDR;
|
}WAVE_HDR;
|
||||||
|
#include <poppack.h>
|
||||||
|
|
||||||
void sb16_play(WAVE_HDR* wave);
|
void sb16_play(WAVE_HDR* wave);
|
||||||
void dump_wav(WAVE_HDR* wave);
|
void dump_wav(WAVE_HDR* wave);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue