source: cmedia/trunk/Drv16/midi_idc.h@ 354

Last change on this file since 354 was 354, checked in by stevenhl, 17 years ago

Import untested baseline cmedia sources, work products and binaries
Binaries and work products should be deleted from repository.
once new builds are verified to work.

File size: 11.0 KB
Line 
1/* $Id: midi_idc.h,v 1.1 2000/04/23 14:55:17 ktk Exp $ */
2
3/* MIDI_IDC.H
4
5 MODIFICATION HISTORY
6 DATE PROGRAMMER COMMENT
7 01-Jul-95 Timur Tabi Creation
8*/
9
10#ifndef MIDI_IDC_INCLUDED
11#define MIDI_IDC_INCLUDED
12
13#ifndef OS2_INCLUDED
14#define INCL_NOPMAPI
15#include <os2.h>
16#endif
17
18#define MIDI_NAME_LENGTH 32
19
20//
21// DEFINITIONS AND PROTOTYPES FOR TYPE A REGISTRATION
22//
23
24// The capabilities flags for Type A drivers
25#define MIDICAPSA_INPUT 0x00000001 // driver supports receiving data
26#define MIDICAPSA_OUTPUT 0x00000002 // driver can send data
27#define MIDICAPSA_ALSO_DEVICE 0x00000004 // driver represents a device
28#define MIDICAPSA_USES_BRIDGE 0x00000008 // candidate node for MMPM/2 bridge
29#define MIDICAPSA_NOT_DEFAULT 0x00000010 // don't let this node be a default HW node
30#define MIDICAPSA_RUNNING_STATUS 0x00000020 // the driver/device can accpt running status
31
32// definitions used for the Open and Close commands
33#define MIDIMODE_OPEN_RECEIVE 0 // open for receiving data from MIDI.SYS
34#define MIDIMODE_OPEN_SEND 1 // open for sending data to MIDI.SYS
35
36// error codes that the PDD returns to the MIDI driver
37#define MIDIERRA_GEN_FAILURE 1 // if it's not one of the other errors
38#define MIDIERRA_NO_HARDWARE 2 // hardware just isn't there
39#define MIDIERRA_HW_FAILED 3 // hw is there, but can't be accessed
40#define MIDIERRA_CANT_GET_IRQ 4 // IRQ is unavailable
41#define MIDIERRA_CANT_GET_DMA 5 // DMA is unavailable
42#define MIDIERRA_IN_USE 6 // device is in use by something else
43
44// error codes that the MIDI driver returns to the PDD after a failed registration
45#define MIDIERRA_BAD_PARAMETER 1 // something was wrong with the MIDIREG_TYPEA structure passed
46#define MIDIERRA_NAME_EXISTS 2 // the name for this device is used by another device
47#define MIDIERRA_OUT_OF_RESOURCES 3 // The MIDI driver doesn't have enough resources
48#define MIDIERRA_INTERNAL_SYS 4 // something's really wrong with the MIDI driver
49
50typedef struct {
51 BYTE bCategory; // category code
52 BYTE bCode; // function code
53 void __far *pvParm; // address of parameter buffer
54 void __far *pvData; // address of data buffer
55 USHORT usSysFileNum; // system file number
56 USHORT usPLength; // length of parameter buffer
57 USHORT usDLength; // length of data buffer
58} IOCTL_RP, __far *PIOCTL_RP;
59
60typedef void (__far __loadds __cdecl *PFNMIDI_SENDBYTE) (ULONG ulHandle, BYTE bData);
61// called by the PDD to send 1 byte of MIDI data to the MIDI driver
62
63typedef void (__far __loadds __cdecl *PFNMIDI_SENDSTRING) (ULONG ulHandle, BYTE __far *pbData, USHORT usLength);
64// called by the PDD to send a sequence of MIDI data to the MIDI driver
65
66typedef void (__far __loadds __cdecl *PFNMIDI_DEREGISTER) (ULONG ulHandle);
67// called by the PDD to tell the MIDI driver that it's been uninstalled/removed
68// don't call this during interrupt time!
69
70
71typedef USHORT (__far __loadds __cdecl *PFNMIDI_RECVSTRING) (USHORT usDevId, BYTE __far *pbData, USHORT usLength);
72// called by the MIDI driver to send a string of data to the PDD
73// returns error code
74
75typedef USHORT (__far __loadds __cdecl *PFNMIDI_RECVBYTE) (USHORT usDevId, BYTE bData);
76// called by the MIDI driver to send a single byte to the PDD
77// returns error code
78
79typedef USHORT (__far __loadds __cdecl *PFNMIDI_OPENCLOSE) (USHORT usDevId, USHORT usMode);
80// called by the MIDI driver to open or close the PDD
81// usMode = 0 for input (sending data to MIDI driver), = 1 for output
82// returns error code
83
84typedef USHORT (__far __loadds __cdecl *PFNMIDI_IOCTL) (PIOCTL_RP);
85// called by the MIDI driver to re-route an MMPM/2 IOCtl to the PDD
86
87typedef struct {
88 USHORT usSize; // set this equal to sizeof(MIDIREG_TYPEA) before calling!
89 struct { // filled by Type A driver
90 ULONG flCapabilities; // the capabilities (MIDICAPSA_xxxx)
91 char __far *pszInstanceName; // ptr to instance name, must be a valid ASCIIZ
92 PFNMIDI_OPENCLOSE pfnOpen; // can be NULL
93 PFNMIDI_OPENCLOSE pfnClose; // can be NULL
94 PFNMIDI_RECVBYTE pfnRecvByte; // can be NULL if MIDICAPSA_INPUT is not set
95 PFNMIDI_RECVSTRING pfnRecvString; // can be NULL if MIDICAPSA_INPUT is not set
96 PFNMIDI_IOCTL pfnIOCtl; // can be NULL if MIDICAPSA_USESBRIDGE is not set
97 USHORT usDevId; // the DevID the MIDI driver should use
98 } in;
99 struct { // filled by MIDI.SYS
100 ULONG ulHandle; // device handle
101 PFNMIDI_SENDBYTE pfnSendByte;
102 PFNMIDI_SENDSTRING pfnSendString;
103 PFNMIDI_DEREGISTER pfnDeregister;
104 } out;
105} MIDIREG_TYPEA, __far *PMIDIREG_TYPEA;
106
107typedef USHORT (__far __cdecl __loadds *PFN_REGA) (PMIDIREG_TYPEA);
108// Used by the PDD to register a Type A driver with the MIDI driver.
109// returns error code
110
111//
112// DEFINITIONS AND PROTOTYPES FOR TYPE B REGISTRATION
113//
114
115// error codes that the PDD returns to the MIDI driver
116#define MIDIERRB_BAD_CONFIG_SIZE 1 // the usLength field in pfnConfig is bad
117#define MIDIERRB_BAD_CONFIG_DATA 2 // the config data format is bad
118
119// error codes that the MIDI driver returns to the PDD after a failed registration
120#define MIDIERRB_BAD_PARAMETER 1 // something was wrong with the MIDIREG_TYPEB structure passed
121#define MIDIERRB_CANT_SEND_MSG 2 // pfnSendMessage failed: scheduler queue is full
122
123#ifndef MIDI_MESSAGE_DEFINED
124
125typedef struct {
126 ULONG ulSourceNode;
127 ULONG ulTime;
128 ULONG ulTrack;
129 union {
130 ULONG ulMessage;
131 struct {
132 BYTE bStatus; // The 1st byte of the message
133 BYTE abData[3]; // the rest of the message
134 } bytes;
135 BYTE abData[4];
136 } msg;
137} MESSAGE, __far *PMESSAGE;
138
139#define MIDI_MESSAGE_DEFINED
140#endif
141
142typedef USHORT (__far __loadds __cdecl *PFNMIDIB_PROCESSMESSAGE) (
143 void __far *pvInstanceData,
144 MESSAGE __far *pmsg
145 );
146
147typedef USHORT (__far __loadds __cdecl *PFNMIDIB_CONFIGURE) (
148 void __far *pvInstanceData, // ptr to instance data
149 void __far *pvConfigData, // ptr to config data buffer
150 USHORT usLength // length of config data buffer
151 );
152
153typedef USHORT (__far __loadds __cdecl *PFNMIDIB_QUERY) (
154 void __far *pvInstanceData, // ptr to instance data
155 void __far *pvQueryBuffer, // ptr to query buffer
156 USHORT usLength // length of query buffer
157 );
158
159typedef USHORT (__far __loadds __cdecl *PFNMIDIB_INSTCREATED) (
160 void __far *pvInstanceData, // ptr to instance data
161 ULONG ulInstance // the instance number
162 );
163
164typedef void (__far __loadds __cdecl *PFNMIDIB_INSTDELETED) (
165 void __far *pvInstanceData // ptr to instance data
166 );
167
168
169typedef USHORT (__far __loadds __cdecl *PFNMIDIB_SENDMESSAGE) (
170 ULONG ulInstance, // inst # from pfnCreated
171 MESSAGE __far *pmsg, // ptr to message
172 USHORT usSlot // slot # of targets to send to
173 );
174
175typedef struct {
176 USHORT usSize; // set this equal to sizeof(MIDIREG_TYPEB) before calling!
177 struct { // filled by Type B driver
178 ULONG flCapabilities; // the capabilities (MIDICAPSB_xxxx)
179 USHORT usNumSlots; // # of slots for this class
180 USHORT usInstanceDataSize; // size of instance data for this class
181 char __far *pszClassName; // ptr to class name, must be a valid ASCIIZ
182 PFNMIDIB_CONFIGURE pfnConfigure; // called to configure instance
183 PFNMIDIB_QUERY pfnQuery; // called to obtain config info
184 PFNMIDIB_INSTCREATED pfnCreated; // called when inst is created
185 PFNMIDIB_INSTDELETED pfnDeleted; // called when inst is deleted
186 PFNMIDIB_PROCESSMESSAGE pfnProcessMessage; // called to process a message
187 } in;
188 struct { // filled by MIDI.SYS
189 ULONG ulClassNumber; // class number of this new class
190 PFNMIDIB_SENDMESSAGE pfnSendMessage; // call to send msg to all nodes on a slot
191 } out;
192} MIDIREG_TYPEB, __far *PMIDIREG_TYPEB;
193
194typedef USHORT (__far __cdecl __loadds *PFN_REGB) (PMIDIREG_TYPEB);
195// Used by the PDD to register a Type B driver with the MIDI driver.
196// returns error code
197
198//
199// DEFINITIONS AND PROTOTYPES FOR TYPE C REGISTRATION
200//
201
202// error codes that the MIDI driver returns to the PDD after a failed registration
203#define MIDIERRC_BAD_PARAMETER 1 // something was wrong with the MIDIREG_TYPEC structure passed
204
205typedef USHORT (__far __loadds __cdecl *PFNMIDIC_OPENCLOSE) (void);
206// called by the MIDI driver to open or close the PDD
207// returns error code
208
209typedef struct {
210 USHORT usSize; // set this equal to sizeof(MIDIREG_TYPEC) before calling!
211 struct { // filled by Type C driver
212 ULONG flCapabilities; // the capabilities (MIDICAPSC_xxxx)
213 char __far *pszTimesourceName; // ptr to timesource name, must be a valid ASCIIZ
214 PFNMIDIC_OPENCLOSE pfnOpen;
215 PFNMIDIC_OPENCLOSE pfnClose;
216 } in;
217 struct { // filled by MIDI.SYS
218 volatile ULONG __far *pulMIDIClock; // pointer to 32-bit MIDI timer count
219 USHORT __far *pfTimerActive; // if non-zero, then MIDI timer is running
220 } out;
221} MIDIREG_TYPEC, __far *PMIDIREG_TYPEC;
222
223typedef USHORT (__far __cdecl __loadds *PFN_REGC) (PMIDIREG_TYPEC);
224// Used by the PDD to register a Type C driver with the MIDI driver.
225// returns error code
226
227// definitions for all drivers
228
229#define MIDI_VERSION_DEV 0
230#define MIDI_VERSION_ALPHA 1
231#define MIDI_VERSION_BETA 2
232#define MIDI_VERSION_GA 3
233
234#define MIDI_DDVER_MAJOR(x) ( ((USHORT) (x)) >> 14 )
235#define MIDI_DDVER_MINOR(x) ( (((USHORT) (x)) >> 10) & 15)
236#define MIDI_DDVER_BUGFIX(x) ( (((USHORT) (x)) >> 6) & 15)
237#define MIDI_DDVER_PHASE(x) ( (((USHORT) (x)) >> 4) & 3)
238#define MIDI_DDVER_BUILD(x) ( ((USHORT) (x)) & 3)
239
240typedef struct {
241 USHORT usSize; // set this equal to sizeof(MIDI_REGISTER) before calling!
242 USHORT usVersion;
243 PFN_REGA pfnRegisterA;
244 PFN_REGB pfnRegisterB;
245 PFN_REGC pfnRegisterC;
246} MIDI_REGISTER, __far *PMIDI_REGISTER;
247
248typedef void (__far __cdecl __loadds *PFN_MIDIIDC) (PMIDI_REGISTER);
249
250typedef struct {
251 USHORT ausReserved[3]; // 3 reserved words
252 PFN_MIDIIDC pfn; // far pointer to IDC entry
253 USHORT ds; // data segment of IDC
254} MIDI_ATTACH_DD;
255
256#endif
Note: See TracBrowser for help on using the repository browser.