Ignore:
Timestamp:
Dec 11, 2005, 5:57:39 PM (20 years ago)
Author:
vladest
Message:

Latest update from ALSA. some intial > 15 interrupts support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/alsa-kernel/include/sound/trident.h

    r33 r34  
    3434#include "ainstr_simple.h"
    3535
    36 #ifndef PCI_VENDOR_ID_TRIDENT
    37 #define PCI_VENDOR_ID_TRIDENT           0x1023
     36#ifndef PCI_DEVICE_ID_SI_7018
     37#define PCI_DEVICE_ID_SI_7018           0x7018
    3838#endif
    39 #ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 
    40 #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
     39#ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_DX
     40#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
    4141#endif
    42 #ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_NX
    43 #define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
    44 #endif
    45 
    46 #ifndef PCI_VENDOR_ID_SI
    47 #define PCI_VENDOR_ID_SI                0x1039
    48 #endif
    49 #ifndef PCI_DEVICE_ID_SI_7018
    50 #define PCI_DEVICE_ID_SI_7018           0x7018
     42#ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_NX
     43#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
    5144#endif
    5245
     
    263256        SI_AC97_POWERDOWN = 0x04000000,
    264257};
    265 
     258                                                                                                                                   
    266259/* PCM defaults */
    267260
     
    271264#define T4D_DEFAULT_PCM_CVOL    127     /* 0 - 127 */
    272265
    273 typedef struct _snd_trident trident_t;
    274 typedef struct _snd_trident_voice snd_trident_voice_t;
    275 typedef struct _snd_trident_pcm_mixer snd_trident_pcm_mixer_t;
    276 
    277 typedef struct {
    278         void (*sample_start)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_position_t position);
    279         void (*sample_stop)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_stop_mode_t mode);
    280         void (*sample_freq)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_frequency_t freq);
    281         void (*sample_volume)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_ev_volume_t *volume);
    282         void (*sample_loop)(trident_t *card, snd_trident_voice_t *voice, snd_seq_ev_loop_t *loop);
    283         void (*sample_pos)(trident_t *card, snd_trident_voice_t *voice, snd_seq_position_t position);
    284         void (*sample_private1)(trident_t *card, snd_trident_voice_t *voice, unsigned char *data);
    285 } snd_trident_sample_ops_t;
    286 
    287 typedef struct {
    288         snd_midi_channel_set_t * chset;
    289         trident_t * trident;
     266struct snd_trident;
     267struct snd_trident_voice;
     268struct snd_trident_pcm_mixer;
     269
     270struct snd_trident_sample_ops {
     271        void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position);
     272        void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode);
     273        void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq);
     274        void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume);
     275        void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop);
     276        void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position);
     277        void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data);
     278};
     279
     280struct snd_trident_port {
     281        struct snd_midi_channel_set * chset;
     282        struct snd_trident * trident;
    290283        int mode;               /* operation mode */
    291284        int client;             /* sequencer client number */
    292285        int port;               /* sequencer port number */
    293         int midi_has_voices: 1;
    294 } snd_trident_port_t;
    295 
    296 typedef struct snd_trident_memblk_arg {
     286        unsigned int midi_has_voices: 1;
     287};
     288
     289struct snd_trident_memblk_arg {
    297290        short first_page, last_page;
    298 } snd_trident_memblk_arg_t;
    299 
    300 typedef struct {
     291};
     292
     293struct snd_trident_tlb {
    301294        unsigned int * entries;         /* 16k-aligned TLB table */
    302295        dma_addr_t entries_dmaaddr;     /* 16k-aligned PCI address to TLB table */
    303         unsigned long * shadow_entries; /* shadow entries with virtual addresses */
    304         struct snd_dma_buffer buffer;
    305         snd_util_memhdr_t * memhdr;     /* page allocation list */
    306         struct snd_dma_buffer silent_page;
    307 } snd_trident_tlb_t;
    308 
    309 struct _snd_trident_voice {
     296        unsigned long * shadow_entries; /* shadow entries with virtual addresses */
     297        struct snd_dma_buffer buffer;
     298        struct snd_util_memhdr * memhdr;        /* page allocation list */
     299        struct snd_dma_buffer silent_page;
     300};
     301
     302struct snd_trident_voice {
    310303        unsigned int number;
    311         int use: 1,
     304        unsigned int use: 1,
    312305            pcm: 1,
    313306            synth:1,
     
    318311        unsigned char index;
    319312
    320         snd_seq_instr_t instr;
    321         snd_trident_sample_ops_t *sample_ops;
     313        struct snd_seq_instr instr;
     314        struct snd_trident_sample_ops *sample_ops;
    322315
    323316        /* channel parameters */
     
    341334        unsigned int negCSO;    /* nonzero - use negative CSO */
    342335
    343         snd_util_memblk_t *memblk;      /* memory block if TLB enabled */
     336        struct snd_util_memblk *memblk; /* memory block if TLB enabled */
    344337
    345338        /* PCM data */
    346339
    347         trident_t *trident;
    348         snd_pcm_substream_t *substream;
    349         snd_trident_voice_t *extra;     /* extra PCM voice (acts as interrupt generator) */
    350         int running: 1,
     340        struct snd_trident *trident;
     341        struct snd_pcm_substream *substream;
     342        struct snd_trident_voice *extra;        /* extra PCM voice (acts as interrupt generator) */
     343        unsigned int running: 1,
    351344            capture: 1,
    352345            spdif: 1,
     
    365358
    366359        void *private_data;
    367         void (*private_free)(snd_trident_voice_t *voice);
    368 };
    369 
    370 struct _snd_4dwave {
     360        void (*private_free)(struct snd_trident_voice *voice);
     361};
     362
     363struct snd_4dwave {
    371364        int seq_client;
    372365
    373         snd_trident_port_t seq_ports[4];
    374         snd_simple_ops_t simple_ops;
    375         snd_seq_kinstr_list_t *ilist;
    376 
    377         snd_trident_voice_t voices[64];
     366        struct snd_trident_port seq_ports[4];
     367        struct snd_simple_ops simple_ops;
     368        struct snd_seq_kinstr_list *ilist;
     369
     370        struct snd_trident_voice voices[64];   
    378371
    379372        int ChanSynthCount;             /* number of allocated synth channels */
     
    382375};
    383376
    384 struct _snd_trident_pcm_mixer {
    385         snd_trident_voice_t *voice;     /* active voice */
     377struct snd_trident_pcm_mixer {
     378        struct snd_trident_voice *voice;        /* active voice */
    386379        unsigned short vol;             /* front volume */
    387380        unsigned char pan;              /* pan control */
     
    391384};
    392385
    393 struct _snd_trident {
     386struct snd_trident {
    394387        int irq;
    395388
     
    404397        unsigned int spurious_irq_max_delta;
    405398
    406         snd_trident_tlb_t tlb;  /* TLB entries for NX cards */
     399        struct snd_trident_tlb tlb;     /* TLB entries for NX cards */
    407400
    408401        unsigned char spdif_ctrl;
     
    410403        unsigned int spdif_bits;
    411404        unsigned int spdif_pcm_bits;
    412         snd_kcontrol_t *spdif_pcm_ctl;  /* S/PDIF settings */
     405        struct snd_kcontrol *spdif_pcm_ctl;     /* S/PDIF settings */
    413406        unsigned int ac97_ctrl;
    414407       
     
    421414        unsigned int in_suspend: 1;     /* 1 during suspend/resume */
    422415
    423         struct _snd_4dwave synth;       /* synth specific variables */
     416        struct snd_4dwave synth;        /* synth specific variables */
    424417
    425418        spinlock_t event_lock;
    426419        spinlock_t voice_alloc;
    427420
    428         struct snd_dma_device dma_dev;
     421        struct snd_dma_device dma_dev;
     422
    429423        struct pci_dev *pci;
    430         snd_card_t *card;
    431         snd_pcm_t *pcm;         /* ADC/DAC PCM */
    432         snd_pcm_t *foldback;    /* Foldback PCM */
    433         snd_pcm_t *spdif;       /* SPDIF PCM */
    434         snd_rawmidi_t *rmidi;
    435         snd_seq_device_t *seq_dev;
    436 
    437         ac97_bus_t *ac97_bus;
    438         ac97_t *ac97;
    439         ac97_t *ac97_sec;
     424        struct snd_card *card;
     425        struct snd_pcm *pcm;            /* ADC/DAC PCM */
     426        struct snd_pcm *foldback;       /* Foldback PCM */
     427        struct snd_pcm *spdif;  /* SPDIF PCM */
     428        struct snd_rawmidi *rmidi;
     429        struct snd_seq_device *seq_dev;
     430
     431        struct snd_ac97_bus *ac97_bus;
     432        struct snd_ac97 *ac97;
     433        struct snd_ac97 *ac97_sec;
    440434
    441435        unsigned int musicvol_wavevol;
    442         snd_trident_pcm_mixer_t pcm_mixer[32];
    443         snd_kcontrol_t *ctl_vol;        /* front volume */
    444         snd_kcontrol_t *ctl_pan;        /* pan */
    445         snd_kcontrol_t *ctl_rvol;       /* rear volume */
    446         snd_kcontrol_t *ctl_cvol;       /* center volume */
     436        struct snd_trident_pcm_mixer pcm_mixer[32];
     437        struct snd_kcontrol *ctl_vol;   /* front volume */
     438        struct snd_kcontrol *ctl_pan;   /* pan */
     439        struct snd_kcontrol *ctl_rvol;  /* rear volume */
     440        struct snd_kcontrol *ctl_cvol;  /* center volume */
    447441
    448442        spinlock_t reg_lock;
    449443
    450         struct snd_trident_gameport *gameport;
    451 };
    452 
    453 int snd_trident_create(snd_card_t * card,
     444        struct gameport *gameport;
     445};
     446
     447int snd_trident_create(struct snd_card *card,
    454448                       struct pci_dev *pci,
    455449                       int pcm_streams,
    456450                       int pcm_spdif_device,
    457451                       int max_wavetable_size,
    458                        trident_t ** rtrident);
    459 int snd_trident_free(trident_t *trident);
    460 void snd_trident_gameport(trident_t *trident);
    461 
    462 int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);
    463 int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);
    464 int snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);
    465 int snd_trident_attach_synthesizer(trident_t * trident);
    466 int snd_trident_detach_synthesizer(trident_t * trident);
    467 snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port);
    468 void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice);
    469 void snd_trident_start_voice(trident_t * trident, unsigned int voice);
    470 void snd_trident_stop_voice(trident_t * trident, unsigned int voice);
    471 void snd_trident_write_voice_regs(trident_t * trident, snd_trident_voice_t *voice);
    472 void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max);
     452                       struct snd_trident ** rtrident);
     453int snd_trident_create_gameport(struct snd_trident *trident);
     454
     455int snd_trident_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
     456int snd_trident_foldback_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
     457int snd_trident_spdif_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
     458int snd_trident_attach_synthesizer(struct snd_trident * trident);
     459struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type,
     460                                             int client, int port);
     461void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice);
     462void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice);
     463void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice);
     464void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice);
     465int snd_trident_suspend(struct pci_dev *pci, pm_message_t state);
     466int snd_trident_resume(struct pci_dev *pci);
    473467
    474468/* TLB memory allocation */
    475 snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream);
    476 int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk);
    477 snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size);
    478 int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk);
    479 int snd_trident_synth_bzero(trident_t *trident, snd_util_memblk_t *blk, int offset, int size);
    480 int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char *data, int size);
     469struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident,
     470                                                struct snd_pcm_substream *substream);
     471int snd_trident_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk);
     472struct snd_util_memblk *snd_trident_synth_alloc(struct snd_trident *trident, unsigned int size);
     473int snd_trident_synth_free(struct snd_trident *trident, struct snd_util_memblk *blk);
     474int snd_trident_synth_copy_from_user(struct snd_trident *trident, struct snd_util_memblk *blk,
     475                                     int offset, const char __user *data, int size);
    481476
    482477#endif /* __SOUND_TRIDENT_H */
Note: See TracChangeset for help on using the changeset viewer.