Commit c7e0b5bf authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: Sequencer

Modules: ALSA sequencer

Remove xxx_t typedefs from the core sequencer codes.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6ac77bc1
This diff is collapsed.
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
* *
*/ */
typedef struct snd_seq_device snd_seq_device_t;
typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
/* /*
* registered device information * registered device information
*/ */
...@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t; ...@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
struct snd_seq_device { struct snd_seq_device {
/* device info */ /* device info */
snd_card_t *card; /* sound card */ struct snd_card *card; /* sound card */
int device; /* device number */ int device; /* device number */
char id[ID_LEN]; /* driver id */ char id[ID_LEN]; /* driver id */
char name[80]; /* device name */ char name[80]; /* device name */
...@@ -44,7 +41,7 @@ struct snd_seq_device { ...@@ -44,7 +41,7 @@ struct snd_seq_device {
void *driver_data; /* private data for driver */ void *driver_data; /* private data for driver */
int status; /* flag - read only */ int status; /* flag - read only */
void *private_data; /* private data for the caller */ void *private_data; /* private data for the caller */
void (*private_free)(snd_seq_device_t *device); void (*private_free)(struct snd_seq_device *device);
struct list_head list; /* link to next device */ struct list_head list; /* link to next device */
}; };
...@@ -63,19 +60,19 @@ struct snd_seq_device { ...@@ -63,19 +60,19 @@ struct snd_seq_device {
* Typically, call snd_device_free(dev->card, dev->driver_data) * Typically, call snd_device_free(dev->card, dev->driver_data)
*/ */
struct snd_seq_dev_ops { struct snd_seq_dev_ops {
int (*init_device)(snd_seq_device_t *dev); int (*init_device)(struct snd_seq_device *dev);
int (*free_device)(snd_seq_device_t *dev); int (*free_device)(struct snd_seq_device *dev);
}; };
/* /*
* prototypes * prototypes
*/ */
void snd_seq_device_load_drivers(void); void snd_seq_device_load_drivers(void);
int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result); int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize); int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
int snd_seq_device_unregister_driver(char *id); int snd_seq_device_unregister_driver(char *id);
#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t)) #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
/* /*
...@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id); ...@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id);
#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
#endif /* __SOUND_SEQ_DEVICE_H */ #endif /* __SOUND_SEQ_DEVICE_H */
...@@ -24,29 +24,27 @@ ...@@ -24,29 +24,27 @@
#include "seq_kernel.h" #include "seq_kernel.h"
/* Instrument cluster */ /* Instrument cluster */
typedef struct _snd_seq_kcluster { struct snd_seq_kcluster {
snd_seq_instr_cluster_t cluster; snd_seq_instr_cluster_t cluster;
char name[32]; char name[32];
int priority; int priority;
struct _snd_seq_kcluster *next; struct snd_seq_kcluster *next;
} snd_seq_kcluster_t; };
/* return pointer to private data */ /* return pointer to private data */
#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) #define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
/* Instrument structure */ /* Instrument structure */
typedef struct _snd_seq_kinstr { struct snd_seq_kinstr {
snd_seq_instr_t instr; struct snd_seq_instr instr;
char name[32]; char name[32];
int type; /* instrument type */ int type; /* instrument type */
int use; /* use count */ int use; /* use count */
int busy; /* not useable */ int busy; /* not useable */
int add_len; /* additional length */ int add_len; /* additional length */
snd_seq_kinstr_ops_t *ops; /* operations */ struct snd_seq_kinstr_ops *ops; /* operations */
struct _snd_seq_kinstr *next; struct snd_seq_kinstr *next;
} snd_seq_kinstr_t; };
#define SNDRV_SEQ_INSTR_HASH_SIZE 32 #define SNDRV_SEQ_INSTR_HASH_SIZE 32
...@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr { ...@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr {
#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ #define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
/* List of all instruments */ /* List of all instruments */
typedef struct { struct snd_seq_kinstr_list {
snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
int count; /* count of all instruments */ int count; /* count of all instruments */
snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
int ccount; /* count of all clusters */ int ccount; /* count of all clusters */
int owner; /* current owner of the instrument list */ int owner; /* current owner of the instrument list */
...@@ -68,7 +66,7 @@ typedef struct { ...@@ -68,7 +66,7 @@ typedef struct {
spinlock_t ops_lock; spinlock_t ops_lock;
struct semaphore ops_mutex; struct semaphore ops_mutex;
unsigned long ops_flags; unsigned long ops_flags;
} snd_seq_kinstr_list_t; };
#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 #define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 #define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
...@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops { ...@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops {
long add_len; /* additional length */ long add_len; /* additional length */
char *instr_type; char *instr_type;
int (*info)(void *private_data, char *info_data, long len); int (*info)(void *private_data, char *info_data, long len);
int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
char __user *instr_data, long len, int atomic, int cmd); char __user *instr_data, long len, int atomic, int cmd);
int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
char __user *instr_data, long len, int atomic, int cmd); char __user *instr_data, long len, int atomic, int cmd);
int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
struct snd_seq_kinstr_ops *next; struct snd_seq_kinstr_ops *next;
}; };
/* instrument operations */ /* instrument operations */
snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
snd_seq_instr_header_t *ifree, struct snd_seq_instr_header *ifree,
int client, int client,
int atomic); int atomic);
snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
snd_seq_instr_t *instr, struct snd_seq_instr *instr,
int exact, int exact,
int follow_alias); int follow_alias);
void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
snd_seq_kinstr_t *instr); struct snd_seq_kinstr *instr);
int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_list_t *list, struct snd_seq_kinstr_list *list,
snd_seq_event_t *ev, struct snd_seq_event *ev,
int client, int client,
int atomic, int atomic,
int hop); int hop);
......
...@@ -24,62 +24,8 @@ ...@@ -24,62 +24,8 @@
#include <linux/time.h> #include <linux/time.h>
#include "asequencer.h" #include "asequencer.h"
typedef sndrv_seq_tick_time_t snd_seq_tick_time_t; typedef struct snd_seq_real_time snd_seq_real_time_t;
typedef sndrv_seq_position_t snd_seq_position_t; typedef union snd_seq_timestamp snd_seq_timestamp_t;
typedef sndrv_seq_frequency_t snd_seq_frequency_t;
typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t;
typedef enum sndrv_seq_client_type snd_seq_client_type_t;
typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
typedef struct sndrv_seq_port_info snd_seq_port_info_t;
typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t;
typedef struct sndrv_seq_event snd_seq_event_t;
typedef struct sndrv_seq_addr snd_seq_addr_t;
typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t;
typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t;
typedef struct sndrv_seq_remove_events snd_seq_remove_events_t;
typedef struct sndrv_seq_query_subs snd_seq_query_subs_t;
typedef struct sndrv_seq_real_time snd_seq_real_time_t;
typedef struct sndrv_seq_system_info snd_seq_system_info_t;
typedef struct sndrv_seq_client_info snd_seq_client_info_t;
typedef struct sndrv_seq_queue_info snd_seq_queue_info_t;
typedef struct sndrv_seq_queue_status snd_seq_queue_status_t;
typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t;
typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t;
typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t;
typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
typedef struct sndrv_seq_client_pool snd_seq_client_pool_t;
typedef struct sndrv_seq_instr snd_seq_instr_t;
typedef struct sndrv_seq_instr_data snd_seq_instr_data_t;
typedef struct sndrv_seq_instr_header snd_seq_instr_header_t;
typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
#define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data
#define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type
#define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type
#define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type
#define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type
#define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type
#define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type
#define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type
#define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type
#define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type
#define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type
#define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type
#define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved
#define snd_seq_ev_is_direct sndrv_seq_ev_is_direct
#define snd_seq_ev_is_prior sndrv_seq_ev_is_prior
#define snd_seq_ev_length_type sndrv_seq_ev_length_type
#define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed
#define snd_seq_ev_is_variable sndrv_seq_ev_is_variable
#define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr
#define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type
#define snd_seq_ev_is_tick sndrv_seq_ev_is_tick
#define snd_seq_ev_is_real sndrv_seq_ev_is_real
#define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type
#define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime
#define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime
#define snd_seq_queue_sync_port sndrv_seq_queue_sync_port
#define snd_seq_queue_owner sndrv_seq_queue_owner
/* maximum number of events dequeued per schedule interval */ /* maximum number of events dequeued per schedule interval */
#define SNDRV_SEQ_MAX_DEQUEUE 50 #define SNDRV_SEQ_MAX_DEQUEUE 50
...@@ -114,69 +60,56 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t; ...@@ -114,69 +60,56 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
/* max size of event size */ /* max size of event size */
#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
/* typedefs */
struct _snd_seq_user_client;
struct _snd_seq_kernel_client;
struct _snd_seq_client;
struct _snd_seq_queue;
typedef struct _snd_seq_user_client user_client_t;
typedef struct _snd_seq_kernel_client kernel_client_t;
typedef struct _snd_seq_client client_t;
typedef struct _snd_seq_queue queue_t;
/* call-backs for kernel client */ /* call-backs for kernel client */
typedef struct { struct snd_seq_client_callback {
void *private_data; void *private_data;
unsigned allow_input: 1, unsigned allow_input: 1,
allow_output: 1; allow_output: 1;
/*...*/ /*...*/
} snd_seq_client_callback_t; };
/* call-backs for kernel port */ /* call-backs for kernel port */
typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info); struct snd_seq_port_callback {
typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info);
typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop);
typedef void (snd_seq_kernel_port_private_free_t)(void *private_data);
typedef struct {
struct module *owner; struct module *owner;
void *private_data; void *private_data;
snd_seq_kernel_port_open_t *subscribe; int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_close_t *unsubscribe; int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_open_t *use; int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_close_t *unuse; int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_input_t *event_input; int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
snd_seq_kernel_port_private_free_t *private_free; void (*private_free)(void *private_data);
unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */ unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */
/*...*/ /*...*/
} snd_seq_port_callback_t; };
/* interface for kernel client */ /* interface for kernel client */
extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback); int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
extern int snd_seq_delete_kernel_client(int client); struct snd_seq_client_callback *callback);
extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); int snd_seq_delete_kernel_client(int client);
extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
#define SNDRV_SEQ_EXT_MASK 0xc0000000 #define SNDRV_SEQ_EXT_MASK 0xc0000000
#define SNDRV_SEQ_EXT_USRPTR 0x80000000 #define SNDRV_SEQ_EXT_USRPTR 0x80000000
#define SNDRV_SEQ_EXT_CHAINED 0x40000000 #define SNDRV_SEQ_EXT_CHAINED 0x40000000
typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned); int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data); int in_kernel, int size_aligned);
int snd_seq_dump_var_event(const struct snd_seq_event *event,
snd_seq_dump_func_t func, void *private_data);
/* interface for OSS emulation */ /* interface for OSS emulation */
int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo); int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
/* port callback routines */ /* port callback routines */
void snd_port_init_callback(snd_seq_port_callback_t *p); void snd_port_init_callback(struct snd_seq_port_callback *p);
snd_seq_port_callback_t *snd_port_alloc_callback(void); struct snd_seq_port_callback *snd_port_alloc_callback(void);
/* port attach/detach */ /* port attach/detach */
int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
int cap, int type, int midi_channels, int midi_voices, char *portname); int cap, int type, int midi_channels, int midi_voices, char *portname);
int snd_seq_event_port_detach(int client, int port); int snd_seq_event_port_detach(int client, int port);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* channel. All drivers for hardware that does not understand midi * channel. All drivers for hardware that does not understand midi
* directly will probably need to use this structure. * directly will probably need to use this structure.
*/ */
typedef struct snd_midi_channel { struct snd_midi_channel {
void *private; /* A back pointer to driver data */ void *private; /* A back pointer to driver data */
int number; /* The channel number */ int number; /* The channel number */
int client; /* The client associated with this channel */ int client; /* The client associated with this channel */
...@@ -53,41 +53,43 @@ typedef struct snd_midi_channel { ...@@ -53,41 +53,43 @@ typedef struct snd_midi_channel {
short gm_rpn_fine_tuning; /* Master fine tuning */ short gm_rpn_fine_tuning; /* Master fine tuning */
short gm_rpn_coarse_tuning; /* Master coarse tuning */ short gm_rpn_coarse_tuning; /* Master coarse tuning */
} snd_midi_channel_t; };
/* /*
* A structure that represets a set of channels bound to a port. There * A structure that represets a set of channels bound to a port. There
* would usually be 16 channels per port. But fewer could be used for * would usually be 16 channels per port. But fewer could be used for
* particular cases. * particular cases.
* The channel set consists of information describing the client and * The channel set consists of information describing the client and
* port for this midi synth and an array of snd_midi_channel_t structures. * port for this midi synth and an array of snd_midi_channel structures.
* A driver that had no need for snd_midi_channel_t could still use the * A driver that had no need for snd_midi_channel could still use the
* channel set type if it wished with the channel array null. * channel set type if it wished with the channel array null.
*/ */
typedef struct snd_midi_channel_set { struct snd_midi_channel_set {
void *private_data; /* Driver data */ void *private_data; /* Driver data */
int client; /* Client for this port */ int client; /* Client for this port */
int port; /* The port number */ int port; /* The port number */
int max_channels; /* Size of the channels array */ int max_channels; /* Size of the channels array */
snd_midi_channel_t *channels; struct snd_midi_channel *channels;
unsigned char midi_mode; /* MIDI operating mode */ unsigned char midi_mode; /* MIDI operating mode */
unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */ unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
unsigned char gs_chorus_mode; unsigned char gs_chorus_mode;
unsigned char gs_reverb_mode; unsigned char gs_reverb_mode;
} snd_midi_channel_set_t; };
typedef struct snd_seq_midi_op { struct snd_midi_op {
void (*note_on)(void *private_data, int note, int vel, snd_midi_channel_t *chan); void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
void (*note_off)(void *private_data,int note, int vel, snd_midi_channel_t *chan); /* release note */ void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */
void (*key_press)(void *private_data, int note, int vel, snd_midi_channel_t *chan); void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
void (*note_terminate)(void *private_data, int note, snd_midi_channel_t *chan); /* terminate note immediately */ void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */
void (*control)(void *private_data, int type, snd_midi_channel_t *chan); void (*control)(void *private_data, int type, struct snd_midi_channel *chan);
void (*nrpn)(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); void (*nrpn)(void *private_data, struct snd_midi_channel *chan,
void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); struct snd_midi_channel_set *chset);
} snd_midi_op_t; void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed,
struct snd_midi_channel_set *chset);
};
/* /*
* These defines are used so that pitchbend, aftertouch etc, can be * These defines are used so that pitchbend, aftertouch etc, can be
...@@ -186,10 +188,10 @@ enum { ...@@ -186,10 +188,10 @@ enum {
}; };
/* Prototypes for midi_process.c */ /* Prototypes for midi_process.c */
void snd_midi_process_event(snd_midi_op_t *ops, snd_seq_event_t *ev, void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev,
snd_midi_channel_set_t *chanset); struct snd_midi_channel_set *chanset);
void snd_midi_channel_set_clear(snd_midi_channel_set_t *chset); void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset);
snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n); struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
void snd_midi_channel_free_set(snd_midi_channel_set_t *chset); void snd_midi_channel_free_set(struct snd_midi_channel_set *chset);
#endif /* __SOUND_SEQ_MIDI_EMUL_H */ #endif /* __SOUND_SEQ_MIDI_EMUL_H */
...@@ -26,10 +26,8 @@ ...@@ -26,10 +26,8 @@
#define MAX_MIDI_EVENT_BUF 256 #define MAX_MIDI_EVENT_BUF 256
typedef struct snd_midi_event_t snd_midi_event_t;
/* midi status */ /* midi status */
struct snd_midi_event_t { struct snd_midi_event {
int qlen; /* queue length */ int qlen; /* queue length */
int read; /* chars read */ int read; /* chars read */
int type; /* current event type */ int type; /* current event type */
...@@ -40,15 +38,17 @@ struct snd_midi_event_t { ...@@ -40,15 +38,17 @@ struct snd_midi_event_t {
spinlock_t lock; spinlock_t lock;
}; };
int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
void snd_midi_event_free(snd_midi_event_t *dev); void snd_midi_event_free(struct snd_midi_event *dev);
void snd_midi_event_reset_encode(snd_midi_event_t *dev); void snd_midi_event_reset_encode(struct snd_midi_event *dev);
void snd_midi_event_reset_decode(snd_midi_event_t *dev); void snd_midi_event_reset_decode(struct snd_midi_event *dev);
void snd_midi_event_no_status(snd_midi_event_t *dev, int on); void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
/* encode from byte stream - return number of written bytes if success */ /* encode from byte stream - return number of written bytes if success */
long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev); struct snd_seq_event *ev);
int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
/* decode from event to bytes - return number of written bytes if success */ /* decode from event to bytes - return number of written bytes if success */
long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
struct snd_seq_event *ev);
#endif /* __SOUND_SEQ_MIDI_EVENT_H */ #endif /* __SOUND_SEQ_MIDI_EVENT_H */
...@@ -25,25 +25,23 @@ ...@@ -25,25 +25,23 @@
#include "rawmidi.h" #include "rawmidi.h"
#include "seq_midi_event.h" #include "seq_midi_event.h"
typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
/* /*
* device file instance: * device file instance:
* This instance is created at each time the midi device file is * This instance is created at each time the midi device file is
* opened. Each instance has its own input buffer and MIDI parser * opened. Each instance has its own input buffer and MIDI parser
* (buffer), and is associated with the device instance. * (buffer), and is associated with the device instance.
*/ */
typedef struct _snd_virmidi { struct snd_virmidi {
struct list_head list; struct list_head list;
int seq_mode; int seq_mode;
int client; int client;
int port; int port;
unsigned int trigger: 1; unsigned int trigger: 1;
snd_midi_event_t *parser; struct snd_midi_event *parser;
snd_seq_event_t event; struct snd_seq_event event;
snd_virmidi_dev_t *rdev; struct snd_virmidi_dev *rdev;
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
} snd_virmidi_t; };
#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) #define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
#define SNDRV_VIRMIDI_USE (1<<1) #define SNDRV_VIRMIDI_USE (1<<1)
...@@ -53,9 +51,9 @@ typedef struct _snd_virmidi { ...@@ -53,9 +51,9 @@ typedef struct _snd_virmidi {
* Each virtual midi device has one device instance. It contains * Each virtual midi device has one device instance. It contains
* common information and the linked-list of opened files, * common information and the linked-list of opened files,
*/ */
struct _snd_virmidi_dev { struct snd_virmidi_dev {
snd_card_t *card; /* associated card */ struct snd_card *card; /* associated card */
snd_rawmidi_t *rmidi; /* rawmidi device */ struct snd_rawmidi *rmidi; /* rawmidi device */
int seq_mode; /* SNDRV_VIRMIDI_XXX */ int seq_mode; /* SNDRV_VIRMIDI_XXX */
int device; /* sequencer device */ int device; /* sequencer device */
int client; /* created/attached client */ int client; /* created/attached client */
...@@ -78,6 +76,6 @@ struct _snd_virmidi_dev { ...@@ -78,6 +76,6 @@ struct _snd_virmidi_dev {
#define SNDRV_VIRMIDI_SEQ_ATTACH 1 #define SNDRV_VIRMIDI_SEQ_ATTACH 1
#define SNDRV_VIRMIDI_SEQ_DISPATCH 2 #define SNDRV_VIRMIDI_SEQ_DISPATCH 2
int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
#endif /* __SOUND_SEQ_VIRMIDI */ #endif /* __SOUND_SEQ_VIRMIDI */
This diff is collapsed.
...@@ -30,24 +30,24 @@ ...@@ -30,24 +30,24 @@
/* client manager */ /* client manager */
struct _snd_seq_user_client { struct snd_seq_user_client {
struct file *file; /* file struct of client */ struct file *file; /* file struct of client */
/* ... */ /* ... */
/* fifo */ /* fifo */
fifo_t *fifo; /* queue for incoming events */ struct snd_seq_fifo *fifo; /* queue for incoming events */
int fifo_pool_size; int fifo_pool_size;
}; };
struct _snd_seq_kernel_client { struct snd_seq_kernel_client {
snd_card_t *card; struct snd_card *card;
/* pointer to client functions */ /* pointer to client functions */
void *private_data; /* private data for client */ void *private_data; /* private data for client */
/* ... */ /* ... */
}; };
struct _snd_seq_client { struct snd_seq_client {
snd_seq_client_type_t type; snd_seq_client_type_t type;
unsigned int accept_input: 1, unsigned int accept_input: 1,
accept_output: 1; accept_output: 1;
...@@ -65,40 +65,42 @@ struct _snd_seq_client { ...@@ -65,40 +65,42 @@ struct _snd_seq_client {
int convert32; /* convert 32->64bit */ int convert32; /* convert 32->64bit */
/* output pool */ /* output pool */
pool_t *pool; /* memory pool for this client */ struct snd_seq_pool *pool; /* memory pool for this client */
union { union {
user_client_t user; struct snd_seq_user_client user;
kernel_client_t kernel; struct snd_seq_kernel_client kernel;
} data; } data;
}; };
/* usage statistics */ /* usage statistics */
typedef struct { struct snd_seq_usage {
int cur; int cur;
int peak; int peak;
} usage_t; };
extern int client_init_data(void); int client_init_data(void);
extern int snd_sequencer_device_init(void); int snd_sequencer_device_init(void);
extern void snd_sequencer_device_done(void); void snd_sequencer_device_done(void);
/* get locked pointer to client */ /* get locked pointer to client */
extern client_t *snd_seq_client_use_ptr(int clientid); struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
/* unlock pointer to client */ /* unlock pointer to client */
#define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock) #define snd_seq_client_unlock(client) snd_use_lock_free(&(client)->use_lock)
/* dispatch event to client(s) */ /* dispatch event to client(s) */
extern int snd_seq_dispatch_event(snd_seq_event_cell_t *cell, int atomic, int hop); int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
/* exported to other modules */ /* exported to other modules */
extern int snd_seq_register_kernel_client(snd_seq_client_callback_t *callback, void *private_data); int snd_seq_register_kernel_client(struct snd_seq_client_callback *callback, void *private_data);
extern int snd_seq_unregister_kernel_client(int client); int snd_seq_unregister_kernel_client(int client);
extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
int snd_seq_kernel_client_enqueue_blocking(int client, snd_seq_event_t * ev, struct file *file, int atomic, int hop); int snd_seq_kernel_client_enqueue_blocking(int client, struct snd_seq_event * ev,
struct file *file, int atomic, int hop);
int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait); int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
int snd_seq_client_notify_subscription(int client, int port, snd_seq_port_subscribe_t *info, int evtype); int snd_seq_client_notify_subscription(int client, int port,
struct snd_seq_port_subscribe *info, int evtype);
#endif #endif
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include <linux/compat.h> #include <linux/compat.h>
struct sndrv_seq_port_info32 { struct snd_seq_port_info32 {
struct sndrv_seq_addr addr; /* client/port numbers */ struct snd_seq_addr addr; /* client/port numbers */
char name[64]; /* port name */ char name[64]; /* port name */
u32 capability; /* port capability bits */ u32 capability; /* port capability bits */
...@@ -41,11 +41,11 @@ struct sndrv_seq_port_info32 { ...@@ -41,11 +41,11 @@ struct sndrv_seq_port_info32 {
char reserved[59]; /* for future use */ char reserved[59]; /* for future use */
}; };
static int snd_seq_call_port_info_ioctl(client_t *client, unsigned int cmd, static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned int cmd,
struct sndrv_seq_port_info32 __user *data32) struct snd_seq_port_info32 __user *data32)
{ {
int err = -EFAULT; int err = -EFAULT;
snd_seq_port_info_t *data; struct snd_seq_port_info *data;
mm_segment_t fs; mm_segment_t fs;
data = kmalloc(sizeof(*data), GFP_KERNEL); data = kmalloc(sizeof(*data), GFP_KERNEL);
...@@ -80,16 +80,16 @@ static int snd_seq_call_port_info_ioctl(client_t *client, unsigned int cmd, ...@@ -80,16 +80,16 @@ static int snd_seq_call_port_info_ioctl(client_t *client, unsigned int cmd,
*/ */
enum { enum {
SNDRV_SEQ_IOCTL_CREATE_PORT32 = _IOWR('S', 0x20, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_CREATE_PORT32 = _IOWR('S', 0x20, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_DELETE_PORT32 = _IOW ('S', 0x21, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_DELETE_PORT32 = _IOW ('S', 0x21, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_GET_PORT_INFO32 = _IOWR('S', 0x22, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_GET_PORT_INFO32 = _IOWR('S', 0x22, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_SET_PORT_INFO32 = _IOW ('S', 0x23, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_SET_PORT_INFO32 = _IOW ('S', 0x23, struct snd_seq_port_info32),
SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32 = _IOWR('S', 0x52, struct sndrv_seq_port_info32), SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT32 = _IOWR('S', 0x52, struct snd_seq_port_info32),
}; };
static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{ {
client_t *client = (client_t *) file->private_data; struct snd_seq_client *client = file->private_data;
void __user *argp = compat_ptr(arg); void __user *argp = compat_ptr(arg);
snd_assert(client != NULL, return -ENXIO); snd_assert(client != NULL, return -ENXIO);
......
This diff is collapsed.
...@@ -73,12 +73,12 @@ MODULE_PARM_DESC(ports, "number of ports to be created"); ...@@ -73,12 +73,12 @@ MODULE_PARM_DESC(ports, "number of ports to be created");
module_param(duplex, bool, 0444); module_param(duplex, bool, 0444);
MODULE_PARM_DESC(duplex, "create DUPLEX ports"); MODULE_PARM_DESC(duplex, "create DUPLEX ports");
typedef struct snd_seq_dummy_port { struct snd_seq_dummy_port {
int client; int client;
int port; int port;
int duplex; int duplex;
int connect; int connect;
} snd_seq_dummy_port_t; };
static int my_client = -1; static int my_client = -1;
...@@ -88,11 +88,11 @@ static int my_client = -1; ...@@ -88,11 +88,11 @@ static int my_client = -1;
* Note: this callback is called only after all subscribers are removed. * Note: this callback is called only after all subscribers are removed.
*/ */
static int static int
dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info) dummy_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{ {
snd_seq_dummy_port_t *p; struct snd_seq_dummy_port *p;
int i; int i;
snd_seq_event_t ev; struct snd_seq_event ev;
p = private_data; p = private_data;
memset(&ev, 0, sizeof(ev)); memset(&ev, 0, sizeof(ev));
...@@ -116,10 +116,11 @@ dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info) ...@@ -116,10 +116,11 @@ dummy_unuse(void *private_data, snd_seq_port_subscribe_t *info)
* event input callback - just redirect events to subscribers * event input callback - just redirect events to subscribers
*/ */
static int static int
dummy_input(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop) dummy_input(struct snd_seq_event *ev, int direct, void *private_data,
int atomic, int hop)
{ {
snd_seq_dummy_port_t *p; struct snd_seq_dummy_port *p;
snd_seq_event_t tmpev; struct snd_seq_event tmpev;
p = private_data; p = private_data;
if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM || if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM ||
...@@ -146,12 +147,12 @@ dummy_free(void *private_data) ...@@ -146,12 +147,12 @@ dummy_free(void *private_data)
/* /*
* create a port * create a port
*/ */
static snd_seq_dummy_port_t __init * static struct snd_seq_dummy_port __init *
create_port(int idx, int type) create_port(int idx, int type)
{ {
snd_seq_port_info_t pinfo; struct snd_seq_port_info pinfo;
snd_seq_port_callback_t pcb; struct snd_seq_port_callback pcb;
snd_seq_dummy_port_t *rec; struct snd_seq_dummy_port *rec;
if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL)
return NULL; return NULL;
...@@ -192,9 +193,9 @@ create_port(int idx, int type) ...@@ -192,9 +193,9 @@ create_port(int idx, int type)
static int __init static int __init
register_client(void) register_client(void)
{ {
snd_seq_client_callback_t cb; struct snd_seq_client_callback cb;
snd_seq_client_info_t cinfo; struct snd_seq_client_info cinfo;
snd_seq_dummy_port_t *rec1, *rec2; struct snd_seq_dummy_port *rec1, *rec2;
int i; int i;
if (ports < 1) { if (ports < 1) {
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
/* FIFO */ /* FIFO */
/* create new fifo */ /* create new fifo */
fifo_t *snd_seq_fifo_new(int poolsize) struct snd_seq_fifo *snd_seq_fifo_new(int poolsize)
{ {
fifo_t *f; struct snd_seq_fifo *f;
f = kzalloc(sizeof(*f), GFP_KERNEL); f = kzalloc(sizeof(*f), GFP_KERNEL);
if (f == NULL) { if (f == NULL) {
...@@ -62,9 +62,9 @@ fifo_t *snd_seq_fifo_new(int poolsize) ...@@ -62,9 +62,9 @@ fifo_t *snd_seq_fifo_new(int poolsize)
return f; return f;
} }
void snd_seq_fifo_delete(fifo_t **fifo) void snd_seq_fifo_delete(struct snd_seq_fifo **fifo)
{ {
fifo_t *f; struct snd_seq_fifo *f;
snd_assert(fifo != NULL, return); snd_assert(fifo != NULL, return);
f = *fifo; f = *fifo;
...@@ -88,12 +88,12 @@ void snd_seq_fifo_delete(fifo_t **fifo) ...@@ -88,12 +88,12 @@ void snd_seq_fifo_delete(fifo_t **fifo)
kfree(f); kfree(f);
} }
static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f); static struct snd_seq_event_cell *fifo_cell_out(struct snd_seq_fifo *f);
/* clear queue */ /* clear queue */
void snd_seq_fifo_clear(fifo_t *f) void snd_seq_fifo_clear(struct snd_seq_fifo *f)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
/* clear overflow flag */ /* clear overflow flag */
...@@ -110,9 +110,10 @@ void snd_seq_fifo_clear(fifo_t *f) ...@@ -110,9 +110,10 @@ void snd_seq_fifo_clear(fifo_t *f)
/* enqueue event to fifo */ /* enqueue event to fifo */
int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event) int snd_seq_fifo_event_in(struct snd_seq_fifo *f,
struct snd_seq_event *event)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
int err; int err;
...@@ -148,9 +149,9 @@ int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event) ...@@ -148,9 +149,9 @@ int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event)
} }
/* dequeue cell from fifo */ /* dequeue cell from fifo */
static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f) static struct snd_seq_event_cell *fifo_cell_out(struct snd_seq_fifo *f)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
if ((cell = f->head) != NULL) { if ((cell = f->head) != NULL) {
f->head = cell->next; f->head = cell->next;
...@@ -167,9 +168,10 @@ static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f) ...@@ -167,9 +168,10 @@ static snd_seq_event_cell_t *fifo_cell_out(fifo_t *f)
} }
/* dequeue cell from fifo and copy on user space */ /* dequeue cell from fifo and copy on user space */
int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock) int snd_seq_fifo_cell_out(struct snd_seq_fifo *f,
struct snd_seq_event_cell **cellp, int nonblock)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
wait_queue_t wait; wait_queue_t wait;
...@@ -202,7 +204,8 @@ int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock) ...@@ -202,7 +204,8 @@ int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock)
} }
void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell) void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f,
struct snd_seq_event_cell *cell)
{ {
unsigned long flags; unsigned long flags;
...@@ -217,18 +220,19 @@ void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell) ...@@ -217,18 +220,19 @@ void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell)
/* polling; return non-zero if queue is available */ /* polling; return non-zero if queue is available */
int snd_seq_fifo_poll_wait(fifo_t *f, struct file *file, poll_table *wait) int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file,
poll_table *wait)
{ {
poll_wait(file, &f->input_sleep, wait); poll_wait(file, &f->input_sleep, wait);
return (f->cells > 0); return (f->cells > 0);
} }
/* change the size of pool; all old events are removed */ /* change the size of pool; all old events are removed */
int snd_seq_fifo_resize(fifo_t *f, int poolsize) int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize)
{ {
unsigned long flags; unsigned long flags;
pool_t *newpool, *oldpool; struct snd_seq_pool *newpool, *oldpool;
snd_seq_event_cell_t *cell, *next, *oldhead; struct snd_seq_event_cell *cell, *next, *oldhead;
snd_assert(f != NULL && f->pool != NULL, return -EINVAL); snd_assert(f != NULL && f->pool != NULL, return -EINVAL);
......
...@@ -27,46 +27,46 @@ ...@@ -27,46 +27,46 @@
/* === FIFO === */ /* === FIFO === */
typedef struct { struct snd_seq_fifo {
pool_t *pool; /* FIFO pool */ struct snd_seq_pool *pool; /* FIFO pool */
snd_seq_event_cell_t* head; /* pointer to head of fifo */ struct snd_seq_event_cell *head; /* pointer to head of fifo */
snd_seq_event_cell_t* tail; /* pointer to tail of fifo */ struct snd_seq_event_cell *tail; /* pointer to tail of fifo */
int cells; int cells;
spinlock_t lock; spinlock_t lock;
snd_use_lock_t use_lock; snd_use_lock_t use_lock;
wait_queue_head_t input_sleep; wait_queue_head_t input_sleep;
atomic_t overflow; atomic_t overflow;
} fifo_t; };
/* create new fifo (constructor) */ /* create new fifo (constructor) */
extern fifo_t *snd_seq_fifo_new(int poolsize); struct snd_seq_fifo *snd_seq_fifo_new(int poolsize);
/* delete fifo (destructor) */ /* delete fifo (destructor) */
extern void snd_seq_fifo_delete(fifo_t **f); void snd_seq_fifo_delete(struct snd_seq_fifo **f);
/* enqueue event to fifo */ /* enqueue event to fifo */
extern int snd_seq_fifo_event_in(fifo_t *f, snd_seq_event_t *event); int snd_seq_fifo_event_in(struct snd_seq_fifo *f, struct snd_seq_event *event);
/* lock fifo from release */ /* lock fifo from release */
#define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock) #define snd_seq_fifo_lock(fifo) snd_use_lock_use(&(fifo)->use_lock)
#define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock) #define snd_seq_fifo_unlock(fifo) snd_use_lock_free(&(fifo)->use_lock)
/* get a cell from fifo - fifo should be locked */ /* get a cell from fifo - fifo should be locked */
int snd_seq_fifo_cell_out(fifo_t *f, snd_seq_event_cell_t **cellp, int nonblock); int snd_seq_fifo_cell_out(struct snd_seq_fifo *f, struct snd_seq_event_cell **cellp, int nonblock);
/* free dequeued cell - fifo should be locked */ /* free dequeued cell - fifo should be locked */
extern void snd_seq_fifo_cell_putback(fifo_t *f, snd_seq_event_cell_t *cell); void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f, struct snd_seq_event_cell *cell);
/* clean up queue */ /* clean up queue */
extern void snd_seq_fifo_clear(fifo_t *f); void snd_seq_fifo_clear(struct snd_seq_fifo *f);
/* polling */ /* polling */
extern int snd_seq_fifo_poll_wait(fifo_t *f, struct file *file, poll_table *wait); int snd_seq_fifo_poll_wait(struct snd_seq_fifo *f, struct file *file, poll_table *wait);
/* resize pool in fifo */ /* resize pool in fifo */
int snd_seq_fifo_resize(fifo_t *f, int poolsize); int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);
#endif #endif
...@@ -28,15 +28,16 @@ ...@@ -28,15 +28,16 @@
#include "seq_timer.h" #include "seq_timer.h"
static snd_info_entry_t *queues_entry; static struct snd_info_entry *queues_entry;
static snd_info_entry_t *clients_entry; static struct snd_info_entry *clients_entry;
static snd_info_entry_t *timer_entry; static struct snd_info_entry *timer_entry;
static snd_info_entry_t * __init static struct snd_info_entry * __init
create_info_entry(char *name, int size, void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) create_info_entry(char *name, int size, void (*read)(struct snd_info_entry *,
struct snd_info_buffer *))
{ {
snd_info_entry_t *entry; struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root); entry = snd_info_create_module_entry(THIS_MODULE, name, snd_seq_root);
if (entry == NULL) if (entry == NULL)
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#include <sound/info.h> #include <sound/info.h>
#include <sound/seq_kernel.h> #include <sound/seq_kernel.h>
void snd_seq_info_clients_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); void snd_seq_info_clients_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
void snd_seq_info_timer_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); void snd_seq_info_timer_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
void snd_seq_info_queues_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer); void snd_seq_info_queues_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer);
int snd_seq_info_init( void ); int snd_seq_info_init( void );
......
This diff is collapsed.
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem) #define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem)
static inline int snd_seq_pool_available(pool_t *pool) static inline int snd_seq_pool_available(struct snd_seq_pool *pool)
{ {
return pool->total_elements - atomic_read(&pool->counter); return pool->total_elements - atomic_read(&pool->counter);
} }
static inline int snd_seq_output_ok(pool_t *pool) static inline int snd_seq_output_ok(struct snd_seq_pool *pool)
{ {
return snd_seq_pool_available(pool) >= pool->room; return snd_seq_pool_available(pool) >= pool->room;
} }
...@@ -72,7 +72,7 @@ static inline int snd_seq_output_ok(pool_t *pool) ...@@ -72,7 +72,7 @@ static inline int snd_seq_output_ok(pool_t *pool)
* call dump function to expand external data. * call dump function to expand external data.
*/ */
static int get_var_len(const snd_seq_event_t *event) static int get_var_len(const struct snd_seq_event *event)
{ {
if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
return -EINVAL; return -EINVAL;
...@@ -80,10 +80,11 @@ static int get_var_len(const snd_seq_event_t *event) ...@@ -80,10 +80,11 @@ static int get_var_len(const snd_seq_event_t *event)
return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK; return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
} }
int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data) int snd_seq_dump_var_event(const struct snd_seq_event *event,
snd_seq_dump_func_t func, void *private_data)
{ {
int len, err; int len, err;
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
if ((len = get_var_len(event)) <= 0) if ((len = get_var_len(event)) <= 0)
return len; return len;
...@@ -108,9 +109,9 @@ int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun ...@@ -108,9 +109,9 @@ int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun
return func(private_data, event->data.ext.ptr, len); return func(private_data, event->data.ext.ptr, len);
} }
cell = (snd_seq_event_cell_t*)event->data.ext.ptr; cell = (struct snd_seq_event_cell *)event->data.ext.ptr;
for (; len > 0 && cell; cell = cell->next) { for (; len > 0 && cell; cell = cell->next) {
int size = sizeof(snd_seq_event_t); int size = sizeof(struct snd_seq_event);
if (len < size) if (len < size)
size = len; size = len;
err = func(private_data, &cell->event, size); err = func(private_data, &cell->event, size);
...@@ -142,7 +143,8 @@ static int seq_copy_in_user(char __user **bufptr, const void *src, int size) ...@@ -142,7 +143,8 @@ static int seq_copy_in_user(char __user **bufptr, const void *src, int size)
return 0; return 0;
} }
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned) int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
int in_kernel, int size_aligned)
{ {
int len, newlen; int len, newlen;
int err; int err;
...@@ -174,17 +176,18 @@ int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, ...@@ -174,17 +176,18 @@ int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
* release this cell, free extended data if available * release this cell, free extended data if available
*/ */
static inline void free_cell(pool_t *pool, snd_seq_event_cell_t *cell) static inline void free_cell(struct snd_seq_pool *pool,
struct snd_seq_event_cell *cell)
{ {
cell->next = pool->free; cell->next = pool->free;
pool->free = cell; pool->free = cell;
atomic_dec(&pool->counter); atomic_dec(&pool->counter);
} }
void snd_seq_cell_free(snd_seq_event_cell_t * cell) void snd_seq_cell_free(struct snd_seq_event_cell * cell)
{ {
unsigned long flags; unsigned long flags;
pool_t *pool; struct snd_seq_pool *pool;
snd_assert(cell != NULL, return); snd_assert(cell != NULL, return);
pool = cell->pool; pool = cell->pool;
...@@ -194,7 +197,7 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell) ...@@ -194,7 +197,7 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell)
free_cell(pool, cell); free_cell(pool, cell);
if (snd_seq_ev_is_variable(&cell->event)) { if (snd_seq_ev_is_variable(&cell->event)) {
if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) { if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) {
snd_seq_event_cell_t *curp, *nextptr; struct snd_seq_event_cell *curp, *nextptr;
curp = cell->event.data.ext.ptr; curp = cell->event.data.ext.ptr;
for (; curp; curp = nextptr) { for (; curp; curp = nextptr) {
nextptr = curp->next; nextptr = curp->next;
...@@ -215,9 +218,11 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell) ...@@ -215,9 +218,11 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell)
/* /*
* allocate an event cell. * allocate an event cell.
*/ */
static int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int nonblock, struct file *file) static int snd_seq_cell_alloc(struct snd_seq_pool *pool,
struct snd_seq_event_cell **cellp,
int nonblock, struct file *file)
{ {
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
unsigned long flags; unsigned long flags;
int err = -EAGAIN; int err = -EAGAIN;
wait_queue_t wait; wait_queue_t wait;
...@@ -280,11 +285,13 @@ __error: ...@@ -280,11 +285,13 @@ __error:
* if the event has external data, the data is decomposed to additional * if the event has external data, the data is decomposed to additional
* cells. * cells.
*/ */
int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t **cellp, int nonblock, struct file *file) int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
struct snd_seq_event_cell **cellp, int nonblock,
struct file *file)
{ {
int ncells, err; int ncells, err;
unsigned int extlen; unsigned int extlen;
snd_seq_event_cell_t *cell; struct snd_seq_event_cell *cell;
*cellp = NULL; *cellp = NULL;
...@@ -292,7 +299,7 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t ...@@ -292,7 +299,7 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
extlen = 0; extlen = 0;
if (snd_seq_ev_is_variable(event)) { if (snd_seq_ev_is_variable(event)) {
extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK; extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
ncells = (extlen + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t); ncells = (extlen + sizeof(struct snd_seq_event) - 1) / sizeof(struct snd_seq_event);
} }
if (ncells >= pool->total_elements) if (ncells >= pool->total_elements)
return -ENOMEM; return -ENOMEM;
...@@ -309,18 +316,18 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t ...@@ -309,18 +316,18 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
int len = extlen; int len = extlen;
int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED; int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED;
int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR; int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR;
snd_seq_event_cell_t *src, *tmp, *tail; struct snd_seq_event_cell *src, *tmp, *tail;
char *buf; char *buf;
cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED; cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED;
cell->event.data.ext.ptr = NULL; cell->event.data.ext.ptr = NULL;
src = (snd_seq_event_cell_t*)event->data.ext.ptr; src = (struct snd_seq_event_cell *)event->data.ext.ptr;
buf = (char *)event->data.ext.ptr; buf = (char *)event->data.ext.ptr;
tail = NULL; tail = NULL;
while (ncells-- > 0) { while (ncells-- > 0) {
int size = sizeof(snd_seq_event_t); int size = sizeof(struct snd_seq_event);
if (len < size) if (len < size)
size = len; size = len;
err = snd_seq_cell_alloc(pool, &tmp, nonblock, file); err = snd_seq_cell_alloc(pool, &tmp, nonblock, file);
...@@ -358,7 +365,8 @@ __error: ...@@ -358,7 +365,8 @@ __error:
/* poll wait */ /* poll wait */
int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait) int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file,
poll_table *wait)
{ {
poll_wait(file, &pool->output_sleep, wait); poll_wait(file, &pool->output_sleep, wait);
return snd_seq_output_ok(pool); return snd_seq_output_ok(pool);
...@@ -366,17 +374,17 @@ int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait) ...@@ -366,17 +374,17 @@ int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait)
/* allocate room specified number of events */ /* allocate room specified number of events */
int snd_seq_pool_init(pool_t *pool) int snd_seq_pool_init(struct snd_seq_pool *pool)
{ {
int cell; int cell;
snd_seq_event_cell_t *cellptr; struct snd_seq_event_cell *cellptr;
unsigned long flags; unsigned long flags;
snd_assert(pool != NULL, return -EINVAL); snd_assert(pool != NULL, return -EINVAL);
if (pool->ptr) /* should be atomic? */ if (pool->ptr) /* should be atomic? */
return 0; return 0;
pool->ptr = vmalloc(sizeof(snd_seq_event_cell_t) * pool->size); pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size);
if (pool->ptr == NULL) { if (pool->ptr == NULL) {
snd_printd("seq: malloc for sequencer events failed\n"); snd_printd("seq: malloc for sequencer events failed\n");
return -ENOMEM; return -ENOMEM;
...@@ -402,10 +410,10 @@ int snd_seq_pool_init(pool_t *pool) ...@@ -402,10 +410,10 @@ int snd_seq_pool_init(pool_t *pool)
} }
/* remove events */ /* remove events */
int snd_seq_pool_done(pool_t *pool) int snd_seq_pool_done(struct snd_seq_pool *pool)
{ {
unsigned long flags; unsigned long flags;
snd_seq_event_cell_t *ptr; struct snd_seq_event_cell *ptr;
int max_count = 5 * HZ; int max_count = 5 * HZ;
snd_assert(pool != NULL, return -EINVAL); snd_assert(pool != NULL, return -EINVAL);
...@@ -446,9 +454,9 @@ int snd_seq_pool_done(pool_t *pool) ...@@ -446,9 +454,9 @@ int snd_seq_pool_done(pool_t *pool)
/* init new memory pool */ /* init new memory pool */
pool_t *snd_seq_pool_new(int poolsize) struct snd_seq_pool *snd_seq_pool_new(int poolsize)
{ {
pool_t *pool; struct snd_seq_pool *pool;
/* create pool block */ /* create pool block */
pool = kzalloc(sizeof(*pool), GFP_KERNEL); pool = kzalloc(sizeof(*pool), GFP_KERNEL);
...@@ -472,9 +480,9 @@ pool_t *snd_seq_pool_new(int poolsize) ...@@ -472,9 +480,9 @@ pool_t *snd_seq_pool_new(int poolsize)
} }
/* remove memory pool */ /* remove memory pool */
int snd_seq_pool_delete(pool_t **ppool) int snd_seq_pool_delete(struct snd_seq_pool **ppool)
{ {
pool_t *pool = *ppool; struct snd_seq_pool *pool = *ppool;
*ppool = NULL; *ppool = NULL;
if (pool == NULL) if (pool == NULL)
...@@ -497,7 +505,8 @@ void __exit snd_sequencer_memory_done(void) ...@@ -497,7 +505,8 @@ void __exit snd_sequencer_memory_done(void)
/* exported to seq_clientmgr.c */ /* exported to seq_clientmgr.c */
void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t *pool, char *space) void snd_seq_info_pool(struct snd_info_buffer *buffer,
struct snd_seq_pool *pool, char *space)
{ {
if (pool == NULL) if (pool == NULL)
return; return;
......
...@@ -24,23 +24,21 @@ ...@@ -24,23 +24,21 @@
#include <sound/seq_kernel.h> #include <sound/seq_kernel.h>
#include <linux/poll.h> #include <linux/poll.h>
typedef struct pool pool_t;
/* container for sequencer event (internal use) */ /* container for sequencer event (internal use) */
typedef struct snd_seq_event_cell_t { struct snd_seq_event_cell {
snd_seq_event_t event; struct snd_seq_event event;
pool_t *pool; /* used pool */ struct snd_seq_pool *pool; /* used pool */
struct snd_seq_event_cell_t *next; /* next cell */ struct snd_seq_event_cell *next; /* next cell */
} snd_seq_event_cell_t; };
/* design note: the pool is a contigious block of memory, if we dynamicly /* design note: the pool is a contigious block of memory, if we dynamicly
want to add additional cells to the pool be better store this in another want to add additional cells to the pool be better store this in another
pool as we need to know the base address of the pool when releasing pool as we need to know the base address of the pool when releasing
memory. */ memory. */
struct pool { struct snd_seq_pool {
snd_seq_event_cell_t *ptr; /* pointer to first event chunk */ struct snd_seq_event_cell *ptr; /* pointer to first event chunk */
snd_seq_event_cell_t *free; /* pointer to the head of the free list */ struct snd_seq_event_cell *free; /* pointer to the head of the free list */
int total_elements; /* pool size actually allocated */ int total_elements; /* pool size actually allocated */
atomic_t counter; /* cells free */ atomic_t counter; /* cells free */
...@@ -63,33 +61,34 @@ struct pool { ...@@ -63,33 +61,34 @@ struct pool {
spinlock_t lock; spinlock_t lock;
}; };
extern void snd_seq_cell_free(snd_seq_event_cell_t* cell); void snd_seq_cell_free(struct snd_seq_event_cell *cell);
int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t **cellp, int nonblock, struct file *file); int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
struct snd_seq_event_cell **cellp, int nonblock, struct file *file);
/* return number of unused (free) cells */ /* return number of unused (free) cells */
static inline int snd_seq_unused_cells(pool_t *pool) static inline int snd_seq_unused_cells(struct snd_seq_pool *pool)
{ {
return pool ? pool->total_elements - atomic_read(&pool->counter) : 0; return pool ? pool->total_elements - atomic_read(&pool->counter) : 0;
} }
/* return total number of allocated cells */ /* return total number of allocated cells */
static inline int snd_seq_total_cells(pool_t *pool) static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
{ {
return pool ? pool->total_elements : 0; return pool ? pool->total_elements : 0;
} }
/* init pool - allocate events */ /* init pool - allocate events */
int snd_seq_pool_init(pool_t *pool); int snd_seq_pool_init(struct snd_seq_pool *pool);
/* done pool - free events */ /* done pool - free events */
int snd_seq_pool_done(pool_t *pool); int snd_seq_pool_done(struct snd_seq_pool *pool);
/* create pool */ /* create pool */
pool_t *snd_seq_pool_new(int poolsize); struct snd_seq_pool *snd_seq_pool_new(int poolsize);
/* remove pool */ /* remove pool */
int snd_seq_pool_delete(pool_t **pool); int snd_seq_pool_delete(struct snd_seq_pool **pool);
/* init memory */ /* init memory */
int snd_sequencer_memory_init(void); int snd_sequencer_memory_init(void);
...@@ -98,7 +97,7 @@ int snd_sequencer_memory_init(void); ...@@ -98,7 +97,7 @@ int snd_sequencer_memory_init(void);
void snd_sequencer_memory_done(void); void snd_sequencer_memory_done(void);
/* polling */ /* polling */
int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait); int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait);
#endif #endif
...@@ -51,40 +51,40 @@ module_param(input_buffer_size, int, 0644); ...@@ -51,40 +51,40 @@ module_param(input_buffer_size, int, 0644);
MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes."); MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes.");
/* data for this midi synth driver */ /* data for this midi synth driver */
typedef struct { struct seq_midisynth {
snd_card_t *card; struct snd_card *card;
int device; int device;
int subdevice; int subdevice;
snd_rawmidi_file_t input_rfile; struct snd_rawmidi_file input_rfile;
snd_rawmidi_file_t output_rfile; struct snd_rawmidi_file output_rfile;
int seq_client; int seq_client;
int seq_port; int seq_port;
snd_midi_event_t *parser; struct snd_midi_event *parser;
} seq_midisynth_t; };
typedef struct { struct seq_midisynth_client {
int seq_client; int seq_client;
int num_ports; int num_ports;
int ports_per_device[SNDRV_RAWMIDI_DEVICES]; int ports_per_device[SNDRV_RAWMIDI_DEVICES];
seq_midisynth_t *ports[SNDRV_RAWMIDI_DEVICES]; struct seq_midisynth *ports[SNDRV_RAWMIDI_DEVICES];
} seq_midisynth_client_t; };
static seq_midisynth_client_t *synths[SNDRV_CARDS]; static struct seq_midisynth_client *synths[SNDRV_CARDS];
static DECLARE_MUTEX(register_mutex); static DECLARE_MUTEX(register_mutex);
/* handle rawmidi input event (MIDI v1.0 stream) */ /* handle rawmidi input event (MIDI v1.0 stream) */
static void snd_midi_input_event(snd_rawmidi_substream_t * substream) static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
{ {
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
seq_midisynth_t *msynth; struct seq_midisynth *msynth;
snd_seq_event_t ev; struct snd_seq_event ev;
char buf[16], *pbuf; char buf[16], *pbuf;
long res, count; long res, count;
if (substream == NULL) if (substream == NULL)
return; return;
runtime = substream->runtime; runtime = substream->runtime;
msynth = (seq_midisynth_t *) runtime->private_data; msynth = runtime->private_data;
if (msynth == NULL) if (msynth == NULL)
return; return;
memset(&ev, 0, sizeof(ev)); memset(&ev, 0, sizeof(ev));
...@@ -112,9 +112,9 @@ static void snd_midi_input_event(snd_rawmidi_substream_t * substream) ...@@ -112,9 +112,9 @@ static void snd_midi_input_event(snd_rawmidi_substream_t * substream)
} }
} }
static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int count) static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, int count)
{ {
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
int tmp; int tmp;
snd_assert(substream != NULL || buf != NULL, return -EINVAL); snd_assert(substream != NULL || buf != NULL, return -EINVAL);
...@@ -128,12 +128,12 @@ static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int co ...@@ -128,12 +128,12 @@ static int dump_midi(snd_rawmidi_substream_t *substream, const char *buf, int co
return 0; return 0;
} }
static int event_process_midi(snd_seq_event_t * ev, int direct, static int event_process_midi(struct snd_seq_event *ev, int direct,
void *private_data, int atomic, int hop) void *private_data, int atomic, int hop)
{ {
seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; struct seq_midisynth *msynth = private_data;
unsigned char msg[10]; /* buffer for constructing midi messages */ unsigned char msg[10]; /* buffer for constructing midi messages */
snd_rawmidi_substream_t *substream; struct snd_rawmidi_substream *substream;
int len; int len;
snd_assert(msynth != NULL, return -EINVAL); snd_assert(msynth != NULL, return -EINVAL);
...@@ -161,8 +161,8 @@ static int event_process_midi(snd_seq_event_t * ev, int direct, ...@@ -161,8 +161,8 @@ static int event_process_midi(snd_seq_event_t * ev, int direct,
} }
static int snd_seq_midisynth_new(seq_midisynth_t *msynth, static int snd_seq_midisynth_new(struct seq_midisynth *msynth,
snd_card_t *card, struct snd_card *card,
int device, int device,
int subdevice) int subdevice)
{ {
...@@ -175,12 +175,12 @@ static int snd_seq_midisynth_new(seq_midisynth_t *msynth, ...@@ -175,12 +175,12 @@ static int snd_seq_midisynth_new(seq_midisynth_t *msynth,
} }
/* open associated midi device for input */ /* open associated midi device for input */
static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_subscribe(void *private_data, struct snd_seq_port_subscribe *info)
{ {
int err; int err;
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
snd_rawmidi_runtime_t *runtime; struct snd_rawmidi_runtime *runtime;
snd_rawmidi_params_t params; struct snd_rawmidi_params params;
/* open midi port */ /* open midi port */
if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) { if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_INPUT, &msynth->input_rfile)) < 0) {
...@@ -203,10 +203,10 @@ static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *inf ...@@ -203,10 +203,10 @@ static int midisynth_subscribe(void *private_data, snd_seq_port_subscribe_t *inf
} }
/* close associated midi device for input */ /* close associated midi device for input */
static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_unsubscribe(void *private_data, struct snd_seq_port_subscribe *info)
{ {
int err; int err;
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
snd_assert(msynth->input_rfile.input != NULL, return -EINVAL); snd_assert(msynth->input_rfile.input != NULL, return -EINVAL);
err = snd_rawmidi_kernel_release(&msynth->input_rfile); err = snd_rawmidi_kernel_release(&msynth->input_rfile);
...@@ -214,11 +214,11 @@ static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *i ...@@ -214,11 +214,11 @@ static int midisynth_unsubscribe(void *private_data, snd_seq_port_subscribe_t *i
} }
/* open associated midi device for output */ /* open associated midi device for output */
static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info)
{ {
int err; int err;
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
snd_rawmidi_params_t params; struct snd_rawmidi_params params;
/* open midi port */ /* open midi port */
if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) { if ((err = snd_rawmidi_kernel_open(msynth->card->number, msynth->device, msynth->subdevice, SNDRV_RAWMIDI_LFLG_OUTPUT, &msynth->output_rfile)) < 0) {
...@@ -237,9 +237,9 @@ static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info) ...@@ -237,9 +237,9 @@ static int midisynth_use(void *private_data, snd_seq_port_subscribe_t *info)
} }
/* close associated midi device for output */ /* close associated midi device for output */
static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info) static int midisynth_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{ {
seq_midisynth_t *msynth = (seq_midisynth_t *)private_data; struct seq_midisynth *msynth = private_data;
unsigned char buf = 0xff; /* MIDI reset */ unsigned char buf = 0xff; /* MIDI reset */
snd_assert(msynth->output_rfile.output != NULL, return -EINVAL); snd_assert(msynth->output_rfile.output != NULL, return -EINVAL);
...@@ -250,7 +250,7 @@ static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info) ...@@ -250,7 +250,7 @@ static int midisynth_unuse(void *private_data, snd_seq_port_subscribe_t *info)
} }
/* delete given midi synth port */ /* delete given midi synth port */
static void snd_seq_midisynth_delete(seq_midisynth_t *msynth) static void snd_seq_midisynth_delete(struct seq_midisynth *msynth)
{ {
if (msynth == NULL) if (msynth == NULL)
return; return;
...@@ -265,10 +265,10 @@ static void snd_seq_midisynth_delete(seq_midisynth_t *msynth) ...@@ -265,10 +265,10 @@ static void snd_seq_midisynth_delete(seq_midisynth_t *msynth)
} }
/* set our client name */ /* set our client name */
static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card, static int set_client_name(struct seq_midisynth_client *client, struct snd_card *card,
snd_rawmidi_info_t *rmidi) struct snd_rawmidi_info *rmidi)
{ {
snd_seq_client_info_t cinfo; struct snd_seq_client_info cinfo;
const char *name; const char *name;
memset(&cinfo, 0, sizeof(cinfo)); memset(&cinfo, 0, sizeof(cinfo));
...@@ -281,17 +281,17 @@ static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card, ...@@ -281,17 +281,17 @@ static int set_client_name(seq_midisynth_client_t *client, snd_card_t *card,
/* register new midi synth port */ /* register new midi synth port */
static int static int
snd_seq_midisynth_register_port(snd_seq_device_t *dev) snd_seq_midisynth_register_port(struct snd_seq_device *dev)
{ {
seq_midisynth_client_t *client; struct seq_midisynth_client *client;
seq_midisynth_t *msynth, *ms; struct seq_midisynth *msynth, *ms;
snd_seq_port_info_t *port; struct snd_seq_port_info *port;
snd_rawmidi_info_t *info; struct snd_rawmidi_info *info;
int newclient = 0; int newclient = 0;
unsigned int p, ports; unsigned int p, ports;
snd_seq_client_callback_t callbacks; struct snd_seq_client_callback callbacks;
snd_seq_port_callback_t pcallbacks; struct snd_seq_port_callback pcallbacks;
snd_card_t *card = dev->card; struct snd_card *card = dev->card;
int device = dev->device; int device = dev->device;
unsigned int input_count = 0, output_count = 0; unsigned int input_count = 0, output_count = 0;
...@@ -342,7 +342,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev) ...@@ -342,7 +342,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
} else if (device == 0) } else if (device == 0)
set_client_name(client, card, info); /* use the first device's name */ set_client_name(client, card, info); /* use the first device's name */
msynth = kcalloc(ports, sizeof(seq_midisynth_t), GFP_KERNEL); msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL);
port = kmalloc(sizeof(*port), GFP_KERNEL); port = kmalloc(sizeof(*port), GFP_KERNEL);
if (msynth == NULL || port == NULL) if (msynth == NULL || port == NULL)
goto __nomem; goto __nomem;
...@@ -432,11 +432,11 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev) ...@@ -432,11 +432,11 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
/* release midi synth port */ /* release midi synth port */
static int static int
snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
{ {
seq_midisynth_client_t *client; struct seq_midisynth_client *client;
seq_midisynth_t *msynth; struct seq_midisynth *msynth;
snd_card_t *card = dev->card; struct snd_card *card = dev->card;
int device = dev->device, p, ports; int device = dev->device, p, ports;
down(&register_mutex); down(&register_mutex);
...@@ -465,7 +465,7 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) ...@@ -465,7 +465,7 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev)
static int __init alsa_seq_midi_init(void) static int __init alsa_seq_midi_init(void)
{ {
static snd_seq_dev_ops_t ops = { static struct snd_seq_dev_ops ops = {
snd_seq_midisynth_register_port, snd_seq_midisynth_register_port,
snd_seq_midisynth_unregister_port, snd_seq_midisynth_unregister_port,
}; };
......
...@@ -44,17 +44,25 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer MIDI emulation." ...@@ -44,17 +44,25 @@ MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer MIDI emulation."
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* Prototypes for static functions */ /* Prototypes for static functions */
static void note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int vel); static void note_off(struct snd_midi_op *ops, void *drv,
static void do_control(snd_midi_op_t *ops, void *private, struct snd_midi_channel *chan,
snd_midi_channel_set_t *chset, snd_midi_channel_t *chan, int note, int vel);
static void do_control(struct snd_midi_op *ops, void *private,
struct snd_midi_channel_set *chset,
struct snd_midi_channel *chan,
int control, int value); int control, int value);
static void rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); static void rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
static void nrpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); struct snd_midi_channel_set *chset);
static void sysex(snd_midi_op_t *ops, void *private, unsigned char *sysex, int len, snd_midi_channel_set_t *chset); static void nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
static void all_sounds_off(snd_midi_op_t *ops, void *private, snd_midi_channel_t *chan); struct snd_midi_channel_set *chset);
static void all_notes_off(snd_midi_op_t *ops, void *private, snd_midi_channel_t *chan); static void sysex(struct snd_midi_op *ops, void *private, unsigned char *sysex,
static void snd_midi_reset_controllers(snd_midi_channel_t *chan); int len, struct snd_midi_channel_set *chset);
static void reset_all_channels(snd_midi_channel_set_t *chset); static void all_sounds_off(struct snd_midi_op *ops, void *private,
struct snd_midi_channel *chan);
static void all_notes_off(struct snd_midi_op *ops, void *private,
struct snd_midi_channel *chan);
static void snd_midi_reset_controllers(struct snd_midi_channel *chan);
static void reset_all_channels(struct snd_midi_channel_set *chset);
/* /*
...@@ -72,10 +80,11 @@ static void reset_all_channels(snd_midi_channel_set_t *chset); ...@@ -72,10 +80,11 @@ static void reset_all_channels(snd_midi_channel_set_t *chset);
* be interpreted. * be interpreted.
*/ */
void void
snd_midi_process_event(snd_midi_op_t *ops, snd_midi_process_event(struct snd_midi_op *ops,
snd_seq_event_t *ev, snd_midi_channel_set_t *chanset) struct snd_seq_event *ev,
struct snd_midi_channel_set *chanset)
{ {
snd_midi_channel_t *chan; struct snd_midi_channel *chan;
void *drv; void *drv;
int dest_channel = 0; int dest_channel = 0;
...@@ -89,7 +98,8 @@ snd_midi_process_event(snd_midi_op_t *ops, ...@@ -89,7 +98,8 @@ snd_midi_process_event(snd_midi_op_t *ops,
if (snd_seq_ev_is_channel_type(ev)) { if (snd_seq_ev_is_channel_type(ev)) {
dest_channel = ev->data.note.channel; dest_channel = ev->data.note.channel;
if (dest_channel >= chanset->max_channels) { if (dest_channel >= chanset->max_channels) {
snd_printd("dest channel is %d, max is %d\n", dest_channel, chanset->max_channels); snd_printd("dest channel is %d, max is %d\n",
dest_channel, chanset->max_channels);
return; return;
} }
} }
...@@ -239,7 +249,8 @@ snd_midi_process_event(snd_midi_op_t *ops, ...@@ -239,7 +249,8 @@ snd_midi_process_event(snd_midi_op_t *ops,
* release note * release note
*/ */
static void static void
note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int vel) note_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
int note, int vel)
{ {
if (chan->gm_hold) { if (chan->gm_hold) {
/* Hold this note until pedal is turned off */ /* Hold this note until pedal is turned off */
...@@ -260,8 +271,8 @@ note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int ...@@ -260,8 +271,8 @@ note_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, int note, int
* events that need to take place immediately to the driver. * events that need to take place immediately to the driver.
*/ */
static void static void
do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset, do_control(struct snd_midi_op *ops, void *drv, struct snd_midi_channel_set *chset,
snd_midi_channel_t *chan, int control, int value) struct snd_midi_channel *chan, int control, int value)
{ {
int i; int i;
...@@ -376,7 +387,7 @@ do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset, ...@@ -376,7 +387,7 @@ do_control(snd_midi_op_t *ops, void *drv, snd_midi_channel_set_t *chset,
* initialize the MIDI status * initialize the MIDI status
*/ */
void void
snd_midi_channel_set_clear(snd_midi_channel_set_t *chset) snd_midi_channel_set_clear(struct snd_midi_channel_set *chset)
{ {
int i; int i;
...@@ -384,7 +395,7 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset) ...@@ -384,7 +395,7 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset)
chset->gs_master_volume = 127; chset->gs_master_volume = 127;
for (i = 0; i < chset->max_channels; i++) { for (i = 0; i < chset->max_channels; i++) {
snd_midi_channel_t *chan = chset->channels + i; struct snd_midi_channel *chan = chset->channels + i;
memset(chan->note, 0, sizeof(chan->note)); memset(chan->note, 0, sizeof(chan->note));
chan->midi_aftertouch = 0; chan->midi_aftertouch = 0;
...@@ -407,8 +418,8 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset) ...@@ -407,8 +418,8 @@ snd_midi_channel_set_clear(snd_midi_channel_set_t *chset)
* Process a rpn message. * Process a rpn message.
*/ */
static void static void
rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
snd_midi_channel_set_t *chset) struct snd_midi_channel_set *chset)
{ {
int type; int type;
int val; int val;
...@@ -447,8 +458,8 @@ rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, ...@@ -447,8 +458,8 @@ rpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan,
* Process an nrpn message. * Process an nrpn message.
*/ */
static void static void
nrpn(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan, nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
snd_midi_channel_set_t *chset) struct snd_midi_channel_set *chset)
{ {
/* parse XG NRPNs here if possible */ /* parse XG NRPNs here if possible */
if (ops->nrpn) if (ops->nrpn)
...@@ -475,7 +486,8 @@ get_channel(unsigned char cmd) ...@@ -475,7 +486,8 @@ get_channel(unsigned char cmd)
* Process a sysex message. * Process a sysex message.
*/ */
static void static void
sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_channel_set_t *chset) sysex(struct snd_midi_op *ops, void *private, unsigned char *buf, int len,
struct snd_midi_channel_set *chset)
{ {
/* GM on */ /* GM on */
static unsigned char gm_on_macro[] = { static unsigned char gm_on_macro[] = {
...@@ -588,7 +600,7 @@ sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_c ...@@ -588,7 +600,7 @@ sysex(snd_midi_op_t *ops, void *private, unsigned char *buf, int len, snd_midi_c
* all sound off * all sound off
*/ */
static void static void
all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) all_sounds_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
{ {
int n; int n;
...@@ -606,7 +618,7 @@ all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) ...@@ -606,7 +618,7 @@ all_sounds_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan)
* all notes off * all notes off
*/ */
static void static void
all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) all_notes_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
{ {
int n; int n;
...@@ -621,12 +633,12 @@ all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan) ...@@ -621,12 +633,12 @@ all_notes_off(snd_midi_op_t *ops, void *drv, snd_midi_channel_t *chan)
/* /*
* Initialise a single midi channel control block. * Initialise a single midi channel control block.
*/ */
static void snd_midi_channel_init(snd_midi_channel_t *p, int n) static void snd_midi_channel_init(struct snd_midi_channel *p, int n)
{ {
if (p == NULL) if (p == NULL)
return; return;
memset(p, 0, sizeof(snd_midi_channel_t)); memset(p, 0, sizeof(struct snd_midi_channel));
p->private = NULL; p->private = NULL;
p->number = n; p->number = n;
...@@ -642,12 +654,12 @@ static void snd_midi_channel_init(snd_midi_channel_t *p, int n) ...@@ -642,12 +654,12 @@ static void snd_midi_channel_init(snd_midi_channel_t *p, int n)
/* /*
* Allocate and initialise a set of midi channel control blocks. * Allocate and initialise a set of midi channel control blocks.
*/ */
static snd_midi_channel_t *snd_midi_channel_init_set(int n) static struct snd_midi_channel *snd_midi_channel_init_set(int n)
{ {
snd_midi_channel_t *chan; struct snd_midi_channel *chan;
int i; int i;
chan = kmalloc(n * sizeof(snd_midi_channel_t), GFP_KERNEL); chan = kmalloc(n * sizeof(struct snd_midi_channel), GFP_KERNEL);
if (chan) { if (chan) {
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
snd_midi_channel_init(chan+i, i); snd_midi_channel_init(chan+i, i);
...@@ -660,11 +672,11 @@ static snd_midi_channel_t *snd_midi_channel_init_set(int n) ...@@ -660,11 +672,11 @@ static snd_midi_channel_t *snd_midi_channel_init_set(int n)
* reset all midi channels * reset all midi channels
*/ */
static void static void
reset_all_channels(snd_midi_channel_set_t *chset) reset_all_channels(struct snd_midi_channel_set *chset)
{ {
int ch; int ch;
for (ch = 0; ch < chset->max_channels; ch++) { for (ch = 0; ch < chset->max_channels; ch++) {
snd_midi_channel_t *chan = chset->channels + ch; struct snd_midi_channel *chan = chset->channels + ch;
snd_midi_reset_controllers(chan); snd_midi_reset_controllers(chan);
chan->gm_rpn_pitch_bend_range = 256; /* 2 semitones */ chan->gm_rpn_pitch_bend_range = 256; /* 2 semitones */
chan->gm_rpn_fine_tuning = 0; chan->gm_rpn_fine_tuning = 0;
...@@ -681,9 +693,9 @@ reset_all_channels(snd_midi_channel_set_t *chset) ...@@ -681,9 +693,9 @@ reset_all_channels(snd_midi_channel_set_t *chset)
/* /*
* Allocate and initialise a midi channel set. * Allocate and initialise a midi channel set.
*/ */
snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n) struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n)
{ {
snd_midi_channel_set_t *chset; struct snd_midi_channel_set *chset;
chset = kmalloc(sizeof(*chset), GFP_KERNEL); chset = kmalloc(sizeof(*chset), GFP_KERNEL);
if (chset) { if (chset) {
...@@ -697,7 +709,7 @@ snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n) ...@@ -697,7 +709,7 @@ snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n)
/* /*
* Reset the midi controllers on a particular channel to default values. * Reset the midi controllers on a particular channel to default values.
*/ */
static void snd_midi_reset_controllers(snd_midi_channel_t *chan) static void snd_midi_reset_controllers(struct snd_midi_channel *chan)
{ {
memset(chan->control, 0, sizeof(chan->control)); memset(chan->control, 0, sizeof(chan->control));
chan->gm_volume = 127; chan->gm_volume = 127;
...@@ -709,7 +721,7 @@ static void snd_midi_reset_controllers(snd_midi_channel_t *chan) ...@@ -709,7 +721,7 @@ static void snd_midi_reset_controllers(snd_midi_channel_t *chan)
/* /*
* Free a midi channel set. * Free a midi channel set.
*/ */
void snd_midi_channel_free_set(snd_midi_channel_set_t *chset) void snd_midi_channel_free_set(struct snd_midi_channel_set *chset)
{ {
if (chset == NULL) if (chset == NULL)
return; return;
......
This diff is collapsed.
This diff is collapsed.
...@@ -40,37 +40,38 @@ ...@@ -40,37 +40,38 @@
*/ */
typedef struct subscribers_t { struct snd_seq_subscribers {
snd_seq_port_subscribe_t info; /* additional info */ struct snd_seq_port_subscribe info; /* additional info */
struct list_head src_list; /* link of sources */ struct list_head src_list; /* link of sources */
struct list_head dest_list; /* link of destinations */ struct list_head dest_list; /* link of destinations */
atomic_t ref_count; atomic_t ref_count;
} subscribers_t; };
typedef struct port_subs_info_t { struct snd_seq_port_subs_info {
struct list_head list_head; /* list of subscribed ports */ struct list_head list_head; /* list of subscribed ports */
unsigned int count; /* count of subscribers */ unsigned int count; /* count of subscribers */
unsigned int exclusive: 1; /* exclusive mode */ unsigned int exclusive: 1; /* exclusive mode */
struct rw_semaphore list_mutex; struct rw_semaphore list_mutex;
rwlock_t list_lock; rwlock_t list_lock;
snd_seq_kernel_port_open_t *open; int (*open)(void *private_data, struct snd_seq_port_subscribe *info);
snd_seq_kernel_port_close_t *close; int (*close)(void *private_data, struct snd_seq_port_subscribe *info);
} port_subs_info_t; };
typedef struct client_port_t { struct snd_seq_client_port {
snd_seq_addr_t addr; /* client/port number */ struct snd_seq_addr addr; /* client/port number */
struct module *owner; /* owner of this port */ struct module *owner; /* owner of this port */
char name[64]; /* port name */ char name[64]; /* port name */
struct list_head list; /* port list */ struct list_head list; /* port list */
snd_use_lock_t use_lock; snd_use_lock_t use_lock;
/* subscribers */ /* subscribers */
port_subs_info_t c_src; /* read (sender) list */ struct snd_seq_port_subs_info c_src; /* read (sender) list */
port_subs_info_t c_dest; /* write (dest) list */ struct snd_seq_port_subs_info c_dest; /* write (dest) list */
snd_seq_kernel_port_input_t *event_input; int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data,
snd_seq_kernel_port_private_free_t *private_free; int atomic, int hop);
void (*private_free)(void *private_data);
void *private_data; void *private_data;
unsigned int callback_all : 1; unsigned int callback_all : 1;
unsigned int closing : 1; unsigned int closing : 1;
...@@ -87,42 +88,55 @@ typedef struct client_port_t { ...@@ -87,42 +88,55 @@ typedef struct client_port_t {
int midi_voices; int midi_voices;
int synth_voices; int synth_voices;
} client_port_t; };
struct snd_seq_client;
/* return pointer to port structure and lock port */ /* return pointer to port structure and lock port */
client_port_t *snd_seq_port_use_ptr(client_t *client, int num); struct snd_seq_client_port *snd_seq_port_use_ptr(struct snd_seq_client *client, int num);
/* search for next port - port is locked if found */ /* search for next port - port is locked if found */
client_port_t *snd_seq_port_query_nearest(client_t *client, snd_seq_port_info_t *pinfo); struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *client,
struct snd_seq_port_info *pinfo);
/* unlock the port */ /* unlock the port */
#define snd_seq_port_unlock(port) snd_use_lock_free(&(port)->use_lock) #define snd_seq_port_unlock(port) snd_use_lock_free(&(port)->use_lock)
/* create a port, port number is returned (-1 on failure) */ /* create a port, port number is returned (-1 on failure) */
client_port_t *snd_seq_create_port(client_t *client, int port_index); struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, int port_index);
/* delete a port */ /* delete a port */
int snd_seq_delete_port(client_t *client, int port); int snd_seq_delete_port(struct snd_seq_client *client, int port);
/* delete all ports */ /* delete all ports */
int snd_seq_delete_all_ports(client_t *client); int snd_seq_delete_all_ports(struct snd_seq_client *client);
/* set port info fields */ /* set port info fields */
int snd_seq_set_port_info(client_port_t *port, snd_seq_port_info_t *info); int snd_seq_set_port_info(struct snd_seq_client_port *port,
struct snd_seq_port_info *info);
/* get port info fields */ /* get port info fields */
int snd_seq_get_port_info(client_port_t *port, snd_seq_port_info_t *info); int snd_seq_get_port_info(struct snd_seq_client_port *port,
struct snd_seq_port_info *info);
/* add subscriber to subscription list */ /* add subscriber to subscription list */
int snd_seq_port_connect(client_t *caller, client_t *s, client_port_t *sp, client_t *d, client_port_t *dp, snd_seq_port_subscribe_t *info); int snd_seq_port_connect(struct snd_seq_client *caller,
struct snd_seq_client *s, struct snd_seq_client_port *sp,
struct snd_seq_client *d, struct snd_seq_client_port *dp,
struct snd_seq_port_subscribe *info);
/* remove subscriber from subscription list */ /* remove subscriber from subscription list */
int snd_seq_port_disconnect(client_t *caller, client_t *s, client_port_t *sp, client_t *d, client_port_t *dp, snd_seq_port_subscribe_t *info); int snd_seq_port_disconnect(struct snd_seq_client *caller,
struct snd_seq_client *s, struct snd_seq_client_port *sp,
struct snd_seq_client *d, struct snd_seq_client_port *dp,
struct snd_seq_port_subscribe *info);
/* subscribe port */ /* subscribe port */
int snd_seq_port_subscribe(client_port_t *port, snd_seq_port_subscribe_t *info); int snd_seq_port_subscribe(struct snd_seq_client_port *port,
struct snd_seq_port_subscribe *info);
/* get matched subscriber */ /* get matched subscriber */
subscribers_t *snd_seq_port_get_subscription(port_subs_info_t *src_grp, snd_seq_addr_t *dest_addr); struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp,
struct snd_seq_addr *dest_addr);
#endif #endif
This diff is collapsed.
...@@ -26,37 +26,37 @@ ...@@ -26,37 +26,37 @@
/* === PRIOQ === */ /* === PRIOQ === */
typedef struct { struct snd_seq_prioq {
snd_seq_event_cell_t* head; /* pointer to head of prioq */ struct snd_seq_event_cell *head; /* pointer to head of prioq */
snd_seq_event_cell_t* tail; /* pointer to tail of prioq */ struct snd_seq_event_cell *tail; /* pointer to tail of prioq */
int cells; int cells;
spinlock_t lock; spinlock_t lock;
} prioq_t; };
/* create new prioq (constructor) */ /* create new prioq (constructor) */
extern prioq_t *snd_seq_prioq_new(void); struct snd_seq_prioq *snd_seq_prioq_new(void);
/* delete prioq (destructor) */ /* delete prioq (destructor) */
extern void snd_seq_prioq_delete(prioq_t **fifo); void snd_seq_prioq_delete(struct snd_seq_prioq **fifo);
/* enqueue cell to prioq */ /* enqueue cell to prioq */
extern int snd_seq_prioq_cell_in(prioq_t *f, snd_seq_event_cell_t *cell); int snd_seq_prioq_cell_in(struct snd_seq_prioq *f, struct snd_seq_event_cell *cell);
/* dequeue cell from prioq */ /* dequeue cell from prioq */
extern snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t *f); struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f);
/* return number of events available in prioq */ /* return number of events available in prioq */
extern int snd_seq_prioq_avail(prioq_t *f); int snd_seq_prioq_avail(struct snd_seq_prioq *f);
/* peek at cell at the head of the prioq */ /* peek at cell at the head of the prioq */
extern snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t *f); struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq *f);
/* client left queue */ /* client left queue */
extern void snd_seq_prioq_leave(prioq_t *f, int client, int timestamp); void snd_seq_prioq_leave(struct snd_seq_prioq *f, int client, int timestamp);
/* Remove events */ /* Remove events */
void snd_seq_prioq_remove_events(prioq_t * f, int client, void snd_seq_prioq_remove_events(struct snd_seq_prioq *f, int client,
snd_seq_remove_events_t *info); struct snd_seq_remove_events *info);
#endif #endif
This diff is collapsed.
This diff is collapsed.
...@@ -66,12 +66,12 @@ static int announce_port = -1; ...@@ -66,12 +66,12 @@ static int announce_port = -1;
/* fill standard header data, source port & channel are filled in */ /* fill standard header data, source port & channel are filled in */
static int setheader(snd_seq_event_t * ev, int client, int port) static int setheader(struct snd_seq_event * ev, int client, int port)
{ {
if (announce_port < 0) if (announce_port < 0)
return -ENODEV; return -ENODEV;
memset(ev, 0, sizeof(snd_seq_event_t)); memset(ev, 0, sizeof(struct snd_seq_event));
ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK; ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED; ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED;
...@@ -92,7 +92,7 @@ static int setheader(snd_seq_event_t * ev, int client, int port) ...@@ -92,7 +92,7 @@ static int setheader(snd_seq_event_t * ev, int client, int port)
/* entry points for broadcasting system events */ /* entry points for broadcasting system events */
void snd_seq_system_broadcast(int client, int port, int type) void snd_seq_system_broadcast(int client, int port, int type)
{ {
snd_seq_event_t ev; struct snd_seq_event ev;
if (setheader(&ev, client, port) < 0) if (setheader(&ev, client, port) < 0)
return; return;
...@@ -101,7 +101,7 @@ void snd_seq_system_broadcast(int client, int port, int type) ...@@ -101,7 +101,7 @@ void snd_seq_system_broadcast(int client, int port, int type)
} }
/* entry points for broadcasting system events */ /* entry points for broadcasting system events */
int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev) int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev)
{ {
ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED; ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED;
ev->source.client = sysclient; ev->source.client = sysclient;
...@@ -112,7 +112,7 @@ int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev) ...@@ -112,7 +112,7 @@ int snd_seq_system_notify(int client, int port, snd_seq_event_t *ev)
} }
/* call-back handler for timer events */ /* call-back handler for timer events */
static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_data, int atomic, int hop) static int event_input_timer(struct snd_seq_event * ev, int direct, void *private_data, int atomic, int hop)
{ {
return snd_seq_control_queue(ev, atomic, hop); return snd_seq_control_queue(ev, atomic, hop);
} }
...@@ -121,10 +121,10 @@ static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_dat ...@@ -121,10 +121,10 @@ static int event_input_timer(snd_seq_event_t * ev, int direct, void *private_dat
int __init snd_seq_system_client_init(void) int __init snd_seq_system_client_init(void)
{ {
snd_seq_client_callback_t callbacks; struct snd_seq_client_callback callbacks;
snd_seq_port_callback_t pcallbacks; struct snd_seq_port_callback pcallbacks;
snd_seq_client_info_t *inf; struct snd_seq_client_info *inf;
snd_seq_port_info_t *port; struct snd_seq_port_info *port;
inf = kzalloc(sizeof(*inf), GFP_KERNEL); inf = kzalloc(sizeof(*inf), GFP_KERNEL);
port = kzalloc(sizeof(*port), GFP_KERNEL); port = kzalloc(sizeof(*port), GFP_KERNEL);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment