ReactOS 0.4.15-dev-7788-g1ad9096
test.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <windows.h>
3#include <ntddk.h>
4#include "mpu401.h"
5
6int main()
7{
8// NTSTATUS s;
9// PHANDLE Handle;
10// PIO_STATUS_BLOCK Status;
12 BYTE Test[3]; // Will store MIDI data
13 BYTE Notes[] = {50, 52, 54, 55, 57, 59, 61};
15 UINT Note;
16 UINT Junk;
17
18 printf("Test program for MPU401 driver\n");
19
20 Device = CreateFile("\\\\.\\MPU401_Out_0", GENERIC_READ | GENERIC_WRITE,
22 NULL,
25 NULL);
26
28 {
29 printf("Device is busy or could not be found.\n");
30 return -1;
31 }
32
33 printf("Device is open, let's play some music...\n");
34
35 Test[0] = 0x90;
36 Test[2] = 0x7f;
37
38 for (Note = 0; Note < sizeof(Notes); Note ++)
39 {
40 Test[1] = Notes[Note];
41
43 Device,
45 &Test,
46 sizeof(Test),
47 NULL,
48 0,
50 NULL
51 );
52
53 for (Junk = 0; Junk < 100000; Junk ++); // Pause
54 }
55
56
57/* s = IoCreateFile(Handle, GENERIC_READ | GENERIC_WRITE,
58 OBJ_KERNEL_HANDLE,
59 Status,
60 0,
61 FILE_SHARE_READ | FILE_SHARE_WRITE,
62 FILE_OPEN,
63 FILE_NON_DIRECTORY_FILE,
64 NULL,
65 0,
66 CreateFileTypeNone,
67 NULL,
68 0);
69*/
70}
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define NULL
Definition: types.h:112
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define FILE_SHARE_READ
Definition: compat.h:136
int main()
Definition: test.c:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:93
#define IOCTL_MIDI_PLAY
Definition: mmdef.h:74
#define FILE_FLAG_NO_BUFFERING
Definition: disk.h:45
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
#define CreateFile
Definition: winbase.h:3684
unsigned char BYTE
Definition: xxhash.c:193