mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
Basic beginnings of an MPU401 driver (forgot to commit with last files)
svn path=/trunk/; revision=26102
This commit is contained in:
parent
6092d2b4b8
commit
b4da8c5ab8
4 changed files with 118 additions and 0 deletions
97
reactos/drivers/multimedia/mpu401_ks/adapter.cpp
Normal file
97
reactos/drivers/multimedia/mpu401_ks/adapter.cpp
Normal file
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
ReactOS Operating System
|
||||
MPU401 Example KS Driver
|
||||
|
||||
AUTHORS:
|
||||
Andrew Greenwood
|
||||
|
||||
NOTES:
|
||||
This is an example MPU401 driver. You can use DirectMusic instead with
|
||||
this, by changing the CLSIDs accordingly.
|
||||
*/
|
||||
|
||||
#define MAX_MINIPORTS 1
|
||||
|
||||
#define PUT_GUIDS_HERE
|
||||
|
||||
#include <portcls.h>
|
||||
|
||||
extern "C"
|
||||
NTSTATUS
|
||||
StartDevice(
|
||||
IN PDEVICE_OBJECT pDeviceObject,
|
||||
IN PIRP pIrp,
|
||||
IN PRESOURCELIST ResourceList)
|
||||
{
|
||||
if ( ! ResourceList )
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
if ( ResourceList->NumberOfEntries() == 0 )
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
PPORT port;
|
||||
PMINIPORT miniport;
|
||||
|
||||
NTSTATUS status;
|
||||
|
||||
status = PcNewPort(&port, CLSID_PortMidi);
|
||||
|
||||
if ( ! NT_SUCCESS(status) )
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
status = PcNewMiniport(&miniport, CLSID_MiniportDriverUart);
|
||||
|
||||
if ( ! NT_SUCCESS(status) )
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
status = port->Init(pDeviceObject, pIrp, miniport, NULL, ResourceList);
|
||||
|
||||
if ( ! NT_SUCCESS(status) )
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
status = PcRegisterSubdevice(pDeviceObject, L"Uart", port);
|
||||
|
||||
if ( ! NT_SUCCESS(status) )
|
||||
{
|
||||
/* just print an error here */
|
||||
}
|
||||
|
||||
miniport->Release();
|
||||
port->Release();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
NTSTATUS
|
||||
AddDevice(
|
||||
IN PVOID Context1,
|
||||
IN PVOID Context2)
|
||||
{
|
||||
return PcAddAdapterDevice((PDRIVER_OBJECT) Context1,
|
||||
(PDEVICE_OBJECT) Context2,
|
||||
StartDevice,
|
||||
MAX_MINIPORTS,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
NTSTATUS
|
||||
DriverEntry(
|
||||
IN PVOID Context1,
|
||||
IN PVOID Context2)
|
||||
{
|
||||
return PcInitializeAdapterDriver((PDRIVER_OBJECT) Context1,
|
||||
(PUNICODE_STRING) Context2,
|
||||
(PDRIVER_ADD_DEVICE) AddDevice);
|
||||
};
|
6
reactos/drivers/multimedia/mpu401_ks/mpu401.def
Normal file
6
reactos/drivers/multimedia/mpu401_ks/mpu401.def
Normal file
|
@ -0,0 +1,6 @@
|
|||
;
|
||||
; Exports definition file for mpu401_ks.sys
|
||||
;
|
||||
EXPORTS
|
||||
DriverEntry@8
|
||||
|
10
reactos/drivers/multimedia/mpu401_ks/mpu401.rbuild
Normal file
10
reactos/drivers/multimedia/mpu401_ks/mpu401.rbuild
Normal file
|
@ -0,0 +1,10 @@
|
|||
<module name="mpu401_ks" type="exportdriver" installbase="system32/drivers" installname="mpu401_ks.sys" allowwarnings="true">
|
||||
<include base="mpu401">.</include>
|
||||
<include base="mpu401">..</include>
|
||||
<importlibrary definition="mpu401.def" />
|
||||
<library>ntoskrnl</library>
|
||||
<library>portcls</library>
|
||||
<define name="__USE_W32API" />
|
||||
<file>mpu401.rc</file>
|
||||
<file>adapter.cpp</file>
|
||||
</module>
|
5
reactos/drivers/multimedia/mpu401_ks/mpu401.rc
Normal file
5
reactos/drivers/multimedia/mpu401_ks/mpu401.rc
Normal file
|
@ -0,0 +1,5 @@
|
|||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "MPU401 KS Driver\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "mpu401_ks\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "mpu401_ks.sys\0"
|
||||
#include <reactos/version.rc>
|
Loading…
Reference in a new issue