ReactOS  0.4.15-dev-4857-g47842d7
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 
6 int 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};
14  HANDLE Device;
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 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define IOCTL_MIDI_PLAY
Definition: mmdef.h:74
#define FILE_SHARE_READ
Definition: compat.h:136
_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:1039
#define GENERIC_WRITE
Definition: nt_native.h:90
int main()
Definition: test.c:6
#define OPEN_EXISTING
Definition: compat.h:634
#define printf
Definition: freeldr.h:94
#define FILE_FLAG_NO_BUFFERING
Definition: disk.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GENERIC_READ
Definition: compat.h:135
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
unsigned char BYTE
Definition: xxhash.c:193
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
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
Definition: fatprocs.h:913
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112