diff options
Diffstat (limited to 'include/sound/rawmidi.h')
-rw-r--r-- | include/sound/rawmidi.h | 123 |
1 files changed, 63 insertions, 60 deletions
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h index 3f9db510dee3..9492a32c1026 100644 --- a/include/sound/rawmidi.h +++ b/include/sound/rawmidi.h | |||
@@ -36,11 +36,6 @@ | |||
36 | * Raw MIDI interface | 36 | * Raw MIDI interface |
37 | */ | 37 | */ |
38 | 38 | ||
39 | typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t; | ||
40 | typedef struct sndrv_rawmidi_info snd_rawmidi_info_t; | ||
41 | typedef struct sndrv_rawmidi_params snd_rawmidi_params_t; | ||
42 | typedef struct sndrv_rawmidi_status snd_rawmidi_status_t; | ||
43 | |||
44 | #define SNDRV_RAWMIDI_DEVICES 8 | 39 | #define SNDRV_RAWMIDI_DEVICES 8 |
45 | 40 | ||
46 | #define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) | 41 | #define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) |
@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t; | |||
49 | #define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) | 44 | #define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) |
50 | #define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) | 45 | #define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) |
51 | 46 | ||
52 | typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; | 47 | struct snd_rawmidi; |
53 | typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; | 48 | struct snd_rawmidi_substream; |
54 | typedef struct _snd_rawmidi_str snd_rawmidi_str_t; | ||
55 | 49 | ||
56 | typedef struct _snd_rawmidi_ops { | 50 | struct snd_rawmidi_ops { |
57 | int (*open) (snd_rawmidi_substream_t * substream); | 51 | int (*open) (struct snd_rawmidi_substream * substream); |
58 | int (*close) (snd_rawmidi_substream_t * substream); | 52 | int (*close) (struct snd_rawmidi_substream * substream); |
59 | void (*trigger) (snd_rawmidi_substream_t * substream, int up); | 53 | void (*trigger) (struct snd_rawmidi_substream * substream, int up); |
60 | void (*drain) (snd_rawmidi_substream_t * substream); | 54 | void (*drain) (struct snd_rawmidi_substream * substream); |
61 | } snd_rawmidi_ops_t; | 55 | }; |
62 | 56 | ||
63 | typedef struct _snd_rawmidi_global_ops { | 57 | struct snd_rawmidi_global_ops { |
64 | int (*dev_register) (snd_rawmidi_t * rmidi); | 58 | int (*dev_register) (struct snd_rawmidi * rmidi); |
65 | int (*dev_unregister) (snd_rawmidi_t * rmidi); | 59 | int (*dev_unregister) (struct snd_rawmidi * rmidi); |
66 | } snd_rawmidi_global_ops_t; | 60 | }; |
67 | 61 | ||
68 | struct _snd_rawmidi_runtime { | 62 | struct snd_rawmidi_runtime { |
69 | unsigned int drain: 1, /* drain stage */ | 63 | unsigned int drain: 1, /* drain stage */ |
70 | oss: 1; /* OSS compatible mode */ | 64 | oss: 1; /* OSS compatible mode */ |
71 | /* midi stream buffer */ | 65 | /* midi stream buffer */ |
@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime { | |||
80 | spinlock_t lock; | 74 | spinlock_t lock; |
81 | wait_queue_head_t sleep; | 75 | wait_queue_head_t sleep; |
82 | /* event handler (new bytes, input only) */ | 76 | /* event handler (new bytes, input only) */ |
83 | void (*event)(snd_rawmidi_substream_t *substream); | 77 | void (*event)(struct snd_rawmidi_substream *substream); |
84 | /* defers calls to event [input] or ops->trigger [output] */ | 78 | /* defers calls to event [input] or ops->trigger [output] */ |
85 | struct tasklet_struct tasklet; | 79 | struct tasklet_struct tasklet; |
86 | /* private data */ | 80 | /* private data */ |
87 | void *private_data; | 81 | void *private_data; |
88 | void (*private_free)(snd_rawmidi_substream_t *substream); | 82 | void (*private_free)(struct snd_rawmidi_substream *substream); |
89 | }; | 83 | }; |
90 | 84 | ||
91 | struct _snd_rawmidi_substream { | 85 | struct snd_rawmidi_substream { |
92 | struct list_head list; /* list of all substream for given stream */ | 86 | struct list_head list; /* list of all substream for given stream */ |
93 | int stream; /* direction */ | 87 | int stream; /* direction */ |
94 | int number; /* substream number */ | 88 | int number; /* substream number */ |
@@ -97,28 +91,28 @@ struct _snd_rawmidi_substream { | |||
97 | active_sensing: 1; /* send active sensing when close */ | 91 | active_sensing: 1; /* send active sensing when close */ |
98 | int use_count; /* use counter (for output) */ | 92 | int use_count; /* use counter (for output) */ |
99 | size_t bytes; | 93 | size_t bytes; |
100 | snd_rawmidi_t *rmidi; | 94 | struct snd_rawmidi *rmidi; |
101 | snd_rawmidi_str_t *pstr; | 95 | struct snd_rawmidi_str *pstr; |
102 | char name[32]; | 96 | char name[32]; |
103 | snd_rawmidi_runtime_t *runtime; | 97 | struct snd_rawmidi_runtime *runtime; |
104 | /* hardware layer */ | 98 | /* hardware layer */ |
105 | snd_rawmidi_ops_t *ops; | 99 | struct snd_rawmidi_ops *ops; |
106 | }; | 100 | }; |
107 | 101 | ||
108 | typedef struct _snd_rawmidi_file { | 102 | struct snd_rawmidi_file { |
109 | snd_rawmidi_t *rmidi; | 103 | struct snd_rawmidi *rmidi; |
110 | snd_rawmidi_substream_t *input; | 104 | struct snd_rawmidi_substream *input; |
111 | snd_rawmidi_substream_t *output; | 105 | struct snd_rawmidi_substream *output; |
112 | } snd_rawmidi_file_t; | 106 | }; |
113 | 107 | ||
114 | struct _snd_rawmidi_str { | 108 | struct snd_rawmidi_str { |
115 | unsigned int substream_count; | 109 | unsigned int substream_count; |
116 | unsigned int substream_opened; | 110 | unsigned int substream_opened; |
117 | struct list_head substreams; | 111 | struct list_head substreams; |
118 | }; | 112 | }; |
119 | 113 | ||
120 | struct _snd_rawmidi { | 114 | struct snd_rawmidi { |
121 | snd_card_t *card; | 115 | struct snd_card *card; |
122 | 116 | ||
123 | unsigned int device; /* device number */ | 117 | unsigned int device; /* device number */ |
124 | unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ | 118 | unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ |
@@ -129,52 +123,61 @@ struct _snd_rawmidi { | |||
129 | int ossreg; | 123 | int ossreg; |
130 | #endif | 124 | #endif |
131 | 125 | ||
132 | snd_rawmidi_global_ops_t *ops; | 126 | struct snd_rawmidi_global_ops *ops; |
133 | 127 | ||
134 | snd_rawmidi_str_t streams[2]; | 128 | struct snd_rawmidi_str streams[2]; |
135 | 129 | ||
136 | void *private_data; | 130 | void *private_data; |
137 | void (*private_free) (snd_rawmidi_t *rmidi); | 131 | void (*private_free) (struct snd_rawmidi *rmidi); |
138 | 132 | ||
139 | struct semaphore open_mutex; | 133 | struct semaphore open_mutex; |
140 | wait_queue_head_t open_wait; | 134 | wait_queue_head_t open_wait; |
141 | 135 | ||
142 | snd_info_entry_t *dev; | 136 | struct snd_info_entry *dev; |
143 | snd_info_entry_t *proc_entry; | 137 | struct snd_info_entry *proc_entry; |
144 | 138 | ||
145 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) | 139 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) |
146 | snd_seq_device_t *seq_dev; | 140 | struct snd_seq_device *seq_dev; |
147 | #endif | 141 | #endif |
148 | }; | 142 | }; |
149 | 143 | ||
150 | /* main rawmidi functions */ | 144 | /* main rawmidi functions */ |
151 | 145 | ||
152 | int snd_rawmidi_new(snd_card_t * card, char *id, int device, | 146 | int snd_rawmidi_new(struct snd_card *card, char *id, int device, |
153 | int output_count, int input_count, | 147 | int output_count, int input_count, |
154 | snd_rawmidi_t ** rmidi); | 148 | struct snd_rawmidi **rmidi); |
155 | void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops); | 149 | void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, |
150 | struct snd_rawmidi_ops *ops); | ||
156 | 151 | ||
157 | /* callbacks */ | 152 | /* callbacks */ |
158 | 153 | ||
159 | void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream); | 154 | void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream); |
160 | int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count); | 155 | int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, |
161 | void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream); | 156 | const unsigned char *buffer, int count); |
162 | int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream); | 157 | void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream); |
163 | int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); | 158 | int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream); |
164 | int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count); | 159 | int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream, |
165 | int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); | 160 | unsigned char *buffer, int count); |
161 | int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count); | ||
162 | int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream, | ||
163 | unsigned char *buffer, int count); | ||
166 | 164 | ||
167 | /* main midi functions */ | 165 | /* main midi functions */ |
168 | 166 | ||
169 | int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info); | 167 | int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info); |
170 | int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile); | 168 | int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, |
171 | int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile); | 169 | struct snd_rawmidi_file *rfile); |
172 | int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); | 170 | int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile); |
173 | int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); | 171 | int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, |
174 | int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream); | 172 | struct snd_rawmidi_params *params); |
175 | int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream); | 173 | int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, |
176 | int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream); | 174 | struct snd_rawmidi_params *params); |
177 | long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count); | 175 | int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream); |
178 | long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count); | 176 | int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream); |
177 | int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream); | ||
178 | long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream, | ||
179 | unsigned char *buf, long count); | ||
180 | long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream, | ||
181 | const unsigned char *buf, long count); | ||
179 | 182 | ||
180 | #endif /* __SOUND_RAWMIDI_H */ | 183 | #endif /* __SOUND_RAWMIDI_H */ |