aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/emu10k1.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound/emu10k1.h')
-rw-r--r--include/sound/emu10k1.h336
1 files changed, 171 insertions, 165 deletions
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 8411c7ef6f11..d14c543b1608 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -887,47 +887,45 @@
887 887
888/* ------------------- STRUCTURES -------------------- */ 888/* ------------------- STRUCTURES -------------------- */
889 889
890typedef struct _snd_emu10k1 emu10k1_t; 890enum {
891typedef struct _snd_emu10k1_voice emu10k1_voice_t;
892typedef struct _snd_emu10k1_pcm emu10k1_pcm_t;
893
894typedef enum {
895 EMU10K1_EFX, 891 EMU10K1_EFX,
896 EMU10K1_PCM, 892 EMU10K1_PCM,
897 EMU10K1_SYNTH, 893 EMU10K1_SYNTH,
898 EMU10K1_MIDI 894 EMU10K1_MIDI
899} emu10k1_voice_type_t; 895};
896
897struct snd_emu10k1;
900 898
901struct _snd_emu10k1_voice { 899struct snd_emu10k1_voice {
902 emu10k1_t *emu; 900 struct snd_emu10k1 *emu;
903 int number; 901 int number;
904 unsigned int use: 1, 902 unsigned int use: 1,
905 pcm: 1, 903 pcm: 1,
906 efx: 1, 904 efx: 1,
907 synth: 1, 905 synth: 1,
908 midi: 1; 906 midi: 1;
909 void (*interrupt)(emu10k1_t *emu, emu10k1_voice_t *pvoice); 907 void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
910 908
911 emu10k1_pcm_t *epcm; 909 struct snd_emu10k1_pcm *epcm;
912}; 910};
913 911
914typedef enum { 912enum {
915 PLAYBACK_EMUVOICE, 913 PLAYBACK_EMUVOICE,
916 PLAYBACK_EFX, 914 PLAYBACK_EFX,
917 CAPTURE_AC97ADC, 915 CAPTURE_AC97ADC,
918 CAPTURE_AC97MIC, 916 CAPTURE_AC97MIC,
919 CAPTURE_EFX 917 CAPTURE_EFX
920} snd_emu10k1_pcm_type_t; 918};
921 919
922struct _snd_emu10k1_pcm { 920struct snd_emu10k1_pcm {
923 emu10k1_t *emu; 921 struct snd_emu10k1 *emu;
924 snd_emu10k1_pcm_type_t type; 922 int type;
925 snd_pcm_substream_t *substream; 923 struct snd_pcm_substream *substream;
926 emu10k1_voice_t *voices[NUM_EFX_PLAYBACK]; 924 struct snd_emu10k1_voice *voices[NUM_EFX_PLAYBACK];
927 emu10k1_voice_t *extra; 925 struct snd_emu10k1_voice *extra;
928 unsigned short running; 926 unsigned short running;
929 unsigned short first_ptr; 927 unsigned short first_ptr;
930 snd_util_memblk_t *memblk; 928 struct snd_util_memblk *memblk;
931 unsigned int start_addr; 929 unsigned int start_addr;
932 unsigned int ccca_start_addr; 930 unsigned int ccca_start_addr;
933 unsigned int capture_ipr; /* interrupt acknowledge mask */ 931 unsigned int capture_ipr; /* interrupt acknowledge mask */
@@ -941,13 +939,13 @@ struct _snd_emu10k1_pcm {
941 unsigned int capture_bufsize; /* buffer size in bytes */ 939 unsigned int capture_bufsize; /* buffer size in bytes */
942}; 940};
943 941
944typedef struct { 942struct snd_emu10k1_pcm_mixer {
945 /* mono, left, right x 8 sends (4 on emu10k1) */ 943 /* mono, left, right x 8 sends (4 on emu10k1) */
946 unsigned char send_routing[3][8]; 944 unsigned char send_routing[3][8];
947 unsigned char send_volume[3][8]; 945 unsigned char send_volume[3][8];
948 unsigned short attn[3]; 946 unsigned short attn[3];
949 emu10k1_pcm_t *epcm; 947 struct snd_emu10k1_pcm *epcm;
950} emu10k1_pcm_mixer_t; 948};
951 949
952#define snd_emu10k1_compose_send_routing(route) \ 950#define snd_emu10k1_compose_send_routing(route) \
953((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16) 951((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16)
@@ -958,20 +956,20 @@ typedef struct {
958#define snd_emu10k1_compose_audigy_fxrt2(route) \ 956#define snd_emu10k1_compose_audigy_fxrt2(route) \
959((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24)) 957((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24))
960 958
961typedef struct snd_emu10k1_memblk { 959struct snd_emu10k1_memblk {
962 snd_util_memblk_t mem; 960 struct snd_util_memblk mem;
963 /* private part */ 961 /* private part */
964 int first_page, last_page, pages, mapped_page; 962 int first_page, last_page, pages, mapped_page;
965 unsigned int map_locked; 963 unsigned int map_locked;
966 struct list_head mapped_link; 964 struct list_head mapped_link;
967 struct list_head mapped_order_link; 965 struct list_head mapped_order_link;
968} emu10k1_memblk_t; 966};
969 967
970#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1))) 968#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1)))
971 969
972#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16 970#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16
973 971
974typedef struct { 972struct snd_emu10k1_fx8010_ctl {
975 struct list_head list; /* list link container */ 973 struct list_head list; /* list link container */
976 unsigned int vcount; 974 unsigned int vcount;
977 unsigned int count; /* count of GPR (1..16) */ 975 unsigned int count; /* count of GPR (1..16) */
@@ -980,19 +978,19 @@ typedef struct {
980 unsigned int min; /* minimum range */ 978 unsigned int min; /* minimum range */
981 unsigned int max; /* maximum range */ 979 unsigned int max; /* maximum range */
982 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 980 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
983 snd_kcontrol_t *kcontrol; 981 struct snd_kcontrol *kcontrol;
984} snd_emu10k1_fx8010_ctl_t; 982};
985 983
986typedef void (snd_fx8010_irq_handler_t)(emu10k1_t *emu, void *private_data); 984typedef void (snd_fx8010_irq_handler_t)(struct snd_emu10k1 *emu, void *private_data);
987 985
988typedef struct _snd_emu10k1_fx8010_irq { 986struct snd_emu10k1_fx8010_irq {
989 struct _snd_emu10k1_fx8010_irq *next; 987 struct snd_emu10k1_fx8010_irq *next;
990 snd_fx8010_irq_handler_t *handler; 988 snd_fx8010_irq_handler_t *handler;
991 unsigned short gpr_running; 989 unsigned short gpr_running;
992 void *private_data; 990 void *private_data;
993} snd_emu10k1_fx8010_irq_t; 991};
994 992
995typedef struct { 993struct snd_emu10k1_fx8010_pcm {
996 unsigned int valid: 1, 994 unsigned int valid: 1,
997 opened: 1, 995 opened: 1,
998 active: 1; 996 active: 1;
@@ -1006,13 +1004,13 @@ typedef struct {
1006 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ 1004 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
1007 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ 1005 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
1008 unsigned char etram[32]; /* external TRAM address & data */ 1006 unsigned char etram[32]; /* external TRAM address & data */
1009 snd_pcm_indirect_t pcm_rec; 1007 struct snd_pcm_indirect pcm_rec;
1010 unsigned int tram_pos; 1008 unsigned int tram_pos;
1011 unsigned int tram_shift; 1009 unsigned int tram_shift;
1012 snd_emu10k1_fx8010_irq_t *irq; 1010 struct snd_emu10k1_fx8010_irq *irq;
1013} snd_emu10k1_fx8010_pcm_t; 1011};
1014 1012
1015typedef struct { 1013struct snd_emu10k1_fx8010 {
1016 unsigned short fxbus_mask; /* used FX buses (bitmask) */ 1014 unsigned short fxbus_mask; /* used FX buses (bitmask) */
1017 unsigned short extin_mask; /* used external inputs (bitmask) */ 1015 unsigned short extin_mask; /* used external inputs (bitmask) */
1018 unsigned short extout_mask; /* used external outputs (bitmask) */ 1016 unsigned short extout_mask; /* used external outputs (bitmask) */
@@ -1025,18 +1023,18 @@ typedef struct {
1025 int gpr_count; /* count of used kcontrols */ 1023 int gpr_count; /* count of used kcontrols */
1026 struct list_head gpr_ctl; /* GPR controls */ 1024 struct list_head gpr_ctl; /* GPR controls */
1027 struct semaphore lock; 1025 struct semaphore lock;
1028 snd_emu10k1_fx8010_pcm_t pcm[8]; 1026 struct snd_emu10k1_fx8010_pcm pcm[8];
1029 spinlock_t irq_lock; 1027 spinlock_t irq_lock;
1030 snd_emu10k1_fx8010_irq_t *irq_handlers; 1028 struct snd_emu10k1_fx8010_irq *irq_handlers;
1031} snd_emu10k1_fx8010_t; 1029};
1032 1030
1033#define emu10k1_gpr_ctl(n) list_entry(n, snd_emu10k1_fx8010_ctl_t, list) 1031#define emu10k1_gpr_ctl(n) list_entry(n, struct snd_emu10k1_fx8010_ctl, list)
1034 1032
1035typedef struct { 1033struct snd_emu10k1_midi {
1036 struct _snd_emu10k1 *emu; 1034 struct snd_emu10k1 *emu;
1037 snd_rawmidi_t *rmidi; 1035 struct snd_rawmidi *rmidi;
1038 snd_rawmidi_substream_t *substream_input; 1036 struct snd_rawmidi_substream *substream_input;
1039 snd_rawmidi_substream_t *substream_output; 1037 struct snd_rawmidi_substream *substream_output;
1040 unsigned int midi_mode; 1038 unsigned int midi_mode;
1041 spinlock_t input_lock; 1039 spinlock_t input_lock;
1042 spinlock_t output_lock; 1040 spinlock_t output_lock;
@@ -1044,10 +1042,10 @@ typedef struct {
1044 int tx_enable, rx_enable; 1042 int tx_enable, rx_enable;
1045 int port; 1043 int port;
1046 int ipr_tx, ipr_rx; 1044 int ipr_tx, ipr_rx;
1047 void (*interrupt)(emu10k1_t *emu, unsigned int status); 1045 void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1048} emu10k1_midi_t; 1046};
1049 1047
1050typedef struct { 1048struct snd_emu_chip_details {
1051 u32 vendor; 1049 u32 vendor;
1052 u32 device; 1050 u32 device;
1053 u32 subsystem; 1051 u32 subsystem;
@@ -1066,15 +1064,16 @@ typedef struct {
1066 const char *driver; 1064 const char *driver;
1067 const char *name; 1065 const char *name;
1068 const char *id; /* for backward compatibility - can be NULL if not needed */ 1066 const char *id; /* for backward compatibility - can be NULL if not needed */
1069} emu_chip_details_t; 1067};
1070 1068
1071struct _snd_emu10k1 { 1069struct snd_emu10k1 {
1072 int irq; 1070 int irq;
1073 1071
1074 unsigned long port; /* I/O port number */ 1072 unsigned long port; /* I/O port number */
1075 unsigned int tos_link: 1, /* tos link detected */ 1073 unsigned int tos_link: 1, /* tos link detected */
1076 rear_ac97: 1; /* rear channels are on AC'97 */ 1074 rear_ac97: 1; /* rear channels are on AC'97 */
1077 const emu_chip_details_t *card_capabilities; /* Contains profile of card capabilities */ 1075 /* Contains profile of card capabilities */
1076 const struct snd_emu_chip_details *card_capabilities;
1078 unsigned int audigy; /* is Audigy? */ 1077 unsigned int audigy; /* is Audigy? */
1079 unsigned int revision; /* chip revision */ 1078 unsigned int revision; /* chip revision */
1080 unsigned int serial; /* serial number */ 1079 unsigned int serial; /* serial number */
@@ -1088,8 +1087,8 @@ struct _snd_emu10k1 {
1088 struct snd_dma_device p16v_dma_dev; 1087 struct snd_dma_device p16v_dma_dev;
1089 struct snd_dma_buffer p16v_buffer; 1088 struct snd_dma_buffer p16v_buffer;
1090 1089
1091 snd_util_memhdr_t *memhdr; /* page allocation list */ 1090 struct snd_util_memhdr *memhdr; /* page allocation list */
1092 emu10k1_memblk_t *reserved_page; /* reserved page */ 1091 struct snd_emu10k1_memblk *reserved_page; /* reserved page */
1093 1092
1094 struct list_head mapped_link_head; 1093 struct list_head mapped_link_head;
1095 struct list_head mapped_order_link_head; 1094 struct list_head mapped_order_link_head;
@@ -1099,142 +1098,142 @@ struct _snd_emu10k1 {
1099 1098
1100 unsigned int spdif_bits[3]; /* s/pdif out setup */ 1099 unsigned int spdif_bits[3]; /* s/pdif out setup */
1101 1100
1102 snd_emu10k1_fx8010_t fx8010; /* FX8010 info */ 1101 struct snd_emu10k1_fx8010 fx8010; /* FX8010 info */
1103 int gpr_base; 1102 int gpr_base;
1104 1103
1105 ac97_t *ac97; 1104 struct snd_ac97 *ac97;
1106 1105
1107 struct pci_dev *pci; 1106 struct pci_dev *pci;
1108 snd_card_t *card; 1107 struct snd_card *card;
1109 snd_pcm_t *pcm; 1108 struct snd_pcm *pcm;
1110 snd_pcm_t *pcm_mic; 1109 struct snd_pcm *pcm_mic;
1111 snd_pcm_t *pcm_efx; 1110 struct snd_pcm *pcm_efx;
1112 snd_pcm_t *pcm_p16v; 1111 struct snd_pcm *pcm_p16v;
1113 1112
1114 spinlock_t synth_lock; 1113 spinlock_t synth_lock;
1115 void *synth; 1114 void *synth;
1116 int (*get_synth_voice)(emu10k1_t *emu); 1115 int (*get_synth_voice)(struct snd_emu10k1 *emu);
1117 1116
1118 spinlock_t reg_lock; 1117 spinlock_t reg_lock;
1119 spinlock_t emu_lock; 1118 spinlock_t emu_lock;
1120 spinlock_t voice_lock; 1119 spinlock_t voice_lock;
1121 struct semaphore ptb_lock; 1120 struct semaphore ptb_lock;
1122 1121
1123 emu10k1_voice_t voices[NUM_G]; 1122 struct snd_emu10k1_voice voices[NUM_G];
1124 emu10k1_voice_t p16v_voices[4]; 1123 struct snd_emu10k1_voice p16v_voices[4];
1125 emu10k1_voice_t p16v_capture_voice; 1124 struct snd_emu10k1_voice p16v_capture_voice;
1126 int p16v_device_offset; 1125 int p16v_device_offset;
1127 u32 p16v_capture_source; 1126 u32 p16v_capture_source;
1128 u32 p16v_capture_channel; 1127 u32 p16v_capture_channel;
1129 emu10k1_pcm_mixer_t pcm_mixer[32]; 1128 struct snd_emu10k1_pcm_mixer pcm_mixer[32];
1130 emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK]; 1129 struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK];
1131 snd_kcontrol_t *ctl_send_routing; 1130 struct snd_kcontrol *ctl_send_routing;
1132 snd_kcontrol_t *ctl_send_volume; 1131 struct snd_kcontrol *ctl_send_volume;
1133 snd_kcontrol_t *ctl_attn; 1132 struct snd_kcontrol *ctl_attn;
1134 snd_kcontrol_t *ctl_efx_send_routing; 1133 struct snd_kcontrol *ctl_efx_send_routing;
1135 snd_kcontrol_t *ctl_efx_send_volume; 1134 struct snd_kcontrol *ctl_efx_send_volume;
1136 snd_kcontrol_t *ctl_efx_attn; 1135 struct snd_kcontrol *ctl_efx_attn;
1137 1136
1138 void (*hwvol_interrupt)(emu10k1_t *emu, unsigned int status); 1137 void (*hwvol_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1139 void (*capture_interrupt)(emu10k1_t *emu, unsigned int status); 1138 void (*capture_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1140 void (*capture_mic_interrupt)(emu10k1_t *emu, unsigned int status); 1139 void (*capture_mic_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1141 void (*capture_efx_interrupt)(emu10k1_t *emu, unsigned int status); 1140 void (*capture_efx_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1142 void (*spdif_interrupt)(emu10k1_t *emu, unsigned int status); 1141 void (*spdif_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1143 void (*dsp_interrupt)(emu10k1_t *emu); 1142 void (*dsp_interrupt)(struct snd_emu10k1 *emu);
1144 1143
1145 snd_pcm_substream_t *pcm_capture_substream; 1144 struct snd_pcm_substream *pcm_capture_substream;
1146 snd_pcm_substream_t *pcm_capture_mic_substream; 1145 struct snd_pcm_substream *pcm_capture_mic_substream;
1147 snd_pcm_substream_t *pcm_capture_efx_substream; 1146 struct snd_pcm_substream *pcm_capture_efx_substream;
1148 snd_pcm_substream_t *pcm_playback_efx_substream; 1147 struct snd_pcm_substream *pcm_playback_efx_substream;
1149 1148
1150 snd_timer_t *timer; 1149 struct snd_timer *timer;
1151 1150
1152 emu10k1_midi_t midi; 1151 struct snd_emu10k1_midi midi;
1153 emu10k1_midi_t midi2; /* for audigy */ 1152 struct snd_emu10k1_midi midi2; /* for audigy */
1154 1153
1155 unsigned int efx_voices_mask[2]; 1154 unsigned int efx_voices_mask[2];
1156 unsigned int next_free_voice; 1155 unsigned int next_free_voice;
1157}; 1156};
1158 1157
1159int snd_emu10k1_create(snd_card_t * card, 1158int snd_emu10k1_create(struct snd_card *card,
1160 struct pci_dev *pci, 1159 struct pci_dev *pci,
1161 unsigned short extin_mask, 1160 unsigned short extin_mask,
1162 unsigned short extout_mask, 1161 unsigned short extout_mask,
1163 long max_cache_bytes, 1162 long max_cache_bytes,
1164 int enable_ir, 1163 int enable_ir,
1165 uint subsystem, 1164 uint subsystem,
1166 emu10k1_t ** remu); 1165 struct snd_emu10k1 ** remu);
1167 1166
1168int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1167int snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1169int snd_emu10k1_pcm_mic(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1168int snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1170int snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1169int snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1171int snd_p16v_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1170int snd_p16v_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1172int snd_p16v_free(emu10k1_t * emu); 1171int snd_p16v_free(struct snd_emu10k1 * emu);
1173int snd_p16v_mixer(emu10k1_t * emu); 1172int snd_p16v_mixer(struct snd_emu10k1 * emu);
1174int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1173int snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1175int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1174int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1176int snd_emu10k1_mixer(emu10k1_t * emu, int pcm_device, int multi_device); 1175int snd_emu10k1_mixer(struct snd_emu10k1 * emu, int pcm_device, int multi_device);
1177int snd_emu10k1_timer(emu10k1_t * emu, int device); 1176int snd_emu10k1_timer(struct snd_emu10k1 * emu, int device);
1178int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep); 1177int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep);
1179 1178
1180irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs); 1179irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs);
1181 1180
1182/* initialization */ 1181/* initialization */
1183void snd_emu10k1_voice_init(emu10k1_t * emu, int voice); 1182void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int voice);
1184int snd_emu10k1_init_efx(emu10k1_t *emu); 1183int snd_emu10k1_init_efx(struct snd_emu10k1 *emu);
1185void snd_emu10k1_free_efx(emu10k1_t *emu); 1184void snd_emu10k1_free_efx(struct snd_emu10k1 *emu);
1186int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size); 1185int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size);
1187 1186
1188/* I/O functions */ 1187/* I/O functions */
1189unsigned int snd_emu10k1_ptr_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1188unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1190void snd_emu10k1_ptr_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1189void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1191unsigned int snd_emu10k1_ptr20_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1190unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1192void snd_emu10k1_ptr20_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1191void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1193unsigned int snd_emu10k1_efx_read(emu10k1_t *emu, unsigned int pc); 1192unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc);
1194void snd_emu10k1_intr_enable(emu10k1_t *emu, unsigned int intrenb); 1193void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb);
1195void snd_emu10k1_intr_disable(emu10k1_t *emu, unsigned int intrenb); 1194void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb);
1196void snd_emu10k1_voice_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1195void snd_emu10k1_voice_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1197void snd_emu10k1_voice_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1196void snd_emu10k1_voice_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1198void snd_emu10k1_voice_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1197void snd_emu10k1_voice_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1199void snd_emu10k1_voice_half_loop_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1198void snd_emu10k1_voice_half_loop_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1200void snd_emu10k1_voice_half_loop_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1199void snd_emu10k1_voice_half_loop_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1201void snd_emu10k1_voice_half_loop_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1200void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1202void snd_emu10k1_voice_set_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1201void snd_emu10k1_voice_set_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1203void snd_emu10k1_voice_clear_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1202void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1204void snd_emu10k1_wait(emu10k1_t *emu, unsigned int wait); 1203void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait);
1205static inline unsigned int snd_emu10k1_wc(emu10k1_t *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; } 1204static inline unsigned int snd_emu10k1_wc(struct snd_emu10k1 *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; }
1206unsigned short snd_emu10k1_ac97_read(ac97_t *ac97, unsigned short reg); 1205unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
1207void snd_emu10k1_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short data); 1206void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
1208unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); 1207unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
1209 1208
1210/* memory allocation */ 1209/* memory allocation */
1211snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, snd_pcm_substream_t *substream); 1210struct snd_util_memblk *snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream);
1212int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk); 1211int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1213snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size); 1212struct snd_util_memblk *snd_emu10k1_synth_alloc(struct snd_emu10k1 *emu, unsigned int size);
1214int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk); 1213int snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1215int snd_emu10k1_synth_bzero(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, int size); 1214int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, int size);
1216int snd_emu10k1_synth_copy_from_user(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, const char __user *data, int size); 1215int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, const char __user *data, int size);
1217int snd_emu10k1_memblk_map(emu10k1_t *emu, emu10k1_memblk_t *blk); 1216int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk);
1218 1217
1219/* voice allocation */ 1218/* voice allocation */
1220int snd_emu10k1_voice_alloc(emu10k1_t *emu, emu10k1_voice_type_t type, int pair, emu10k1_voice_t **rvoice); 1219int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int pair, struct snd_emu10k1_voice **rvoice);
1221int snd_emu10k1_voice_free(emu10k1_t *emu, emu10k1_voice_t *pvoice); 1220int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
1222 1221
1223/* MIDI uart */ 1222/* MIDI uart */
1224int snd_emu10k1_midi(emu10k1_t * emu); 1223int snd_emu10k1_midi(struct snd_emu10k1 * emu);
1225int snd_emu10k1_audigy_midi(emu10k1_t * emu); 1224int snd_emu10k1_audigy_midi(struct snd_emu10k1 * emu);
1226 1225
1227/* proc interface */ 1226/* proc interface */
1228int snd_emu10k1_proc_init(emu10k1_t * emu); 1227int snd_emu10k1_proc_init(struct snd_emu10k1 * emu);
1229 1228
1230/* fx8010 irq handler */ 1229/* fx8010 irq handler */
1231int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, 1230int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
1232 snd_fx8010_irq_handler_t *handler, 1231 snd_fx8010_irq_handler_t *handler,
1233 unsigned char gpr_running, 1232 unsigned char gpr_running,
1234 void *private_data, 1233 void *private_data,
1235 snd_emu10k1_fx8010_irq_t **r_irq); 1234 struct snd_emu10k1_fx8010_irq **r_irq);
1236int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, 1235int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
1237 snd_emu10k1_fx8010_irq_t *irq); 1236 struct snd_emu10k1_fx8010_irq *irq);
1238 1237
1239#endif /* __KERNEL__ */ 1238#endif /* __KERNEL__ */
1240 1239
@@ -1469,14 +1468,14 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu,
1469#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ 1468#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
1470#endif 1469#endif
1471 1470
1472typedef struct { 1471struct snd_emu10k1_fx8010_info {
1473 unsigned int internal_tram_size; /* in samples */ 1472 unsigned int internal_tram_size; /* in samples */
1474 unsigned int external_tram_size; /* in samples */ 1473 unsigned int external_tram_size; /* in samples */
1475 char fxbus_names[16][32]; /* names of FXBUSes */ 1474 char fxbus_names[16][32]; /* names of FXBUSes */
1476 char extin_names[16][32]; /* names of external inputs */ 1475 char extin_names[16][32]; /* names of external inputs */
1477 char extout_names[32][32]; /* names of external outputs */ 1476 char extout_names[32][32]; /* names of external outputs */
1478 unsigned int gpr_controls; /* count of GPR controls */ 1477 unsigned int gpr_controls; /* count of GPR controls */
1479} emu10k1_fx8010_info_t; 1478};
1480 1479
1481#define EMU10K1_GPR_TRANSLATION_NONE 0 1480#define EMU10K1_GPR_TRANSLATION_NONE 0
1482#define EMU10K1_GPR_TRANSLATION_TABLE100 1 1481#define EMU10K1_GPR_TRANSLATION_TABLE100 1
@@ -1484,8 +1483,8 @@ typedef struct {
1484#define EMU10K1_GPR_TRANSLATION_TREBLE 3 1483#define EMU10K1_GPR_TRANSLATION_TREBLE 3
1485#define EMU10K1_GPR_TRANSLATION_ONOFF 4 1484#define EMU10K1_GPR_TRANSLATION_ONOFF 4
1486 1485
1487typedef struct { 1486struct snd_emu10k1_fx8010_control_gpr {
1488 snd_ctl_elem_id_t id; /* full control ID definition */ 1487 struct snd_ctl_elem_id id; /* full control ID definition */
1489 unsigned int vcount; /* visible count */ 1488 unsigned int vcount; /* visible count */
1490 unsigned int count; /* count of GPR (1..16) */ 1489 unsigned int count; /* count of GPR (1..16) */
1491 unsigned short gpr[32]; /* GPR number(s) */ 1490 unsigned short gpr[32]; /* GPR number(s) */
@@ -1493,23 +1492,23 @@ typedef struct {
1493 unsigned int min; /* minimum range */ 1492 unsigned int min; /* minimum range */
1494 unsigned int max; /* maximum range */ 1493 unsigned int max; /* maximum range */
1495 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 1494 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
1496} emu10k1_fx8010_control_gpr_t; 1495};
1497 1496
1498typedef struct { 1497struct snd_emu10k1_fx8010_code {
1499 char name[128]; 1498 char name[128];
1500 1499
1501 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ 1500 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
1502 u_int32_t __user *gpr_map; /* initializers */ 1501 u_int32_t __user *gpr_map; /* initializers */
1503 1502
1504 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ 1503 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
1505 emu10k1_fx8010_control_gpr_t __user *gpr_add_controls; /* GPR controls to add/replace */ 1504 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
1506 1505
1507 unsigned int gpr_del_control_count; /* count of GPR controls to remove */ 1506 unsigned int gpr_del_control_count; /* count of GPR controls to remove */
1508 snd_ctl_elem_id_t __user *gpr_del_controls; /* IDs of GPR controls to remove */ 1507 struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
1509 1508
1510 unsigned int gpr_list_control_count; /* count of GPR controls to list */ 1509 unsigned int gpr_list_control_count; /* count of GPR controls to list */
1511 unsigned int gpr_list_control_total; /* total count of GPR controls */ 1510 unsigned int gpr_list_control_total; /* total count of GPR controls */
1512 emu10k1_fx8010_control_gpr_t __user *gpr_list_controls; /* listed GPR controls */ 1511 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
1513 1512
1514 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ 1513 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
1515 u_int32_t __user *tram_data_map; /* data initializers */ 1514 u_int32_t __user *tram_data_map; /* data initializers */
@@ -1517,16 +1516,16 @@ typedef struct {
1517 1516
1518 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ 1517 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
1519 u_int32_t __user *code; /* one instruction - 64 bits */ 1518 u_int32_t __user *code; /* one instruction - 64 bits */
1520} emu10k1_fx8010_code_t; 1519};
1521 1520
1522typedef struct { 1521struct snd_emu10k1_fx8010_tram {
1523 unsigned int address; /* 31.bit == 1 -> external TRAM */ 1522 unsigned int address; /* 31.bit == 1 -> external TRAM */
1524 unsigned int size; /* size in samples (4 bytes) */ 1523 unsigned int size; /* size in samples (4 bytes) */
1525 unsigned int *samples; /* pointer to samples (20-bit) */ 1524 unsigned int *samples; /* pointer to samples (20-bit) */
1526 /* NULL->clear memory */ 1525 /* NULL->clear memory */
1527} emu10k1_fx8010_tram_t; 1526};
1528 1527
1529typedef struct { 1528struct snd_emu10k1_fx8010_pcm_rec {
1530 unsigned int substream; /* substream number */ 1529 unsigned int substream; /* substream number */
1531 unsigned int res1; /* reserved */ 1530 unsigned int res1; /* reserved */
1532 unsigned int channels; /* 16-bit channels count, zero = remove this substream */ 1531 unsigned int channels; /* 16-bit channels count, zero = remove this substream */
@@ -1541,20 +1540,27 @@ typedef struct {
1541 unsigned char pad; /* reserved */ 1540 unsigned char pad; /* reserved */
1542 unsigned char etram[32]; /* external TRAM address & data (one per channel) */ 1541 unsigned char etram[32]; /* external TRAM address & data (one per channel) */
1543 unsigned int res2; /* reserved */ 1542 unsigned int res2; /* reserved */
1544} emu10k1_fx8010_pcm_t; 1543};
1545 1544
1546#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t) 1545#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
1547#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t) 1546#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
1548#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t) 1547#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
1549#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) 1548#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
1550#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t) 1549#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
1551#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t) 1550#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
1552#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t) 1551#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
1553#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t) 1552#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
1554#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) 1553#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
1555#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) 1554#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
1556#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) 1555#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
1557#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) 1556#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
1558#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) 1557#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
1559 1558
1559/* typedefs for compatibility to user-space */
1560typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
1561typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
1562typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
1563typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
1564typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
1565
1560#endif /* __SOUND_EMU10K1_H */ 1566#endif /* __SOUND_EMU10K1_H */