1 | /* $Id: cardmi.h 151 2000-05-28 16:50:46Z sandervl $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | **********************************************************************
|
---|
5 | * sblive_mi.h
|
---|
6 | * Copyright 1999, 2000 Creative Labs, Inc.
|
---|
7 | *
|
---|
8 | **********************************************************************
|
---|
9 | *
|
---|
10 | * Date Author Summary of changes
|
---|
11 | * ---- ------ ------------------
|
---|
12 | * October 20, 1999 Bertrand Lee base code release
|
---|
13 | * November 2, 1999 Alan Cox cleaned up
|
---|
14 | *
|
---|
15 | **********************************************************************
|
---|
16 | *
|
---|
17 | * This program is free software; you can redistribute it and/or
|
---|
18 | * modify it under the terms of the GNU General Public License as
|
---|
19 | * published by the Free Software Foundation; either version 2 of
|
---|
20 | * the License, or (at your option) any later version.
|
---|
21 | *
|
---|
22 | * This program is distributed in the hope that it will be useful,
|
---|
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
25 | * GNU General Public License for more details.
|
---|
26 | *
|
---|
27 | * You should have received a copy of the GNU General Public
|
---|
28 | * License along with this program; if not, write to the Free
|
---|
29 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
---|
30 | * USA.
|
---|
31 | *
|
---|
32 | **********************************************************************
|
---|
33 | */
|
---|
34 |
|
---|
35 | #ifndef _CARDMI_H
|
---|
36 | #define _CARDMI_H
|
---|
37 |
|
---|
38 | #include "icardmid.h"
|
---|
39 |
|
---|
40 | typedef enum
|
---|
41 | {
|
---|
42 | STIN_PARSE = 0,
|
---|
43 | STIN_3BYTE, /* 0x80, 0x90, 0xA0, 0xB0, 0xE0 */
|
---|
44 | STIN_3BYTE_KEY, /* Byte 1 */
|
---|
45 | STIN_3BYTE_VEL, /* Byte 1 */
|
---|
46 | STIN_2BYTE, /* 0xC0, 0xD0 */
|
---|
47 | STIN_2BYTE_KEY, /* Byte 1 */
|
---|
48 | STIN_SYS_COMMON_2, /* 0xF1, 0xF3 */
|
---|
49 | STIN_SYS_COMMON_2_KEY,
|
---|
50 | STIN_SYS_COMMON_3, /* 0xF2 */
|
---|
51 | STIN_SYS_COMMON_3_KEY,
|
---|
52 | STIN_SYS_COMMON_3_VEL,
|
---|
53 | STIN_SYS_EX_NORM, /* 0xF0, Normal mode */
|
---|
54 | STIN_SYS_REAL
|
---|
55 | } midi_in_state;
|
---|
56 |
|
---|
57 |
|
---|
58 | /* flags for card MIDI in object */
|
---|
59 | #define FLAGS_MIDM_STARTED 0x00001000 // Data has started to come in after Midm Start
|
---|
60 |
|
---|
61 | #ifdef TARGET_OS2
|
---|
62 | #define MIDIIN_MAX_BUFFER_SIZE 4
|
---|
63 | #else
|
---|
64 | #define MIDIIN_MAX_BUFFER_SIZE 200 // Definition for struct emu10k1_mpuin
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | struct midi_data
|
---|
68 | {
|
---|
69 | u8 data;
|
---|
70 | u32 timein;
|
---|
71 | };
|
---|
72 |
|
---|
73 | struct emu10k1_mpuin
|
---|
74 | {
|
---|
75 | spinlock_t lock;
|
---|
76 | struct midi_queue *firstmidiq;
|
---|
77 | struct midi_queue *lastmidiq;
|
---|
78 | unsigned qhead, qtail;
|
---|
79 | struct midi_data midiq[MIDIIN_MAX_BUFFER_SIZE];
|
---|
80 | struct tasklet_struct tasklet;
|
---|
81 | struct midi_openinfo openinfo;
|
---|
82 |
|
---|
83 | /* For MIDI state machine */
|
---|
84 | u8 status; /* For MIDI running status */
|
---|
85 | u8 fstatus; /* For 0xFn status only */
|
---|
86 | midi_in_state curstate;
|
---|
87 | midi_in_state laststate;
|
---|
88 | u32 timestart;
|
---|
89 | u32 timein;
|
---|
90 | u8 data;
|
---|
91 | };
|
---|
92 |
|
---|
93 | int emu10k1_mpuin_open(struct emu10k1_card *, struct midi_openinfo *);
|
---|
94 | int emu10k1_mpuin_close(struct emu10k1_card *);
|
---|
95 | int emu10k1_mpuin_add_buffer(struct emu10k1_mpuin *, struct midi_hdr *);
|
---|
96 | int emu10k1_mpuin_start(struct emu10k1_card *);
|
---|
97 | int emu10k1_mpuin_stop(struct emu10k1_card *);
|
---|
98 | int emu10k1_mpuin_reset(struct emu10k1_card *);
|
---|
99 |
|
---|
100 | int sblive_miStateInit(struct emu10k1_mpuin *);
|
---|
101 | int sblive_miStateEntry(struct emu10k1_mpuin *, u8);
|
---|
102 | int sblive_miStateParse(struct emu10k1_mpuin *, u8);
|
---|
103 | int sblive_miState3Byte(struct emu10k1_mpuin *, u8);
|
---|
104 | int sblive_miState3ByteKey(struct emu10k1_mpuin *, u8);
|
---|
105 | int sblive_miState3ByteVel(struct emu10k1_mpuin *, u8);
|
---|
106 | int sblive_miState2Byte(struct emu10k1_mpuin *, u8);
|
---|
107 | int sblive_miState2ByteKey(struct emu10k1_mpuin *, u8);
|
---|
108 | int sblive_miStateSysCommon2(struct emu10k1_mpuin *, u8);
|
---|
109 | int sblive_miStateSysCommon2Key(struct emu10k1_mpuin *, u8);
|
---|
110 | int sblive_miStateSysCommon3(struct emu10k1_mpuin *, u8);
|
---|
111 | int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *, u8);
|
---|
112 | int sblive_miStateSysCommon3Vel(struct emu10k1_mpuin *, u8);
|
---|
113 | int sblive_miStateSysExNorm(struct emu10k1_mpuin *, u8);
|
---|
114 | int sblive_miStateSysReal(struct emu10k1_mpuin *, u8);
|
---|
115 |
|
---|
116 | int emu10k1_mpuin_irqhandler(struct emu10k1_card *);
|
---|
117 | void emu10k1_mpuin_bh(unsigned long);
|
---|
118 | int emu10k1_mpuin_callback(struct emu10k1_mpuin *card_mpuin, u32 msg, unsigned long data, u32 bytesvalid);
|
---|
119 |
|
---|
120 | #endif /* _CARDMI_H */
|
---|