Further stubbing of Kernel Streaming APIs

(corrective path fix to follow...)


svn path=/trunk/; revision=25108
This commit is contained in:
Andrew Greenwood 2006-12-10 04:16:35 +00:00
parent 275e3ef97e
commit 26fa983af4
72 changed files with 746 additions and 7135 deletions

View file

@ -1,53 +0,0 @@
This is a directory for the kernel streaming components, along with multimedia
kernel-mode drivers.
Much of this code exists only as stubs for future implementation.
The "include" directory exists as a place to store the KS related headers. It
should be moved to the main include tree later.
Andrew Greenwood
3rd December, 2006
== Kernel Streaming (KS.SYS) ==
Deals with streaming media. This is the core component for this, and can be
interacted with from usermode (usually via DirectX.)
XP and DirectX 8 versions of this component provide an additional suite of
AvStream API functions.
COM-style interfaces are used with this component.
== SysAudio (SYSAUDIO.SYS) ==
Filter graph builder (deals with topology.) Not sure what this does yet.
== Port Class (PORTCLS.SYS) ==
Used by WDM audio drivers, this handles many common tasks required for
audio drivers.
COM-style interfaces are used with this component.
== WDM Audio (WDMAUD.DLL / WDMAUD.SYS) ==
Effectively a relay from usermode to kernelmode, the usermode portion is a
MME-style driver (for WINMM.DLL) which tells the kernelmode portion what to do.
This typically involves interacting with KS.SYS in some way.
In Vista, the kernelmode portion is no longer present and the usermode portion
interacts with the Vista audio stack (which resides in usermode but also
ultimately ends up going back into kernelmode in the end!)
== Optional drivers ==
- sndblst Sound Blaster (+ Pro / 16) compatible driver
- mpu401 MPU-401 MIDI compatible driver

View file

@ -1,9 +0,0 @@
<directory name="mpu401">
<xi:include href="mpu401/mpu401.rbuild" />
</directory>
<directory name="sndblst">
<xi:include href="sndblst/sndblst.rbuild" />
</directory>
<directory name="sound">
<xi:include href="sound/sound.rbuild" />
</directory>

View file

@ -1,408 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/mpu401/mpu401.c
* PURPOSE: MPU-401 MIDI device driver
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 26, 2003: Copied from beep.c as template
* Sept 27, 2003: Implemented MPU-401 init & playback
*/
/* INCLUDES ****************************************************************/
#include <ntddk.h>
//#include <ntddbeep.h>
//#define NDEBUG
#include <debug.h>
#include "mpu401.h"
/* INTERNAL VARIABLES ******************************************************/
ULONG DeviceCount = 0;
/* FUNCTIONS ***************************************************************/
static NTSTATUS InitDevice(
IN PUNICODE_STRING RegistryPath,
IN PVOID Context)
{
// PDEVICE_INSTANCE Instance = Context;
PDEVICE_OBJECT DeviceObject; // = Context;
PDEVICE_EXTENSION Parameters; // = DeviceObject->DeviceExtension;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\MidiOut0");
UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\??\\MidiOut0");
// CONFIG Config;
RTL_QUERY_REGISTRY_TABLE Table[2];
NTSTATUS s;
// This is TEMPORARY, to ensure that we don't process more than 1 device.
// I'll remove this limitation in the future.
if (DeviceCount > 0)
{
DPRINT("Sorry - only 1 device supported by MPU401 driver at present :(\n");
return STATUS_NOT_IMPLEMENTED;
}
DPRINT("Creating IO device\n");
s = IoCreateDevice(Context, // driverobject
sizeof(DEVICE_EXTENSION),
&DeviceName,
FILE_DEVICE_SOUND, // Correct?
0,
FALSE,
&DeviceObject);
if (!NT_SUCCESS(s))
return s;
DPRINT("Device Extension at 0x%x\n", DeviceObject->DeviceExtension);
Parameters = DeviceObject->DeviceExtension;
DPRINT("Creating DOS link\n");
/* Create the dos device link */
IoCreateSymbolicLink(&SymlinkName,
&DeviceName);
DPRINT("Initializing device\n");
// DPRINT("Allocating memory for parameters structure\n");
// Bodged:
// Parameters = (PDEVICE_EXTENSION)ExAllocatePool(NonPagedPool, sizeof(DEVICE_EXTENSION));
// DeviceObject->DeviceExtension = Parameters;
// Parameters = Instance->DriverObject->DriverExtension;
DPRINT("DeviceObject at 0x%x, DeviceExtension at 0x%x\n", DeviceObject, Parameters);
if (! Parameters)
{
DPRINT("NULL POINTER!\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
// Instance->DriverObject->DriverExtension = Parameters;
DPRINT("Setting reg path\n");
Parameters->RegistryPath = RegistryPath;
// Parameters->DriverObject = Instance->DriverObject;
DPRINT("Zeroing table memory and setting query routine\n");
RtlZeroMemory(Table, sizeof(Table));
Table[0].QueryRoutine = LoadSettings;
DPRINT("Setting port and IRQ defaults\n");
Parameters->Port = DEFAULT_PORT;
Parameters->IRQ = DEFAULT_IRQ;
// Only to be enabled once we can get support for multiple cards working :)
/*
DPRINT("Loading settings from: %S\n", RegistryPath);
s = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, RegistryPath, Table,
&Parameters, NULL);
*/
if (! NT_SUCCESS(s))
return s;
DPRINT("Port 0x%x IRQ %d\n", Parameters->Port, Parameters->IRQ);
// Instance->P
// Enter UART mode (should be done in init phase
if (! InitUARTMode(Parameters->Port))
{
DPRINT("UART mode initialization FAILED!\n");
// Set state indication somehow
// Failure - what error code do we give?!
// return STATUS_????
}
DeviceCount ++;
return STATUS_SUCCESS;
}
static NTSTATUS STDCALL
MPU401Create(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
DPRINT("MPU401Create() called!\n");
// Initialize the MPU-401?
// ... do stuff ...
// Play a note to say we're alive:
WaitToSend(MPU401_PORT);
MPU401_WRITE_DATA(MPU401_PORT, 0x90);
WaitToSend(MPU401_PORT);
MPU401_WRITE_DATA(MPU401_PORT, 0x50);
WaitToSend(MPU401_PORT);
MPU401_WRITE_DATA(MPU401_PORT, 0x7f);
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_SUCCESS);
}
static NTSTATUS STDCALL
MPU401Close(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PDEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
DPRINT("MPU401Close() called!\n");
DeviceExtension = DeviceObject->DeviceExtension;
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(Status);
}
static NTSTATUS STDCALL
MPU401Cleanup(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
ULONG Channel;
DPRINT("MPU401Cleanup() called!\n");
// Reset the device (should we do this?)
for (Channel = 0; Channel <= 15; Channel ++)
{
// All notes off
// MPU401_WRITE_MESSAGE(MPU401_PORT, 0xb0 + Channel, 123, 0);
// All controllers off
// MPU401_WRITE_MESSAGE(MPU401_PORT, 0xb0 + Channel, 121, 0);
}
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_SUCCESS);
}
static NTSTATUS STDCALL
MPU401DeviceControl(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack;
PDEVICE_EXTENSION DeviceExtension;
ULONG ByteCount;
PUCHAR Data;
DPRINT("MPU401DeviceControl() called!\n");
DeviceExtension = DeviceObject->DeviceExtension;
Stack = IoGetCurrentIrpStackLocation(Irp);
DPRINT("Control code %d [0x%x]\n", Stack->Parameters.DeviceIoControl.IoControlCode,
Stack->Parameters.DeviceIoControl.IoControlCode);
switch(Stack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_MIDI_PLAY :
{
DPRINT("Received IOCTL_MIDI_PLAY\n");
Data = (PUCHAR) Irp->AssociatedIrp.SystemBuffer;
DPRINT("Sending %d bytes of MIDI data to 0x%d:\n", Stack->Parameters.DeviceIoControl.InputBufferLength, DeviceExtension->Port);
for (ByteCount = 0; ByteCount < Stack->Parameters.DeviceIoControl.InputBufferLength; ByteCount ++)
{
DPRINT("0x%x ", Data[ByteCount]);
MPU401_WRITE_BYTE(DeviceExtension->Port, Data[ByteCount]);
// if (WaitToSend(MPU401_PORT))
// MPU401_WRITE_DATA(MPU401_PORT, Data[ByteCount]);
}
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return(STATUS_SUCCESS);
}
}
return(STATUS_SUCCESS);
/*
DeviceExtension = DeviceObject->DeviceExtension;
Stack = IoGetCurrentIrpStackLocation(Irp);
BeepParam = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer;
Irp->IoStatus.Information = 0;
if (Stack->Parameters.DeviceIoControl.IoControlCode != IOCTL_BEEP_SET)
{
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_NOT_IMPLEMENTED);
}
if ((Stack->Parameters.DeviceIoControl.InputBufferLength != sizeof(BEEP_SET_PARAMETERS))
|| (BeepParam->Frequency < BEEP_FREQUENCY_MINIMUM)
|| (BeepParam->Frequency > BEEP_FREQUENCY_MAXIMUM))
{
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_INVALID_PARAMETER);
}
DueTime.QuadPart = 0;
*/
/* do the beep!! */
/* DPRINT("Beep:\n Freq: %lu Hz\n Dur: %lu ms\n",
pbsp->Frequency,
pbsp->Duration);
if (BeepParam->Duration >= 0)
{
DueTime.QuadPart = (LONGLONG)BeepParam->Duration * -10000;
KeSetTimer(&DeviceExtension->Timer,
DueTime,
&DeviceExtension->Dpc);
HalMakeBeep(BeepParam->Frequency);
DeviceExtension->BeepOn = TRUE;
KeWaitForSingleObject(&DeviceExtension->Event,
Executive,
KernelMode,
FALSE,
NULL);
}
else if (BeepParam->Duration == (DWORD)-1)
{
if (DeviceExtension->BeepOn == TRUE)
{
HalMakeBeep(0);
DeviceExtension->BeepOn = FALSE;
}
else
{
HalMakeBeep(BeepParam->Frequency);
DeviceExtension->BeepOn = TRUE;
}
}
DPRINT("Did the beep!\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_SUCCESS);
*/
}
static VOID STDCALL
MPU401Unload(PDRIVER_OBJECT DriverObject)
{
DPRINT("MPU401Unload() called!\n");
}
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
// PDEVICE_EXTENSION DeviceExtension;
// PDEVICE_OBJECT DeviceObject;
// DEVICE_INSTANCE Instance;
// Doesn't support multiple instances (yet ...)
NTSTATUS Status;
DPRINT("MPU401 Device Driver 0.0.1\n");
// Is this really necessary? Yes! (Talking to myself again...)
// Instance.DriverObject = DriverObject;
// previous instance = NULL...
// DeviceExtension->RegistryPath = RegistryPath;
DriverObject->Flags = 0;
DriverObject->MajorFunction[IRP_MJ_CREATE] = MPU401Create;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = MPU401Close;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = MPU401Cleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = MPU401DeviceControl;
DriverObject->DriverUnload = MPU401Unload;
// Major hack to just get this damn thing working:
Status = InitDevice(RegistryPath, DriverObject); // ????
// DPRINT("Enumerating devices at %wZ\n", RegistryPath);
// Status = EnumDeviceKeys(RegistryPath, PARMS_SUBKEY, InitDevice, (PVOID)&DeviceObject); // &Instance;
// check error
/* set up device extension */
// DeviceExtension = DeviceObject->DeviceExtension;
// DeviceExtension->BeepOn = FALSE;
return(STATUS_SUCCESS);
}
/* EOF */

View file

@ -1,155 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/mpu401/mpu401.h
* PURPOSE: MPU-401 MIDI device driver header
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 26, 2003: Created
*/
#ifndef __INCLUDES_MPU401_H__
#define __INCLUDES_MPU401_H__
//#include <mmsystem.h>
//#include <mmddk.h>
//#include <winioctl.h>
#include "../../../dll/win32/mmdrv/mmdef.h"
#define DEFAULT_PORT 0x330
#define DEFAULT_IRQ 9
#define DEVICE_SUBKEY L"Devices"
#define PARMS_SUBKEY L"Parameters"
#define REGISTRY_PORT L"Port"
// At the moment, we just support a single device with fixed parameters:
#define MPU401_PORT DEFAULT_PORT
#define MPU401_IRQ DEFAULT_IRQ
#define MPU401_TIMEOUT 10000
/* OBSOLETE - see mmdef.h instead:
#define IOCTL_SOUND_BASE FILE_DEVICE_SOUND
// wave base 0
#define IOCTL_MIDI_BASE 0x0080
#define IOCTL_MIDI_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_SET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_GET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0003, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_PLAY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0006, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_RECORD CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0007, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_CACHE_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0008, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_CACHE_DRUM_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
*/
// The MPU-401 has 2 ports, usually 0x330 and 0x331, which are known as
// "data" and "status/command", respectively. These macros deal with
// reading from and writing to these ports:
#define MPU401_WRITE_DATA(bp, x) WRITE_PORT_UCHAR((PUCHAR) bp, x)
#define MPU401_READ_DATA(bp) READ_PORT_UCHAR((PUCHAR) bp)
#define MPU401_WRITE_COMMAND(bp, x) WRITE_PORT_UCHAR((PUCHAR) bp+1, x)
#define MPU401_READ_STATUS(bp) READ_PORT_UCHAR((PUCHAR) bp+1)
// Flow control
#define MPU401_READY_TO_SEND(bp) \
MPU401_READ_STATUS(bp) & 0x80
#define MPU401_READY_TO_RECEIVE(bp) \
MPU401_READ_STATUS(bp) & 0x40
#define MPU401_WRITE_BYTE(bp, x) \
if (WaitToSend(bp)) MPU401_WRITE_DATA(bp, x)
#define MPU401_WRITE_MESSAGE(bp, status, da, db) \
MPU401_WRITE(bp, status); \
MPU401_WRITE(bp, da); \
MPU401_WRITE(bp, db)
//#define MPU401_READ(bp)
// if (WaitToRead(bp)) ... ???
/*
DEVICE_EXTENSION contains the settings for each individual device
*/
typedef struct _DEVICE_EXTENSION
{
PUNICODE_STRING RegistryPath;
PDRIVER_OBJECT DriverObject;
ULONG Port;
ULONG IRQ;
// KDPC Dpc;
// KTIMER Timer;
// KEVENT Event;
// BOOLEAN BeepOn;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
/*
DEVICE_INSTANCE contains ???
*/
typedef struct _DEVICE_INSTANCE
{
// pPrevGDI
PDRIVER_OBJECT DriverObject;
} DEVICE_INSTANCE, *PDEVICE_INSTANCE;
/*
CONFIG contains device parameters (port/IRQ)
THIS STRUCTURE IS REDUNDANT
*/
//typedef struct _CONFIG
//{
// ULONG Port;
// ULONG IRQ;
//} CONFIG, *PCONFIG;
/*
Some callback typedefs
*/
typedef NTSTATUS REGISTRY_CALLBACK_ROUTINE(PWSTR RegistryPath, PVOID Context);
typedef REGISTRY_CALLBACK_ROUTINE *PREGISTRY_CALLBACK_ROUTINE;
/*
Prototypes for functions in portio.c :
*/
BOOLEAN WaitToSend(ULONG BasePort);
BOOLEAN WaitToReceive(ULONG BasePort);
BOOLEAN InitUARTMode(ULONG BasePort);
/*
Prototypes for functions in settings.c :
*/
NTSTATUS STDCALL EnumDeviceKeys(
IN PUNICODE_STRING RegistryPath,
IN PWSTR SubKey,
IN PREGISTRY_CALLBACK_ROUTINE Callback,
IN PVOID Context);
NTSTATUS STDCALL LoadSettings(
IN PWSTR ValueName,
IN ULONG ValueType,
IN PVOID ValueData,
IN ULONG ValueLength,
IN PVOID Context,
IN PVOID EntryContext);
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath);
#endif

View file

@ -1,10 +0,0 @@
<module name="mpu401" type="kernelmodedriver">
<include base="mpu401">.</include>
<define name="__USE_W32API" />
<library>ntoskrnl</library>
<library>hal</library>
<file>mpu401.c</file>
<file>portio.c</file>
<file>settings.c</file>
<file>mpu401.rc</file>
</module>

View file

@ -1,7 +0,0 @@
/* $Id$ */
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "MPU-401 MIDI Driver\0"
#define REACTOS_STR_INTERNAL_NAME "mpu401\0"
#define REACTOS_STR_ORIGINAL_FILENAME "mpu401.sys\0"
#include <reactos/version.rc>

View file

@ -1,96 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/mpu401/portio.c (see also mpu401.h)
* PURPOSE: MPU-401 MIDI port I/O helper
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 26, 2003: Created
*/
#include <ntddk.h>
#include "mpu401.h"
BOOLEAN WaitToSend(ULONG BasePort)
{
int TimeOut;
DbgPrint("WaitToSend ");
// Check if it's OK to send
for (TimeOut = MPU401_TIMEOUT;
! MPU401_READY_TO_SEND(BasePort) && TimeOut > 0;
TimeOut --);
// If a time-out occurs, we report failure
if (! TimeOut)
{
DbgPrint("FAILED\n");
return FALSE;
}
DbgPrint("SUCCEEDED\n");
return TRUE;
}
BOOLEAN WaitToReceive(ULONG BasePort)
{
int TimeOut;
DbgPrint("WaitToSend ");
// Check if it's OK to receive
for (TimeOut = MPU401_TIMEOUT;
! MPU401_READY_TO_RECEIVE(BasePort) && TimeOut > 0;
TimeOut --);
// If a time-out occurs, we report failure
if (! TimeOut)
{
DbgPrint("FAILED\n");
return FALSE;
}
DbgPrint("SUCCEEDED\n");
return TRUE;
}
BOOLEAN InitUARTMode(ULONG BasePort)
{
ULONG TimeOut;
UCHAR Status = 0;
DbgPrint("InitUARTMode() called\n");
// Check if it's OK to send
if (! WaitToSend(BasePort))
return FALSE;
DbgPrint("Resetting MPU401\n");
// Send an MPU reset:
MPU401_WRITE_COMMAND(BasePort, 0xff);
// 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)
DbgPrint("Waiting for an ACK\n");
if (WaitToReceive(BasePort))
{
// Check to make sure the reset was acknowledged:
for (TimeOut = MPU401_TIMEOUT;
(Status = (MPU401_READ_DATA(BasePort) & 0xfe) && TimeOut > 0);
TimeOut --);
}
DbgPrint("Entering UART mode\n");
// Now we kick the MPU401 into UART ("dumb") mode
MPU401_WRITE_COMMAND(BasePort, 0x3f);
return TRUE;
}

View file

@ -1,28 +0,0 @@
----------------------------------
REACTOS MPU-401 MIDI DEVICE DRIVER
by Andrew Greenwood
----------------------------------
This driver initializes the MPU-401 MIDI/joystick port found on
most sound cards, and allows the sending of simple messages.
It's far from complete, and at present will only support 1 device.
In Bochs, the MIDI output will be played using whatever device is
set up in Windows as your MIDI output.
For real hardware, the output will be played to whatever device is
attached to your MIDI/joystick port, or, in some cases, the wave-table
or other synth on-board your card (note: this is NOT an FM synth
driver!)
Thanks to Vizzini and all the other great ReactOS developers for
helping me code this driver and also for giving me encouragement.
I'd also like to thank Jeff Glatt, whose MIDI and MPU-401
documentation has been a valuable resource to me over the past few
years, and who provided me with almost all of my knowledge of MIDI
and MPU-401. His site is at: www.borg.com/~jglatt/
- Andrew "Silver Blade" Greenwood

View file

@ -1,24 +0,0 @@
#ifndef NDEBUG
#define TEST_STATUS(s) \
if (! NT_SUCCESS(s)) \
{ \
if (s == STATUS_NO_MORE_ENTRIES) \
DPRINT("NTSTATUS == NO MORE ENTRIES\n") \
else if (s == STATUS_BUFFER_OVERFLOW) \
DPRINT("NTSTATUS == BUFFER OVERFLOW\n") \
else if (s == STATUS_BUFFER_TOO_SMALL) \
DPRINT("NTSTATUS == BUFFER TOO SMALL\n") \
else if (s == STATUS_INVALID_PARAMETER) \
DPRINT("NTSTATUS == INVALID PARAMETER\n") \
else if (s == STATUS_OBJECT_NAME_NOT_FOUND) \
DPRINT("NTSTATUS == OBJECT NAME NOT FOUND\n") \
else if (s == STATUS_INVALID_HANDLE) \
DPRINT("NTATATUS == INVALID_HANDLE\n") \
else if (s == STATUS_ACCESS_DENIED) \
DPRINT("NTSTATUS == ACCESS_DENIED\n") \
else \
DPRINT("NTSTATUS == FAILURE (?)\n"); \
}
#else
#define TEST_STATUS(s)
#endif

View file

@ -1,307 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/mpu401/settings.c
* PURPOSE: MPU-401 MIDI device driver setting management
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 27, 2003: Created
*/
#include <ntddk.h>
#include "mpu401.h"
#define NDEBUG
#include <debug.h>
#include "sbdebug.h" // our own debug helper
#if 0
static NTSTATUS
OpenDevicesKey(
IN PWSTR RegistryPath,
OUT PHANDLE Key)
/*
Description:
Create a volatile key under this driver's Services node to contain
the device name list.
Parameters:
RegistryPath The location of the registry entry
Key The key in the registry
Return Value:
NT status STATUS_SUCCESS if successful (duh...)
*/
{
NTSTATUS s;
HANDLE hKey;
OBJECT_ATTRIBUTES oa;
UNICODE_STRING uStr;
// Attempt to open the key
RtlInitUnicodeString(&uStr, RegistryPath);
InitializeObjectAttributes(&oa, &uStr, OBJ_CASE_INSENSITIVE, NULL,
(PSECURITY_DESCRIPTOR)NULL);
s = ZwOpenKey(&hKey, KEY_CREATE_SUB_KEY, &oa);
if (! NT_SUCCESS(s))
return s; // Problem
// Now create sub key
RtlInitUnicodeString(&uStr, (PWSTR) DEVICE_SUBKEY);
InitializeObjectAttributes(&oa, &uStr, OBJ_CASE_INSENSITIVE, hKey,
(PSECURITY_DESCRIPTOR)NULL);
s = ZwCreateKey(Key, KEY_ALL_ACCESS, &oa, 0, NULL, REG_OPTION_VOLATILE,
NULL);
ZwClose(hKey);
return s;
}
#endif
NTSTATUS STDCALL EnumDeviceKeys(
IN PUNICODE_STRING RegistryPath,
IN PWSTR SubKey,
IN PREGISTRY_CALLBACK_ROUTINE Callback,
IN PVOID Context)
/*
Description:
Enumerate the device subkeys in the driver's registry entry, and
call the specified callback routine for each device.
Parameters:
RegistryPath The location of the registry entry
Subkey The device's subkey
Callback A routine called for each device
Context ???
Return Value:
NT status STATUS_SUCCESS if successful
*/
{
NTSTATUS s;
OBJECT_ATTRIBUTES oa;
HANDLE hKey, hSubKey;
UNICODE_STRING SubkeyName;
ULONG i;
// Attempt to open the key
InitializeObjectAttributes(&oa, RegistryPath, OBJ_CASE_INSENSITIVE,
NULL, (PSECURITY_DESCRIPTOR)NULL);
s = ZwOpenKey(&hKey, KEY_READ, &oa);
TEST_STATUS(s); // debugging
if (! NT_SUCCESS(s))
return s; // Problem
RtlInitUnicodeString(&SubkeyName, SubKey);
DPRINT("Subkey: %wZ\n", &SubkeyName);
InitializeObjectAttributes(&oa, &SubkeyName, OBJ_CASE_INSENSITIVE,
hKey, (PSECURITY_DESCRIPTOR)NULL);
s = ZwOpenKey(&hSubKey, KEY_ENUMERATE_SUB_KEYS, &oa);
ZwClose(hKey);
TEST_STATUS(s); // debugging
if (! NT_SUCCESS(s))
return s;
// And now, the enumeration
for (i = 0;; i ++)
{
KEY_BASIC_INFORMATION Info;
PKEY_BASIC_INFORMATION pInfo;
ULONG ResultLength = 0;
ULONG Size = 0;
PWSTR Pos;
PWSTR Name;
// Find the length of the subkey data
// Info.NameLength = 0; // TEMPORARY!
s = ZwEnumerateKey(hSubKey, i, KeyBasicInformation, &Info,
sizeof(Info), &ResultLength);
if (s == STATUS_NO_MORE_ENTRIES)
break;
DPRINT("Found an entry, allocating memory...\n");
// Size = Info.NameLength + FIELD_OFFSET(KEY_BASIC_INFORMATION, Name[0]);
Size = ResultLength + FIELD_OFFSET(KEY_BASIC_INFORMATION, Name[0]);
DPRINT("Size is %d\n", Size);
pInfo = (PKEY_BASIC_INFORMATION) ExAllocatePool(PagedPool, Size);
if (pInfo == NULL)
{
DPRINT("INSUFFICIENT RESOURCES!\n");
s = STATUS_INSUFFICIENT_RESOURCES;
break;
}
DPRINT("Re-enumerating...\n");
s = ZwEnumerateKey(hSubKey, i, KeyBasicInformation, pInfo, Size,
&ResultLength);
// TEST_STATUS(s); // debugging
if (! NT_SUCCESS(s))
{
ExFreePool((PVOID) pInfo);
s = STATUS_INTERNAL_ERROR;
break;
}
DPRINT("Allocating memory for name...\n");
Name = ExAllocatePool(PagedPool,
RegistryPath->Length + sizeof(WCHAR) +
SubkeyName.Length + sizeof(WCHAR) +
pInfo->NameLength + sizeof(UNICODE_NULL));
if (Name == NULL)
{
DPRINT("INSUFFICIENT RESOURCES!");
ExFreePool((PVOID) pInfo);
return STATUS_INSUFFICIENT_RESOURCES;
}
// Copy the key name
RtlCopyMemory((PVOID)Name, (PVOID)RegistryPath->Buffer, RegistryPath->Length);
Pos = Name + (RegistryPath->Length / sizeof(WCHAR));
Pos[0] = '\\';
Pos++;
// Copy the parameters sub key name
RtlCopyMemory((PVOID)Pos, (PVOID)SubKey, SubkeyName.Length); //SubkeyName?
Pos += SubkeyName.Length / sizeof(WCHAR);
Pos[0] = '\\';
Pos ++;
// Copy the device sub key name
RtlCopyMemory((PVOID)Pos, (PVOID)pInfo->Name, pInfo->NameLength);
Pos += pInfo->NameLength / sizeof(WCHAR);
Pos[0] = UNICODE_NULL;
ExFreePool((PVOID)pInfo);
DPRINT("Calling callback...\n");
s = (*Callback)(Name, Context);
if (! NT_SUCCESS(s))
{ DPRINT("Callback FAILED\n");
break;}
}
ZwClose(hSubKey);
DPRINT("%d device registry keys found\n", i);
if ((i == 0) && (s == STATUS_NO_MORE_ENTRIES))
return STATUS_DEVICE_CONFIGURATION_ERROR;
return s == STATUS_NO_MORE_ENTRIES ? STATUS_SUCCESS : s;
}
NTSTATUS STDCALL LoadSettings(
IN PWSTR ValueName,
IN ULONG ValueType,
IN PVOID ValueData,
IN ULONG ValueLength,
IN PVOID Context,
IN PVOID EntryContext)
/*
Description:
Read the settings for a particular device
Parameters:
ValueName The value to read from the registry
ValueType ?
ValueData ?
ValueLength ?
Context The configuration structure to write to
EntryContext ?
Return Value:
NT status STATUS_SUCCESS if successful
*/
{
PDEVICE_EXTENSION DeviceInfo = Context;
if (ValueType == REG_DWORD)
{
if (! _wcsicmp(ValueName, REGISTRY_PORT))
{
DeviceInfo->Port = *(PULONG) ValueData;
DPRINT("Registry port = 0x%x\n", DeviceInfo->Port);
}
// More to come... (config.c)
}
else
{
// ?
}
return STATUS_SUCCESS;
}
#if 0
static NTSTATUS SaveSettings(
IN PWSTR RegistryPath,
IN ULONG Port,
IN ULONG IRQ,
IN ULONG DMA)
/*
Description:
Saves the settings for a particular device
Parameters:
RegistryPath Where to save the settings to
Port The device's port number
IRQ The device's interrupt number
DMA The device's DMA channel
Return Value:
NT status STATUS_SUCCESS if successful
*/
{
// NTSTATUS s;
DPRINT("SaveSettings() unimplemented\n");
// UNIMPLEMENTED;
return STATUS_SUCCESS;
}
#endif

View file

@ -1,70 +0,0 @@
#include <stdio.h>
#include <windows.h>
#include <ntddk.h>
#include "mpu401.h"
int main()
{
// NTSTATUS s;
// PHANDLE Handle;
// PIO_STATUS_BLOCK Status;
DWORD BytesReturned;
BYTE Test[3]; // Will store MIDI data
BYTE Notes[] = {50, 52, 54, 55, 57, 59, 61};
HANDLE Device;
UINT Note;
UINT Junk;
printf("Test program for MPU401 driver\n");
Device = CreateFile("\\\\.\\MPU401_Out_0", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL);
if (Device == INVALID_HANDLE_VALUE)
{
printf("Device is busy or could not be found.\n");
return -1;
}
printf("Device is open, let's play some music...\n");
Test[0] = 0x90;
Test[2] = 0x7f;
for (Note = 0; Note < sizeof(Notes); Note ++)
{
Test[1] = Notes[Note];
DeviceIoControl(
Device,
IOCTL_MIDI_PLAY,
&Test,
sizeof(Test),
NULL,
0,
&BytesReturned,
NULL
);
for (Junk = 0; Junk < 100000; Junk ++); // Pause
}
/* s = IoCreateFile(Handle, GENERIC_READ | GENERIC_WRITE,
OBJ_KERNEL_HANDLE,
Status,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL,
0,
CreateFileTypeNone,
NULL,
0);
*/
}

View file

@ -1,69 +0,0 @@
/*
Sound card operations
http://www.cae.wisc.edu/~brodskye/sb16doc/sb16doc.html
*/
#include <ntddk.h>
#include "sndblst.h"
VOID SetOutputSampleRate(ULONG BasePort, ULONG SampleRate)
{
// This only works for DSP v4.xx ONLY - need a workaround!
DPRINT("Setting output sample rate\n");
// WAIT
// if (! WaitToSend(BasePort))
// return;
SB_WRITE_BYTE(BasePort, SB_SET_OUTPUT_RATE);
SB_WRITE_BYTE(BasePort, SampleRate / 256); // high
SB_WRITE_BYTE(BasePort, SampleRate % 256); // low
}
VOID EnableSpeaker(ULONG BasePort, BOOLEAN SpeakerOn)
{
DPRINT("Setting speaker status %d\n", SpeakerOn);
// if (! WaitForWrite(BasePort))
// return;
SB_WRITE_BYTE(BasePort, SpeakerOn ? SB_ENABLE_SPEAKER : SB_DISABLE_SPEAKER);
}
BOOLEAN IsSpeakerEnabled(ULONG BasePort)
{
DPRINT("Obtaining speaker status\n");
// if (! WaitToSend(BasePort))
// return FALSE;
SB_WRITE_BYTE(BasePort, SB_GET_SPEAKER_STATUS);
if (! WaitToReceive(BasePort))
return FALSE;
return SB_READ_DATA(BasePort) == 0xff;
}
VOID BeginPlayback(ULONG BasePort, ULONG BitDepth, ULONG Channels, ULONG BlockSize)
{
DPRINT("BeginPlayback(%d, %d, %d, %d)\n", BasePort, BitDepth, Channels, BlockSize);
// switch(BitDepth)
// {
// case 8 : Command = 0xc0; break;
// case 16 : Command = 0xb0; break; // Make sure we support it
// default : Command = 0xc0;
// }
DPRINT("Initiating playback\n");
// TEMPORARY:
SB_WRITE_BYTE(BasePort, 0xc6);
SB_WRITE_BYTE(BasePort, 0); // mode - TEMPORARY
SB_WRITE_BYTE(BasePort, BlockSize % 256);
SB_WRITE_BYTE(BasePort, BlockSize / 256);
}

View file

@ -1,203 +0,0 @@
/*
Routines to simplify the use of DMA for Sound Blaster driver
*/
#include <ntddk.h>
#include "sndblst.h"
#if 0
BOOLEAN CheckDMA(PDEVICE_EXTENSION Device)
{
// Don't forget to check for Compaq machines (they can't be configured
// manually...)
return TRUE; // for now...
// if (! CompaqBA)
// return (BOOLEAN) !((INPORT(pHw, BOARD_ID) & 0x80) && Device->DMA == 0);
// else
// {
// UCHAR CompaqPIDR;
// UCHAR Expected = (UCHAR)(Device->DMA == 0 ? 0x40 :
// Device->DMA == 1 ? 0x80 :
// 0xc0);
// CompaqPIDR = READ_PORT_UCHAR(pHw->CompaqBA + BOARD_ID);
// if (CompaqPIDR != 0xff)
// {
// if ((UCHAR)(CompaqPIDR & 0xc0) == Expected)
// return true;
// }
// }
return FALSE;
}
#endif
static IO_ALLOCATION_ACTION STDCALL SoundProgramDMA(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID MapRegisterBase,
IN PVOID Context)
{
PDEVICE_EXTENSION Device = DeviceObject->DeviceExtension;
ULONG zzz;
PUCHAR VirtualAddress = (PUCHAR) MmGetMdlVirtualAddress(Device->Mdl);
DPRINT("IoMapTransfer\n");
IoMapTransfer(Device->Adapter,
Device->Mdl,
MapRegisterBase,
(PUCHAR) MmGetMdlVirtualAddress(Device->Mdl),
&Device->BufferSize, // is this right?
TRUE);
DPRINT("VBuffer == 0x%x (really 0x%x?) Bufsize == %u\n", Device->VirtualBuffer, MmGetPhysicalAddress(Device->VirtualBuffer), Device->BufferSize);
DPRINT("Writing %u bytes of garbage...\n", Device->BufferSize);
// Write some garbage:
for (zzz = 0; zzz < Device->BufferSize; zzz ++)
*(VirtualAddress + zzz) = (UCHAR) zzz % 200;
DPRINT("done\n");
KeSetEvent(Context, 0, FALSE);
return KeepObject;
}
BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject)
{
DEVICE_DESCRIPTION Desc;
ULONG MappedRegs = 0;
PDEVICE_EXTENSION Device = DeviceObject->DeviceExtension;
KEVENT DMAEvent;
KIRQL OldIrql;
// Buffersize should already be set but it isn't yet !
Device->BufferSize = SB_BUFSIZE;
DPRINT("Bufsize == %u\n", Device->BufferSize);
RtlZeroMemory(&Desc, sizeof(DEVICE_DESCRIPTION));
// Init memory!
Desc.Version = DEVICE_DESCRIPTION_VERSION;
Desc.Master = FALSE; // Slave
Desc.ScatterGather = FALSE; // Don't think so anyway
Desc.DemandMode = FALSE; // == !SingleModeDMA
Desc.AutoInitialize = TRUE; // ?
Desc.Dma32BitAddresses = FALSE; // I don't think we can
Desc.IgnoreCount = FALSE; // Should be OK
Desc.Reserved1 = 0;
// Desc.Reserved2 = 0;
Desc.BusNumber = 0;
Desc.DmaChannel = Device->DMA; // Our channel :)
Desc.InterfaceType = Isa; // (BusType == MicroChannel) ? MicroChannel : Isa;
Desc.DmaWidth = 0; // hmm... 8 bits?
Desc.DmaSpeed = 0; // double hmm (Compatible it should be)
Desc.MaximumLength = Device->BufferSize;
// Desc.MinimumLength = 0;
Desc.DmaPort = 0;
DPRINT("Calling HalGetAdapter(), asking for %d mapped regs\n", MappedRegs);
Device->Adapter = HalGetAdapter(&Desc, &MappedRegs);
DPRINT("Called\n");
if (! Device->Adapter)
{
DPRINT("HalGetAdapter() FAILED\n");
return FALSE;
}
DPRINT("Bufsize == %u\n", Device->BufferSize);
if (MappedRegs < BYTES_TO_PAGES(Device->BufferSize))
{
DPRINT("Could only allocate %u mapping registers\n", MappedRegs);
if (MappedRegs == 0)
return FALSE;
Device->BufferSize = MappedRegs * PAGE_SIZE;
DPRINT("Bufsize == %u\n", Device->BufferSize);
}
DPRINT("Allocated %u mapping registers\n", MappedRegs);
// Check if we already have memory here...
// Check to make sure we're >= minimum
DPRINT("Allocating buffer\n");
DPRINT("Bufsize == %u\n", Device->BufferSize);
Device->VirtualBuffer = HalAllocateCommonBuffer(Device->Adapter, Device->BufferSize,
&Device->Buffer, FALSE);
// For some reason BufferSize == 0 here?!
// 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)
{
DPRINT("Could not allocate buffer :(\n");
// should try again with smaller buffer...
return FALSE;
}
// 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->Mdl)
{
DPRINT("IoAllocateMdl() FAILED\n");
// Free the HAL buffer
return FALSE;
}
DPRINT("VBuffer == 0x%x Mdl == %u Bufsize == %u\n", Device->VirtualBuffer, Device->Mdl, Device->BufferSize);
DPRINT("Calling MmBuildMdlForNonPagedPool\n");
MmBuildMdlForNonPagedPool(Device->Mdl);
DPRINT("Bufsize == %u\n", Device->BufferSize);
// part II:
KeInitializeEvent(&DMAEvent, SynchronizationEvent, FALSE);
// Raise IRQL
KeRaiseIrql(DISPATCH_LEVEL,&OldIrql);
IoAllocateAdapterChannel(Device->Adapter, DeviceObject,
BYTES_TO_PAGES(Device->BufferSize),
SoundProgramDMA, &DMAEvent);
// Lower IRQL
KeLowerIrql(OldIrql);
DPRINT("VBuffer == 0x%x Bufsize == %u\n", Device->VirtualBuffer, Device->BufferSize);
KeWaitForSingleObject(&DMAEvent, Executive, KernelMode, FALSE, NULL);
// if (MappedRegs == 0)
// MappedRegs = 2;
// else
// MappedRegs ++;
// Status = IoAllocateAdapterChannel(
// Adapter,
// DeviceObject,
// MappedRegs,
// CALLBACK,
// DeviceObject); // Context
return TRUE;
}

View file

@ -1,93 +0,0 @@
#include <ntddk.h>
#include "sndblst.h"
#if 0
BOOLEAN CheckIRQ(PDEVICE_EXTENSION Parameters)
{
static CONST ULONG ValidIRQs[] = VALID_IRQS;
int i;
return TRUE; // for now...
// Check for Compaq!
// if ...
for (i = 0; ValidIRQs[i] != 0xffff; i ++)
{
// Consult the card
// OUTPORT(pHw, BOARD_CONFIG, bConfig);
// if (INPORT(pHEW, BOARD_ID) & 0x40)
// pHW->ValidInterrupts |= (1 << ThisIRQ);
// return (BOOLEAN)((pHw->ValidInterrupts & (1 << Interrupt)) &&
// (! ((INPORT(pHw, BOARD_ID) & 0x80) &&
// (Interrupt == 10 || Interrupt == 11)));
}
// else
// Compaq stuff?
{
UCHAR Expected;
switch (Parameters->IRQ)
{
case 10 : Expected = 0x10;
case 11 : Expected = 0x20;
case 7 : Expected = 0x30;
default : return FALSE;
}
// CompaqPIDR = READ_PORT_UCHAR( ... )
// ...
}
}
BOOLEAN ISR(
IN PKINTERRUPT pInterrupt,
IN PVOID Context)
{
DPRINT("*** Processing ISR ***\n");
// What do we do here then?
return FALSE;
}
NTSTATUS EnableIRQ(PDEVICE_OBJECT DeviceObject)
{
PDEVICE_EXTENSION Parameters = DeviceObject->DeviceExtension;
ULONG Vector;
KIRQL IRQ_Level;
KAFFINITY Affinity;
NTSTATUS Status = STATUS_SUCCESS;
Vector = HalGetInterruptVector(Isa, // FIX THIS
0, // FIX THIS
Parameters->IRQ,
Parameters->IRQ,
&IRQ_Level,
&Affinity);
// Status = IoConnectInterrupt(Parameters->Interrupt, // Object
// ISR, // Function
// DeviceObject, // Context
// (PKSPIN_LOCK) NULL,
// Vector,
// IRQ_Level,
// IRQ_Level,
// mode - Latched or Level sensitive?
// share - if irq can be shared
// Affinity,
// FALSE);
return Status == STATUS_INVALID_PARAMETER ?
STATUS_DEVICE_CONFIGURATION_ERROR : Status;
}
#endif

View file

@ -1,111 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/dd/sndblst/portio.c (see also sndblst.h)
* PURPOSE: Sound Blaster port I/O helper
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 28, 2003: Created
*/
#include <ntddk.h>
#include "sndblst.h"
BOOLEAN WaitToSend(ULONG BasePort)
{
int TimeOut;
DPRINT("WaitToSend ");
// Check if it's OK to send
for (TimeOut = SB_TIMEOUT;
! SB_READY_TO_SEND(BasePort) && TimeOut > 0;
TimeOut --);
// If a time-out occurs, we report failure
if (! TimeOut)
{
DPRINT("FAILED\n");
return FALSE;
}
DPRINT("SUCCEEDED\n");
return TRUE;
}
BOOLEAN WaitToReceive(ULONG BasePort)
{
int TimeOut;
DPRINT("WaitToReceive ");
// Check if it's OK to receive
for (TimeOut = SB_TIMEOUT;
! SB_READY_TO_RECEIVE(BasePort) && TimeOut > 0;
TimeOut --);
// If a time-out occurs, we report failure
if (! TimeOut)
{
DPRINT("FAILED\n");
return FALSE;
}
DPRINT("SUCCEEDED\n");
return TRUE;
}
USHORT InitSoundCard(ULONG BasePort)
{
ULONG TimeOut;
BOOLEAN Status;
UCHAR DSP_Major, DSP_Minor;
DPRINT("InitSoundCard() called\n");
DPRINT("Resetting sound card\n");
// if (!WaitToSend(BasePort))
// return FALSE;
SB_WRITE_RESET(BasePort, 0x01);
for (TimeOut = 0; TimeOut < 30000; TimeOut ++); // Wait a while
SB_WRITE_RESET(BasePort, 0x00);
// 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)
DPRINT("Waiting for an ACK\n");
if (WaitToReceive(BasePort))
{
// Check to make sure the reset was acknowledged:
for (TimeOut = SB_TIMEOUT;
(Status = (SB_READ_DATA(BasePort) != SB_DSP_READY) && (TimeOut > 0));
TimeOut --);
}
DPRINT("Querying DSP version\n");
if (! WaitToSend(BasePort))
return FALSE;
SB_WRITE_DATA(BasePort, SB_GET_DSP_VERSION);
if (! WaitToReceive(BasePort))
return FALSE;
DSP_Major = SB_READ_DATA(BasePort);
DSP_Minor = SB_READ_DATA(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

@ -1,24 +0,0 @@
#ifndef NDEBUG
#define TEST_STATUS(s) \
if (! NT_SUCCESS(s)) \
{ \
if (s == STATUS_NO_MORE_ENTRIES) \
DPRINT("NTSTATUS == NO MORE ENTRIES\n"); \
else if (s == STATUS_BUFFER_OVERFLOW) \
DPRINT("NTSTATUS == BUFFER OVERFLOW\n"); \
else if (s == STATUS_BUFFER_TOO_SMALL) \
DPRINT("NTSTATUS == BUFFER TOO SMALL\n"); \
else if (s == STATUS_INVALID_PARAMETER) \
DPRINT("NTSTATUS == INVALID PARAMETER\n"); \
else if (s == STATUS_OBJECT_NAME_NOT_FOUND) \
DPRINT("NTSTATUS == OBJECT NAME NOT FOUND\n"); \
else if (s == STATUS_INVALID_HANDLE) \
DPRINT("NTATATUS == INVALID_HANDLE\n"); \
else if (s == STATUS_ACCESS_DENIED) \
DPRINT("NTSTATUS == ACCESS_DENIED\n"); \
else \
DPRINT("NTSTATUS == FAILURE (Unknown)\n"); \
}
#else
#define TEST_STATUS(s)
#endif

View file

@ -1,301 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/dd/sndblst/settings.c
* PURPOSE: MPU-401 MIDI device driver setting management
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 28, 2003: Created
*/
#include <ntddk.h>
#include "sndblst.h"
#include "sbdebug.h" // our own debug helper
#if 0
NTSTATUS
OpenDevicesKey(
IN PWSTR RegistryPath,
OUT PHANDLE Key)
/*
Description:
Create a volatile key under this driver's Services node to contain
the device name list.
Parameters:
RegistryPath The location of the registry entry
Key The key in the registry
Return Value:
NT status STATUS_SUCCESS if successful (duh...)
*/
{
NTSTATUS s;
HANDLE hKey;
OBJECT_ATTRIBUTES oa;
UNICODE_STRING uStr;
// Attempt to open the key
RtlInitUnicodeString(&uStr, RegistryPath);
InitializeObjectAttributes(&oa, &uStr, OBJ_CASE_INSENSITIVE, NULL,
(PSECURITY_DESCRIPTOR)NULL);
s = ZwOpenKey(&hKey, KEY_CREATE_SUB_KEY, &oa);
if (! NT_SUCCESS(s))
return s; // Problem
// Now create sub key
RtlInitUnicodeString(&uStr, (PWSTR) DEVICE_SUBKEY);
InitializeObjectAttributes(&oa, &uStr, OBJ_CASE_INSENSITIVE, hKey,
(PSECURITY_DESCRIPTOR)NULL);
s = ZwCreateKey(Key, KEY_ALL_ACCESS, &oa, 0, NULL, REG_OPTION_VOLATILE,
NULL);
ZwClose(hKey);
return s;
}
#endif
NTSTATUS STDCALL EnumDeviceKeys(
IN PUNICODE_STRING RegistryPath,
IN PWSTR SubKey,
IN PREGISTRY_CALLBACK_ROUTINE Callback,
IN PVOID Context)
/*
Description:
Enumerate the device subkeys in the driver's registry entry, and
call the specified callback routine for each device.
Parameters:
RegistryPath The location of the registry entry
Subkey The device's subkey
Callback A routine called for each device
Context ???
Return Value:
NT status STATUS_SUCCESS if successful
*/
{
NTSTATUS s;
OBJECT_ATTRIBUTES oa;
HANDLE hKey, hSubKey;
UNICODE_STRING SubkeyName;
ULONG i;
// Attempt to open the key
InitializeObjectAttributes(&oa, RegistryPath, OBJ_CASE_INSENSITIVE,
NULL, (PSECURITY_DESCRIPTOR)NULL);
s = ZwOpenKey(&hKey, KEY_READ, &oa);
TEST_STATUS(s); // debugging
if (! NT_SUCCESS(s))
return s; // Problem
RtlInitUnicodeString(&SubkeyName, SubKey);
DPRINT("Subkey: %wZ\n", &SubkeyName);
InitializeObjectAttributes(&oa, &SubkeyName, OBJ_CASE_INSENSITIVE,
hKey, (PSECURITY_DESCRIPTOR)NULL);
s = ZwOpenKey(&hSubKey, KEY_ENUMERATE_SUB_KEYS, &oa);
ZwClose(hKey);
TEST_STATUS(s); // debugging
if (! NT_SUCCESS(s))
return s;
// And now, the enumeration
for (i = 0;; i ++)
{
KEY_BASIC_INFORMATION Info;
PKEY_BASIC_INFORMATION pInfo;
ULONG ResultLength = 0;
ULONG Size = 0;
PWSTR Pos;
PWSTR Name;
// Find the length of the subkey data
// Info.NameLength = 0; // TEMPORARY!
s = ZwEnumerateKey(hSubKey, i, KeyBasicInformation, &Info,
sizeof(Info), &ResultLength);
if (s == STATUS_NO_MORE_ENTRIES)
break;
DPRINT("Found an entry, allocating memory...\n");
// Size = Info.NameLength + FIELD_OFFSET(KEY_BASIC_INFORMATION, Name[0]);
Size = ResultLength + FIELD_OFFSET(KEY_BASIC_INFORMATION, Name[0]);
DPRINT("Size is %d\n", Size);
pInfo = (PKEY_BASIC_INFORMATION) ExAllocatePool(PagedPool, Size);
if (pInfo == NULL)
{
DPRINT("INSUFFICIENT RESOURCES!\n");
s = STATUS_INSUFFICIENT_RESOURCES;
break;
}
DPRINT("Re-enumerating...\n");
s = ZwEnumerateKey(hSubKey, i, KeyBasicInformation, pInfo, Size,
&ResultLength);
// TEST_STATUS(s); // debugging
if (! NT_SUCCESS(s))
{
ExFreePool((PVOID) pInfo);
s = STATUS_INTERNAL_ERROR;
break;
}
DPRINT("Allocating memory for name...\n");
Name = ExAllocatePool(PagedPool,
RegistryPath->Length + sizeof(WCHAR) +
SubkeyName.Length + sizeof(WCHAR) +
pInfo->NameLength + sizeof(UNICODE_NULL));
if (Name == NULL)
{
DPRINT("INSUFFICIENT RESOURCES!");
ExFreePool((PVOID) pInfo);
return STATUS_INSUFFICIENT_RESOURCES;
}
// Copy the key name
RtlCopyMemory((PVOID)Name, (PVOID)RegistryPath->Buffer, RegistryPath->Length);
Pos = Name + (RegistryPath->Length / sizeof(WCHAR));
Pos[0] = '\\';
Pos++;
// Copy the parameters sub key name
RtlCopyMemory((PVOID)Pos, (PVOID)SubKey, SubkeyName.Length); //SubkeyName?
Pos += SubkeyName.Length / sizeof(WCHAR);
Pos[0] = '\\';
Pos ++;
// Copy the device sub key name
RtlCopyMemory((PVOID)Pos, (PVOID)pInfo->Name, pInfo->NameLength);
Pos += pInfo->NameLength / sizeof(WCHAR);
Pos[0] = UNICODE_NULL;
ExFreePool((PVOID)pInfo);
DPRINT("Calling callback...\n");
s = (*Callback)(Name, Context);
if (! NT_SUCCESS(s))
{ DPRINT("Callback FAILED\n");
break;}
}
ZwClose(hSubKey);
DPRINT("%d device registry keys found\n", i);
if ((i == 0) && (s == STATUS_NO_MORE_ENTRIES))
return STATUS_DEVICE_CONFIGURATION_ERROR;
return s == STATUS_NO_MORE_ENTRIES ? STATUS_SUCCESS : s;
}
NTSTATUS STDCALL LoadSettings(
IN PWSTR ValueName,
IN ULONG ValueType,
IN PVOID ValueData,
IN ULONG ValueLength,
IN PVOID Context,
IN PVOID EntryContext)
/*
Description:
Read the settings for a particular device
Parameters:
ValueName The value to read from the registry
ValueType ?
ValueData ?
ValueLength ?
Context The configuration structure to write to
EntryContext ?
Return Value:
NT status STATUS_SUCCESS if successful
*/
{
PDEVICE_EXTENSION DeviceInfo = Context;
if (ValueType == REG_DWORD)
{
if (! _wcsicmp(ValueName, REGISTRY_PORT))
{
DeviceInfo->Port = *(PULONG) ValueData;
DPRINT("Registry port = 0x%x\n", DeviceInfo->Port);
}
// More to come... (config.c)
}
else
{
// ?
}
return STATUS_SUCCESS;
}
#if 0
NTSTATUS SaveSettings(
IN PWSTR RegistryPath,
IN ULONG Port,
IN ULONG IRQ,
IN ULONG DMA)
/*
Description:
Saves the settings for a particular device
Parameters:
RegistryPath Where to save the settings to
Port The device's port number
IRQ The device's interrupt number
DMA The device's DMA channel
Return Value:
NT status STATUS_SUCCESS if successful
*/
{
DPRINT("SaveSettings() unimplemented\n");
// UNIMPLEMENTED;
return STATUS_SUCCESS;
}
#endif

View file

@ -1,461 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/sndblst/sndblst.c
* PURPOSE: Sound Blaster / SB Pro / SB 16 driver
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 28, 2003: Copied from mpu401.c as a template
*/
/* INCLUDES ****************************************************************/
#include <ntddk.h>
#include "sndblst.h"
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath);
/* INTERNAL VARIABLES ******************************************************/
ULONG DeviceCount = 0;
/* FUNCTIONS ***************************************************************/
static NTSTATUS InitDevice(
IN PWSTR RegistryPath,
IN PVOID Context)
{
// PDEVICE_INSTANCE Instance = Context;
PDEVICE_OBJECT DeviceObject; // = Context;
PDEVICE_EXTENSION Parameters; // = DeviceObject->DeviceExtension;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\WaveOut0"); // CHANGE THESE?
UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\??\\WaveOut0");
// CONFIG Config;
RTL_QUERY_REGISTRY_TABLE Table[2];
NTSTATUS s;
USHORT DSP_Version = 0;
UCHAR DSP_Major = 0, DSP_Minor = 0;
// This is TEMPORARY, to ensure that we don't process more than 1 device.
// This limitation should be removed in future.
if (DeviceCount > 0)
{
DPRINT("Sorry - only 1 device supported by Sound Blaster driver at present :(\n");
return STATUS_NOT_IMPLEMENTED;
}
DPRINT("Creating IO device\n");
s = IoCreateDevice(Context, // driverobject
sizeof(DEVICE_EXTENSION),
&DeviceName,
FILE_DEVICE_SOUND, // Correct?
0,
FALSE,
&DeviceObject);
if (!NT_SUCCESS(s))
return s;
DPRINT("Device Extension at 0x%x\n", DeviceObject->DeviceExtension);
Parameters = DeviceObject->DeviceExtension;
DPRINT("Creating DOS link\n");
/* Create the dos device link */
IoCreateSymbolicLink(&SymlinkName,
&DeviceName);
DPRINT("Initializing device\n");
// DPRINT("Allocating memory for parameters structure\n");
// Bodged:
// Parameters = (PDEVICE_EXTENSION)ExAllocatePool(NonPagedPool, sizeof(DEVICE_EXTENSION));
// DeviceObject->DeviceExtension = Parameters;
// Parameters = Instance->DriverObject->DriverExtension;
DPRINT("DeviceObject at 0x%x, DeviceExtension at 0x%x\n", DeviceObject, Parameters);
if (! Parameters)
{
DPRINT("NULL POINTER!\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
// Instance->DriverObject->DriverExtension = Parameters;
DPRINT("Setting reg path\n");
Parameters->RegistryPath = RegistryPath;
// Parameters->DriverObject = Instance->DriverObject;
DPRINT("Zeroing table memory and setting query routine\n");
RtlZeroMemory(Table, sizeof(Table));
Table[0].QueryRoutine = LoadSettings;
DPRINT("Setting port and IRQ defaults\n");
Parameters->Port = DEFAULT_PORT;
Parameters->IRQ = DEFAULT_IRQ;
Parameters->DMA = DEFAULT_DMA;
Parameters->BufferSize = DEFAULT_BUFSIZE;
// Only to be enabled once we can get support for multiple cards working :)
/*
DPRINT("Loading settings from: %S\n", RegistryPath);
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);
// Instance->P
// Initialize the card
DSP_Version = InitSoundCard(Parameters->Port);
if (! DSP_Version)
{
DPRINT("Sound card initialization FAILED!\n");
// Set state indication somehow
// Failure - what error code do we give?!
// return STATUS_????
return STATUS_UNSUCCESSFUL;
}
DSP_Major = DSP_Version / 256;
DSP_Minor = DSP_Version % 256;
// Do stuff related to version here...
DPRINT("Allocating DMA\n");
if (! CreateDMA(DeviceObject))
DPRINT("FAILURE!\n");
// TEMPORARY TESTING STUFF: should be in BlasterCreate
EnableSpeaker(Parameters->Port, TRUE);
SetOutputSampleRate(Parameters->Port, 2205);
BeginPlayback(Parameters->Port, 16, 2, Parameters->BufferSize);
DeviceCount ++;
return STATUS_SUCCESS;
}
static NTSTATUS STDCALL
BlasterCreate(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
DPRINT("BlasterCreate() called!\n");
// Initialize the MPU-401
// ... do stuff ...
// Play a note to say we're alive:
// WaitToSend(MPU401_PORT);
// MPU401_WRITE_DATA(MPU401_PORT, 0x90);
// WaitToSend(MPU401_PORT);
// MPU401_WRITE_DATA(MPU401_PORT, 0x50);
// WaitToSend(MPU401_PORT);
// MPU401_WRITE_DATA(MPU401_PORT, 0x7f);
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
DPRINT("IoCompleteRequest()\n");
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
DPRINT("BlasterCreate() completed\n");
return(STATUS_SUCCESS);
}
static NTSTATUS STDCALL
BlasterClose(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PDEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
DPRINT("BlasterClose() called!\n");
DeviceExtension = DeviceObject->DeviceExtension;
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(Status);
}
static NTSTATUS STDCALL
BlasterCleanup(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
ULONG Channel;
DPRINT("BlasterCleanup() called!\n");
// Reset the device (should we do this?)
for (Channel = 0; Channel <= 15; Channel ++)
{
// All notes off
// MPU401_WRITE_MESSAGE(MPU401_PORT, 0xb0 + Channel, 123, 0);
// All controllers off
// MPU401_WRITE_MESSAGE(MPU401_PORT, 0xb0 + Channel, 121, 0);
}
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_SUCCESS);
}
static NTSTATUS STDCALL
BlasterWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PDEVICE_EXTENSION DeviceExtension;
ULONG ByteCount;
PUCHAR Data;
DPRINT("BlasterWrite() called!\n");
DeviceExtension = DeviceObject->DeviceExtension;
Stack = IoGetCurrentIrpStackLocation(Irp);
DPRINT("%d bytes\n", Stack->Parameters.Write.Length);
Data = (PUCHAR) Irp->AssociatedIrp.SystemBuffer;
for (ByteCount = 0; ByteCount < Stack->Parameters.Write.Length; ByteCount ++)
{
// DPRINT("0x%x ", Data[ByteCount]);
// MPU401_WRITE_BYTE(DeviceExtension->Port, Data[ByteCount]);
}
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_SUCCESS);
}
static NTSTATUS STDCALL
BlasterDeviceControl(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack;
PDEVICE_EXTENSION DeviceExtension;
DPRINT("BlasterDeviceControl() called!\n");
DeviceExtension = DeviceObject->DeviceExtension;
Stack = IoGetCurrentIrpStackLocation(Irp);
switch(Stack->Parameters.DeviceIoControl.IoControlCode)
{
/* case IOCTL_MIDI_PLAY :
{
DPRINT("Received IOCTL_MIDI_PLAY\n");
Data = (PUCHAR) Irp->AssociatedIrp.SystemBuffer;
DPRINT("Sending %d bytes of MIDI data to 0x%d:\n", Stack->Parameters.DeviceIoControl.InputBufferLength, DeviceExtension->Port);
for (ByteCount = 0; ByteCount < Stack->Parameters.DeviceIoControl.InputBufferLength; ByteCount ++)
{
DPRINT("0x%x ", Data[ByteCount]);
MPU401_WRITE_BYTE(DeviceExtension->Port, Data[ByteCount]);
// if (WaitToSend(MPU401_PORT))
// MPU401_WRITE_DATA(MPU401_PORT, Data[ByteCount]);
}
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return(STATUS_SUCCESS);
}
*/
}
return(STATUS_SUCCESS);
/*
DeviceExtension = DeviceObject->DeviceExtension;
Stack = IoGetCurrentIrpStackLocation(Irp);
BeepParam = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer;
Irp->IoStatus.Information = 0;
if (Stack->Parameters.DeviceIoControl.IoControlCode != IOCTL_BEEP_SET)
{
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_NOT_IMPLEMENTED);
}
if ((Stack->Parameters.DeviceIoControl.InputBufferLength != sizeof(BEEP_SET_PARAMETERS))
|| (BeepParam->Frequency < BEEP_FREQUENCY_MINIMUM)
|| (BeepParam->Frequency > BEEP_FREQUENCY_MAXIMUM))
{
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_INVALID_PARAMETER);
}
DueTime.QuadPart = 0;
*/
/* do the beep!! */
/* DPRINT("Beep:\n Freq: %lu Hz\n Dur: %lu ms\n",
pbsp->Frequency,
pbsp->Duration);
if (BeepParam->Duration >= 0)
{
DueTime.QuadPart = (LONGLONG)BeepParam->Duration * -10000;
KeSetTimer(&DeviceExtension->Timer,
DueTime,
&DeviceExtension->Dpc);
HalMakeBeep(BeepParam->Frequency);
DeviceExtension->BeepOn = TRUE;
KeWaitForSingleObject(&DeviceExtension->Event,
Executive,
KernelMode,
FALSE,
NULL);
}
else if (BeepParam->Duration == (DWORD)-1)
{
if (DeviceExtension->BeepOn == TRUE)
{
HalMakeBeep(0);
DeviceExtension->BeepOn = FALSE;
}
else
{
HalMakeBeep(BeepParam->Frequency);
DeviceExtension->BeepOn = TRUE;
}
}
DPRINT("Did the beep!\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp,
IO_NO_INCREMENT);
return(STATUS_SUCCESS);
*/
}
static VOID STDCALL
BlasterUnload(PDRIVER_OBJECT DriverObject)
{
DPRINT("BlasterUnload() called!\n");
}
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
// PDEVICE_EXTENSION DeviceExtension;
// PDEVICE_OBJECT DeviceObject;
// DEVICE_INSTANCE Instance;
// Doesn't support multiple instances (yet ...)
NTSTATUS Status;
DPRINT("Sound Blaster Device Driver 0.0.2\n");
// Instance.DriverObject = DriverObject;
// previous instance = NULL...
// DeviceExtension->RegistryPath = RegistryPath;
DriverObject->Flags = 0;
DriverObject->MajorFunction[IRP_MJ_CREATE] = BlasterCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = BlasterClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BlasterCleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = BlasterDeviceControl;
DriverObject->MajorFunction[IRP_MJ_WRITE] = BlasterWrite;
DriverObject->DriverUnload = BlasterUnload;
// Major hack to just get this damn thing working:
Status = InitDevice(RegistryPath->Buffer, DriverObject); // ????
// DPRINT("Enumerating devices at %wZ\n", RegistryPath);
// Status = EnumDeviceKeys(RegistryPath, PARMS_SUBKEY, InitDevice, (PVOID)&DeviceObject); // &Instance;
// check error
/* set up device extension */
// DeviceExtension = DeviceObject->DeviceExtension;
// DeviceExtension->BeepOn = FALSE;
// return(STATUS_SUCCESS);
return(Status);
}
/* EOF */

View file

@ -1,176 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/dd/sndblst/sndblst.h
* PURPOSE: Sound Blaster driver header
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Sept 28, 2003: Created
*/
#ifndef __INCLUDES_SNDBLST_H__
#define __INCLUDES_SNDBLST_H__
#include <ntddk.h>
#define NDEBUG
#include <debug.h>
#define DEFAULT_PORT 0x220
#define DEFAULT_IRQ 5
#define DEFAULT_DMA 1
#define DEFAULT_BUFSIZE 0x4000
#define DEFAULT_SAMPLERATE 11025
#define DEFAULT_BITDEPTH 8
#define DEFAULT_CHANNELS 1
#define VALID_IRQS {5}
#define MIN_BUFSIZE 0x1000
#define MAX_BUFSIZE 0x4000
#define DEVICE_SUBKEY L"Devices"
#define PARMS_SUBKEY L"Parameters"
#define REGISTRY_PORT L"Port"
// At the moment, we just support a single device with fixed parameters:
#define SB_PORT DEFAULT_PORT
#define SB_IRQ DEFAULT_IRQ
#define SB_DMA DEFAULT_DMA
#define SB_BUFSIZE DEFAULT_BUFSIZE
#define SB_TIMEOUT 1000000
#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)
*/
// Some constants
#define SB_DSP_READY 0xaa
// Commands (only the ones we use)
#define SB_SET_OUTPUT_RATE 0x41 // DSP v4.xx only
#define SB_SET_INPUT_RATE 0x42 // DSP v4.xx only
#define SB_SET_BLOCK_SIZE 0x48 // DSP v2.00 +
#define SB_ENABLE_SPEAKER 0xd1
#define SB_DISABLE_SPEAKER 0xd3
#define SB_GET_SPEAKER_STATUS 0xd8 // DSP v2.00 +
#define SB_GET_DSP_VERSION 0xe1
// Hmm... These are a weenie bit trickier than MPU401...
#define SB_WRITE_RESET(bp, x) WRITE_PORT_UCHAR((PUCHAR) bp+0x6, x)
#define SB_READ_DATA(bp) READ_PORT_UCHAR((PUCHAR) bp+0xa)
#define SB_WRITE_DATA(bp, x) WRITE_PORT_UCHAR((PUCHAR) bp+0xc, x)
#define SB_READ_WRITESTATUS(bp) READ_PORT_UCHAR((PUCHAR) bp+0xc)
#define SB_READ_READSTATUS(bp) READ_PORT_UCHAR((PUCHAR) bp+0xe)
// Flow control
#define SB_READY_TO_SEND(bp) \
SB_READ_WRITESTATUS(bp) & 0x80
#define SB_READY_TO_RECEIVE(bp) \
SB_READ_READSTATUS(bp) & 0x80
#define SB_WRITE_BYTE(bp, x) \
if (WaitToSend(bp)) SB_WRITE_DATA(bp, x)
//#define MPU401_READ(bp)
// if (WaitToRead(bp)) ... ???
/*
DEVICE_EXTENSION contains the settings for each individual device
*/
typedef struct _DEVICE_EXTENSION
{
PWSTR RegistryPath;
PDRIVER_OBJECT DriverObject;
ULONG Port;
ULONG IRQ;
ULONG DMA;
ULONG BufferSize;
PADAPTER_OBJECT Adapter;
PMDL Mdl;
PCHAR VirtualBuffer;
PHYSICAL_ADDRESS Buffer;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
/*
DEVICE_INSTANCE contains ???
*/
typedef struct _DEVICE_INSTANCE
{
// pPrevGDI
PDRIVER_OBJECT DriverObject;
} DEVICE_INSTANCE, *PDEVICE_INSTANCE;
/*
CONFIG contains device parameters (port/IRQ)
THIS STRUCTURE IS REDUNDANT
*/
//typedef struct _CONFIG
//{
// ULONG Port;
// ULONG IRQ;
//} CONFIG, *PCONFIG;
/*
Some callback typedefs
*/
typedef NTSTATUS REGISTRY_CALLBACK_ROUTINE(PWSTR RegistryPath, PVOID Context);
typedef REGISTRY_CALLBACK_ROUTINE *PREGISTRY_CALLBACK_ROUTINE;
/*
Prototypes for functions in portio.c :
*/
BOOLEAN WaitToSend(ULONG BasePort);
BOOLEAN WaitToReceive(ULONG BasePort);
USHORT InitSoundCard(ULONG BasePort);
/*
Prototypes for functions in settings.c :
*/
NTSTATUS STDCALL EnumDeviceKeys(
IN PUNICODE_STRING RegistryPath,
IN PWSTR SubKey,
IN PREGISTRY_CALLBACK_ROUTINE Callback,
IN PVOID Context);
NTSTATUS STDCALL LoadSettings(
IN PWSTR ValueName,
IN ULONG ValueType,
IN PVOID ValueData,
IN ULONG ValueLength,
IN PVOID Context,
IN PVOID EntryContext);
BOOLEAN CreateDMA(PDEVICE_OBJECT DeviceObject);
VOID SetOutputSampleRate(ULONG BasePort, ULONG SampleRate);
VOID EnableSpeaker(ULONG BasePort, BOOLEAN SpeakerOn);
BOOLEAN IsSpeakerEnabled(ULONG BasePort);
VOID BeginPlayback(ULONG BasePort, ULONG BitDepth, ULONG Channels, ULONG BlockSize);
#endif

View file

@ -1,13 +0,0 @@
<module name="sndblst" type="kernelmodedriver" allowwarnings="true">
<include base="sndblst">.</include>
<define name="__USE_W32API" />
<library>ntoskrnl</library>
<library>hal</library>
<file>card.c</file>
<file>dma.c</file>
<file>irq.c</file>
<file>portio.c</file>
<file>settings.c</file>
<file>sndblst.c</file>
<file>sndblst.rc</file>
</module>

View file

@ -1,7 +0,0 @@
/* $Id$ */
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "SoundBlaster Driver\0"
#define REACTOS_STR_INTERNAL_NAME "sndblst\0"
#define REACTOS_STR_ORIGINAL_FILENAME "sndblst.sys\0"
#include <reactos/version.rc>

View file

@ -1,70 +0,0 @@
#include <stdio.h>
#include <windows.h>
#include <ntddk.h>
#include "mpu401.h"
int main()
{
// NTSTATUS s;
// PHANDLE Handle;
// PIO_STATUS_BLOCK Status;
DWORD BytesReturned;
BYTE Test[3]; // Will store MIDI data
BYTE Notes[] = {50, 52, 54, 55, 57, 59, 61};
HANDLE Device;
UINT Note;
UINT Junk;
printf("Test program for MPU401 driver\n");
Device = CreateFile("\\\\.\\MPU401_Out_0", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL);
if (Device == INVALID_HANDLE_VALUE)
{
printf("Device is busy or could not be found.\n");
return -1;
}
printf("Device is open, let's play some music...\n");
Test[0] = 0x90;
Test[2] = 0x7f;
for (Note = 0; Note < sizeof(Notes); Note ++)
{
Test[1] = Notes[Note];
DeviceIoControl(
Device,
IOCTL_MIDI_PLAY,
&Test,
sizeof(Test),
NULL,
0,
&BytesReturned,
NULL
);
for (Junk = 0; Junk < 100000; Junk ++); // Pause
}
/* s = IoCreateFile(Handle, GENERIC_READ | GENERIC_WRITE,
OBJ_KERNEL_HANDLE,
Status,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL,
0,
CreateFileTypeNone,
NULL,
0);
*/
}

View file

@ -1,54 +0,0 @@
#include <stdio.h>
#include <windows.h>
#include <ntddk.h>
int main()
{
// NTSTATUS s;
// PHANDLE Handle;
// PIO_STATUS_BLOCK Status;
HANDLE Device;
DWORD BytesReturned;
printf("SB Test\n");
Device = CreateFile("\\\\.\\SndBlst", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL);
if (Device == INVALID_HANDLE_VALUE)
{
printf("Device is busy or could not be found.\n");
return -1;
}
// DeviceIoControl(
// Device,
// IOCTL_FILE_DISK_OPEN_FILE,
// OpenFileInformation,
// sizeof(OPEN_FILE_INFORMATION) + OpenFileInformation->FileNameLength - 1,
// NULL
// 0,
// &BytesReturned,
// NULL
// )
/* s = IoCreateFile(Handle, GENERIC_READ | GENERIC_WRITE,
OBJ_KERNEL_HANDLE,
Status,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL,
0,
CreateFileTypeNone,
NULL,
0);
*/
}

View file

@ -1,78 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/dd/sound/dsp.c
* PURPOSE: Digital Signal Processing ?
* PROGRAMMER: Snatched from ?
*
* UPDATE HISTORY:
* ??/??/??: Created
* 10/23/02: Steven Edwards (Steven_Ed4153@yahoo.com)
* Minor build fix
*/
#include "sb16.h"
#include "dsp.h"
/************************************
* unsigned char read_dsp(void)
*
* Reads the DSP chip
* Arguments: none
* Returns: Byte read
************************************/
unsigned char read_dsp(unsigned short base)
{
// while((inb(base+0x0e)&0x80)==0); //Wait until there is something to read
// return inb(base+0x0a);
return 0;
}
/************************************'
* sb_status detect_dsp(void);
*
* Detects if a SB16 is installed
* Arguments: None
* Returns: Success or failure
************************************/
sb_status detect_dsp(SB16* sb16)
{
for(base=0x200;base<0x280;base+=0x10) //Tries to reset all DSP addresses there is
if(reset_dsp(base)==SB_TRUE)
{
sb16->base=base;
return SB_TRUE;
}
return SB_FALSE;
}
/**************************************
* sb_status reset_dsp(unsigned short base_address);
*
* Tries to reset a DSP chip
* Arguments: base address
* Returns: Success of failure
**************************************/
sb_status reset_dsp(unsigned short base_address)
{
// int delay;
// outb(base_address+DSP_RESET_PORT,1);
// for(delay=0;delay<0xffff;delay++);
// outb(base_address+DSP_RESET_PORT,0);
// for(delay=0;delay<0xffff;delay++);
// if((inb(base_address+DSP_READ_STATUS_PORT)&0x80)==0) return SB_FALSE;
// if(inb(base_address+DSP_READ_DATA_PORT)!=0xAA) return SB_FALSE;
return SB_TRUE;
}
void write_dsp(unsigned short base,unsigned char data)
{
// while ((inb(base+DSP_WRITE_PORT) & 0x80) != 0);
// outb(base+DSP_WRITE_PORT, data);
}

View file

@ -1,17 +0,0 @@
#define SB_TRUE 0
#define SB_FALSE 1
#define DSP_MIXER_ADDRESS_PORT 0x04
#define DSP_MIXER_DATA_PORT 0x05
#define DSP_RESET_PORT 0x06
#define DSP_READ_DATA_PORT 0x0A
#define DSP_WRITE_PORT 0x0C //Same port used for reading status and writing data
#define DSP_READ_STATUS_PORT 0x0E
typedef unsigned char sb_status;
unsigned short base;
unsigned char irq,dma8,dma16;
unsigned char read_dsp(unsigned short base);
void write_dsp(unsigned short base,unsigned char data);
sb_status detect_dsp(SB16* sb16);
sb_status reset_dsp(unsigned short base_address);

View file

@ -1,491 +0,0 @@
unsigned int wavelength=3891;
unsigned char wave[]={
0x52,0x49,0x46,0x46,0x2b,0xf,0x0,0x0,
0x57,0x41,0x56,0x45,0x66,0x6d,0x74,0x20,
0x10,0x0,0x0,0x0,0x1,0x0,0x1,0x0,
0x22,0x56,0x0,0x0,0x22,0x56,0x0,0x0,
0x1,0x0,0x8,0x0,0x64,0x61,0x74,0x61,
0x7,0xf,0x0,0x0,0x80,0xce,0xb2,0x53,
0x2e,0x75,0xca,0xbb,0x5d,0x2c,0x6a,0xc4,
0xc2,0x68,0x2c,0x5f,0xbd,0xc8,0x74,0x2e,
0x51,0xad,0xd0,0x8a,0x36,0x3f,0x98,0xd2,
0xa2,0x46,0x33,0x81,0xcd,0xb5,0x58,0x2d,
0x67,0xbe,0xc8,0x78,0x30,0x49,0xa3,0xd2,
0x9b,0x43,0x34,0x80,0xcc,0xb9,0x60,0x2c,
0x5e,0xb6,0xce,0x89,0x39,0x3b,0x8b,0xce,
0xb4,0x5c,0x2d,0x5e,0xb6,0xce,0x89,0x39,
0x3a,0x8b,0xce,0xb7,0x62,0x2d,0x54,0xaa,
0xd1,0x9b,0x46,0x31,0x74,0xc2,0xc7,0x7b,
0x34,0x41,0x94,0xcf,0xb3,0x61,0x2e,0x53,
0xa6,0xd1,0xa3,0x4f,0x2e,0x65,0xb7,0xce,
0x90,0x41,0x33,0x78,0xc3,0xc8,0x83,0x3a,
0x38,0x80,0xc6,0xc4,0x7d,0x36,0x3c,0x86,
0xc9,0xc0,0x76,0x34,0x40,0x8d,0xcb,0xbe,
0x74,0x34,0x3e,0x87,0xc9,0xc1,0x78,0x36,
0x3b,0x83,0xc7,0xc4,0x7e,0x39,0x39,0x7d,
0xc2,0xc9,0x8a,0x42,0x32,0x6a,0xb6,0xce,
0x9c,0x4f,0x2e,0x5b,0xa8,0xd0,0xab,0x5d,
0x2f,0x49,0x94,0xcb,0xbe,0x78,0x39,0x38,
0x77,0xbd,0xcc,0x95,0x4a,0x2f,0x5c,0xa7,
0xcf,0xb0,0x68,0x33,0x40,0x83,0xc3,0xc9,
0x8e,0x47,0x30,0x5c,0xa6,0xcf,0xb2,0x6b,
0x34,0x3e,0x7e,0xbf,0xcc,0x99,0x51,0x2f,
0x4f,0x96,0xcb,0xc1,0x81,0x40,0x32,0x64,
0xab,0xcf,0xb0,0x6c,0x36,0x39,0x74,0xb7,
0xce,0xa7,0x61,0x32,0x40,0x80,0xbe,0xcc,
0x9d,0x56,0x30,0x48,0x88,0xc3,0xca,0x99,
0x54,0x30,0x47,0x88,0xc2,0xca,0x98,0x55,
0x30,0x47,0x87,0xc1,0xca,0x9a,0x58,0x31,
0x42,0x80,0xbb,0xcd,0xa5,0x63,0x34,0x3b,
0x73,0xb3,0xce,0xb1,0x6f,0x39,0x36,0x66,
0xa6,0xcc,0xbe,0x84,0x47,0x30,0x50,0x8f,
0xc4,0xc9,0x9b,0x5c,0x33,0x3f,0x77,0xb4,
0xce,0xb2,0x77,0x40,0x32,0x57,0x96,0xc6,
0xc7,0x99,0x5a,0x33,0x3e,0x73,0xb0,0xcd,
0xb7,0x7e,0x45,0x31,0x4e,0x88,0xbe,0xcc,
0xa9,0x6c,0x3b,0x34,0x5d,0x99,0xc7,0xc7,
0x99,0x5d,0x35,0x3a,0x69,0xa3,0xca,0xc3,
0x93,0x58,0x33,0x3c,0x6e,0xa8,0xcb,0xc0,
0x8f,0x54,0x33,0x3f,0x6f,0xa8,0xcb,0xc1,
0x91,0x58,0x34,0x3b,0x69,0xa3,0xc9,0xc5,
0x98,0x5f,0x37,0x38,0x61,0x99,0xc4,0xc9,
0xa5,0x6d,0x3e,0x33,0x52,0x88,0xba,0xcc,
0xb3,0x80,0x4b,0x32,0x44,0x76,0xac,0xca,
0xc2,0x96,0x5f,0x38,0x36,0x5b,0x91,0xbf,
0xcb,0xaf,0x7b,0x49,0x32,0x44,0x75,0xa9,
0xc9,0xc4,0x9d,0x68,0x3d,0x34,0x50,0x83,
0xb5,0xcb,0xbc,0x8f,0x59,0x37,0x38,0x5d,
0x91,0xbd,0xcb,0xb6,0x85,0x53,0x35,0x3a,
0x60,0x94,0xbe,0xcb,0xb3,0x83,0x51,0x34,
0x3c,0x62,0x95,0xbe,0xcb,0xb6,0x87,0x56,
0x37,0x39,0x5a,0x8c,0xb9,0xcb,0xbb,0x90,
0x5d,0x3a,0x35,0x52,0x80,0xb0,0xc9,0xc3,
0x9f,0x6e,0x44,0x33,0x43,0x6d,0x9f,0xc2,
0xc9,0xaf,0x81,0x53,0x37,0x39,0x57,0x85,
0xb2,0xc9,0xc2,0x9f,0x6e,0x45,0x34,0x41,
0x68,0x98,0xbe,0xca,0xb8,0x8e,0x61,0x3d,
0x34,0x49,0x72,0xa1,0xc2,0xc9,0xb2,0x88,
0x5a,0x3b,0x36,0x4e,0x7a,0xa6,0xc4,0xc8,
0xb0,0x85,0x59,0x3b,0x36,0x4d,0x76,0xa3,
0xc3,0xc9,0xb3,0x89,0x5d,0x3d,0x35,0x49,
0x70,0x9c,0xbe,0xc9,0xba,0x96,0x6a,0x44,
0x35,0x40,0x61,0x8d,0xb4,0xc8,0xc2,0xa4,
0x7a,0x51,0x38,0x38,0x4f,0x78,0xa2,0xc0,
0xc9,0xb8,0x93,0x68,0x45,0x35,0x3f,0x5f,
0x89,0xaf,0xc6,0xc6,0xad,0x86,0x5e,0x3f,
0x35,0x43,0x66,0x8f,0xb4,0xc7,0xc3,0xa9,
0x81,0x58,0x3d,0x36,0x46,0x67,0x8f,0xb4,
0xc7,0xc4,0xab,0x85,0x5d,0x3f,0x36,0x43,
0x63,0x8a,0xb0,0xc5,0xc6,0xb1,0x8e,0x66,
0x46,0x36,0x3c,0x56,0x7d,0xa2,0xbf,0xc8,
0xbc,0x9c,0x77,0x51,0x3a,0x37,0x48,0x69,
0x8f,0xb2,0xc5,0xc5,0xb2,0x8f,0x69,0x48,
0x37,0x3b,0x51,0x75,0x9b,0xba,0xc7,0xc1,
0xaa,0x86,0x62,0x44,0x37,0x3d,0x55,0x79,
0x9d,0xba,0xc7,0xc1,0xa8,0x85,0x61,0x44,
0x37,0x3c,0x54,0x75,0x99,0xb7,0xc6,0xc3,
0xae,0x8e,0x69,0x4a,0x39,0x3a,0x4c,0x6b,
0x8f,0xaf,0xc3,0xc6,0xb8,0x9c,0x79,0x57,
0x3f,0x37,0x41,0x59,0x7c,0x9e,0xb9,0xc6,
0xc2,0xad,0x8e,0x6c,0x4d,0x3b,0x38,0x46,
0x61,0x82,0xa4,0xbc,0xc7,0xc0,0xaa,0x8a,
0x68,0x4b,0x3a,0x39,0x48,0x62,0x84,0xa4,
0xbc,0xc6,0xc1,0xad,0x8d,0x6d,0x4f,0x3c,
0x38,0x44,0x5d,0x7d,0x9d,0xb6,0xc5,0xc4,
0xb5,0x99,0x79,0x5b,0x43,0x38,0x3d,0x50,
0x6c,0x8c,0xab,0xbf,0xc6,0xbf,0xaa,0x8d,
0x6e,0x52,0x3e,0x38,0x41,0x56,0x73,0x92,
0xae,0xc1,0xc6,0xbc,0xa5,0x87,0x6a,0x4f,
0x3d,0x39,0x41,0x57,0x73,0x92,0xad,0xbf,
0xc5,0xbe,0xa9,0x8d,0x70,0x53,0x40,0x39,
0x3f,0x50,0x6b,0x88,0xa5,0xba,0xc5,0xc2,
0xb3,0x9a,0x7e,0x61,0x49,0x3b,0x3a,0x46,
0x5b,0x78,0x94,0xae,0xbf,0xc5,0xbe,0xad,
0x93,0x77,0x5b,0x46,0x3b,0x3b,0x47,0x5b,
0x77,0x92,0xac,0xbe,0xc5,0xc0,0xb1,0x9a,
0x7e,0x63,0x4c,0x3e,0x3a,0x41,0x52,0x6a,
0x85,0x9f,0xb4,0xc1,0xc4,0xbc,0xab,0x93,
0x79,0x5f,0x4a,0x3d,0x3a,0x42,0x53,0x6a,
0x82,0x9c,0xb1,0xc0,0xc4,0xbf,0xb0,0x9a,
0x80,0x68,0x51,0x42,0x3a,0x3d,0x48,0x5c,
0x73,0x8d,0xa4,0xb7,0xc2,0xc3,0xbc,0xac,
0x96,0x7e,0x67,0x51,0x42,0x3b,0x3d,0x48,
0x5a,0x70,0x88,0x9f,0xb2,0xbf,0xc3,0xbf,
0xb3,0xa1,0x89,0x72,0x5c,0x4a,0x3e,0x3b,
0x3f,0x4c,0x5e,0x75,0x8a,0xa1,0xb3,0xbf,
0xc3,0xbf,0xb5,0xa3,0x8e,0x77,0x61,0x4e,
0x41,0x3b,0x3d,0x46,0x55,0x69,0x80,0x95,
0xa9,0xb8,0xc1,0xc3,0xbd,0xb0,0x9f,0x8a,
0x75,0x61,0x4e,0x42,0x3c,0x3d,0x44,0x52,
0x65,0x7a,0x8e,0xa2,0xb2,0xbd,0xc2,0xc0,
0xb8,0xaa,0x98,0x83,0x6f,0x5c,0x4c,0x41,
0x3c,0x3d,0x45,0x52,0x63,0x77,0x8b,0x9e,
0xaf,0xbb,0xc1,0xc1,0xbc,0xb1,0xa1,0x8f,
0x7b,0x67,0x56,0x48,0x3f,0x3c,0x3f,0x47,
0x54,0x65,0x77,0x8a,0x9d,0xad,0xb9,0xc0,
0xc2,0xbe,0xb5,0xa7,0x97,0x83,0x72,0x60,
0x50,0x45,0x3e,0x3d,0x40,0x49,0x56,0x66,
0x78,0x8a,0x9c,0xab,0xb7,0xbf,0xc1,0xbf,
0xb8,0xac,0x9d,0x8c,0x7b,0x6a,0x59,0x4c,
0x43,0x3d,0x3d,0x42,0x4b,0x57,0x67,0x79,
0x89,0x9a,0xa8,0xb5,0xbd,0xc1,0xc0,0xbb,
0xb1,0xa5,0x95,0x84,0x74,0x63,0x56,0x4a,
0x42,0x3e,0x3e,0x43,0x4b,0x57,0x66,0x75,
0x85,0x95,0xa4,0xb0,0xba,0xbf,0xc0,0xbe,
0xb7,0xad,0xa0,0x92,0x81,0x72,0x63,0x55,
0x4a,0x42,0x3e,0x3e,0x42,0x48,0x53,0x60,
0x6e,0x7e,0x8d,0x9b,0xa9,0xb4,0xbb,0xbf,
0xc0,0xbd,0xb7,0xad,0xa1,0x93,0x84,0x75,
0x67,0x5a,0x4f,0x46,0x40,0x3e,0x3f,0x44,
0x4b,0x56,0x63,0x71,0x80,0x8d,0x9a,0xa7,
0xb1,0xb9,0xbe,0xc0,0xbe,0xb9,0xb2,0xa7,
0x9c,0x8e,0x80,0x73,0x65,0x59,0x4f,0x47,
0x41,0x3f,0x3f,0x43,0x49,0x53,0x5d,0x69,
0x76,0x84,0x91,0x9e,0xa9,0xb3,0xba,0xbe,
0xbf,0xbe,0xba,0xb3,0xaa,0xa0,0x93,0x86,
0x7a,0x6d,0x60,0x55,0x4d,0x46,0x41,0x3f,
0x40,0x44,0x49,0x51,0x5c,0x66,0x72,0x80,
0x8b,0x97,0xa2,0xac,0xb4,0xba,0xbd,0xbe,
0xbd,0xb9,0xb4,0xab,0xa1,0x96,0x8b,0x80,
0x73,0x68,0x5d,0x52,0x4b,0x45,0x41,0x40,
0x41,0x44,0x49,0x50,0x58,0x63,0x6e,0x7a,
0x85,0x90,0x9b,0xa5,0xae,0xb5,0xba,0xbd,
0xbe,0xbd,0xba,0xb4,0xae,0xa5,0x9b,0x91,
0x85,0x7b,0x70,0x65,0x5b,0x53,0x4b,0x46,
0x42,0x41,0x41,0x43,0x47,0x4c,0x54,0x5d,
0x67,0x71,0x7c,0x86,0x90,0x9a,0xa3,0xac,
0xb3,0xb8,0xbb,0xbd,0xbd,0xbb,0xb7,0xb2,
0xac,0xa3,0x9b,0x91,0x87,0x7d,0x72,0x69,
0x5f,0x57,0x50,0x4a,0x45,0x42,0x41,0x42,
0x43,0x47,0x4c,0x53,0x5b,0x63,0x6c,0x76,
0x80,0x88,0x93,0x9c,0xa4,0xab,0xb1,0xb6,
0xba,0xbc,0xbd,0xbc,0xb9,0xb5,0xb0,0xaa,
0xa2,0x9a,0x91,0x87,0x80,0x76,0x6c,0x63,
0x5c,0x55,0x4e,0x49,0x45,0x43,0x42,0x42,
0x44,0x47,0x4b,0x50,0x57,0x5e,0x66,0x6f,
0x78,0x80,0x89,0x92,0x9a,0xa2,0xa8,0xae,
0xb4,0xb7,0xba,0xbc,0xbc,0xbb,0xb8,0xb5,
0xb0,0xab,0xa4,0x9d,0x95,0x8d,0x85,0x7c,
0x74,0x6c,0x64,0x5c,0x56,0x51,0x4c,0x48,
0x45,0x43,0x43,0x43,0x45,0x48,0x4b,0x50,
0x56,0x5d,0x63,0x6b,0x73,0x7b,0x82,0x8a,
0x92,0x99,0xa0,0xa7,0xac,0xb1,0xb5,0xb8,
0xba,0xbb,0xbb,0xba,0xb8,0xb4,0xb1,0xac,
0xa6,0xa0,0x9a,0x92,0x8b,0x83,0x7c,0x75,
0x6d,0x66,0x60,0x5a,0x54,0x4f,0x4b,0x48,
0x45,0x44,0x43,0x44,0x45,0x47,0x4a,0x4e,
0x53,0x58,0x5e,0x64,0x6b,0x72,0x79,0x80,
0x87,0x8d,0x94,0x9b,0xa1,0xa6,0xac,0xaf,
0xb3,0xb6,0xb8,0xba,0xba,0xba,0xb9,0xb7,
0xb4,0xb0,0xad,0xa8,0xa2,0x9d,0x97,0x90,
0x8a,0x83,0x7d,0x76,0x70,0x69,0x64,0x5d,
0x59,0x53,0x50,0x4c,0x49,0x47,0x45,0x44,
0x44,0x45,0x46,0x48,0x4b,0x4f,0x52,0x57,
0x5c,0x61,0x67,0x6c,0x72,0x79,0x80,0x85,
0x8b,0x91,0x96,0x9c,0xa2,0xa7,0xab,0xaf,
0xb2,0xb5,0xb7,0xb8,0xb9,0xb9,0xb9,0xb8,
0xb6,0xb4,0xb1,0xae,0xaa,0xa6,0xa1,0x9c,
0x96,0x91,0x8c,0x86,0x80,0x7a,0x75,0x6f,
0x6a,0x64,0x5f,0x5b,0x56,0x52,0x4f,0x4c,
0x4a,0x48,0x46,0x46,0x45,0x46,0x47,0x48,
0x4a,0x4c,0x4f,0x52,0x56,0x5a,0x5e,0x63,
0x68,0x6e,0x72,0x78,0x7d,0x82,0x88,0x8c,
0x92,0x97,0x9b,0xa0,0xa4,0xa8,0xac,0xaf,
0xb1,0xb3,0xb6,0xb7,0xb8,0xb8,0xb8,0xb7,
0xb6,0xb5,0xb3,0xb0,0xad,0xaa,0xa7,0xa3,
0x9f,0x9b,0x97,0x92,0x8c,0x87,0x82,0x7f,
0x7a,0x75,0x70,0x6b,0x66,0x62,0x5e,0x5a,
0x56,0x54,0x51,0x4e,0x4c,0x4a,0x49,0x47,
0x47,0x47,0x47,0x47,0x48,0x4a,0x4b,0x4d,
0x50,0x53,0x55,0x59,0x5d,0x61,0x64,0x68,
0x6d,0x71,0x76,0x7b,0x7f,0x82,0x87,0x8b,
0x90,0x95,0x98,0x9c,0xa0,0xa3,0xa7,0xaa,
0xad,0xaf,0xb1,0xb3,0xb4,0xb5,0xb6,0xb7,
0xb7,0xb6,0xb6,0xb5,0xb3,0xb2,0xb0,0xad,
0xab,0xa8,0xa5,0xa2,0x9e,0x9a,0x96,0x93,
0x8e,0x8a,0x86,0x81,0x7f,0x7a,0x76,0x72,
0x6d,0x6a,0x65,0x62,0x5e,0x5b,0x58,0x55,
0x53,0x50,0x4e,0x4c,0x4b,0x4a,0x49,0x48,
0x48,0x48,0x49,0x49,0x4a,0x4b,0x4d,0x4f,
0x51,0x54,0x56,0x59,0x5c,0x5f,0x63,0x66,
0x6a,0x6e,0x72,0x76,0x7a,0x7e,0x80,0x85,
0x89,0x8d,0x90,0x94,0x98,0x9c,0x9f,0xa2,
0xa5,0xa7,0xaa,0xac,0xae,0xb0,0xb2,0xb3,
0xb4,0xb5,0xb5,0xb5,0xb5,0xb5,0xb4,0xb3,
0xb2,0xb0,0xaf,0xad,0xab,0xa8,0xa6,0xa3,
0xa0,0x9d,0x9a,0x96,0x93,0x8f,0x8c,0x88,
0x84,0x80,0x7e,0x7a,0x76,0x72,0x6f,0x6b,
0x68,0x65,0x62,0x5f,0x5c,0x59,0x57,0x54,
0x52,0x50,0x4f,0x4d,0x4c,0x4b,0x4a,0x4a,
0x4a,0x4a,0x4a,0x4a,0x4b,0x4c,0x4d,0x4f,
0x50,0x52,0x54,0x56,0x59,0x5c,0x5e,0x61,
0x64,0x67,0x6a,0x6d,0x71,0x74,0x77,0x7b,
0x7f,0x81,0x84,0x88,0x8b,0x8e,0x92,0x95,
0x98,0x9b,0x9e,0xa1,0xa3,0xa5,0xa8,0xaa,
0xac,0xad,0xaf,0xb0,0xb1,0xb2,0xb3,0xb3,
0xb3,0xb3,0xb3,0xb3,0xb2,0xb2,0xb1,0xb0,
0xae,0xac,0xab,0xa9,0xa7,0xa4,0xa2,0xa0,
0x9d,0x9a,0x97,0x95,0x91,0x8f,0x8b,0x89,
0x85,0x82,0x80,0x7d,0x79,0x76,0x73,0x70,
0x6d,0x6a,0x68,0x65,0x62,0x5f,0x5d,0x5b,
0x59,0x56,0x55,0x53,0x51,0x50,0x4f,0x4e,
0x4d,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,
0x4d,0x4e,0x4e,0x50,0x51,0x53,0x54,0x56,
0x58,0x5a,0x5b,0x5d,0x60,0x63,0x65,0x68,
0x6a,0x6d,0x70,0x73,0x76,0x78,0x7c,0x7f,
0x80,0x84,0x87,0x89,0x8c,0x8f,0x92,0x94,
0x97,0x99,0x9c,0x9e,0xa0,0xa2,0xa5,0xa6,
0xa8,0xaa,0xab,0xad,0xae,0xaf,0xaf,0xb0,
0xb1,0xb1,0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,
0xb0,0xaf,0xae,0xad,0xac,0xab,0xa9,0xa8,
0xa5,0xa4,0xa2,0xa0,0x9e,0x9c,0x99,0x97,
0x95,0x92,0x90,0x8d,0x8b,0x88,0x86,0x82,
0x80,0x7e,0x7b,0x78,0x76,0x73,0x71,0x6e,
0x6c,0x69,0x67,0x65,0x63,0x60,0x5e,0x5d,
0x5b,0x59,0x57,0x56,0x54,0x53,0x52,0x51,
0x50,0x50,0x4f,0x4e,0x4e,0x4e,0x4d,0x4d,
0x4e,0x4e,0x4e,0x4f,0x4f,0x50,0x51,0x52,
0x53,0x54,0x56,0x57,0x58,0x5a,0x5c,0x5e,
0x60,0x62,0x63,0x65,0x67,0x6a,0x6c,0x6f,
0x71,0x73,0x75,0x78,0x7a,0x7d,0x7f,0x80,
0x83,0x85,0x88,0x8a,0x8c,0x8f,0x91,0x93,
0x95,0x97,0x99,0x9b,0x9d,0x9f,0xa1,0xa2,
0xa4,0xa5,0xa7,0xa8,0xa9,0xaa,0xab,0xac,
0xad,0xae,0xae,0xaf,0xaf,0xaf,0xaf,0xaf,
0xaf,0xaf,0xaf,0xae,0xae,0xad,0xad,0xac,
0xab,0xaa,0xa9,0xa8,0xa7,0xa5,0xa4,0xa3,
0xa1,0x9f,0x9e,0x9c,0x9a,0x98,0x96,0x95,
0x92,0x91,0x8e,0x8c,0x8a,0x88,0x86,0x84,
0x81,0x80,0x7e,0x7c,0x7a,0x78,0x75,0x73,
0x71,0x6f,0x6d,0x6b,0x6a,0x67,0x66,0x64,
0x63,0x61,0x5f,0x5e,0x5c,0x5b,0x5a,0x58,
0x57,0x56,0x55,0x54,0x53,0x53,0x52,0x51,
0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,
0x50,0x50,0x51,0x51,0x52,0x53,0x53,0x54,
0x55,0x56,0x57,0x58,0x59,0x5a,0x5c,0x5d,
0x5f,0x60,0x61,0x63,0x64,0x66,0x68,0x69,
0x6c,0x6d,0x6f,0x71,0x73,0x74,0x77,0x78,
0x7a,0x7c,0x7e,0x80,0x81,0x83,0x84,0x87,
0x88,0x8a,0x8c,0x8e,0x8f,0x92,0x93,0x94,
0x96,0x98,0x99,0x9b,0x9d,0x9e,0x9f,0xa0,
0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,
0xa9,0xaa,0xaa,0xab,0xac,0xac,0xac,0xac,
0xad,0xad,0xad,0xad,0xad,0xac,0xac,0xac,
0xac,0xab,0xab,0xaa,0xaa,0xa9,0xa8,0xa7,
0xa6,0xa6,0xa5,0xa4,0xa2,0xa1,0xa0,0x9f,
0x9e,0x9d,0x9b,0x99,0x98,0x97,0x95,0x94,
0x93,0x90,0x8f,0x8d,0x8c,0x8a,0x89,0x87,
0x86,0x83,0x82,0x80,0x80,0x7e,0x7c,0x7b,
0x79,0x78,0x76,0x75,0x72,0x71,0x6f,0x6e,
0x6c,0x6b,0x6a,0x68,0x67,0x66,0x64,0x63,
0x62,0x61,0x60,0x5e,0x5d,0x5c,0x5b,0x5a,
0x59,0x59,0x58,0x57,0x56,0x56,0x55,0x55,
0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x53,
0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,
0x55,0x55,0x56,0x56,0x56,0x57,0x58,0x59,
0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,
0x61,0x62,0x64,0x64,0x65,0x67,0x68,0x69,
0x6b,0x6c,0x6e,0x6f,0x70,0x71,0x73,0x74,
0x76,0x77,0x79,0x7a,0x7c,0x7d,0x7e,0x80,
0x80,0x82,0x83,0x85,0x86,0x88,0x89,0x8a,
0x8b,0x8d,0x8e,0x90,0x91,0x92,0x93,0x94,
0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,
0x9e,0x9f,0xa0,0xa1,0xa2,0xa2,0xa3,0xa4,
0xa5,0xa5,0xa6,0xa6,0xa7,0xa7,0xa8,0xa8,
0xa8,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,
0xaa,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa8,
0xa8,0xa8,0xa7,0xa7,0xa6,0xa6,0xa5,0xa4,
0xa4,0xa3,0xa2,0xa1,0xa1,0xa0,0x9f,0x9e,
0x9d,0x9d,0x9c,0x9a,0x99,0x99,0x97,0x96,
0x95,0x94,0x93,0x92,0x90,0x8f,0x8e,0x8d,
0x8c,0x8a,0x89,0x88,0x87,0x85,0x84,0x83,
0x81,0x80,0x80,0x7f,0x7d,0x7d,0x7b,0x7a,
0x78,0x77,0x76,0x75,0x74,0x73,0x71,0x70,
0x6f,0x6e,0x6c,0x6c,0x6b,0x69,0x68,0x68,
0x66,0x65,0x65,0x64,0x63,0x62,0x61,0x60,
0x5f,0x5f,0x5e,0x5d,0x5d,0x5c,0x5b,0x5b,
0x5a,0x5a,0x59,0x59,0x58,0x58,0x58,0x57,
0x57,0x57,0x57,0x57,0x56,0x56,0x56,0x56,
0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,
0x58,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,
0x5b,0x5c,0x5c,0x5d,0x5d,0x5e,0x5f,0x5f,
0x60,0x61,0x62,0x63,0x64,0x64,0x65,0x66,
0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,
0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,
0x77,0x78,0x7a,0x7b,0x7c,0x7d,0x7e,0x80,
0x80,0x81,0x81,0x83,0x84,0x85,0x86,0x87,
0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x96,
0x98,0x98,0x99,0x9a,0x9b,0x9b,0x9c,0x9d,
0x9d,0x9e,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1,
0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,
0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,
0xa6,0xa6,0xa6,0xa6,0xa6,0xa5,0xa5,0xa5,
0xa5,0xa5,0xa5,0xa4,0xa4,0xa4,0xa3,0xa3,
0xa3,0xa2,0xa2,0xa1,0xa1,0xa0,0xa0,0x9f,
0x9f,0x9e,0x9e,0x9d,0x9d,0x9c,0x9b,0x9a,
0x9a,0x99,0x98,0x97,0x97,0x96,0x95,0x95,
0x93,0x93,0x92,0x91,0x90,0x8f,0x8e,0x8d,
0x8d,0x8c,0x8b,0x8a,0x89,0x88,0x87,0x86,
0x85,0x84,0x83,0x82,0x81,0x80,0x80,0x80,
0x7e,0x7e,0x7d,0x7c,0x7b,0x7a,0x79,0x78,
0x77,0x76,0x75,0x74,0x74,0x73,0x72,0x71,
0x70,0x70,0x6e,0x6e,0x6d,0x6c,0x6b,0x6a,
0x6a,0x69,0x68,0x67,0x67,0x66,0x65,0x65,
0x64,0x64,0x63,0x62,0x62,0x62,0x61,0x61,
0x60,0x60,0x5f,0x5f,0x5e,0x5e,0x5d,0x5d,
0x5d,0x5d,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,
0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,
0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,
0x5b,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,
0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x60,0x60,
0x61,0x61,0x62,0x62,0x63,0x63,0x64,0x64,
0x65,0x65,0x66,0x67,0x67,0x68,0x69,0x69,
0x6a,0x6b,0x6b,0x6c,0x6d,0x6d,0x6e,0x6f,
0x70,0x70,0x71,0x72,0x73,0x73,0x74,0x75,
0x76,0x77,0x77,0x78,0x79,0x7a,0x7b,0x7b,
0x7c,0x7d,0x7e,0x7e,0x80,0x80,0x80,0x81,
0x82,0x82,0x83,0x84,0x85,0x85,0x86,0x87,
0x88,0x88,0x89,0x8a,0x8b,0x8b,0x8c,0x8d,
0x8d,0x8e,0x8f,0x90,0x90,0x91,0x92,0x92,
0x93,0x93,0x94,0x95,0x95,0x96,0x96,0x97,
0x97,0x98,0x99,0x99,0x99,0x9a,0x9a,0x9b,
0x9b,0x9b,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,
0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,
0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,
0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,
0xa1,0xa1,0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,
0xa0,0xa0,0x9f,0x9f,0x9f,0x9f,0x9f,0x9e,
0x9e,0x9e,0x9d,0x9d,0x9d,0x9c,0x9c,0x9c,
0x9b,0x9b,0x9a,0x9a,0x9a,0x99,0x99,0x98,
0x98,0x97,0x97,0x96,0x96,0x95,0x95,0x94,
0x94,0x93,0x93,0x92,0x92,0x91,0x90,0x90,
0x8f,0x8f,0x8e,0x8d,0x8d,0x8c,0x8c,0x8b,
0x8a,0x8a,0x89,0x88,0x88,0x87,0x87,0x86,
0x85,0x85,0x84,0x83,0x83,0x82,0x81,0x81,
0x80,0x80,0x80,0x7f,0x7e,0x7e,0x7d,0x7d,
0x7c,0x7b,0x7a,0x7a,0x79,0x79,0x78,0x78,
0x77,0x76,0x75,0x75,0x74,0x74,0x73,0x73,
0x72,0x72,0x71,0x71,0x70,0x6f,0x6f,0x6e,
0x6e,0x6d,0x6d,0x6c,0x6c,0x6b,0x6b,0x6a,
0x6a,0x69,0x69,0x69,0x68,0x68,0x68,0x67,
0x67,0x66,0x66,0x65,0x65,0x65,0x65,0x64,
0x64,0x64,0x63,0x63,0x63,0x63,0x62,0x62,
0x62,0x62,0x62,0x61,0x61,0x61,0x61,0x61,
0x61,0x61,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x61,
0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x62,
0x62,0x62,0x63,0x63,0x63,0x63,0x64,0x64,
0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,
0x66,0x67,0x67,0x67,0x68,0x68,0x69,0x69,
0x69,0x6a,0x6a,0x6b,0x6b,0x6b,0x6c,0x6c,
0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x70,
0x70,0x71,0x71,0x72,0x72,0x73,0x73,0x74,
0x74,0x75,0x75,0x76,0x76,0x77,0x77,0x78,
0x78,0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7c,
0x7c,0x7d,0x7d,0x7e,0x7e,0x7f,0x80,0x80,
0x80,0x80,0x81,0x81,0x82,0x82,0x83,0x83,
0x84,0x84,0x84,0x85,0x85,0x86,0x86,0x87,
0x87,0x88,0x88,0x89,0x89,0x8a,0x8a,0x8b,
0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,
0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x91,0x91,
0x91,0x92,0x92,0x92,0x93,0x93,0x93,0x94,
0x94,0x94,0x94,0x95,0x95,0x95,0x96,0x96,
0x96,0x96,0x97,0x97,0x97,0x97,0x98,0x98,
0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,
0x99,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,
0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,
0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,
0x9b,0x9b,0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,
0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,
0x99,0x99,0x99,0x99,0x99,0x99,0x98,0x98,
0x98,0x98,0x98,0x98,0x97,0x97,0x97,0x97,
0x96,0x96,0x96,0x96,0x96,0x95,0x95,0x95,
0x94,0x94,0x94,0x94,0x94,0x93,0x93,0x93,
0x92,0x92,0x92,0x91,0x91,0x91,0x90,0x90,
0x90,0x90,0x8f,0x8f,0x8e,0x8e,0x8e,0x8e,
0x8d,0x8d,0x8c,0x8c,0x8c,0x8b,0x8b,0x8b,
0x8a,0x8a,0x89,0x89,0x89,0x89,0x88,0x88,
0x87,0x87,0x86,0x86,0x86,0x85,0x85,0x85,
0x84,0x84,0x84,0x83,0x83,0x82,0x82,0x82,
0x81,0x81,0x80,0x80,0x80,0x80,0x80,0x80,
0x7f,0x7f,0x7f,0x7e,0x7e,0x7d,0x7d,0x7d,
0x7c,0x7c,0x7b,0x7b,0x7b,0x7b,0x7a,0x7a,
0x79,0x79,0x79,0x78,0x78,0x77,0x77,0x77,
0x77,0x76,0x76,0x75,0x75,0x75,0x75,0x74,
0x74,0x74,0x73,0x73,0x73,0x72,0x72,0x72,
0x72,0x71,0x71,0x71,0x70,0x70,0x70,0x6f,
0x6f,0x6f,0x6f,0x6e,0x6e,0x6e,0x6e,0x6e,
0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6c,0x6c,
0x6c,0x6b,0x6b,0x6b,0x6b,0x6b,0x6a,0x6a,
0x6a,0x6a,0x6a,0x6a,0x6a,0x69,0x69,0x69,
0x69,0x69,0x69,0x69,0x69,0x68,0x68,0x68,
0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,
0x68,0x67,0x67,0x67,0x67,0x67,0x67,0x67,
0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,
0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,
0x67,0x67,0x67,0x67,0x68,0x68,0x68,0x68,
0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,
0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,
0x69,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,
0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,
0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,
0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6f,0x6f,
0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x71,
0x71,0x71,0x71,0x72,0x72,0x72,0x72,0x73,
0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x74,
0x75,0x75,0x75,0x76,0x76,0x76,0x76,0x77,
0x77,0x77,0x77,0x77,0x78,0x78,0x79,0x79,
0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7a,0x7b,
0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,
0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f,
0x7f,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x82,
0x82,0x82,0x83,0x83,0x83,0x83,0x84,0x84,
0x84,0x84,0x84,0x85,0x85,0x85,0x86,0x86,
0x86,0x86,0x87,0x87,0x87,0x87,0x87,0x88,
0x88,0x88,0x88,0x88,0x89,0x89,0x89,0x89,
0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,
0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,
0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,
0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,
0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,
0x92,0x91,0x92,0x92,0x92,0x92,0x92,0x92,
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,
0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
0x90,0x90,0x90,0x90,0x8f,0x8f,0x8f,0x8f,
0x8f,0x8f,0x8f,0x8f,0x8f,0x8e,0x8e,0x8e,
0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8d,0x8d,
0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8c,
0x8c,0x8c,0x8c,0x8c,0x8c,0x8c,0x8b,0x8b,
0x8b,0x8b,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,
0x8a,0x8a,0x8a,0x8a,0x89,0x89,0x89,0x89,
0x89,0x89,0x88,0x88,0x88,0x88,0x88,0x88,
0x88,0x87,0x87,0x87,0x87,0x87,0x86,0x86,
0x86,0x86,0x86,0x86,0x86,0x86,0x85,0x85,
0x85,0x85,0x85,0x84,0x84,0x84,0x84,0x84,
0x84,0x84,0x84,0x83,0x83,0x83,0x83,0x83,
0x83,0x82,0x82,0x82,0x82,0x82,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,
0x7f,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7d,
0x7e,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,
0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,
0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,
0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7d,
0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,
0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,
0x7f,0x7f,0x80,0x80,0x80,0x80,0x80,0x80,
};

View file

@ -1,16 +0,0 @@
typedef struct
{
LPSTR LeftVolumeName;
LPSTR RightVolumeName;
ULONG DefaultVolume;
ULONG Type;
ULONG DeviceType;
char Key[4];
LPSTR PrototypeName;
PVOID DeferredRoutine;
PVOID ExclusionRoutine;
PVOID DispatchRoutine;
PVOID DevCapsRoutine;
PVOID HwSetVolume;
ULONG IoMethod;
}SOUND_DEVICE_INIT;

View file

@ -1,50 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/dd/sound/mixer.c
* PURPOSE: Wave Mixer?
* PROGRAMMER: ?
*
* UPDATE HISTORY:
* ??/??/??: Created
* 10/23/02: Steven Edwards (Steven_Ed4153@yahoo.com)
* Minor build fixes
*/
#include "sb16.h"
#include "dsp.h"
#include "mixer.h"
unsigned char read_mixer(unsigned short base,unsigned char reg)
{
// outb(base+0x04,reg);
// return inb(base+0x05);
return 0;
}
unsigned char get_irq(SB16* sb16)
{
unsigned char irq;
irq=(read_mixer(sb16->base,MIXER_INTERRUPT_SETUP_REGISTER)&0x0f);
if(irq==1) sb16->irq=2;
if(irq==2) sb16->irq=5;
if(irq==4) sb16->irq=7;
if(irq==8) sb16->irq=10;
return 0;
}
void get_dma(SB16* sb16)
{
unsigned char hi,lo,result=read_mixer(sb16->base,MIXER_DMA_SETUP_REGISTER);
hi=result&0xE0;
lo=result&0x0B;
if(hi==0x80) sb16->dma16=7;
if(hi==0x40) sb16->dma16=6;
if(hi==0x20) sb16->dma16=5;
if(lo==0x08) sb16->dma8=3;
if(lo==0x02) sb16->dma8=1;
if(lo==0x01) sb16->dma8=0;
}

View file

@ -1,8 +0,0 @@
#define MIXER_INTERRUPT_SETUP_REGISTER 0x80
#define MIXER_DMA_SETUP_REGISTER 0x81
#define MIXER_INTERRUP_STATUS_REGISTEER 0x82
void get_dma(SB16* sb16);
unsigned char read_mixer(unsigned short base,unsigned char reg);
unsigned char get_irq(SB16* sb16);

View file

@ -1,61 +0,0 @@
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/sound/sb16.c
* PURPOSE: SB16 device driver
* PROGRAMMER: Steven Edwards
* UPDATE HISTORY:
* 19/01/04 Created
*
*/
/* INCLUDES ****************************************************************/
#include <ntddk.h>
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath);
#define NDEBUG
#include <debug.h>
NTSTATUS STDCALL
DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
PDEVICE_OBJECT DeviceObject;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\SNDBLST");
UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\??\\SNDBLST");
NTSTATUS Status;
DPRINT1("Sound Blaster 16 Driver 0.0.1\n");
DriverObject->Flags = 0;
Status = IoCreateDevice(DriverObject,
0,
&DeviceName,
FILE_DEVICE_BEEP,
0,
FALSE,
&DeviceObject);
if (!NT_SUCCESS(Status))
return Status;
/* Create the dos device link */
IoCreateSymbolicLink(&SymlinkName,
&DeviceName);
return(STATUS_SUCCESS);
}
/* EOF */

View file

@ -1,9 +0,0 @@
typedef struct
{
unsigned short base;
unsigned char irq;
unsigned char dma8;
unsigned char dma16;
unsigned char* buffer;
}SB16;

View file

@ -1,7 +0,0 @@
/* $Id$ */
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "SB16 driver\0"
#define REACTOS_STR_INTERNAL_NAME "sb16\0"
#define REACTOS_STR_ORIGINAL_FILENAME "sb16.sys\0"
#include <reactos/version.rc>

View file

@ -1,5 +0,0 @@
#if 0
void write_wave()
{
}
#endif

View file

@ -1,120 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: mkernel/modules/sound/sound.c
* PURPOSE: SoundBlaster 16 Driver
* PROGRAMMER: Snatched from David Welch (welch@mcmail.com)
* Modified for Soundblaster by Robert Bergkvist (fragdance@hotmail.com)
* UPDATE HISTORY:
* ??/??/??: Created
*
*/
/* FUNCTIONS **************************************************************/
#include <ntddk.h>
#include <string.h>
#include <devices.h>
#include "sb16.h"
#include "dsp.h"
#include "mixer.h"
#include "wave.h"
#define NDEBUG
#include <debug.h>
SB16 sb16;
sb_status sb16_getenvironment(void);
#if 0
static NTSTATUS STDCALL Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
switch (Stack->MajorFunction)
{
case IRP_MJ_CREATE:
DPRINT1("(SoundBlaster 16 Driver WaveOut) Creating\n");
reset_dsp(sb16.base);
status = STATUS_SUCCESS;
break;
case IRP_MJ_CLOSE:
status = STATUS_SUCCESS;
break;
case IRP_MJ_WRITE:
DPRINT1("(SoundBlaster 16 Driver) Writing %d bytes\n",Stack->Parameters.Write.Length);
sb16_play((WAVE_HDR*)Irp->UserBuffer);
status = STATUS_SUCCESS;
break;
default:
status = STATUS_NOT_IMPLEMENTED;
break;
}
Irp->IoStatus.Status = status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return(status);
}
NTSTATUS ModuleEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
#if 0
PDEVICE_OBJECT DeviceObject;
NTSTATUS ret;
DPRINT1("SoundBlaster 16 Driver 0.0.1\n");
if(sb16_getenvironment()!=SB_TRUE)
{
DPRINT1("Soundblaster 16 not found\n");
return 0;
}
ret = IoCreateDevice(DriverObject,0,L"\\Device\\WaveOut",FILE_DEVICE_WAVE_OUT,0,FALSE,&DeviceObject);
if (ret!=STATUS_SUCCESS)
return(ret);
DeviceObject->Flags=0;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_CREATE] =Dispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
DriverObject->DriverUnload = NULL;
#endif
return(STATUS_SUCCESS);
}
#endif
sb_status sb16_getenvironment(void)
{
if(detect_dsp(&sb16)!=SB_TRUE)
{
DPRINT1("Detect DSP failed!!!\n");
return SB_FALSE;
}
DPRINT1("DSP base address 0x%x\n",sb16.base);
get_irq(&sb16);
DPRINT1("IRQ: %d\n",sb16.irq);
get_dma(&sb16);
DPRINT1("DMA8: 0x%x DMA16: 0x%x\n",sb16.dma8,sb16.dma16);
return SB_TRUE;
}

View file

@ -1,13 +0,0 @@
<module name="sound" type="kernelmodedriver">
<define name="__USE_W32API" />
<library>ntoskrnl</library>
<library>hal</library>
<include base="sound">.\include</include>
<file>dsp.c</file>
<file>mixer.c</file>
<file>sb16.c</file>
<file>sb_waveout.c</file>
<file>sound.c</file>
<file>wave.c</file>
<file>sb16.rc</file>
</module>

View file

@ -1,151 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: mkernel/modules/sound/sound.c
* PURPOSE: SoundBlaster 16 Driver
* PROGRAMMER: Snatched from David Welch (welch@mcmail.com)
* Modified for Soundblaster by Robert Bergkvist (fragdance@hotmail.com)
* UPDATE HISTORY:
* ??/??/??: Created
*
*/
/* FUNCTIONS **************************************************************/
#include <ntddk.h>
#include <string.h>
#include <devices.h>
#include "sb16.h"
#include "dsp.h"
#include "mixer.h"
#include "in.h"
#include "wave.h"
#define NDEBUG
#include <debug.h>
SB16 sb16;
ULONG OldIRQ;
PKINTERRUPT IrqObject;
static BOOLEAN STDCALL DMAOutputISR(PKINTERRUPT Interrupt, PVOID ServiceContext)
{
DPRINT1("interrupt\n");
return FALSE;
}
void sb16_play(WAVE_HDR* wave)
{
ULONG MappedIrq;
KIRQL Dirql;
KAFFINITY Affinity;
PKINTERRUPT IrqObject;
unsigned int newmask;
unsigned int i;
unsigned int tmp[255];
i=0;
dump_wav(wave);
do
{
// tmp[i++]=get_dma_page(0x0fffff);
// DPRINT1("0x%x ",tmp[i-1]);
}
while((tmp[i-1]&0xffff)!=0);
// free_page((tmp[0]),i-1);
sb16.buffer=((unsigned char*)tmp[i-1]);
/*
* Because this is used by alomost every subsystem including irqs it
* must be atomic. The following code sequence disables interrupts after
* saving the previous state of the interrupt flag
*/
_disable();
memcpy(sb16.buffer,(&wave->data),wave->dLen);
MappedIrq = HalGetInterruptVector(Internal,0,0,8+sb16.irq,&Dirql,&Affinity);
IoConnectInterrupt(&IrqObject,DMAOutputISR,0,NULL,MappedIrq,Dirql,Dirql,0,FALSE,Affinity,FALSE);
// mask=inb(0x21);
newmask=((int)1<<sb16.irq);
// outb(0x21,(mask&~newmask));
// Restore the interrupt flag
_enable();
// disable_dma(sb16.dma8);
//outb(0x0a,5);
// clear_dma_ff(1);
//outb(0xc,0);
// set_dma_count(1,wave->dLen);
//set_dma_mode(1,DMA_MODE_WRITE);
//outb(0xb,0x49);
//outb(0x3,(wave->dLen)&0xff);
//outb(0x3,((unsigned int)(wave->dLen)>>8)&0xff);
//set_dma_addr(sb16.dma8,(unsigned int)sb16.buffer);
//outb(0x83,(((unsigned int)(sb16.buffer-IDMAP_BASE)>>16))&0xf);
//outb(0x2,((unsigned int)sb16.buffer&0xff));
//outb(0x2,(((unsigned int)(sb16.buffer-IDMAP_BASE)>>8))&0xff);
//enable_dma(sb16.dma8);
//outb(0xa,1);
write_dsp(sb16.base,0x00D1);
write_dsp(sb16.base,0x40);
write_dsp(sb16.base,((unsigned char)256-(1000000/wave->nSamplesPerSec)));
// outb(sb16.base + 4, (int) 0xa);
// outb(sb16.base + 5, (int) 0x00);
// outb(sb16.base + 4, (int) 4);
// outb(sb16.base + 5, (int) 0xFF);
// outb(sb16.base + 4, (int) 0x22);
// outb(sb16.base + 5, (int) 0xFF);
write_dsp(sb16.base,0x14);
write_dsp(sb16.base,(wave->dLen&0x00ff));
write_dsp(sb16.base,((wave->dLen)&0xff00)>>8);
// write_dsp(sb16.base,0xc0);
// write_dsp(sb16.base,0x0);
// OldIRQ=HalGetInterruptVector(Internal,0,0,irq+8,&irql,&affinity);
// DPRINT1("OldIRQ: 0x%x\n",OldIRQ);
// status=IoConnectInterrupt(&IrqObject,playRoutine,0,NULL,OldIRQ,irql,irql,0,FALSE,affinity,FALSE);
// if(status!=STATUS_SUCCESS) DPRINT1("Couldn't set irq\n");
// else DPRINT1("IRQ set\n");
}
void dump_wav(WAVE_HDR* wave)
{
DPRINT1("wave.rID: %c%c%c%c\n",wave->rID[0],wave->rID[1],wave->rID[2],wave->rID[3]);
DPRINT1("wave.rLen: 0x%x\n",wave->rLen);
DPRINT1("wave.wID: %c%c%c%c\n",wave->wID[0],wave->wID[1],wave->wID[2],wave->wID[3]);
DPRINT1("wave.fID: %c%c%c%c\n",wave->fID[0],wave->fID[1],wave->fID[2],wave->fID[3]);
DPRINT1("wave.fLen: 0x%x\n",wave->fLen);
DPRINT1("wave.wFormatTag: 0x%x\n",wave->wFormatTag);
DPRINT1("wave.nChannels: 0x%x\n",wave->nChannels);
DPRINT1("wave.nSamplesPerSec: 0x%x\n",wave->nSamplesPerSec);
DPRINT1("wave.nAvgBytesPerSec: 0x%x\n",wave->nAvgBytesPerSec);
DPRINT1("wave.nBlockAlign: 0x%x\n",wave->nBlockAlign);
DPRINT1("wave.FormatSpecific: 0x%x\n",wave->FormatSpecific);
DPRINT1("wave.dID: %c%c%c%c\n",wave->dID[0],wave->dID[1],wave->dID[2],wave->dID[3]);
DPRINT1("wave.dLen: 0x%x\n",wave->dLen);
}
BOOLEAN playRoutine(PKINTERRUPT Interrupt,PVOID ServiceContext)
{
return FALSE;
}

View file

@ -1,26 +0,0 @@
KIRQL irql;
KAFFINITY affinity;
#include <pshpack1.h>
typedef struct
{
unsigned char rID[4] ; //4 0
unsigned int rLen ; //4 4
unsigned char wID[4] ; //4 8
unsigned char fID[4] ; //4 12
unsigned int fLen ; //4 16
unsigned short wFormatTag ; //2 18
unsigned short nChannels ; //2 20
unsigned int nSamplesPerSec ; //2 22
unsigned int nAvgBytesPerSec ; //2 24
unsigned short nBlockAlign ; //2 26
unsigned short FormatSpecific ; //2 28
unsigned char dID[4] ; //4 30
unsigned int dLen ;
unsigned char* data;
}WAVE_HDR;
#include <poppack.h>
void sb16_play(WAVE_HDR* wave);
void dump_wav(WAVE_HDR* wave);
BOOLEAN playRoutine(PKINTERRUPT Interrupt,PVOID ServiceContext);

View file

@ -1,8 +0,0 @@
<module name="avtest" type="kernelmodedriver" installbase="system32/drivers" installname="avtest.sys" warnings="true">
<include base="avtest">.</include>
<include base="avtest">..</include>
<define name="__USE_W32API" />
<library>ks</library>
<library>ntoskrnl</library>
<file>entry.c</file>
</module>

View file

@ -1,83 +0,0 @@
#include <debug.h>
#include <ks.h>
/* Where do we go? */
#ifndef SIZEOF_ARRAY
#define SIZEOF_ARRAY(array) \
(sizeof(array) / sizeof(array[0]))
#endif
/* Not in the DDK but hey! */
#define DEFINE_KSFILTER_DISPATCH(name) \
const KSFILTER_DISPATCH name =
/* To be put in KS.H */
#define DEFINE_KSFILTER_DESCRIPTOR(name) \
const KSFILTER_DESCRIPTOR name =
#define DEFINE_KSFILTER_DESCRIPTOR_TABLE(name) \
const KSFILTER_DESCRIPTOR* const name[] =
NTSTATUS FilterCreate(
IN OUT PKSFILTER Filter,
IN PIRP Irp)
{
return STATUS_SUCCESS;
}
NTSTATUS FilterClose(
IN OUT PKSFILTER Filter,
IN PIRP Irp)
{
return STATUS_SUCCESS;
}
NTSTATUS Process(
IN PKSFILTER Filter,
IN PKSPROCESSPIN_INDEXENTRY ProcessPinsIndex)
{
return STATUS_SUCCESS;
}
DEFINE_KSFILTER_DISPATCH(FilterDispatch)
{
FilterCreate,
FilterClose,
Process,
NULL // Reset
};
DEFINE_KSFILTER_DESCRIPTOR(FilterDesc)
{
};
DEFINE_KSFILTER_DESCRIPTOR_TABLE(FilterDescs)
{
&FilterDesc
};
const KSDEVICE_DESCRIPTOR DeviceDescriptor =
{
NULL,
SIZEOF_ARRAY(FilterDescs),
FilterDescs
};
/* Funcs */
NTSTATUS STDCALL
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPathName)
{
DPRINT1("AVStream test component loaded!\n");
return KsInitializeDriver(DriverObject, RegistryPathName,
&DeviceDescriptor);
}

View file

@ -11,6 +11,7 @@
<!--directory name="wdmaud">
<xi:include href="wdmaud/wdmaud.rbuild" />
</directory-->
<directory name="ks">
<xi:include href="ks/ks.rbuild" />
</directory>
@ -19,6 +20,10 @@
<xi:include href="portcls/portcls.rbuild" />
</directory>
<directory name="drmk">
<xi:include href="drmk/drmk.rbuild" />
</directory>
<!--<directory name="avtest">
<xi:include href="avtest/avtest.rbuild" />
</directory-->

View file

@ -0,0 +1,12 @@
;
; Exports definition file for drmk.sys
;
EXPORTS
DrmAddContentHandlers@12
DrmCreateContentMixed@12
DrmDestroyContent@4
DrmForwardContentToDeviceObject@12
DrmForwardContentToFileObject@8
DrmForwardContentToInterface@12
DrmGetContentRights@8

View file

@ -0,0 +1,11 @@
<module name="drmk" type="exportdriver" installbase="system32/drivers" installname="drmk.sys" allowwarnings="true">
<include base="drmk">.</include>
<include base="drmk">..</include>
<include base="drmk">../include</include>
<importlibrary definition="drmk.def" />
<library>ntoskrnl</library>
<define name="__USE_W32API" />
<define name="BUILDING_DRMK" />
<file>drmk.rc</file>
<file>stubs.c</file>
</module>

View file

@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Digital Rights Management\0"
#define REACTOS_STR_INTERNAL_NAME "drmk\0"
#define REACTOS_STR_ORIGINAL_FILENAME "drmk.sys\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,131 @@
/*
ReactOS Kernel Streaming
Digital Rights Management
Please see COPYING in the top-level directory for license information.
Author: Andrew Greenwood
Notes:
This is just a file containing stub functions. The DRMK kernel library
deals with Digital Rights Management. This is not essential for the
operation of audio/video (except in the cases where content has digital
rights information) but is needed for linking with PORTCLS.
*/
#include <drmk.h>
/*
Provide a driver interface consisting of functions for handling DRM
protected content
*/
/*
* @unimplemented
*/
NTAPI NTSTATUS
DrmAddContentHandlers(
IN ULONG ContentId,
IN PVOID *paHandlers,
IN ULONG NumHandlers)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
Creates a DRM content ID to identify a KS audio stream containing
mixed content from several input streams.
*/
/*
* @unimplemented
*/
NTAPI NTSTATUS
DrmCreateContentMixed(
IN PULONG paContentId,
IN ULONG cContentId,
OUT PULONG pMixedContentId)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
Deletes a DRM content ID.
*/
/*
* @unimplemented
*/
NTAPI NTSTATUS
DrmDestroyContent(
IN ULONG ContentId)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
Authenticates a driver, then passes it the DRM content ID, along with
the content rights which have been assigned to a stream.
*/
/*
* @unimplemented
*/
NTAPI NTSTATUS
DrmForwardContentToDeviceObject(
IN ULONG ContentId,
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
Obsolete because it forces the system to run at a lower DRM security
level. Returns STATUS_NOT_IMPLEMENTED if a pin associated with
FileObject doesnt support the rights assigned to ContentId.
*/
/*
* @unimplemented
*/
NTAPI NTSTATUS
DrmForwardContentToFileObject(
IN ULONG ContentId,
IN PFILE_OBJECT FileObject)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
Similar to DrmForwardContentToDeviceObject, except this works with a driver
object rather than just a driver.
*/
/*
* @unimplemented
*/
NTAPI NTSTATUS
DrmForwardContentToInterface(
IN ULONG ContentId,
IN PUNKNOWN pUnknown,
IN ULONG NumMethods)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
Retrieves DRM Content rights that have been assigend to a DRM Content ID.
*/
/*
* @unimplemented
*/
NTAPI NTSTATUS
DrmGetContentRights(
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}

View file

@ -1,73 +0,0 @@
/*
ReactOS Kernel Streaming
Digital Rights Management
Author: Andrew Greenwood
*/
#ifndef DRMK_H
#define DRMK_H
#include <haxor.h>
typedef struct
{
DWORD Flags;
PDEVICE_OBJECT DeviceObject;
PFILE_OBJECT FileObject;
PVOID Context;
} DRMFORWARD, *PDRMFORWARD, *PCDRMFORWARD;
typedef struct
{
BOOL CopyProtect;
ULONG Reserved;
BOOL DigitalOutputDisable;
} DRMRIGHTS, *PDRMRIGHTS;
/* ===============================================================
Digital Rights Management Functions
TODO: Check calling convention
*/
NTSTATUS
DrmAddContentHandlers(
IN ULONG ContentId,
IN PVOID *paHandlers,
IN ULONG NumHandlers);
NTSTATUS
DrmCreateContentMixed(
IN PULONG paContentId,
IN ULONG cContentId,
OUT PULONG pMixedContentId);
NTSTATUS
DrmDestroyContent(
IN ULONG ContentId);
NTSTATUS
DrmForwardContentToDeviceObject(
IN ULONG ContentId,
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward);
NTSTATUS
DrmForwardContentToFileObject(
IN ULONG ContentId,
IN PFILE_OBJECT FileObject);
NTSTATUS
DrmForwardContentToInterface(
IN ULONG ContentId,
IN PUNKNOWN pUnknown,
IN ULONG NumMethods);
NTSTATUS
DrmGetContentRights(
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,597 +0,0 @@
/*
ReactOS Kernel Streaming
Port Class
Andrew Greenwood
NOTE: Obsolete macros are not implemented. For more info:
http://www.osronline.com/ddkx/stream/audpc-struct_167n.htm
== EXPORTS ==
DRM:
* PcAddContentHandlers
* PcCreateContentMixed
* PcDestroyContent
* PcForwardContentToDeviceObject
* PcForwardContentToFileObject
* PcForwardContentToInterface
* PcGetContentRights
IRP HANDLING:
* PcCompleteIrp
* PcDispatchIrp
* PcForwardIrpSynchronous
ADAPTER:
* PcAddAdapterDevice
* PcInitializeAdapterDriver
FACTORIES:
* PcNewDmaChannel
* PcNewInterruptSync
* PcNewMiniport
* PcNewPort
* PcNewRegistryKey
* PcNewResourceList
* PcNewResourceSublist
* PcNewServiceGroup
POWER MANAGEMENT:
* PcRegisterAdapterPowerManagement
* PcRequestNewPowerState
PROPERTIES:
* PcCompletePendingPropertyRequest
* PcGetDeviceProperty
IO TIMEOUTS:
* PcRegisterIoTimeout
* PcUnregisterIoTimeout
PHYSICAL CONNECTIONS:
* PcRegisterPhysicalConnection
* PcRegisterPhysicalConnectionFromExternal
* PcRegisterPhysicalConnectionToExternal
MISC:
* PcGetTimeInterval
* PcRegisterSubdevice
== INTERFACES ==
IDmaChannel
IDmaChannelSlave
IDmaOperations
IDrmPort
IDrmPort2
IInterruptSync
IMasterClock
IPortClsVersion
IPortEvents
IPreFetchOffset
IRegistryKey
IResourceList
IServiceGroup
IServiceSink
== AUDIO PORT OBJECT INTERFACES ==
IPort
IPortDMus
IPortMidi
IPortTopology
IPortWaveCyclic
IPortWavePci
== AUDIO MINIPORT OBJECT INTERFACES ==
IMiniport
IMiniportDMus
IMiniportMidi
IMiniportTopology
IMiniportWaveCyclic
IMiniportWavePci
== AUDIO MINIPORT AUXILIARY INTERFACES ==
IMusicTechnology
IPinCount
== AUDIO STREAM OBJECT INTERFACES ==
IAllocatorMXF
IDrmAudioStream
IMiniportMidiStream
IMiniportWaveCyclicStream
IMiniportWavePciStream
IMXF
IPortWavePciStream
ISynthSinkDMus
== DIRECTMUSIC USERMODE SYNTH AND SYNTH SINK INTERFACES ==
IDirectMusicSynth
IDirectMusicSynthSink
== AUDIO POWER MANAGEMENT INTERFACES ==
IAdapterPowerManagement
IPowerNotify
*/
#ifndef PORTCLS_H
#define PORTCLS_H
#include <haxor.h>
#include <ks.h>
#include <drmk.h>
/* TODO */
#define PORTCLASSAPI
const ULONG PCFILTER_NODE = ((ULONG) -1);
/* ===============================================================
Class IDs - TODO
*/
//#define CLSID_PortDMus /* dmusicks.h */
#define CLSID_PortMidi
#define CLSID_PortTopology
#define CLSID_PortWaveCyclic
#define CLSID_PortWavePci
/* first 2 are dmusicks.h */
#define CLSID_MiniportDriverDMusUART
#define CLSID_MiniportDriverDMusUARTCapture
#define CLSID_MiniportDriverFmSynth
#define CLSID_MiniportDriverFmSynthWithVol
#define CLSID_MiniportDriverUart
/* ===============================================================
Property Item Flags - TODO
*/
#define PCPROPERTY_ITEM_FLAG_GET
#define PCPROPERTY_ITEM_FLAG_SET
#define PCPROPERTY_ITEM_FLAG_DEFAULTVALUES
#define PCPROPERTY_ITEM_FLAG_BASICSUPPORT
#define PCPROPERTY_ITEM_FLAG_SERIALIZESIZE
#define PCPROPERTY_ITEM_FLAG_SERIALIZERAW
#define PCPROPERTY_ITEM_FLAG_UNSERIALIZERAW
#define PCPROPERTY_ITEM_FLAG_SERIALIZE
/* ===============================================================
Event Item Flags - TODO
*/
#define PCEVENT_ITEM_FLAG_ENABLE
#define PCEVENT_ITEM_FLAG_ONESHOT
#define PCEVENT_ITEM_FLAG_BASICSUPPORT
/* ===============================================================
Event Verbs - TODO
*/
#define PCEVENT_VERB_ADD
#define PCEVENT_VERB_REMOVE
#define PCEVENT_VERB_SUPPORT
#define PCEVENT_VERB_NONE
/* ===============================================================
Method Item Flags - TODO
*/
#define PCMETHOD_ITEM_FLAG_MODIFY
#define PCMETHOD_ITEM_FLAG_NONE
#define PCMETHOD_ITEM_FLAG_READ
#define PCMETHOD_ITEM_FLAG_SOURCE
#define PCMETHOD_ITEM_FLAG_WRITE
/* ===============================================================
Method Verbs - TODO
*/
#define PCMETHOD_ITEM_FLAG_BASICSUPPORT
#define PCMETHOD_ITEM_FLAG_SEND
#define PCMETHOD_ITEM_FLAG_SETSUPPORT
/* ===============================================================
Callback Functions
*/
struct _PCPROPERTY_REQUEST;
typedef NTSTATUS (*PCPFNPROPERTY_HANDLER)(
IN struct _PCPROPERTY_REQUEST* PropertyRequest);
typedef struct _PCPROPERTY_ITEM
{
const GUID* Set;
ULONG Id;
ULONG Flags;
PCPFNPROPERTY_HANDLER Handler;
} PCPROPERTY_ITEM, *PPCPROPERTY_ITEM;
typedef struct _PCPROPERTY_REQUEST
{
PUNKNOWN MajorTarget;
PUNKNOWN MinorTarget;
ULONG Node;
const PCPROPERTY_ITEM* PropertyItem;
ULONG Verb;
ULONG InstanceSize;
PVOID Instance;
ULONG ValueSize;
PVOID Value;
PIRP Irp;
} PCPROPERTY_REQUEST, *PPCPROPERTY_REQUEST;
struct _PCEVENT_REQUEST;
typedef NTSTATUS (*PCPFNEVENT_HANDLER)(
IN struct _PCEVENT_REQUEST* EventRequest);
typedef struct _PCEVENT_ITEM
{
const GUID* Set;
ULONG Id;
ULONG Flags;
PCPFNEVENT_HANDLER Handler;
} PCEVENT_ITEM, *PPCEVENT_ITEM;
typedef struct _PCEVENT_REQUEST
{
PUNKNOWN MajorTarget;
PUNKNOWN MinorTarget;
ULONG Node;
const PCEVENT_ITEM* EventItem;
PKSEVENT_ENTRY EventEntry;
ULONG Verb;
PIRP Irp;
} PCEVENT_REQUEST, *PPCEVENT_REQUEST;
struct _PCMETHOD_REQUEST;
typedef NTSTATUS (*PCPFNMETHOD_HANDLER)(
IN struct _PCMETHOD_REQUEST* MethodRequest);
typedef struct _PCMETHOD_ITEM
{
const GUID* Set;
ULONG Id;
ULONG Flags;
PCPFNMETHOD_HANDLER Handler;
} PCMETHOD_ITEM, *PPCMETHOD_ITEM;
typedef struct _PCMETHOD_REQUEST
{
PUNKNOWN MajorTarget;
PUNKNOWN MinorTarget;
ULONG Node;
const PCMETHOD_ITEM* MethodItem;
ULONG Verb;
} PCMETHOD_REQUEST, *PPCMETHOD_REQUEST;
/* ===============================================================
Structures (unsorted)
*/
typedef struct
{
ULONG PropertyItemSize;
ULONG PropertyCount;
const PCPROPERTY_ITEM* Properties;
ULONG MethodItemSize;
ULONG MethodCount;
const PCMETHOD_ITEM* Methods;
ULONG EventItemSize;
ULONG EventCount;
const PCEVENT_ITEM* Events;
ULONG Reserved;
} PCAUTOMATION_TABLE, *PPCAUTOMATION_TABLE;
typedef struct
{
ULONG FromNode;
ULONG FromNodePin;
ULONG ToNode;
ULONG ToNodePin;
} PCCONNECTION_DESCRIPTOR, *PPCCONNECTIONDESCRIPTOR;
typedef struct
{
ULONG MaxGlobalInstanceCount;
ULONG MaxFilterInstanceCount;
ULONG MinFilterInstanceCount;
const PCAUTOMATION_TABLE* AutomationTable;
KSPIN_DESCRIPTOR KsPinDescriptor;
} PCPIN_DESCRIPTOR, *PPCPIN_DESCRIPTOR;
typedef struct
{
ULONG Flags;
const PCAUTOMATION_TABLE* AutomationTable;
const GUID* Type;
const GUID* Name;
} PCNODE_DESCRIPTOR, *PPCNODE_DESCRIPTOR;
typedef struct
{
ULONG Version;
const PCAUTOMATION_TABLE* AutomationTable;
ULONG PinSize;
ULONG PinCount;
const PCPIN_DESCRIPTOR* Pins;
ULONG NodeSize;
ULONG NodeCount;
const PCNODE_DESCRIPTOR* Nodes;
ULONG ConnectionCount;
const PCCONNECTION_DESCRIPTOR* Connections;
ULONG CategoryCount;
const GUID* Categories;
} PCFILTER_DESCRIPTOR, *PPCFILTER_DESCRIPTOR;
/* ===============================================================
IPort Interface
*/
typedef struct
{
/* TODO */
} IPort;
/* ===============================================================
PortCls API Functions
*/
typedef NTSTATUS (*PCPFNSTARTDEVICE)(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PRESOURCELIST ResourceList);
/* This should be in NTDDK.H */
typedef NTSTATUS (*PDRIVER_ADD_DEVICE)(
IN struct _DRIVER_OBJECT* DriverObject,
IN struct _DEVICE_OBJECT* PhysicalDeviceObject);
PORTCLASSAPI NTSTATUS NTAPI
PcAddAdapterDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PCPFNSTARTDEVICE StartDevice,
IN ULONG MaxObjects,
IN ULONG DeviceExtensionSize);
PORTCLASSAPI NTSTATUS NTAPI
PcInitializeAdapterDriver(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPathName,
IN PDRIVER_ADD_DEVICE AddDevice);
/* ===============================================================
Factories (TODO: Move elsewhere)
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewDmaChannel(
OUT PDMACHANNEL* OutDmaChannel,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN POOL_TYPE PoolType,
IN PDEVICE_DESCRIPTION DeviceDescription,
IN PDEVICE_OBJECT DeviceObject);
PORTCLASSAPI NTSTATUS NTAPI
PcNewInterruptSync(
OUT PINTERRUPTSYNC* OUtInterruptSync,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN PRESOURCELIST ResourceList,
IN ULONG ResourceIndex,
IN INTERRUPTSYNCMODE Mode);
PORTCLASSAPI NTSTATUS NTAPI
PcNewMiniport(
OUT PMINIPORT* OutMiniport,
IN REFCLSID ClassId);
PORTCLASSAPI NTSTATUS NTAPI
PcNewPort(
OUT PPORT* OutPort,
IN REFCLSID ClassId);
PORTCLASSAPI NTSTATUS NTAPI
PcNewRegistryKey(
OUT PREGISTRYKEY* OutRegistryKey,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN ULONG RegistryKeyType,
IN ACCESS_MASK DesiredAccess,
IN PVOID DeviceObject OPTIONAL,
IN PVOID SubDevice OPTIONAL,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG CreateOptions OPTIONAL,
OUT PULONG Disposition OPTIONAL);
PORTCLASSAPI NTSTATUS NTAPI
PcNewResourceList(
OUT PRESOURCELIST* OutResourceList,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN POOL_TYPE PoolType,
IN PCM_RESOURCE_LIST TranslatedResources,
IN PCM_RESOURCE_LIST UntranslatedResources);
PORTCLASSAPI NTSTATUS NTAPI
PcNewResourceSublist(
OUT PRESOURCELIST* OutResourceList,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN POOL_TYPE PoolType,
IN PRESOURCELIST ParentList,
IN ULONG MaximumEntries);
PORTCLASSAPI NTSTATUS NTAPI
PcNewServiceGroup(
OUT PSERVICEGROUP* OutServiceGroup,
IN PUNKNOWN OuterUnknown OPTIONAL);
/* ===============================================================
IRP Handling
*/
PORTCLASSAPI NTSTATUS NTAPI
PcDispatchirp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
PORTCLASSAPI NTSTATUS NTAPI
PcCompleteIrp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN NTSTATUS Status);
PORTCLASSAPI NTSTATUS NTAPI
PcForwardIrpSynchronous(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/* ===============================================================
Power Management
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterAdapterPowerManagement(
IN PUNKNOWN pUnknown,
IN PVOID pvContext1);
PORTCLASSAPI NTSTATUS NTAPI
IN PDEVICE_OBJECT pDeviceObject,
IN DEVICE_POWER_STATE RequestedNewState);
/* ===============================================================
Properties
*/
PORTCLASSAPI NTSTATUS NTAPI
PcGetDeviceProperty(
IN PVOID DeviceObject,
IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
IN ULONG BufferLength,
OUT PVOID PropertyBuffer,
OUT PULONG ResultLength);
PORTCLASSAPI NTSTATUS NTAPI
PcCompletePendingPropertyRequest(
IN PPCPROPERTY_REQUEST PropertyRequest,
IN NTSTATUS NtStatus);
/* ===============================================================
I/O Timeouts
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterIoTimeout(
IN PDEVICE_OBJECT pDeviceObject,
IN PIO_TIMER_ROUTINE pTimerRoutine,
IN PVOID pContext);
PORTCLASSAPI NTSTATUS NTAPI
PcUnregisterIoTimeout(
IN PDEVICE_OBJECT pDeviceObject,
IN PIO_TIMER_ROUTINE pTimerRoutine,
IN PVOID pContext);
/* ===============================================================
Physical Connections
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterPhysicalConnection(
IN PDEVICE_OBJECT DeviceObject,
IN PUNKNOWN FromUnknown,
IN ULONG FromPin,
IN PUNKNOWN ToUnknown,
IN ULONG ToPin);
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterPhysicalConnectionFromExternal(
IN PDEVICE_OBJECT DeviceObject,
IN PUNICODE_STRING FromString,
IN ULONG FromPin,
IN PUNKNOWN ToUnknown,
IN ULONG ToPin);
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterPhysicalConnectionToExternal(
IN PDEVICE_OBJECT DeviceObject,
IN PUNKNOWN FromUnknown,
IN ULONG FromPin,
IN PUNICODE_STRING ToString,
IN ULONG ToPin);
/* ===============================================================
Misc
*/
PORTCLASSAPI ULONGLONG NTAPI
PcGetTimeInterval(
IN ULONGLONG Since);
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterSubdevice(
IN PDEVICE_OBJECT DeviceObject,
IN PWCHAR Name,
IN PUNKNOWN Unknown);
/* ===============================================================
Digital Rights Management Functions
*/
PORTCLASSAPI NTSTATUS NTAPI
PcAddContentHandlers(
IN ULONG ContentId,
IN PVOID *paHandlers,
IN ULONG NumHandlers);
PORTCLASSAPI NTSTATUS NTAPI
PcCreateContentMixed(
IN PULONG paContentId,
IN ULONG cContentId,
OUT PULONG pMixedContentId);
PORTCLASSAPI NTSTATUS NTAPI
PcDestroyContent(
IN ULONG ContentId);
PORTCLASSAPI NTSTATUS NTAPI
PcForwardContentToDeviceObject(
IN ULONG ContentId,
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward);
PORTCLASSAPI NTSTATUS NTAPI
PcForwardContentToFileObject(
IN ULONG ContentId,
IN PFILE_OBJECT FileObject);
PORTCLASSAPI NTSTATUS NTAPI
PcForwardContentToInterface(
IN ULONG ContentId,
IN PUNKNOWN pUnknown,
IN ULONG NumMethods);
PORTCLASSAPI NTSTATUS NTAPI
PcGetContentRights(
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights);
#endif

View file

@ -0,0 +1,87 @@
/*
ReactOS Kernel Streaming
Port Class API: Adapter initialization
Author: Andrew Greenwood
*/
#include <portcls.h>
NTSTATUS
PcStartIo(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
/* Internal function */
return STATUS_UNSUCCESSFUL;
}
NTSTATUS
PcUnload(
IN PDRIVER_OBJECT DriverObject)
{
/* Internal function */
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcInitializeAdapterDriver(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPathName,
IN PDRIVER_ADD_DEVICE AddDevice)
{
/*
This is effectively a common DriverEntry function for PortCls drivers.
So it has similar responsibilities to a normal driver.
First 2 parameters are from DriverEntry.
Installs the supplied AddDevice routine in the driver object?s driver extension and installs the PortCls driver?s IRP handlers in the driver object itself.
*/
DriverObject->DriverExtension->AddDevice = AddDevice;
/*
TODO: (* = implement here, otherwise KS default)
IRP_MJ_CLOSE
* IRP_MJ_CREATE
IRP_MJ_DEVICE_CONTROL
IRP_MJ_FLUSH_BUFFERS
* IRP_MJ_PNP
* IRP_MJ_POWER
IRP_MJ_QUERY_SECURITY
IRP_MJ_READ
IRP_MJ_SET_SECURITY
* IRP_MJ_SYSTEM_CONTROL
IRP_MJ_WRITE
*/
UNIMPLEMENTED;
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcAddAdapterDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PCPFNSTARTDEVICE StartDevice,
IN ULONG MaxObjects,
IN ULONG DeviceExtensionSize)
{
/*
Note - after this has been called, we can
handle IRP_MN_START_DEVICE by calling StartDevice
*/
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}

View file

@ -0,0 +1,29 @@
/*
ReactOS Kernel Streaming
Port Class / Library Init and Cleanup
Author: Andrew Greenwood
Notes:
-
*/
#include <ntddk.h>
/*
* @implemented
*/
ULONG STDCALL
DllInitialize(ULONG Unknown)
{
return 0;
}
/*
* @implemented
*/
ULONG STDCALL
DllUnload(VOID)
{
return 0;
}

View file

@ -0,0 +1,73 @@
/*
ReactOS Kernel Streaming
Port Class / Digital Rights Management
Author: Andrew Greenwood
Notes:
These are convenience functions for accessing DRM facilities, as
documented here:
http://www.osronline.com/ddkx/stream/aud-prop_9f77.htm
*/
#include <portcls.h>
#include <drmk.h>
PORTCLASSAPI NTSTATUS NTAPI
PcAddContentHandlers(
IN ULONG ContentId,
IN PVOID *paHandlers,
IN ULONG NumHandlers)
{
return DrmAddContentHandlers(ContentId, paHandlers, NumHandlers);
}
PORTCLASSAPI NTSTATUS NTAPI
PcCreateContentMixed(
IN PULONG paContentId,
IN ULONG cContentId,
OUT PULONG pMixedContentId)
{
return DrmCreateContentMixed(paContentId, cContentId, pMixedContentId);
}
PORTCLASSAPI NTSTATUS NTAPI
PcDestroyContent(
IN ULONG ContentId)
{
return DrmDestroyContent(ContentId);
}
PORTCLASSAPI NTSTATUS NTAPI
PcForwardContentToDeviceObject(
IN ULONG ContentId,
IN PVOID Reserved,
IN PCDRMFORWARD DrmForward)
{
return DrmForwardContentToDeviceObject(ContentId, Reserved, DrmForward);
}
PORTCLASSAPI NTSTATUS NTAPI
PcForwardContentToFileObject(
IN ULONG ContentId,
IN PFILE_OBJECT FileObject)
{
return DrmForwardContentToFileObject(ContentId, FileObject);
}
PORTCLASSAPI NTSTATUS NTAPI
PcForwardContentToInterface(
IN ULONG ContentId,
IN PUNKNOWN pUnknown,
IN ULONG NumMethods)
{
return DrmForwardContentToInterface(ContentId, pUnknown, NumMethods);
}
PORTCLASSAPI NTSTATUS NTAPI
PcGetContentRights(
IN ULONG ContentId,
OUT PDRMRIGHTS DrmRights)
{
return DrmGetContentRights(ContentId, DrmRights);
}

View file

@ -2,21 +2,14 @@
; Exports definition file for portcls.sys
;
EXPORTS
DllInitialize@4
DllUnload@0
; Adapters (adapter.c)
PcAddAdapterDevice@20
PcAddContentHandlers@12
PcCompleteIrp@12
PcCompletePendingPropertyRequest@8
PcCreateContentMixed@12
PcDestroyContent@4
PcDispatchIrp@8
PcForwardContentToDeviceObject@12
PcForwardContentToFileObject@8
PcForwardContentToInterface@12
PcForwardIrpSynchronous@8
PcGetContentRights@8
PcGetDeviceProperty@20
PcGetTimeInterval@8
PcInitializeAdapterDriver@12
; Factories
PcNewDmaChannel@20
PcNewInterruptSync@20
PcNewMiniport@8
@ -25,12 +18,38 @@ PcNewRegistryKey@36
PcNewResourceList@20
PcNewResourceSublist@20
PcNewServiceGroup@8
PcRegisterAdapterPowerManagement@8
PcRegisterIoTimeout@12
; Digital Rights Management (drm.c)
PcAddContentHandlers@12
PcCreateContentMixed@12
PcDestroyContent@4
PcForwardContentToDeviceObject@12
PcForwardContentToFileObject@8
PcForwardContentToInterface@12
PcGetContentRights@8
; IRP Helpers
PcCompleteIrp@12
PcDispatchIrp@8
PcForwardIrpSynchronous@8
; Misc
PcGetTimeInterval@8
PcRegisterSubdevice@12
; Physical Connections
PcRegisterPhysicalConnection@20
PcRegisterPhysicalConnectionFromExternal@20
PcRegisterPhysicalConnectionToExternal@20
PcRegisterSubdevice@12
PcRequestNewPowerState@8
PcUnregisterIoTimeout@12
; Power Management
PcRegisterAdapterPowerManagement@8
PcRequestNewPowerState@8
; Properties
PcCompletePendingPropertyRequest@8
PcGetDeviceProperty@20
; Timeouts
PcRegisterIoTimeout@12
PcUnregisterIoTimeout@12

View file

@ -0,0 +1,12 @@
<module name="portcls" type="exportdriver" installbase="system32/drivers" installname="portcls.sys" allowwarnings="true">
<importlibrary definition="portcls.def" />
<define name="__USE_W32API" />
<include base="portcls">../include</include>
<library>ntoskrnl</library>
<library>drmk</library>
<file>dll.c</file>
<file>adapter.c</file>
<file>drm.c</file>
<file>stubs.c</file>
<file>portcls.rc</file>
</module>

View file

@ -0,0 +1,338 @@
/*
Port Class API
Stubbed functions
*/
#include <portcls.h>
/*
Factory Stubs
*/
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewDmaChannel(
OUT PDMACHANNEL* OutDmaChannel,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN POOL_TYPE PoolType,
IN PDEVICE_DESCRIPTION DeviceDescription,
IN PDEVICE_OBJECT DeviceObject)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewInterruptSync(
OUT PINTERRUPTSYNC* OUtInterruptSync,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN PRESOURCELIST ResourceList,
IN ULONG ResourceIndex,
IN INTERRUPTSYNCMODE Mode)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewMiniport(
OUT PMINIPORT* OutMiniport,
IN REFCLSID ClassId)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewPort(
OUT PPORT* OutPort,
IN REFCLSID ClassId)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewRegistryKey(
OUT PREGISTRYKEY* OutRegistryKey,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN ULONG RegistryKeyType,
IN ACCESS_MASK DesiredAccess,
IN PVOID DeviceObject OPTIONAL,
IN PVOID SubDevice OPTIONAL,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG CreateOptions OPTIONAL,
OUT PULONG Disposition OPTIONAL)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewResourceList(
OUT PRESOURCELIST* OutResourceList,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN POOL_TYPE PoolType,
IN PCM_RESOURCE_LIST TranslatedResources,
IN PCM_RESOURCE_LIST UntranslatedResources)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewResourceSublist(
OUT PRESOURCELIST* OutResourceList,
IN PUNKNOWN OuterUnknown OPTIONAL,
IN POOL_TYPE PoolType,
IN PRESOURCELIST ParentList,
IN ULONG MaximumEntries)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcNewServiceGroup(
OUT PSERVICEGROUP* OutServiceGroup,
IN PUNKNOWN OuterUnknown OPTIONAL)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/* ===============================================================
IRP Handling
*/
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcDispatchIrp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcCompleteIrp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN NTSTATUS Status)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcForwardIrpSynchronous(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/* ===============================================================
Power Management
*/
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterAdapterPowerManagement(
IN PUNKNOWN pUnknown,
IN PVOID pvContext1)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRequestNewPowerState(
IN PDEVICE_OBJECT pDeviceObject,
IN DEVICE_POWER_STATE RequestedNewState)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/* ===============================================================
Properties
*/
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcGetDeviceProperty(
IN PVOID DeviceObject,
IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
IN ULONG BufferLength,
OUT PVOID PropertyBuffer,
OUT PULONG ResultLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcCompletePendingPropertyRequest(
IN PPCPROPERTY_REQUEST PropertyRequest,
IN NTSTATUS NtStatus)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/* ===============================================================
I/O Timeouts
*/
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterIoTimeout(
IN PDEVICE_OBJECT pDeviceObject,
IN PIO_TIMER_ROUTINE pTimerRoutine,
IN PVOID pContext)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcUnregisterIoTimeout(
IN PDEVICE_OBJECT pDeviceObject,
IN PIO_TIMER_ROUTINE pTimerRoutine,
IN PVOID pContext)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/* ===============================================================
Physical Connections
*/
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterPhysicalConnection(
IN PDEVICE_OBJECT DeviceObject,
IN PUNKNOWN FromUnknown,
IN ULONG FromPin,
IN PUNKNOWN ToUnknown,
IN ULONG ToPin)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterPhysicalConnectionFromExternal(
IN PDEVICE_OBJECT DeviceObject,
IN PUNICODE_STRING FromString,
IN ULONG FromPin,
IN PUNKNOWN ToUnknown,
IN ULONG ToPin)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterPhysicalConnectionToExternal(
IN PDEVICE_OBJECT DeviceObject,
IN PUNKNOWN FromUnknown,
IN ULONG FromPin,
IN PUNICODE_STRING ToString,
IN ULONG ToPin)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/* ===============================================================
Misc
*/
/*
* @unimplemented
*/
PORTCLASSAPI ULONGLONG NTAPI
PcGetTimeInterval(
IN ULONGLONG Since)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/*
* @unimplemented
*/
PORTCLASSAPI NTSTATUS NTAPI
PcRegisterSubdevice(
IN PDEVICE_OBJECT DeviceObject,
IN PWCHAR Name,
IN PUNKNOWN Unknown)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}

View file

@ -1,8 +0,0 @@
<module name="portcls" type="exportdriver" installbase="system32/drivers" installname="portcls.sys">
<importlibrary definition="portcls.def" />
<define name="__USE_W32API" />
<library>ntoskrnl</library>
<library>hal</library>
<file>portcls.c</file>
<file>portcls.rc</file>
</module>

View file

@ -1,59 +0,0 @@
/*
This doesn't do much yet...
*/
#include <debug.h>
#define InPassiveIrql() \
(KeGetCurrentIrql() == IRQL_PASSIVE_LEVEL)
NTSTATUS AudioDeviceControl(
IN PDEVICE_OBJECT device,
IN PIRP irp
)
{
return STATUS_SUCCESS;
}
NTSTATUS AudioAddDevice(
IN PDRIVER_OBJECT driver,
IN PDEVICE_OBJECT device
)
{
DPRINT("AudioAddDevice called\n");
if ( ! IsPassiveIrql() )
{
/* What do we do?! */
/* RtlAssert("FAIL", __FILE__, __LINE__, "?" */
}
return STATUS_SUCCESS;
}
VOID AudioUnload(
IN PDRIVER_OBJECT driver
)
{
DPRINT("AudioUnload called\n");
}
NTSTATUS STDCALL
DriverEntry(
IN PDRIVER_OBJECT driver,
IN PUNICODE_STRING registry_path
)
{
DPRINT("Wdmaud.sys loaded\n");
driver->DriverExtension->AddDevice = AudioAddDevice;
driver->DriverUnload = AudioUnload;
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = AudioDeviceControl;
return STATUS_SUCCESS;
}

View file

@ -1,7 +0,0 @@
<module name="wdmaud_kernel" type="kernelmodedriver" installbase="system32/drivers" installname="wdmaud.sys" warnings="true">
<include base="wdmaud">.</include>
<include base="wdmaud">..</include>
<define name="__USE_W32API" />
<library>ntoskrnl</library>
<file>entry.c</file>
</module>

View file

@ -6,6 +6,7 @@
<library>ntoskrnl</library>
<define name="__USE_W32API" />
<define name="BUILDING_KS" />
<file>ks.rc</file>
<file>allocators.c</file>
<file>clocks.c</file>
<file>connectivity.c</file>

View file

@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Kernel Streaming API\0"
#define REACTOS_STR_INTERNAL_NAME "ks\0"
#define REACTOS_STR_ORIGINAL_FILENAME "ks.sys\0"
#include <reactos/version.rc>