1 /*
2  **********************************************************************
3  *     isblive_mid.h
4  *     Copyright 1999, 2000 Creative Labs, Inc.
5  *
6  **********************************************************************
7  *
8  *     Date                 Author          Summary of changes
9  *     ----                 ------          ------------------
10  *     October 20, 1999     Bertrand Lee    base code release
11  *
12  **********************************************************************
13  *
14  *     This program is free software; you can redistribute it and/or
15  *     modify it under the terms of the GNU General Public License as
16  *     published by the Free Software Foundation; either version 2 of
17  *     the License, or (at your option) any later version.
18  *
19  *     This program is distributed in the hope that it will be useful,
20  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *     GNU General Public License for more details.
23  *
24  *     You should have received a copy of the GNU General Public
25  *     License along with this program; if not, write to the Free
26  *     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
27  *     USA.
28  *
29  **********************************************************************
30  */
31 
32 #ifndef _ICARDMIDI_H
33 #define _ICARDMIDI_H
34 
35 /* MIDI defines */
36 #define MIDI_DATA_FIRST                 0x00
37 #define MIDI_DATA_LAST                  0x7F
38 #define MIDI_STATUS_FIRST               0x80
39 #define MIDI_STATUS_LAST                0xFF
40 
41 /* Channel status bytes */
42 #define MIDI_STATUS_CHANNEL_FIRST       0x80
43 #define MIDI_STATUS_CHANNEL_LAST        0xE0
44 #define MIDI_STATUS_CHANNEL_MASK        0xF0
45 
46 /* Channel voice messages */
47 #define MIDI_VOICE_NOTE_OFF             0x80
48 #define MIDI_VOICE_NOTE_ON              0x90
49 #define MIDI_VOICE_POLY_PRESSURE        0xA0
50 #define MIDI_VOICE_CONTROL_CHANGE       0xB0
51 #define MIDI_VOICE_PROGRAM_CHANGE       0xC0
52 #define MIDI_VOICE_CHANNEL_PRESSURE     0xD0
53 #define MIDI_VOICE_PITCH_BEND           0xE0
54 
55 /* Channel mode messages */
56 #define MIDI_MODE_CHANNEL               MIDI_VOICE_CONTROL_CHANGE
57 
58 /* System status bytes */
59 #define MIDI_STATUS_SYSTEM_FIRST        0xF0
60 #define MIDI_STATUS_SYSTEM_LAST         0xFF
61 
62 /* System exclusive messages */
63 #define MIDI_SYSEX_BEGIN                0xF0
64 #define MIDI_SYSEX_EOX                  0xF7
65 
66 /* System common messages */
67 #define MIDI_COMMON_TCQF                0xF1	/* Time code quarter frame  */
68 #define MIDI_COMMON_SONG_POSITION       0xF2
69 #define MIDI_COMMON_SONG_SELECT         0xF3
70 #define MIDI_COMMON_UNDEFINED_F4        0xF4
71 #define MIDI_COMMON_UNDEFINED_F5        0xF5
72 #define MIDI_COMMON_TUNE_REQUEST        0xF6
73 
74 /* System real-time messages */
75 #define MIDI_RTIME_TIMING_CLOCK         0xF8
76 #define MIDI_RTIME_UNDEFINED_F9         0xF9
77 #define MIDI_RTIME_START                0xFA
78 #define MIDI_RTIME_CONTINUE             0xFB
79 #define MIDI_RTIME_STOP                 0xFC
80 #define MIDI_RTIME_UNDEFINED_FD         0xFD
81 #define MIDI_RTIME_ACTIVE_SENSING       0xFE
82 #define MIDI_RTIME_SYSTEM_RESET         0xFF
83 
84 /* Flags for flags parm of midiOutCachePatches(), midiOutCacheDrumPatches() */
85 #define MIDI_CACHE_ALL                  1
86 #define MIDI_CACHE_BESTFIT              2
87 #define MIDI_CACHE_QUERY                3
88 #define MIDI_UNCACHE                    4
89 
90 /* Event declarations for MPU IRQ Callbacks */
91 #define ICARDMIDI_INLONGDATA            0x00000001 /* MIM_LONGDATA */
92 #define ICARDMIDI_INLONGERROR           0x00000002 /* MIM_LONGERROR */
93 #define ICARDMIDI_OUTLONGDATA           0x00000004 /* MOM_DONE for MPU OUT buffer */
94 #define ICARDMIDI_INDATA                0x00000010 /* MIM_DATA */
95 #define ICARDMIDI_INDATAERROR           0x00000020 /* MIM_ERROR */
96 
97 /* Declaration for flags in CARDMIDIBUFFERHDR */
98 /* Make it the same as MHDR_DONE, MHDR_INQUEUE in mmsystem.h */
99 #define MIDIBUF_DONE                    0x00000001
100 #define MIDIBUF_INQUEUE                 0x00000004
101 
102 /* Declaration for msg parameter in midiCallbackFn */
103 #define ICARDMIDI_OUTBUFFEROK           0x00000001
104 #define ICARDMIDI_INMIDIOK              0x00000002
105 
106 /* Declaration for technology in struct midi_caps */
107 #define MT_MIDIPORT                     0x00000001	/* In original MIDIOUTCAPS structure */
108 #define MT_FMSYNTH                      0x00000004	/* In original MIDIOUTCAPS structure */
109 #define MT_AWESYNTH                     0x00001000
110 #define MT_PCISYNTH                     0x00002000
111 #define MT_PCISYNTH64                   0x00004000
112 #define CARDMIDI_AWEMASK                0x0000F000
113 
114 enum LocalErrorCode
115 {
116         CTSTATUS_NOTENABLED = 0x7000,
117         CTSTATUS_READY,
118         CTSTATUS_BUSY,
119         CTSTATUS_DATAAVAIL,
120         CTSTATUS_NODATA,
121         CTSTATUS_NEXT_BYTE
122 };
123 
124 /* MIDI data block header */
125 struct midi_hdr
126 {
127 	u8 *reserved;		/* Pointer to original locked data block */
128 	u32 bufferlength;	/* Length of data in data block */
129 	u32 bytesrecorded;	/* Used for input only */
130 	u32 user;		/* For client's use */
131 	u32 flags;		/* Assorted flags (see defines) */
132 	struct list_head list;	/* Reserved for driver */
133 	u8 *data;		/* Second copy of first pointer */
134 };
135 
136 /* Enumeration for SetControl */
137 enum
138 {
139 	MIDIOBJVOLUME = 0x1,
140 	MIDIQUERYACTIVEINST
141 };
142 
143 struct midi_queue
144 {
145 	struct midi_queue  *next;
146 	u32 qtype;            /* 0 = short message, 1 = long data */
147 	u32 length;
148 	u32 sizeLeft;
149 	u8 *midibyte;
150 	unsigned long refdata;
151 };
152 
153 struct midi_openinfo
154 {
155 	u32     cbsize;
156 	u32     flags;
157 	unsigned long  refdata;
158 	u32     streamid;
159 };
160 
161 int emu10k1_midi_callback(unsigned long , unsigned long, unsigned long *);
162 
163 #endif /* _ICARDMIDI_H */
164