提交 19ac31e8 编写于 作者: T Takashi Iwai 提交者: Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: Instrument layer

Modules: Instrument layer

Remove xxx_t typedefs from the core instrument layer codes.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 c7e0b5bf
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
* FM operator * FM operator
*/ */
typedef struct fm_operator { struct fm_operator {
unsigned char am_vib; unsigned char am_vib;
unsigned char ksl_level; unsigned char ksl_level;
unsigned char attack_decay; unsigned char attack_decay;
unsigned char sustain_release; unsigned char sustain_release;
unsigned char wave_select; unsigned char wave_select;
} fm_operator_t; };
/* /*
* Instrument * Instrument
...@@ -54,11 +54,11 @@ typedef struct fm_operator { ...@@ -54,11 +54,11 @@ typedef struct fm_operator {
#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ #define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ #define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
typedef struct { struct fm_instrument {
unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned char type; /* instrument type */ unsigned char type; /* instrument type */
fm_operator_t op[4]; struct fm_operator op[4];
unsigned char feedback_connection[2]; unsigned char feedback_connection[2];
unsigned char echo_delay; unsigned char echo_delay;
...@@ -68,7 +68,7 @@ typedef struct { ...@@ -68,7 +68,7 @@ typedef struct {
unsigned char fix_dur; unsigned char fix_dur;
unsigned char modes; unsigned char modes;
unsigned char fix_key; unsigned char fix_key;
} fm_instrument_t; };
/* /*
* *
...@@ -88,25 +88,25 @@ typedef struct { ...@@ -88,25 +88,25 @@ typedef struct {
* FM operator * FM operator
*/ */
typedef struct fm_xoperator { struct fm_xoperator {
__u8 am_vib; __u8 am_vib;
__u8 ksl_level; __u8 ksl_level;
__u8 attack_decay; __u8 attack_decay;
__u8 sustain_release; __u8 sustain_release;
__u8 wave_select; __u8 wave_select;
} fm_xoperator_t; };
/* /*
* Instrument * Instrument
*/ */
typedef struct fm_xinstrument { struct fm_xinstrument {
__u32 stype; /* structure type */ __u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */ __u32 share_id[4]; /* share id - zero = no sharing */
__u8 type; /* instrument type */ __u8 type; /* instrument type */
fm_xoperator_t op[4]; /* fm operators */ struct fm_xoperator op[4]; /* fm operators */
__u8 feedback_connection[2]; __u8 feedback_connection[2];
__u8 echo_delay; __u8 echo_delay;
...@@ -116,15 +116,19 @@ typedef struct fm_xinstrument { ...@@ -116,15 +116,19 @@ typedef struct fm_xinstrument {
__u8 fix_dur; __u8 fix_dur;
__u8 modes; __u8 modes;
__u8 fix_key; __u8 fix_key;
} fm_xinstrument_t; };
#ifdef __KERNEL__ #ifdef __KERNEL__
#include "seq_instr.h" #include "seq_instr.h"
int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops, int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops,
snd_seq_kinstr_ops_t * next); struct snd_seq_kinstr_ops * next);
#endif #endif
/* typedefs for compatibility to user-space */
typedef struct fm_xoperator fm_xoperator_t;
typedef struct fm_xinstrument fm_xinstrument_t;
#endif /* __SOUND_AINSTR_FM_H */ #endif /* __SOUND_AINSTR_FM_H */
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
* Wavetable definitions * Wavetable definitions
*/ */
typedef struct gf1_wave { struct gf1_wave {
unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */ unsigned int format; /* wave format */
...@@ -88,7 +88,7 @@ typedef struct gf1_wave { ...@@ -88,7 +88,7 @@ typedef struct gf1_wave {
unsigned short scale_factor; /* 0-2048 or 0-2 */ unsigned short scale_factor; /* 0-2048 or 0-2 */
struct gf1_wave *next; struct gf1_wave *next;
} gf1_wave_t; };
/* /*
* Instrument * Instrument
...@@ -103,7 +103,7 @@ typedef struct gf1_wave { ...@@ -103,7 +103,7 @@ typedef struct gf1_wave {
#define IWFFFF_EFFECT_CHORUS 2 #define IWFFFF_EFFECT_CHORUS 2
#define IWFFFF_EFFECT_ECHO 3 #define IWFFFF_EFFECT_ECHO 3
typedef struct { struct gf1_instrument {
unsigned short exclusion; unsigned short exclusion;
unsigned short exclusion_group; /* 0 - none, 1-65535 */ unsigned short exclusion_group; /* 0 - none, 1-65535 */
...@@ -112,8 +112,8 @@ typedef struct { ...@@ -112,8 +112,8 @@ typedef struct {
unsigned char effect2; /* effect 2 */ unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */ unsigned char effect2_depth; /* 0-127 */
gf1_wave_t *wave; /* first waveform */ struct gf1_wave *wave; /* first waveform */
} gf1_instrument_t; };
/* /*
* *
...@@ -135,7 +135,7 @@ typedef struct { ...@@ -135,7 +135,7 @@ typedef struct {
* Wavetable definitions * Wavetable definitions
*/ */
typedef struct gf1_xwave { struct gf1_xwave {
__u32 stype; /* structure type */ __u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */ __u32 share_id[4]; /* share id - zero = no sharing */
...@@ -165,13 +165,13 @@ typedef struct gf1_xwave { ...@@ -165,13 +165,13 @@ typedef struct gf1_xwave {
__u8 vibrato_depth; __u8 vibrato_depth;
__u16 scale_frequency; __u16 scale_frequency;
__u16 scale_factor; /* 0-2048 or 0-2 */ __u16 scale_factor; /* 0-2048 or 0-2 */
} gf1_xwave_t; };
/* /*
* Instrument * Instrument
*/ */
typedef struct gf1_xinstrument { struct gf1_xinstrument {
__u32 stype; __u32 stype;
__u16 exclusion; __u16 exclusion;
...@@ -181,7 +181,7 @@ typedef struct gf1_xinstrument { ...@@ -181,7 +181,7 @@ typedef struct gf1_xinstrument {
__u8 effect1_depth; /* 0-127 */ __u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */ __u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */ __u8 effect2_depth; /* 0-127 */
} gf1_xinstrument_t; };
/* /*
* Instrument info * Instrument info
...@@ -191,35 +191,39 @@ typedef struct gf1_xinstrument { ...@@ -191,35 +191,39 @@ typedef struct gf1_xinstrument {
#define GF1_INFO_TREMOLO (1<<1) #define GF1_INFO_TREMOLO (1<<1)
#define GF1_INFO_VIBRATO (1<<2) #define GF1_INFO_VIBRATO (1<<2)
typedef struct gf1_info { struct gf1_info {
unsigned char flags; /* supported wave flags */ unsigned char flags; /* supported wave flags */
unsigned char pad[3]; unsigned char pad[3];
unsigned int features; /* supported features */ unsigned int features; /* supported features */
unsigned int max8_len; /* maximum 8-bit wave length */ unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */ unsigned int max16_len; /* maximum 16-bit wave length */
} gf1_info_t; };
#ifdef __KERNEL__ #ifdef __KERNEL__
#include "seq_instr.h" #include "seq_instr.h"
typedef struct { struct snd_gf1_ops {
void *private_data; void *private_data;
int (*info)(void *private_data, gf1_info_t *info); int (*info)(void *private_data, struct gf1_info *info);
int (*put_sample)(void *private_data, gf1_wave_t *wave, int (*put_sample)(void *private_data, struct gf1_wave *wave,
char __user *data, long len, int atomic); char __user *data, long len, int atomic);
int (*get_sample)(void *private_data, gf1_wave_t *wave, int (*get_sample)(void *private_data, struct gf1_wave *wave,
char __user *data, long len, int atomic); char __user *data, long len, int atomic);
int (*remove_sample)(void *private_data, gf1_wave_t *wave, int (*remove_sample)(void *private_data, struct gf1_wave *wave,
int atomic); int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
snd_seq_kinstr_ops_t kops; struct snd_seq_kinstr_ops kops;
} snd_gf1_ops_t; };
int snd_seq_gf1_init(snd_gf1_ops_t *ops, int snd_seq_gf1_init(struct snd_gf1_ops *ops,
void *private_data, void *private_data,
snd_seq_kinstr_ops_t *next); struct snd_seq_kinstr_ops *next);
#endif #endif
/* typedefs for compatibility to user-space */
typedef struct gf1_xwave gf1_xwave_t;
typedef struct gf1_xinstrument gf1_xinstrument_t;
#endif /* __SOUND_AINSTR_GF1_H */ #endif /* __SOUND_AINSTR_GF1_H */
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
* Wavetable definitions * Wavetable definitions
*/ */
typedef struct iwffff_wave { struct iwffff_wave {
unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */ unsigned int format; /* wave format */
...@@ -76,7 +76,7 @@ typedef struct iwffff_wave { ...@@ -76,7 +76,7 @@ typedef struct iwffff_wave {
unsigned char pad; unsigned char pad;
struct iwffff_wave *next; struct iwffff_wave *next;
} iwffff_wave_t; };
/* /*
* Layer * Layer
...@@ -85,13 +85,13 @@ typedef struct iwffff_wave { ...@@ -85,13 +85,13 @@ typedef struct iwffff_wave {
#define IWFFFF_LFO_SHAPE_TRIANGLE 0 #define IWFFFF_LFO_SHAPE_TRIANGLE 0
#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1 #define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
typedef struct iwffff_lfo { struct iwffff_lfo {
unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */ unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
signed short depth; /* volume +- (0-255) 0.48675dB/step */ signed short depth; /* volume +- (0-255) 0.48675dB/step */
signed short sweep; /* 0 - 950 deciseconds */ signed short sweep; /* 0 - 950 deciseconds */
unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */ unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
unsigned char delay; /* 0 - 255 deciseconds */ unsigned char delay; /* 0 - 255 deciseconds */
} iwffff_lfo_t; };
#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */ #define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
...@@ -102,12 +102,12 @@ typedef struct iwffff_lfo { ...@@ -102,12 +102,12 @@ typedef struct iwffff_lfo {
#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */ #define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */ #define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
typedef struct iwffff_env_point { struct iwffff_env_point {
unsigned short offset; unsigned short offset;
unsigned short rate; unsigned short rate;
} iwffff_env_point_t; };
typedef struct iwffff_env_record { struct iwffff_env_record {
unsigned short nattack; unsigned short nattack;
unsigned short nrelease; unsigned short nrelease;
unsigned short sustain_offset; unsigned short sustain_offset;
...@@ -118,15 +118,15 @@ typedef struct iwffff_env_record { ...@@ -118,15 +118,15 @@ typedef struct iwffff_env_record {
struct iwffff_env_record *next; struct iwffff_env_record *next;
/* points are stored here */ /* points are stored here */
/* count of points = nattack + nrelease */ /* count of points = nattack + nrelease */
} iwffff_env_record_t; };
typedef struct iwffff_env { struct iwffff_env {
unsigned char flags; unsigned char flags;
unsigned char mode; unsigned char mode;
unsigned char index; unsigned char index;
unsigned char pad; unsigned char pad;
struct iwffff_env_record *record; struct iwffff_env_record *record;
} iwffff_env_t; };
#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */ #define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
...@@ -138,7 +138,7 @@ typedef struct iwffff_env { ...@@ -138,7 +138,7 @@ typedef struct iwffff_env {
#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */ #define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */ #define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
typedef struct iwffff_layer { struct iwffff_layer {
unsigned char flags; unsigned char flags;
unsigned char velocity_mode; unsigned char velocity_mode;
unsigned char layer_event; unsigned char layer_event;
...@@ -147,17 +147,17 @@ typedef struct iwffff_layer { ...@@ -147,17 +147,17 @@ typedef struct iwffff_layer {
unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */ unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
unsigned char pan_freq_scale; /* position based on frequency (0-127) */ unsigned char pan_freq_scale; /* position based on frequency (0-127) */
unsigned char attenuation; /* 0-127 (no corresponding midi controller) */ unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
iwffff_lfo_t tremolo; /* tremolo effect */ struct iwffff_lfo tremolo; /* tremolo effect */
iwffff_lfo_t vibrato; /* vibrato effect */ struct iwffff_lfo vibrato; /* vibrato effect */
unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
unsigned char freq_center; /* center for keyboard frequency scaling */ unsigned char freq_center; /* center for keyboard frequency scaling */
unsigned char pad; unsigned char pad;
iwffff_env_t penv; /* pitch envelope */ struct iwffff_env penv; /* pitch envelope */
iwffff_env_t venv; /* volume envelope */ struct iwffff_env venv; /* volume envelope */
iwffff_wave_t *wave; struct iwffff_wave *wave;
struct iwffff_layer *next; struct iwffff_layer *next;
} iwffff_layer_t; };
/* /*
* Instrument * Instrument
...@@ -177,7 +177,7 @@ typedef struct iwffff_layer { ...@@ -177,7 +177,7 @@ typedef struct iwffff_layer {
#define IWFFFF_EFFECT_CHORUS 2 #define IWFFFF_EFFECT_CHORUS 2
#define IWFFFF_EFFECT_ECHO 3 #define IWFFFF_EFFECT_ECHO 3
typedef struct { struct iwffff_instrument {
unsigned short exclusion; unsigned short exclusion;
unsigned short layer_type; unsigned short layer_type;
unsigned short exclusion_group; /* 0 - none, 1-65535 */ unsigned short exclusion_group; /* 0 - none, 1-65535 */
...@@ -187,8 +187,8 @@ typedef struct { ...@@ -187,8 +187,8 @@ typedef struct {
unsigned char effect2; /* effect 2 */ unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */ unsigned char effect2_depth; /* 0-127 */
iwffff_layer_t *layer; /* first layer */ struct iwffff_layer *layer; /* first layer */
} iwffff_instrument_t; };
/* /*
* *
...@@ -216,7 +216,7 @@ typedef struct { ...@@ -216,7 +216,7 @@ typedef struct {
* Wavetable definitions * Wavetable definitions
*/ */
typedef struct iwffff_xwave { struct iwffff_xwave {
__u32 stype; /* structure type */ __u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */ __u32 share_id[4]; /* share id - zero = no sharing */
...@@ -234,26 +234,26 @@ typedef struct iwffff_xwave { ...@@ -234,26 +234,26 @@ typedef struct iwffff_xwave {
__u8 low_note; /* lower frequency range for this waveform */ __u8 low_note; /* lower frequency range for this waveform */
__u8 high_note; /* higher frequency range for this waveform */ __u8 high_note; /* higher frequency range for this waveform */
__u8 pad; __u8 pad;
} iwffff_xwave_t; };
/* /*
* Layer * Layer
*/ */
typedef struct iwffff_xlfo { struct iwffff_xlfo {
__u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */ __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
__s16 depth; /* volume +- (0-255) 0.48675dB/step */ __s16 depth; /* volume +- (0-255) 0.48675dB/step */
__s16 sweep; /* 0 - 950 deciseconds */ __s16 sweep; /* 0 - 950 deciseconds */
__u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */ __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
__u8 delay; /* 0 - 255 deciseconds */ __u8 delay; /* 0 - 255 deciseconds */
} iwffff_xlfo_t; };
typedef struct iwffff_xenv_point { struct iwffff_xenv_point {
__u16 offset; __u16 offset;
__u16 rate; __u16 rate;
} iwffff_xenv_point_t; };
typedef struct iwffff_xenv_record { struct iwffff_xenv_record {
__u32 stype; __u32 stype;
__u16 nattack; __u16 nattack;
__u16 nrelease; __u16 nrelease;
...@@ -264,16 +264,16 @@ typedef struct iwffff_xenv_record { ...@@ -264,16 +264,16 @@ typedef struct iwffff_xenv_record {
__u8 pad; __u8 pad;
/* points are stored here.. */ /* points are stored here.. */
/* count of points = nattack + nrelease */ /* count of points = nattack + nrelease */
} iwffff_xenv_record_t; };
typedef struct iwffff_xenv { struct iwffff_xenv {
__u8 flags; __u8 flags;
__u8 mode; __u8 mode;
__u8 index; __u8 index;
__u8 pad; __u8 pad;
} iwffff_xenv_t; };
typedef struct iwffff_xlayer { struct iwffff_xlayer {
__u32 stype; __u32 stype;
__u8 flags; __u8 flags;
__u8 velocity_mode; __u8 velocity_mode;
...@@ -283,20 +283,20 @@ typedef struct iwffff_xlayer { ...@@ -283,20 +283,20 @@ typedef struct iwffff_xlayer {
__u8 pan; /* pan offset from CC1 (0 left - 127 right) */ __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
__u8 pan_freq_scale; /* position based on frequency (0-127) */ __u8 pan_freq_scale; /* position based on frequency (0-127) */
__u8 attenuation; /* 0-127 (no corresponding midi controller) */ __u8 attenuation; /* 0-127 (no corresponding midi controller) */
iwffff_xlfo_t tremolo; /* tremolo effect */ struct iwffff_xlfo tremolo; /* tremolo effect */
iwffff_xlfo_t vibrato; /* vibrato effect */ struct iwffff_xlfo vibrato; /* vibrato effect */
__u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
__u8 freq_center; /* center for keyboard frequency scaling */ __u8 freq_center; /* center for keyboard frequency scaling */
__u8 pad; __u8 pad;
iwffff_xenv_t penv; /* pitch envelope */ struct iwffff_xenv penv; /* pitch envelope */
iwffff_xenv_t venv; /* volume envelope */ struct iwffff_xenv venv; /* volume envelope */
} iwffff_xlayer_t; };
/* /*
* Instrument * Instrument
*/ */
typedef struct iwffff_xinstrument { struct iwffff_xinstrument {
__u32 stype; __u32 stype;
__u16 exclusion; __u16 exclusion;
...@@ -307,7 +307,7 @@ typedef struct iwffff_xinstrument { ...@@ -307,7 +307,7 @@ typedef struct iwffff_xinstrument {
__u8 effect1_depth; /* 0-127 */ __u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */ __u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */ __u8 effect2_depth; /* 0-127 */
} iwffff_xinstrument_t; };
/* /*
* ROM support * ROM support
...@@ -316,7 +316,7 @@ typedef struct iwffff_xinstrument { ...@@ -316,7 +316,7 @@ typedef struct iwffff_xinstrument {
#define IWFFFF_ROM_HDR_SIZE 512 #define IWFFFF_ROM_HDR_SIZE 512
typedef struct { struct iwffff_rom_header {
__u8 iwave[8]; __u8 iwave[8];
__u8 revision; __u8 revision;
__u8 series_number; __u8 series_number;
...@@ -328,7 +328,7 @@ typedef struct { ...@@ -328,7 +328,7 @@ typedef struct {
__u8 copyright[128]; __u8 copyright[128];
__u8 vendor_name[64]; __u8 vendor_name[64];
__u8 description[128]; __u8 description[128];
} iwffff_rom_header_t; };
/* /*
* Instrument info * Instrument info
...@@ -339,35 +339,46 @@ typedef struct { ...@@ -339,35 +339,46 @@ typedef struct {
#define IWFFFF_INFO_LFO_TREMOLO (1<<2) #define IWFFFF_INFO_LFO_TREMOLO (1<<2)
#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3) #define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
typedef struct iwffff_info { struct iwffff_info {
unsigned int format; /* supported format bits */ unsigned int format; /* supported format bits */
unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */ unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
unsigned int lfos; /* LFO effects */ unsigned int lfos; /* LFO effects */
unsigned int max8_len; /* maximum 8-bit wave length */ unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */ unsigned int max16_len; /* maximum 16-bit wave length */
} iwffff_info_t; };
#ifdef __KERNEL__ #ifdef __KERNEL__
#include "seq_instr.h" #include "seq_instr.h"
typedef struct { struct snd_iwffff_ops {
void *private_data; void *private_data;
int (*info)(void *private_data, iwffff_info_t *info); int (*info)(void *private_data, struct iwffff_info *info);
int (*put_sample)(void *private_data, iwffff_wave_t *wave, int (*put_sample)(void *private_data, struct iwffff_wave *wave,
char __user *data, long len, int atomic); char __user *data, long len, int atomic);
int (*get_sample)(void *private_data, iwffff_wave_t *wave, int (*get_sample)(void *private_data, struct iwffff_wave *wave,
char __user *data, long len, int atomic); char __user *data, long len, int atomic);
int (*remove_sample)(void *private_data, iwffff_wave_t *wave, int (*remove_sample)(void *private_data, struct iwffff_wave *wave,
int atomic); int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
snd_seq_kinstr_ops_t kops; struct snd_seq_kinstr_ops kops;
} snd_iwffff_ops_t; };
int snd_seq_iwffff_init(snd_iwffff_ops_t *ops, int snd_seq_iwffff_init(struct snd_iwffff_ops *ops,
void *private_data, void *private_data,
snd_seq_kinstr_ops_t *next); struct snd_seq_kinstr_ops *next);
#endif #endif
/* typedefs for compatibility to user-space */
typedef struct iwffff_xwave iwffff_xwave_t;
typedef struct iwffff_xlfo iwffff_xlfo_t;
typedef struct iwffff_xenv_point iwffff_xenv_point_t;
typedef struct iwffff_xenv_record iwffff_xenv_record_t;
typedef struct iwffff_xenv iwffff_xenv_t;
typedef struct iwffff_xlayer iwffff_xlayer_t;
typedef struct iwffff_xinstrument iwffff_xinstrument_t;
typedef struct iwffff_rom_header iwffff_rom_header_t;
typedef struct iwffff_info iwffff_info_t;
#endif /* __SOUND_AINSTR_IW_H */ #endif /* __SOUND_AINSTR_IW_H */
...@@ -61,18 +61,18 @@ ...@@ -61,18 +61,18 @@
* instrument info * instrument info
*/ */
typedef struct simple_instrument_info { struct simple_instrument_info {
unsigned int format; /* supported format bits */ unsigned int format; /* supported format bits */
unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */ unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
unsigned int max8_len; /* maximum 8-bit wave length */ unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */ unsigned int max16_len; /* maximum 16-bit wave length */
} simple_instrument_info_t; };
/* /*
* Instrument * Instrument
*/ */
typedef struct { struct simple_instrument {
unsigned int share_id[4]; /* share id - zero = no sharing */ unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */ unsigned int format; /* wave format */
...@@ -92,7 +92,7 @@ typedef struct { ...@@ -92,7 +92,7 @@ typedef struct {
unsigned char effect1_depth; /* 0-127 */ unsigned char effect1_depth; /* 0-127 */
unsigned char effect2; /* effect 2 */ unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */ unsigned char effect2_depth; /* 0-127 */
} simple_instrument_t; };
/* /*
* *
...@@ -112,7 +112,7 @@ typedef struct { ...@@ -112,7 +112,7 @@ typedef struct {
* Instrument * Instrument
*/ */
typedef struct simple_xinstrument { struct simple_xinstrument {
__u32 stype; __u32 stype;
__u32 share_id[4]; /* share id - zero = no sharing */ __u32 share_id[4]; /* share id - zero = no sharing */
...@@ -128,29 +128,32 @@ typedef struct simple_xinstrument { ...@@ -128,29 +128,32 @@ typedef struct simple_xinstrument {
__u8 effect1_depth; /* 0-127 */ __u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */ __u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */ __u8 effect2_depth; /* 0-127 */
} simple_xinstrument_t; };
#ifdef __KERNEL__ #ifdef __KERNEL__
#include "seq_instr.h" #include "seq_instr.h"
typedef struct { struct snd_simple_ops {
void *private_data; void *private_data;
int (*info)(void *private_data, simple_instrument_info_t *info); int (*info)(void *private_data, struct simple_instrument_info *info);
int (*put_sample)(void *private_data, simple_instrument_t *instr, int (*put_sample)(void *private_data, struct simple_instrument *instr,
char __user *data, long len, int atomic); char __user *data, long len, int atomic);
int (*get_sample)(void *private_data, simple_instrument_t *instr, int (*get_sample)(void *private_data, struct simple_instrument *instr,
char __user *data, long len, int atomic); char __user *data, long len, int atomic);
int (*remove_sample)(void *private_data, simple_instrument_t *instr, int (*remove_sample)(void *private_data, struct simple_instrument *instr,
int atomic); int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
snd_seq_kinstr_ops_t kops; struct snd_seq_kinstr_ops kops;
} snd_simple_ops_t; };
int snd_seq_simple_init(snd_simple_ops_t *ops, int snd_seq_simple_init(struct snd_simple_ops *ops,
void *private_data, void *private_data,
snd_seq_kinstr_ops_t *next); struct snd_seq_kinstr_ops *next);
#endif #endif
/* typedefs for compatibility to user-space */
typedef struct simple_xinstrument simple_xinstrument_t;
#endif /* __SOUND_AINSTR_SIMPLE_H */ #endif /* __SOUND_AINSTR_SIMPLE_H */
...@@ -30,11 +30,11 @@ MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>"); ...@@ -30,11 +30,11 @@ MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>");
MODULE_DESCRIPTION("Advanced Linux Sound Architecture FM Instrument support."); MODULE_DESCRIPTION("Advanced Linux Sound Architecture FM Instrument support.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_fm_put(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic, int cmd) char __user *instr_data, long len, int atomic, int cmd)
{ {
fm_instrument_t *ip; struct fm_instrument *ip;
fm_xinstrument_t ix; struct fm_xinstrument ix;
int idx; int idx;
if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
...@@ -46,7 +46,7 @@ static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -46,7 +46,7 @@ static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr,
return -EFAULT; return -EFAULT;
if (ix.stype != FM_STRU_INSTR) if (ix.stype != FM_STRU_INSTR)
return -EINVAL; return -EINVAL;
ip = (fm_instrument_t *)KINSTR_DATA(instr); ip = (struct fm_instrument *)KINSTR_DATA(instr);
ip->share_id[0] = le32_to_cpu(ix.share_id[0]); ip->share_id[0] = le32_to_cpu(ix.share_id[0]);
ip->share_id[1] = le32_to_cpu(ix.share_id[1]); ip->share_id[1] = le32_to_cpu(ix.share_id[1]);
ip->share_id[2] = le32_to_cpu(ix.share_id[2]); ip->share_id[2] = le32_to_cpu(ix.share_id[2]);
...@@ -72,12 +72,12 @@ static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -72,12 +72,12 @@ static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr,
return 0; return 0;
} }
static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_fm_get(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic, char __user *instr_data, long len, int atomic,
int cmd) int cmd)
{ {
fm_instrument_t *ip; struct fm_instrument *ip;
fm_xinstrument_t ix; struct fm_xinstrument ix;
int idx; int idx;
if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
...@@ -85,7 +85,7 @@ static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr, ...@@ -85,7 +85,7 @@ static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr,
if (len < (long)sizeof(ix)) if (len < (long)sizeof(ix))
return -ENOMEM; return -ENOMEM;
memset(&ix, 0, sizeof(ix)); memset(&ix, 0, sizeof(ix));
ip = (fm_instrument_t *)KINSTR_DATA(instr); ip = (struct fm_instrument *)KINSTR_DATA(instr);
ix.stype = FM_STRU_INSTR; ix.stype = FM_STRU_INSTR;
ix.share_id[0] = cpu_to_le32(ip->share_id[0]); ix.share_id[0] = cpu_to_le32(ip->share_id[0]);
ix.share_id[1] = cpu_to_le32(ip->share_id[1]); ix.share_id[1] = cpu_to_le32(ip->share_id[1]);
...@@ -114,19 +114,19 @@ static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr, ...@@ -114,19 +114,19 @@ static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr,
return 0; return 0;
} }
static int snd_seq_fm_get_size(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_fm_get_size(void *private_data, struct snd_seq_kinstr *instr,
long *size) long *size)
{ {
*size = sizeof(fm_xinstrument_t); *size = sizeof(struct fm_xinstrument);
return 0; return 0;
} }
int snd_seq_fm_init(snd_seq_kinstr_ops_t *ops, int snd_seq_fm_init(struct snd_seq_kinstr_ops *ops,
snd_seq_kinstr_ops_t *next) struct snd_seq_kinstr_ops *next)
{ {
memset(ops, 0, sizeof(*ops)); memset(ops, 0, sizeof(*ops));
// ops->private_data = private_data; // ops->private_data = private_data;
ops->add_len = sizeof(fm_instrument_t); ops->add_len = sizeof(struct fm_instrument);
ops->instr_type = SNDRV_SEQ_INSTR_ID_OPL2_3; ops->instr_type = SNDRV_SEQ_INSTR_ID_OPL2_3;
ops->put = snd_seq_fm_put; ops->put = snd_seq_fm_put;
ops->get = snd_seq_fm_get; ops->get = snd_seq_fm_get;
......
...@@ -42,14 +42,14 @@ static unsigned int snd_seq_gf1_size(unsigned int size, unsigned int format) ...@@ -42,14 +42,14 @@ static unsigned int snd_seq_gf1_size(unsigned int size, unsigned int format)
return format; return format;
} }
static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, static int snd_seq_gf1_copy_wave_from_stream(struct snd_gf1_ops *ops,
gf1_instrument_t *ip, struct gf1_instrument *ip,
char __user **data, char __user **data,
long *len, long *len,
int atomic) int atomic)
{ {
gf1_wave_t *wp, *prev; struct gf1_wave *wp, *prev;
gf1_xwave_t xp; struct gf1_xwave xp;
int err; int err;
gfp_t gfp_mask; gfp_t gfp_mask;
unsigned int real_size; unsigned int real_size;
...@@ -116,8 +116,8 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, ...@@ -116,8 +116,8 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
return 0; return 0;
} }
static void snd_seq_gf1_wave_free(snd_gf1_ops_t *ops, static void snd_seq_gf1_wave_free(struct snd_gf1_ops *ops,
gf1_wave_t *wave, struct gf1_wave *wave,
int atomic) int atomic)
{ {
if (ops->remove_sample) if (ops->remove_sample)
...@@ -125,11 +125,11 @@ static void snd_seq_gf1_wave_free(snd_gf1_ops_t *ops, ...@@ -125,11 +125,11 @@ static void snd_seq_gf1_wave_free(snd_gf1_ops_t *ops,
kfree(wave); kfree(wave);
} }
static void snd_seq_gf1_instr_free(snd_gf1_ops_t *ops, static void snd_seq_gf1_instr_free(struct snd_gf1_ops *ops,
gf1_instrument_t *ip, struct gf1_instrument *ip,
int atomic) int atomic)
{ {
gf1_wave_t *wave; struct gf1_wave *wave;
while ((wave = ip->wave) != NULL) { while ((wave = ip->wave) != NULL) {
ip->wave = wave->next; ip->wave = wave->next;
...@@ -137,13 +137,13 @@ static void snd_seq_gf1_instr_free(snd_gf1_ops_t *ops, ...@@ -137,13 +137,13 @@ static void snd_seq_gf1_instr_free(snd_gf1_ops_t *ops,
} }
} }
static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_gf1_put(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic, char __user *instr_data, long len, int atomic,
int cmd) int cmd)
{ {
snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; struct snd_gf1_ops *ops = private_data;
gf1_instrument_t *ip; struct gf1_instrument *ip;
gf1_xinstrument_t ix; struct gf1_xinstrument ix;
int err; int err;
gfp_t gfp_mask; gfp_t gfp_mask;
...@@ -159,7 +159,7 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -159,7 +159,7 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
return -EINVAL; return -EINVAL;
instr_data += sizeof(ix); instr_data += sizeof(ix);
len -= sizeof(ix); len -= sizeof(ix);
ip = (gf1_instrument_t *)KINSTR_DATA(instr); ip = (struct gf1_instrument *)KINSTR_DATA(instr);
ip->exclusion = le16_to_cpu(ix.exclusion); ip->exclusion = le16_to_cpu(ix.exclusion);
ip->exclusion_group = le16_to_cpu(ix.exclusion_group); ip->exclusion_group = le16_to_cpu(ix.exclusion_group);
ip->effect1 = ix.effect1; ip->effect1 = ix.effect1;
...@@ -189,14 +189,14 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -189,14 +189,14 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
return 0; return 0;
} }
static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops, static int snd_seq_gf1_copy_wave_to_stream(struct snd_gf1_ops *ops,
gf1_instrument_t *ip, struct gf1_instrument *ip,
char __user **data, char __user **data,
long *len, long *len,
int atomic) int atomic)
{ {
gf1_wave_t *wp; struct gf1_wave *wp;
gf1_xwave_t xp; struct gf1_xwave xp;
int err; int err;
unsigned int real_size; unsigned int real_size;
...@@ -251,20 +251,20 @@ static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops, ...@@ -251,20 +251,20 @@ static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops,
return 0; return 0;
} }
static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_gf1_get(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic, char __user *instr_data, long len, int atomic,
int cmd) int cmd)
{ {
snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; struct snd_gf1_ops *ops = private_data;
gf1_instrument_t *ip; struct gf1_instrument *ip;
gf1_xinstrument_t ix; struct gf1_xinstrument ix;
if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
return -EINVAL; return -EINVAL;
if (len < (long)sizeof(ix)) if (len < (long)sizeof(ix))
return -ENOMEM; return -ENOMEM;
memset(&ix, 0, sizeof(ix)); memset(&ix, 0, sizeof(ix));
ip = (gf1_instrument_t *)KINSTR_DATA(instr); ip = (struct gf1_instrument *)KINSTR_DATA(instr);
ix.stype = GF1_STRU_INSTR; ix.stype = GF1_STRU_INSTR;
ix.exclusion = cpu_to_le16(ip->exclusion); ix.exclusion = cpu_to_le16(ip->exclusion);
ix.exclusion_group = cpu_to_le16(ip->exclusion_group); ix.exclusion_group = cpu_to_le16(ip->exclusion_group);
...@@ -283,18 +283,18 @@ static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr, ...@@ -283,18 +283,18 @@ static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr,
atomic); atomic);
} }
static int snd_seq_gf1_get_size(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_gf1_get_size(void *private_data, struct snd_seq_kinstr *instr,
long *size) long *size)
{ {
long result; long result;
gf1_instrument_t *ip; struct gf1_instrument *ip;
gf1_wave_t *wp; struct gf1_wave *wp;
*size = 0; *size = 0;
ip = (gf1_instrument_t *)KINSTR_DATA(instr); ip = (struct gf1_instrument *)KINSTR_DATA(instr);
result = sizeof(gf1_xinstrument_t); result = sizeof(struct gf1_xinstrument);
for (wp = ip->wave; wp; wp = wp->next) { for (wp = ip->wave; wp; wp = wp->next) {
result += sizeof(gf1_xwave_t); result += sizeof(struct gf1_xwave);
result += wp->size; result += wp->size;
} }
*size = result; *size = result;
...@@ -302,35 +302,35 @@ static int snd_seq_gf1_get_size(void *private_data, snd_seq_kinstr_t *instr, ...@@ -302,35 +302,35 @@ static int snd_seq_gf1_get_size(void *private_data, snd_seq_kinstr_t *instr,
} }
static int snd_seq_gf1_remove(void *private_data, static int snd_seq_gf1_remove(void *private_data,
snd_seq_kinstr_t *instr, struct snd_seq_kinstr *instr,
int atomic) int atomic)
{ {
snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; struct snd_gf1_ops *ops = private_data;
gf1_instrument_t *ip; struct gf1_instrument *ip;
ip = (gf1_instrument_t *)KINSTR_DATA(instr); ip = (struct gf1_instrument *)KINSTR_DATA(instr);
snd_seq_gf1_instr_free(ops, ip, atomic); snd_seq_gf1_instr_free(ops, ip, atomic);
return 0; return 0;
} }
static void snd_seq_gf1_notify(void *private_data, static void snd_seq_gf1_notify(void *private_data,
snd_seq_kinstr_t *instr, struct snd_seq_kinstr *instr,
int what) int what)
{ {
snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; struct snd_gf1_ops *ops = private_data;
if (ops->notify) if (ops->notify)
ops->notify(ops->private_data, instr, what); ops->notify(ops->private_data, instr, what);
} }
int snd_seq_gf1_init(snd_gf1_ops_t *ops, int snd_seq_gf1_init(struct snd_gf1_ops *ops,
void *private_data, void *private_data,
snd_seq_kinstr_ops_t *next) struct snd_seq_kinstr_ops *next)
{ {
memset(ops, 0, sizeof(*ops)); memset(ops, 0, sizeof(*ops));
ops->private_data = private_data; ops->private_data = private_data;
ops->kops.private_data = ops; ops->kops.private_data = ops;
ops->kops.add_len = sizeof(gf1_instrument_t); ops->kops.add_len = sizeof(struct gf1_instrument);
ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_GUS_PATCH; ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_GUS_PATCH;
ops->kops.put = snd_seq_gf1_put; ops->kops.put = snd_seq_gf1_put;
ops->kops.get = snd_seq_gf1_get; ops->kops.get = snd_seq_gf1_get;
......
...@@ -42,8 +42,8 @@ static unsigned int snd_seq_iwffff_size(unsigned int size, unsigned int format) ...@@ -42,8 +42,8 @@ static unsigned int snd_seq_iwffff_size(unsigned int size, unsigned int format)
return result; return result;
} }
static void snd_seq_iwffff_copy_lfo_from_stream(iwffff_lfo_t *fp, static void snd_seq_iwffff_copy_lfo_from_stream(struct iwffff_lfo *fp,
iwffff_xlfo_t *fx) struct iwffff_xlfo *fx)
{ {
fp->freq = le16_to_cpu(fx->freq); fp->freq = le16_to_cpu(fx->freq);
fp->depth = le16_to_cpu(fx->depth); fp->depth = le16_to_cpu(fx->depth);
...@@ -53,18 +53,18 @@ static void snd_seq_iwffff_copy_lfo_from_stream(iwffff_lfo_t *fp, ...@@ -53,18 +53,18 @@ static void snd_seq_iwffff_copy_lfo_from_stream(iwffff_lfo_t *fp,
} }
static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
iwffff_layer_t *lp, struct iwffff_layer *lp,
iwffff_env_t *ep, struct iwffff_env *ep,
iwffff_xenv_t *ex, struct iwffff_xenv *ex,
char __user **data, char __user **data,
long *len, long *len,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
__u32 stype; __u32 stype;
iwffff_env_record_t *rp, *rp_last; struct iwffff_env_record *rp, *rp_last;
iwffff_xenv_record_t rx; struct iwffff_xenv_record rx;
iwffff_env_point_t *pp; struct iwffff_env_point *pp;
iwffff_xenv_point_t px; struct iwffff_xenv_point px;
int points_size, idx; int points_size, idx;
ep->flags = ex->flags; ep->flags = ex->flags;
...@@ -101,7 +101,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, ...@@ -101,7 +101,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
rp->sustain_rate = le16_to_cpu(rx.sustain_rate); rp->sustain_rate = le16_to_cpu(rx.sustain_rate);
rp->release_rate = le16_to_cpu(rx.release_rate); rp->release_rate = le16_to_cpu(rx.release_rate);
rp->hirange = rx.hirange; rp->hirange = rx.hirange;
pp = (iwffff_env_point_t *)(rp + 1); pp = (struct iwffff_env_point *)(rp + 1);
for (idx = 0; idx < rp->nattack + rp->nrelease; idx++) { for (idx = 0; idx < rp->nattack + rp->nrelease; idx++) {
if (copy_from_user(&px, *data, sizeof(px))) if (copy_from_user(&px, *data, sizeof(px)))
return -EFAULT; return -EFAULT;
...@@ -120,14 +120,14 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, ...@@ -120,14 +120,14 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
return 0; return 0;
} }
static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, static int snd_seq_iwffff_copy_wave_from_stream(struct snd_iwffff_ops *ops,
iwffff_layer_t *lp, struct iwffff_layer *lp,
char __user **data, char __user **data,
long *len, long *len,
int atomic) int atomic)
{ {
iwffff_wave_t *wp, *prev; struct iwffff_wave *wp, *prev;
iwffff_xwave_t xp; struct iwffff_xwave xp;
int err; int err;
gfp_t gfp_mask; gfp_t gfp_mask;
unsigned int real_size; unsigned int real_size;
...@@ -186,11 +186,11 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, ...@@ -186,11 +186,11 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
return 0; return 0;
} }
static void snd_seq_iwffff_env_free(snd_iwffff_ops_t *ops, static void snd_seq_iwffff_env_free(struct snd_iwffff_ops *ops,
iwffff_env_t *env, struct iwffff_env *env,
int atomic) int atomic)
{ {
iwffff_env_record_t *rec; struct iwffff_env_record *rec;
while ((rec = env->record) != NULL) { while ((rec = env->record) != NULL) {
env->record = rec->next; env->record = rec->next;
...@@ -198,8 +198,8 @@ static void snd_seq_iwffff_env_free(snd_iwffff_ops_t *ops, ...@@ -198,8 +198,8 @@ static void snd_seq_iwffff_env_free(snd_iwffff_ops_t *ops,
} }
} }
static void snd_seq_iwffff_wave_free(snd_iwffff_ops_t *ops, static void snd_seq_iwffff_wave_free(struct snd_iwffff_ops *ops,
iwffff_wave_t *wave, struct iwffff_wave *wave,
int atomic) int atomic)
{ {
if (ops->remove_sample) if (ops->remove_sample)
...@@ -207,12 +207,12 @@ static void snd_seq_iwffff_wave_free(snd_iwffff_ops_t *ops, ...@@ -207,12 +207,12 @@ static void snd_seq_iwffff_wave_free(snd_iwffff_ops_t *ops,
kfree(wave); kfree(wave);
} }
static void snd_seq_iwffff_instr_free(snd_iwffff_ops_t *ops, static void snd_seq_iwffff_instr_free(struct snd_iwffff_ops *ops,
iwffff_instrument_t *ip, struct iwffff_instrument *ip,
int atomic) int atomic)
{ {
iwffff_layer_t *layer; struct iwffff_layer *layer;
iwffff_wave_t *wave; struct iwffff_wave *wave;
while ((layer = ip->layer) != NULL) { while ((layer = ip->layer) != NULL) {
ip->layer = layer->next; ip->layer = layer->next;
...@@ -226,15 +226,15 @@ static void snd_seq_iwffff_instr_free(snd_iwffff_ops_t *ops, ...@@ -226,15 +226,15 @@ static void snd_seq_iwffff_instr_free(snd_iwffff_ops_t *ops,
} }
} }
static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_iwffff_put(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic, char __user *instr_data, long len, int atomic,
int cmd) int cmd)
{ {
snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; struct snd_iwffff_ops *ops = private_data;
iwffff_instrument_t *ip; struct iwffff_instrument *ip;
iwffff_xinstrument_t ix; struct iwffff_xinstrument ix;
iwffff_layer_t *lp, *prev_lp; struct iwffff_layer *lp, *prev_lp;
iwffff_xlayer_t lx; struct iwffff_xlayer lx;
int err; int err;
gfp_t gfp_mask; gfp_t gfp_mask;
...@@ -250,7 +250,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -250,7 +250,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
return -EINVAL; return -EINVAL;
instr_data += sizeof(ix); instr_data += sizeof(ix);
len -= sizeof(ix); len -= sizeof(ix);
ip = (iwffff_instrument_t *)KINSTR_DATA(instr); ip = (struct iwffff_instrument *)KINSTR_DATA(instr);
ip->exclusion = le16_to_cpu(ix.exclusion); ip->exclusion = le16_to_cpu(ix.exclusion);
ip->layer_type = le16_to_cpu(ix.layer_type); ip->layer_type = le16_to_cpu(ix.layer_type);
ip->exclusion_group = le16_to_cpu(ix.exclusion_group); ip->exclusion_group = le16_to_cpu(ix.exclusion_group);
...@@ -261,7 +261,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -261,7 +261,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
/* copy layers */ /* copy layers */
prev_lp = NULL; prev_lp = NULL;
while (len > 0) { while (len > 0) {
if (len < (long)sizeof(iwffff_xlayer_t)) { if (len < (long)sizeof(struct iwffff_xlayer)) {
snd_seq_iwffff_instr_free(ops, ip, atomic); snd_seq_iwffff_instr_free(ops, ip, atomic);
return -EINVAL; return -EINVAL;
} }
...@@ -335,8 +335,8 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -335,8 +335,8 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
return 0; return 0;
} }
static void snd_seq_iwffff_copy_lfo_to_stream(iwffff_xlfo_t *fx, static void snd_seq_iwffff_copy_lfo_to_stream(struct iwffff_xlfo *fx,
iwffff_lfo_t *fp) struct iwffff_lfo *fp)
{ {
fx->freq = cpu_to_le16(fp->freq); fx->freq = cpu_to_le16(fp->freq);
fx->depth = cpu_to_le16(fp->depth); fx->depth = cpu_to_le16(fp->depth);
...@@ -346,16 +346,16 @@ static void snd_seq_iwffff_copy_lfo_to_stream(iwffff_xlfo_t *fx, ...@@ -346,16 +346,16 @@ static void snd_seq_iwffff_copy_lfo_to_stream(iwffff_xlfo_t *fx,
} }
static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype, static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype,
iwffff_layer_t *lp, struct iwffff_layer *lp,
iwffff_xenv_t *ex, struct iwffff_xenv *ex,
iwffff_env_t *ep, struct iwffff_env *ep,
char __user **data, char __user **data,
long *len) long *len)
{ {
iwffff_env_record_t *rp; struct iwffff_env_record *rp;
iwffff_xenv_record_t rx; struct iwffff_xenv_record rx;
iwffff_env_point_t *pp; struct iwffff_env_point *pp;
iwffff_xenv_point_t px; struct iwffff_xenv_point px;
int points_size, idx; int points_size, idx;
ex->flags = ep->flags; ex->flags = ep->flags;
...@@ -379,7 +379,7 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype, ...@@ -379,7 +379,7 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype,
points_size = (rp->nattack + rp->nrelease) * 2 * sizeof(__u16); points_size = (rp->nattack + rp->nrelease) * 2 * sizeof(__u16);
if (*len < points_size) if (*len < points_size)
return -ENOMEM; return -ENOMEM;
pp = (iwffff_env_point_t *)(rp + 1); pp = (struct iwffff_env_point *)(rp + 1);
for (idx = 0; idx < rp->nattack + rp->nrelease; idx++) { for (idx = 0; idx < rp->nattack + rp->nrelease; idx++) {
px.offset = cpu_to_le16(pp->offset); px.offset = cpu_to_le16(pp->offset);
px.rate = cpu_to_le16(pp->rate); px.rate = cpu_to_le16(pp->rate);
...@@ -392,14 +392,14 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype, ...@@ -392,14 +392,14 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype,
return 0; return 0;
} }
static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops, static int snd_seq_iwffff_copy_wave_to_stream(struct snd_iwffff_ops *ops,
iwffff_layer_t *lp, struct iwffff_layer *lp,
char __user **data, char __user **data,
long *len, long *len,
int atomic) int atomic)
{ {
iwffff_wave_t *wp; struct iwffff_wave *wp;
iwffff_xwave_t xp; struct iwffff_xwave xp;
int err; int err;
unsigned int real_size; unsigned int real_size;
...@@ -447,14 +447,14 @@ static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops, ...@@ -447,14 +447,14 @@ static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops,
return 0; return 0;
} }
static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_iwffff_get(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic, int cmd) char __user *instr_data, long len, int atomic, int cmd)
{ {
snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; struct snd_iwffff_ops *ops = private_data;
iwffff_instrument_t *ip; struct iwffff_instrument *ip;
iwffff_xinstrument_t ix; struct iwffff_xinstrument ix;
iwffff_layer_t *lp; struct iwffff_layer *lp;
iwffff_xlayer_t lx; struct iwffff_xlayer lx;
char __user *layer_instr_data; char __user *layer_instr_data;
int err; int err;
...@@ -463,7 +463,7 @@ static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr, ...@@ -463,7 +463,7 @@ static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr,
if (len < (long)sizeof(ix)) if (len < (long)sizeof(ix))
return -ENOMEM; return -ENOMEM;
memset(&ix, 0, sizeof(ix)); memset(&ix, 0, sizeof(ix));
ip = (iwffff_instrument_t *)KINSTR_DATA(instr); ip = (struct iwffff_instrument *)KINSTR_DATA(instr);
ix.stype = IWFFFF_STRU_INSTR; ix.stype = IWFFFF_STRU_INSTR;
ix.exclusion = cpu_to_le16(ip->exclusion); ix.exclusion = cpu_to_le16(ip->exclusion);
ix.layer_type = cpu_to_le16(ip->layer_type); ix.layer_type = cpu_to_le16(ip->layer_type);
...@@ -520,43 +520,43 @@ static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr, ...@@ -520,43 +520,43 @@ static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr,
return 0; return 0;
} }
static long snd_seq_iwffff_env_size_in_stream(iwffff_env_t *ep) static long snd_seq_iwffff_env_size_in_stream(struct iwffff_env *ep)
{ {
long result = 0; long result = 0;
iwffff_env_record_t *rp; struct iwffff_env_record *rp;
for (rp = ep->record; rp; rp = rp->next) { for (rp = ep->record; rp; rp = rp->next) {
result += sizeof(iwffff_xenv_record_t); result += sizeof(struct iwffff_xenv_record);
result += (rp->nattack + rp->nrelease) * 2 * sizeof(__u16); result += (rp->nattack + rp->nrelease) * 2 * sizeof(__u16);
} }
return 0; return 0;
} }
static long snd_seq_iwffff_wave_size_in_stream(iwffff_layer_t *lp) static long snd_seq_iwffff_wave_size_in_stream(struct iwffff_layer *lp)
{ {
long result = 0; long result = 0;
iwffff_wave_t *wp; struct iwffff_wave *wp;
for (wp = lp->wave; wp; wp = wp->next) { for (wp = lp->wave; wp; wp = wp->next) {
result += sizeof(iwffff_xwave_t); result += sizeof(struct iwffff_xwave);
if (!(wp->format & IWFFFF_WAVE_ROM)) if (!(wp->format & IWFFFF_WAVE_ROM))
result += wp->size; result += wp->size;
} }
return result; return result;
} }
static int snd_seq_iwffff_get_size(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_iwffff_get_size(void *private_data, struct snd_seq_kinstr *instr,
long *size) long *size)
{ {
long result; long result;
iwffff_instrument_t *ip; struct iwffff_instrument *ip;
iwffff_layer_t *lp; struct iwffff_layer *lp;
*size = 0; *size = 0;
ip = (iwffff_instrument_t *)KINSTR_DATA(instr); ip = (struct iwffff_instrument *)KINSTR_DATA(instr);
result = sizeof(iwffff_xinstrument_t); result = sizeof(struct iwffff_xinstrument);
for (lp = ip->layer; lp; lp = lp->next) { for (lp = ip->layer; lp; lp = lp->next) {
result += sizeof(iwffff_xlayer_t); result += sizeof(struct iwffff_xlayer);
result += snd_seq_iwffff_env_size_in_stream(&lp->penv); result += snd_seq_iwffff_env_size_in_stream(&lp->penv);
result += snd_seq_iwffff_env_size_in_stream(&lp->venv); result += snd_seq_iwffff_env_size_in_stream(&lp->venv);
result += snd_seq_iwffff_wave_size_in_stream(lp); result += snd_seq_iwffff_wave_size_in_stream(lp);
...@@ -566,35 +566,35 @@ static int snd_seq_iwffff_get_size(void *private_data, snd_seq_kinstr_t *instr, ...@@ -566,35 +566,35 @@ static int snd_seq_iwffff_get_size(void *private_data, snd_seq_kinstr_t *instr,
} }
static int snd_seq_iwffff_remove(void *private_data, static int snd_seq_iwffff_remove(void *private_data,
snd_seq_kinstr_t *instr, struct snd_seq_kinstr *instr,
int atomic) int atomic)
{ {
snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; struct snd_iwffff_ops *ops = private_data;
iwffff_instrument_t *ip; struct iwffff_instrument *ip;
ip = (iwffff_instrument_t *)KINSTR_DATA(instr); ip = (struct iwffff_instrument *)KINSTR_DATA(instr);
snd_seq_iwffff_instr_free(ops, ip, atomic); snd_seq_iwffff_instr_free(ops, ip, atomic);
return 0; return 0;
} }
static void snd_seq_iwffff_notify(void *private_data, static void snd_seq_iwffff_notify(void *private_data,
snd_seq_kinstr_t *instr, struct snd_seq_kinstr *instr,
int what) int what)
{ {
snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; struct snd_iwffff_ops *ops = private_data;
if (ops->notify) if (ops->notify)
ops->notify(ops->private_data, instr, what); ops->notify(ops->private_data, instr, what);
} }
int snd_seq_iwffff_init(snd_iwffff_ops_t *ops, int snd_seq_iwffff_init(struct snd_iwffff_ops *ops,
void *private_data, void *private_data,
snd_seq_kinstr_ops_t *next) struct snd_seq_kinstr_ops *next)
{ {
memset(ops, 0, sizeof(*ops)); memset(ops, 0, sizeof(*ops));
ops->private_data = private_data; ops->private_data = private_data;
ops->kops.private_data = ops; ops->kops.private_data = ops;
ops->kops.add_len = sizeof(iwffff_instrument_t); ops->kops.add_len = sizeof(struct iwffff_instrument);
ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_INTERWAVE; ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_INTERWAVE;
ops->kops.put = snd_seq_iwffff_put; ops->kops.put = snd_seq_iwffff_put;
ops->kops.get = snd_seq_iwffff_get; ops->kops.get = snd_seq_iwffff_get;
......
...@@ -42,21 +42,21 @@ static unsigned int snd_seq_simple_size(unsigned int size, unsigned int format) ...@@ -42,21 +42,21 @@ static unsigned int snd_seq_simple_size(unsigned int size, unsigned int format)
return result; return result;
} }
static void snd_seq_simple_instr_free(snd_simple_ops_t *ops, static void snd_seq_simple_instr_free(struct snd_simple_ops *ops,
simple_instrument_t *ip, struct simple_instrument *ip,
int atomic) int atomic)
{ {
if (ops->remove_sample) if (ops->remove_sample)
ops->remove_sample(ops->private_data, ip, atomic); ops->remove_sample(ops->private_data, ip, atomic);
} }
static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_simple_put(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, char __user *instr_data, long len,
int atomic, int cmd) int atomic, int cmd)
{ {
snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; struct snd_simple_ops *ops = private_data;
simple_instrument_t *ip; struct simple_instrument *ip;
simple_xinstrument_t ix; struct simple_xinstrument ix;
int err; int err;
gfp_t gfp_mask; gfp_t gfp_mask;
unsigned int real_size; unsigned int real_size;
...@@ -73,7 +73,7 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -73,7 +73,7 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
return -EINVAL; return -EINVAL;
instr_data += sizeof(ix); instr_data += sizeof(ix);
len -= sizeof(ix); len -= sizeof(ix);
ip = (simple_instrument_t *)KINSTR_DATA(instr); ip = (struct simple_instrument *)KINSTR_DATA(instr);
ip->share_id[0] = le32_to_cpu(ix.share_id[0]); ip->share_id[0] = le32_to_cpu(ix.share_id[0]);
ip->share_id[1] = le32_to_cpu(ix.share_id[1]); ip->share_id[1] = le32_to_cpu(ix.share_id[1]);
ip->share_id[2] = le32_to_cpu(ix.share_id[2]); ip->share_id[2] = le32_to_cpu(ix.share_id[2]);
...@@ -100,13 +100,13 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr, ...@@ -100,13 +100,13 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
return 0; return 0;
} }
static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_simple_get(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, char __user *instr_data, long len,
int atomic, int cmd) int atomic, int cmd)
{ {
snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; struct snd_simple_ops *ops = private_data;
simple_instrument_t *ip; struct simple_instrument *ip;
simple_xinstrument_t ix; struct simple_xinstrument ix;
int err; int err;
unsigned int real_size; unsigned int real_size;
...@@ -115,7 +115,7 @@ static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr, ...@@ -115,7 +115,7 @@ static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr,
if (len < (long)sizeof(ix)) if (len < (long)sizeof(ix))
return -ENOMEM; return -ENOMEM;
memset(&ix, 0, sizeof(ix)); memset(&ix, 0, sizeof(ix));
ip = (simple_instrument_t *)KINSTR_DATA(instr); ip = (struct simple_instrument *)KINSTR_DATA(instr);
ix.stype = SIMPLE_STRU_INSTR; ix.stype = SIMPLE_STRU_INSTR;
ix.share_id[0] = cpu_to_le32(ip->share_id[0]); ix.share_id[0] = cpu_to_le32(ip->share_id[0]);
ix.share_id[1] = cpu_to_le32(ip->share_id[1]); ix.share_id[1] = cpu_to_le32(ip->share_id[1]);
...@@ -147,46 +147,46 @@ static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr, ...@@ -147,46 +147,46 @@ static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr,
return 0; return 0;
} }
static int snd_seq_simple_get_size(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_simple_get_size(void *private_data, struct snd_seq_kinstr *instr,
long *size) long *size)
{ {
simple_instrument_t *ip; struct simple_instrument *ip;
ip = (simple_instrument_t *)KINSTR_DATA(instr); ip = (struct simple_instrument *)KINSTR_DATA(instr);
*size = sizeof(simple_xinstrument_t) + snd_seq_simple_size(ip->size, ip->format); *size = sizeof(struct simple_xinstrument) + snd_seq_simple_size(ip->size, ip->format);
return 0; return 0;
} }
static int snd_seq_simple_remove(void *private_data, static int snd_seq_simple_remove(void *private_data,
snd_seq_kinstr_t *instr, struct snd_seq_kinstr *instr,
int atomic) int atomic)
{ {
snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; struct snd_simple_ops *ops = private_data;
simple_instrument_t *ip; struct simple_instrument *ip;
ip = (simple_instrument_t *)KINSTR_DATA(instr); ip = (struct simple_instrument *)KINSTR_DATA(instr);
snd_seq_simple_instr_free(ops, ip, atomic); snd_seq_simple_instr_free(ops, ip, atomic);
return 0; return 0;
} }
static void snd_seq_simple_notify(void *private_data, static void snd_seq_simple_notify(void *private_data,
snd_seq_kinstr_t *instr, struct snd_seq_kinstr *instr,
int what) int what)
{ {
snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; struct snd_simple_ops *ops = private_data;
if (ops->notify) if (ops->notify)
ops->notify(ops->private_data, instr, what); ops->notify(ops->private_data, instr, what);
} }
int snd_seq_simple_init(snd_simple_ops_t *ops, int snd_seq_simple_init(struct snd_simple_ops *ops,
void *private_data, void *private_data,
snd_seq_kinstr_ops_t *next) struct snd_seq_kinstr_ops *next)
{ {
memset(ops, 0, sizeof(*ops)); memset(ops, 0, sizeof(*ops));
ops->private_data = private_data; ops->private_data = private_data;
ops->kops.private_data = ops; ops->kops.private_data = ops;
ops->kops.add_len = sizeof(simple_instrument_t); ops->kops.add_len = sizeof(struct simple_instrument);
ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_SIMPLE; ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_SIMPLE;
ops->kops.put = snd_seq_simple_put; ops->kops.put = snd_seq_simple_put;
ops->kops.get = snd_seq_simple_get; ops->kops.get = snd_seq_simple_get;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册