···2525#include "seq_kernel.h"26262727/*2828- * type definitions2929- */3030-typedef struct snd_seq_oss_arg_t snd_seq_oss_arg_t;3131-typedef struct snd_seq_oss_callback_t snd_seq_oss_callback_t;3232-3333-/*3428 * argument structure for synthesizer operations3529 */3636-struct snd_seq_oss_arg_t {3030+struct snd_seq_oss_arg {3731 /* given by OSS sequencer */3832 int app_index; /* application unique index */3933 int file_mode; /* file mode - see below */4034 int seq_mode; /* sequencer mode - see below */41354236 /* following must be initialized in open callback */4343- snd_seq_addr_t addr; /* opened port address */3737+ struct snd_seq_addr addr; /* opened port address */4438 void *private_data; /* private data for lowlevel drivers */45394640 /* note-on event passing mode: initially given by OSS seq,···4753/*4854 * synthesizer operation callbacks4955 */5050-struct snd_seq_oss_callback_t {5656+struct snd_seq_oss_callback {5157 struct module *owner;5252- int (*open)(snd_seq_oss_arg_t *p, void *closure);5353- int (*close)(snd_seq_oss_arg_t *p);5454- int (*ioctl)(snd_seq_oss_arg_t *p, unsigned int cmd, unsigned long arg);5555- int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char __user *buf, int offs, int count);5656- int (*reset)(snd_seq_oss_arg_t *p);5757- int (*raw_event)(snd_seq_oss_arg_t *p, unsigned char *data);5858+ int (*open)(struct snd_seq_oss_arg *p, void *closure);5959+ int (*close)(struct snd_seq_oss_arg *p);6060+ int (*ioctl)(struct snd_seq_oss_arg *p, unsigned int cmd, unsigned long arg);6161+ int (*load_patch)(struct snd_seq_oss_arg *p, int format, const char __user *buf, int offs, int count);6262+ int (*reset)(struct snd_seq_oss_arg *p);6363+ int (*raw_event)(struct snd_seq_oss_arg *p, unsigned char *data);5864};59656066/* flag: file_mode */···8288/*8389 * data pointer to snd_seq_register_device8490 */8585-typedef struct snd_seq_oss_reg {9191+struct snd_seq_oss_reg {8692 int type;8793 int subtype;8894 int nvoices;8989- snd_seq_oss_callback_t oper;9595+ struct snd_seq_oss_callback oper;9096 void *private_data;9191-} snd_seq_oss_reg_t;9797+};92989399/* device id */94100#define SNDRV_SEQ_DEV_ID_OSS "seq-oss"
···5555 * type definitions5656 */57575858-typedef struct seq_oss_devinfo_t seq_oss_devinfo_t;5959-typedef struct seq_oss_writeq_t seq_oss_writeq_t;6060-typedef struct seq_oss_readq_t seq_oss_readq_t;6161-typedef struct seq_oss_timer_t seq_oss_timer_t;6262-typedef struct seq_oss_synthinfo_t seq_oss_synthinfo_t;6363-typedef struct seq_oss_synth_sysex_t seq_oss_synth_sysex_t;6464-typedef struct seq_oss_chinfo_t seq_oss_chinfo_t;6558typedef unsigned int reltime_t;6659typedef unsigned int abstime_t;6767-typedef union evrec_t evrec_t;686069617062/*7163 * synthesizer channel information7264 */7373-struct seq_oss_chinfo_t {6565+struct seq_oss_chinfo {7466 int note, vel;7567};76687769/*7870 * synthesizer information7971 */8080-struct seq_oss_synthinfo_t {8181- snd_seq_oss_arg_t arg;8282- seq_oss_chinfo_t *ch;8383- seq_oss_synth_sysex_t *sysex;7272+struct seq_oss_synthinfo {7373+ struct snd_seq_oss_arg arg;7474+ struct seq_oss_chinfo *ch;7575+ struct seq_oss_synth_sysex *sysex;8476 int nr_voices;8577 int opened;8678 int is_midi;···8492 * sequencer client information8593 */86948787-struct seq_oss_devinfo_t {9595+struct seq_oss_devinfo {88968997 int index; /* application index */9098 int cseq; /* sequencer client number */9199 int port; /* sequencer port number */92100 int queue; /* sequencer queue number */931019494- snd_seq_addr_t addr; /* address of this device */102102+ struct snd_seq_addr addr; /* address of this device */9510396104 int seq_mode; /* sequencer mode */97105 int file_mode; /* file access */···101109102110 /* synth device table */103111 int max_synthdev;104104- seq_oss_synthinfo_t synths[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];112112+ struct seq_oss_synthinfo synths[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];105113 int synth_opened;106114107115 /* output queue */108108- seq_oss_writeq_t *writeq;116116+ struct seq_oss_writeq *writeq;109117110118 /* midi input queue */111111- seq_oss_readq_t *readq;119119+ struct seq_oss_readq *readq;112120113121 /* timer */114114- seq_oss_timer_t *timer;122122+ struct seq_oss_timer *timer;115123};116124117125···125133126134/* device file interface */127135int snd_seq_oss_open(struct file *file, int level);128128-void snd_seq_oss_release(seq_oss_devinfo_t *dp);129129-int snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long arg);130130-int snd_seq_oss_read(seq_oss_devinfo_t *dev, char __user *buf, int count);131131-int snd_seq_oss_write(seq_oss_devinfo_t *dp, const char __user *buf, int count, struct file *opt);132132-unsigned int snd_seq_oss_poll(seq_oss_devinfo_t *dp, struct file *file, poll_table * wait);136136+void snd_seq_oss_release(struct seq_oss_devinfo *dp);137137+int snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long arg);138138+int snd_seq_oss_read(struct seq_oss_devinfo *dev, char __user *buf, int count);139139+int snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int count, struct file *opt);140140+unsigned int snd_seq_oss_poll(struct seq_oss_devinfo *dp, struct file *file, poll_table * wait);133141134134-void snd_seq_oss_reset(seq_oss_devinfo_t *dp);135135-void snd_seq_oss_drain_write(seq_oss_devinfo_t *dp);142142+void snd_seq_oss_reset(struct seq_oss_devinfo *dp);143143+void snd_seq_oss_drain_write(struct seq_oss_devinfo *dp);136144137145/* */138138-void snd_seq_oss_process_queue(seq_oss_devinfo_t *dp, abstime_t time);146146+void snd_seq_oss_process_queue(struct seq_oss_devinfo *dp, abstime_t time);139147140148141149/* proc interface */142142-void snd_seq_oss_system_info_read(snd_info_buffer_t *buf);143143-void snd_seq_oss_midi_info_read(snd_info_buffer_t *buf);144144-void snd_seq_oss_synth_info_read(snd_info_buffer_t *buf);145145-void snd_seq_oss_readq_info_read(seq_oss_readq_t *q, snd_info_buffer_t *buf);150150+void snd_seq_oss_system_info_read(struct snd_info_buffer *buf);151151+void snd_seq_oss_midi_info_read(struct snd_info_buffer *buf);152152+void snd_seq_oss_synth_info_read(struct snd_info_buffer *buf);153153+void snd_seq_oss_readq_info_read(struct seq_oss_readq *q, struct snd_info_buffer *buf);146154147155/* file mode macros */148156#define is_read_mode(mode) ((mode) & SNDRV_SEQ_OSS_FILE_READ)···151159152160/* dispatch event */153161static inline int154154-snd_seq_oss_dispatch(seq_oss_devinfo_t *dp, snd_seq_event_t *ev, int atomic, int hop)162162+snd_seq_oss_dispatch(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, int atomic, int hop)155163{156164 return snd_seq_kernel_client_dispatch(dp->cseq, ev, atomic, hop);157165}158166159167/* ioctl */160168static inline int161161-snd_seq_oss_control(seq_oss_devinfo_t *dp, unsigned int type, void *arg)169169+snd_seq_oss_control(struct seq_oss_devinfo *dp, unsigned int type, void *arg)162170{163171 return snd_seq_kernel_client_ctl(dp->cseq, type, arg);164172}165173166174/* fill the addresses in header */167175static inline void168168-snd_seq_oss_fill_addr(seq_oss_devinfo_t *dp, snd_seq_event_t *ev,176176+snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,169177 int dest_client, int dest_port)170178{171179 ev->queue = dp->queue;
+30-30
sound/core/seq/oss/seq_oss_event.c
···3131/*3232 * prototypes3333 */3434-static int extended_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev);3535-static int chn_voice_event(seq_oss_devinfo_t *dp, evrec_t *event_rec, snd_seq_event_t *ev);3636-static int chn_common_event(seq_oss_devinfo_t *dp, evrec_t *event_rec, snd_seq_event_t *ev);3737-static int timing_event(seq_oss_devinfo_t *dp, evrec_t *event_rec, snd_seq_event_t *ev);3838-static int local_event(seq_oss_devinfo_t *dp, evrec_t *event_rec, snd_seq_event_t *ev);3939-static int old_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev);4040-static int note_on_event(seq_oss_devinfo_t *dp, int dev, int ch, int note, int vel, snd_seq_event_t *ev);4141-static int note_off_event(seq_oss_devinfo_t *dp, int dev, int ch, int note, int vel, snd_seq_event_t *ev);4242-static int set_note_event(seq_oss_devinfo_t *dp, int dev, int type, int ch, int note, int vel, snd_seq_event_t *ev);4343-static int set_control_event(seq_oss_devinfo_t *dp, int dev, int type, int ch, int param, int val, snd_seq_event_t *ev);4444-static int set_echo_event(seq_oss_devinfo_t *dp, evrec_t *rec, snd_seq_event_t *ev);3434+static int extended_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev);3535+static int chn_voice_event(struct seq_oss_devinfo *dp, union evrec *event_rec, struct snd_seq_event *ev);3636+static int chn_common_event(struct seq_oss_devinfo *dp, union evrec *event_rec, struct snd_seq_event *ev);3737+static int timing_event(struct seq_oss_devinfo *dp, union evrec *event_rec, struct snd_seq_event *ev);3838+static int local_event(struct seq_oss_devinfo *dp, union evrec *event_rec, struct snd_seq_event *ev);3939+static int old_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev);4040+static int note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev);4141+static int note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev);4242+static int set_note_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int note, int vel, struct snd_seq_event *ev);4343+static int set_control_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int param, int val, struct snd_seq_event *ev);4444+static int set_echo_event(struct seq_oss_devinfo *dp, union evrec *rec, struct snd_seq_event *ev);454546464747/*···5151 */52525353int5454-snd_seq_oss_process_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev)5454+snd_seq_oss_process_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev)5555{5656 switch (q->s.code) {5757 case SEQ_EXTENDED:···104104105105/* old type events: mode1 only */106106static int107107-old_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev)107107+old_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev)108108{109109 switch (q->s.code) {110110 case SEQ_NOTEOFF:···130130131131/* 8bytes extended event: mode1 only */132132static int133133-extended_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev)133133+extended_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev)134134{135135 int val;136136···184184185185/* channel voice events: mode1 and 2 */186186static int187187-chn_voice_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev)187187+chn_voice_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev)188188{189189 if (q->v.chn >= 32)190190 return -EINVAL;···205205206206/* channel common events: mode1 and 2 */207207static int208208-chn_common_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev)208208+chn_common_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev)209209{210210 if (q->l.chn >= 32)211211 return -EINVAL;···232232233233/* timer events: mode1 and mode2 */234234static int235235-timing_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev)235235+timing_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev)236236{237237 switch (q->t.cmd) {238238 case TMR_ECHO:239239 if (dp->seq_mode == SNDRV_SEQ_OSS_MODE_MUSIC)240240 return set_echo_event(dp, q, ev);241241 else {242242- evrec_t tmp;242242+ union evrec tmp;243243 memset(&tmp, 0, sizeof(tmp));244244 /* XXX: only for little-endian! */245245 tmp.echo = (q->t.time << 8) | SEQ_ECHO;···267267268268/* local events: mode1 and 2 */269269static int270270-local_event(seq_oss_devinfo_t *dp, evrec_t *q, snd_seq_event_t *ev)270270+local_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev)271271{272272 return -EINVAL;273273}···283283 * Use key-pressure if note >= 128284284 */285285static int286286-note_on_event(seq_oss_devinfo_t *dp, int dev, int ch, int note, int vel, snd_seq_event_t *ev)286286+note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)287287{288288- seq_oss_synthinfo_t *info = &dp->synths[dev];288288+ struct seq_oss_synthinfo *info = &dp->synths[dev];289289 switch (info->arg.event_passing) {290290 case SNDRV_SEQ_OSS_PROCESS_EVENTS:291291 if (! info->ch || ch < 0 || ch >= info->nr_voices) {···338338 * process note-off event for OSS synth339339 */340340static int341341-note_off_event(seq_oss_devinfo_t *dp, int dev, int ch, int note, int vel, snd_seq_event_t *ev)341341+note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)342342{343343- seq_oss_synthinfo_t *info = &dp->synths[dev];343343+ struct seq_oss_synthinfo *info = &dp->synths[dev];344344 switch (info->arg.event_passing) {345345 case SNDRV_SEQ_OSS_PROCESS_EVENTS:346346 if (! info->ch || ch < 0 || ch >= info->nr_voices) {···369369 * create a note event370370 */371371static int372372-set_note_event(seq_oss_devinfo_t *dp, int dev, int type, int ch, int note, int vel, snd_seq_event_t *ev)372372+set_note_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int note, int vel, struct snd_seq_event *ev)373373{374374 if (! snd_seq_oss_synth_is_valid(dp, dev))375375 return -ENXIO;···387387 * create a control event388388 */389389static int390390-set_control_event(seq_oss_devinfo_t *dp, int dev, int type, int ch, int param, int val, snd_seq_event_t *ev)390390+set_control_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int param, int val, struct snd_seq_event *ev)391391{392392 if (! snd_seq_oss_synth_is_valid(dp, dev))393393 return -ENXIO;···405405 * create an echo event406406 */407407static int408408-set_echo_event(seq_oss_devinfo_t *dp, evrec_t *rec, snd_seq_event_t *ev)408408+set_echo_event(struct seq_oss_devinfo *dp, union evrec *rec, struct snd_seq_event *ev)409409{410410 ev->type = SNDRV_SEQ_EVENT_ECHO;411411 /* echo back to itself */···419419 * the echo event is processed here.420420 */421421int422422-snd_seq_oss_event_input(snd_seq_event_t *ev, int direct, void *private_data,422422+snd_seq_oss_event_input(struct snd_seq_event *ev, int direct, void *private_data,423423 int atomic, int hop)424424{425425- seq_oss_devinfo_t *dp = (seq_oss_devinfo_t *)private_data;426426- evrec_t *rec;425425+ struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private_data;426426+ union evrec *rec;427427428428 if (ev->type != SNDRV_SEQ_EVENT_ECHO)429429 return snd_seq_oss_midi_input(ev, direct, private_data);···431431 if (ev->source.client != dp->cseq)432432 return 0; /* ignored */433433434434- rec = (evrec_t*)&ev->data;434434+ rec = (union evrec*)&ev->data;435435 if (rec->s.code == SEQ_SYNCTIMER) {436436 /* sync echo back */437437 snd_seq_oss_writeq_wakeup(dp->writeq, rec->t.time);