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

Latest update from ALSA. some intial > 15 interrupts support

Location:
GPL/trunk/alsa-kernel/include/sound
Files:
20 edited

Legend:

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

    r33 r34  
    399399 */
    400400
    401 typedef struct _snd_ac97_bus ac97_bus_t;
    402 typedef struct _snd_ac97_bus_ops ac97_bus_ops_t;
    403 typedef struct _snd_ac97_template ac97_template_t;
    404 typedef struct _snd_ac97 ac97_t;
    405 
    406401enum ac97_pcm_cfg {
    407402    AC97_PCM_CFG_FRONT = 2,
     
    448443};
    449444
    450 struct _snd_ac97_bus_ops {
     445struct snd_ac97_bus_ops {
    451446    void (*reset) (ac97_t *ac97);
    452447    void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val);
     
    456451};
    457452
    458 struct _snd_ac97_bus {
     453struct snd_ac97_bus {
    459454    /* -- lowlevel (hardware) driver specific -- */
    460455    ac97_bus_ops_t *ops;
     
    477472};
    478473
    479 struct _snd_ac97_template {
     474struct snd_ac97_template {
    480475    void *private_data;
    481476    void (*private_free) (ac97_t *ac97);
     
    488483};
    489484
    490 struct _snd_ac97 {
     485struct snd_ac97 {
    491486    /* -- lowlevel (hardware) driver specific -- */
    492487    struct snd_ac97_build_ops * build_ops;
  • GPL/trunk/alsa-kernel/include/sound/ainstr_simple.h

    r33 r34  
    137137extern char *snd_seq_simple_id;
    138138
    139 typedef struct {
     139typedef struct snd_simple_ops {
    140140        void *private_data;
    141141        int (*info)(void *private_data, simple_instrument_info_t *info);
  • GPL/trunk/alsa-kernel/include/sound/asound.h

    r33 r34  
    5555#ifndef __bitwise
    5656#define __bitwise
     57#endif
     58
     59#ifdef TARGET_OS2
     60#define SNDRV_PCM_VOL_FRONT_LEFT        0
     61#define SNDRV_PCM_VOL_FRONT_RIGHT       1
     62#define SNDRV_PCM_VOL_REAR_LEFT         2
     63#define SNDRV_PCM_VOL_REAR_RIGHT        3
     64#define SNDRV_PCM_VOL_CENTER            4
     65#define SNDRV_PCM_VOL_LFE               5
     66
     67#define SNDRV_PCM_VOL_MAX               100
     68
     69struct snd_pcm_volume {
     70        int nrchannels;
     71        int volume[6];
     72};
    5773#endif
    5874
     
    314330#define SNDRV_PCM_HW_PARAM_ACCESS       ((__force snd_pcm_hw_param_t) 0) /* Access type */
    315331#define SNDRV_PCM_HW_PARAM_FORMAT       ((__force snd_pcm_hw_param_t) 1) /* Format */
    316 #define SNDRV_PCM_HW_PARAM_SUBFORMAT    ((__force snd_pcm_hw_param_t) 2) /* Subformat */
     332#ifdef TARGET_OS2
     333#define SNDRV_PCM_HW_PARAM_RATE_MASK    ((__force snd_pcm_hw_param_t) 2) /* Format */
     334#endif
     335#define SNDRV_PCM_HW_PARAM_SUBFORMAT    ((__force snd_pcm_hw_param_t) 3) /* Subformat */
    317336#define SNDRV_PCM_HW_PARAM_FIRST_MASK   SNDRV_PCM_HW_PARAM_ACCESS
    318337#define SNDRV_PCM_HW_PARAM_LAST_MASK    SNDRV_PCM_HW_PARAM_SUBFORMAT
     
    856875        SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
    857876        SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
    858         SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
     877        SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
     878#ifdef TARGET_OS2
     879        SNDRV_PCM_IOCTL_SETVOLUME = _IOW('A', 0x62, struct snd_pcm_volume),
     880        SNDRV_PCM_IOCTL_GETVOLUME = _IOR('A', 0x63, struct snd_pcm_volume),
     881#endif
     882
    859883};
    860884
     
    916940};
    917941
     942#define msleep(msecs) \
     943        do { \
     944                set_current_state(TASK_UNINTERRUPTIBLE); \
     945                schedule_timeout(((msecs) * HZ + 999) / 1000);  \
     946        } while (0)
     947
     948#define schedule_timeout_interruptible(x) \
     949 {set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(x);}
     950#define schedule_timeout_uninterruptible(x) {set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(x);}
     951
    918952#endif /* __SOUND_ASOUND_H */
  • GPL/trunk/alsa-kernel/include/sound/asoundef.h

    r33 r34  
    186186#define MIDI_CTL_SUSTAIN                0x40
    187187#define MIDI_CTL_PORTAMENTO             0x41
    188 #define MIDI_CTL_SUSTENUTO              0x42
     188#define MIDI_CTL_SOSTENUTO              0x42
    189189#define MIDI_CTL_SOFT_PEDAL             0x43
    190190#define MIDI_CTL_LEGATO_FOOTSWITCH      0x44
  • GPL/trunk/alsa-kernel/include/sound/config.h

    r33 r34  
    194194#endif
    195195
     196struct snd_minor {
     197        struct list_head list;          /* list of all minors per card */
     198        int number;                     /* minor number */
     199        int device;                     /* device number */
     200        const char *comment;            /* for /proc/asound/devices */
     201        struct file_operations *f_ops;  /* file operations */
     202        char name[1];                   /* device name (keep at the end of
     203                                                                structure) */
     204};
     205
     206/* misc.c */
     207struct resource;
     208void release_and_free_resource(struct resource *res);
     209
     210#include "typedefs.h"
     211
    196212#endif //__ALSA_CONFIG_H__
  • GPL/trunk/alsa-kernel/include/sound/cs46xx.h

    r33 r34  
    2929#include "ac97_codec.h"
    3030#include "cs46xx_dsp_spos.h"
    31 
    32 #ifndef PCI_VENDOR_ID_CIRRUS
    33 #define PCI_VENDOR_ID_CIRRUS            0x1013
    34 #endif
    35 #ifndef PCI_DEVICE_ID_CIRRUS_4610
    36 #define PCI_DEVICE_ID_CIRRUS_4610       0x6001
    37 #endif
    38 #ifndef PCI_DEVICE_ID_CIRRUS_4612
    39 #define PCI_DEVICE_ID_CIRRUS_4612       0x6003
    40 #endif
    41 #ifndef PCI_DEVICE_ID_CIRRUS_4615
    42 #define PCI_DEVICE_ID_CIRRUS_4615       0x6004
    43 #endif
    4431
    4532/*
     
    16451632#define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT   2
    16461633
    1647 typedef struct _snd_cs46xx cs46xx_t;
    1648 
    1649 typedef struct _snd_cs46xx_pcm_t {
     1634
     1635struct snd_cs46xx_pcm {
    16501636        struct snd_dma_buffer hw_buf;
    16511637 
    16521638        unsigned int ctl;
    1653         unsigned int shift;     /* Shift count to trasform frames in bytes */
    1654         snd_pcm_indirect_t pcm_rec;
    1655         snd_pcm_substream_t *substream;
    1656 
    1657         pcm_channel_descriptor_t * pcm_channel;
     1639        unsigned int shift;     /* Shift count to trasform frames in bytes */
     1640        struct snd_pcm_indirect pcm_rec;
     1641        struct snd_pcm_substream *substream;
     1642
     1643        struct dsp_pcm_channel_descriptor * pcm_channel;
    16581644
    16591645        int pcm_channel_id;    /* Fron Rear, Center Lfe  ... */
    1660 } cs46xx_pcm_t;
    1661 
    1662 typedef struct {
     1646};
     1647
     1648struct snd_cs46xx_region {
    16631649        char name[24];
    1664         unsigned long base;
    1665         void __iomem *remap_addr;
     1650        unsigned long base;
     1651        void __iomem *remap_addr;
    16661652        unsigned long size;
    16671653        struct resource *resource;
    1668 } snd_cs46xx_region_t;
    1669 
    1670 struct _snd_cs46xx {
     1654};
     1655
     1656struct snd_cs46xx {
    16711657        int irq;
    16721658        unsigned long ba0_addr;
     
    16741660        union {
    16751661                struct {
    1676                         snd_cs46xx_region_t ba0;
    1677                         snd_cs46xx_region_t data0;
    1678                         snd_cs46xx_region_t data1;
    1679                         snd_cs46xx_region_t pmem;
    1680                         snd_cs46xx_region_t reg;
     1662                        struct snd_cs46xx_region ba0;
     1663                        struct snd_cs46xx_region data0;
     1664                        struct snd_cs46xx_region data1;
     1665                        struct snd_cs46xx_region pmem;
     1666                        struct snd_cs46xx_region reg;
    16811667                } name;
    1682                 snd_cs46xx_region_t idx[5];
     1668                struct snd_cs46xx_region idx[5];
    16831669        } region;
    16841670
    16851671        unsigned int mode;
    16861672       
    1687         struct {
     1673        struct {
    16881674                struct snd_dma_buffer hw_buf;
    16891675
    16901676                unsigned int ctl;
    1691                 unsigned int shift;     /* Shift count to trasform frames in bytes */
    1692                 snd_pcm_indirect_t pcm_rec;
    1693                 snd_pcm_substream_t *substream;
     1677                unsigned int shift;     /* Shift count to trasform frames in bytes */
     1678                struct snd_pcm_indirect pcm_rec;
     1679                struct snd_pcm_substream *substream;
    16941680        } capt;
    16951681
    16961682
    16971683        int nr_ac97_codecs;
    1698         ac97_bus_t *ac97_bus;
    1699         ac97_t *ac97[MAX_NR_AC97];
     1684        struct snd_ac97_bus *ac97_bus;
     1685        struct snd_ac97 *ac97[MAX_NR_AC97];
    17001686
    17011687        struct pci_dev *pci;
    1702         snd_card_t *card;
    1703         snd_pcm_t *pcm;
    1704 
    1705         snd_rawmidi_t *rmidi;
    1706         snd_rawmidi_substream_t *midi_input;
    1707         snd_rawmidi_substream_t *midi_output;
     1688        struct snd_card *card;
     1689        struct snd_pcm *pcm;
     1690
     1691        struct snd_rawmidi *rmidi;
     1692        struct snd_rawmidi_substream *midi_input;
     1693        struct snd_rawmidi_substream *midi_output;
    17081694
    17091695        spinlock_t reg_lock;
     
    17121698
    17131699        int amplifier;
    1714         void (*amplifier_ctrl)(cs46xx_t *, int);
    1715         void (*active_ctrl)(cs46xx_t *, int);
    1716         void (*mixer_init)(cs46xx_t *);
    1717 
    1718         struct pci_dev *acpi_dev;
     1700        void (*amplifier_ctrl)(struct snd_cs46xx *, int);
     1701        void (*active_ctrl)(struct snd_cs46xx *, int);
     1702        void (*mixer_init)(struct snd_cs46xx *);
     1703
    17191704        int acpi_port;
    1720         snd_kcontrol_t *eapd_switch; /* for amplifier hack */
     1705        struct snd_kcontrol *eapd_switch; /* for amplifier hack */
    17211706        int accept_valid;       /* accept mmap valid (for OSS) */
    17221707
    1723         struct snd_cs46xx_gameport *gameport;
     1708        struct gameport *gameport;
    17241709
    17251710#ifdef CONFIG_SND_CS46XX_DEBUG_GPIO
     
    17291714        struct semaphore spos_mutex;
    17301715
    1731         dsp_spos_instance_t * dsp_spos_instance;
    1732 
    1733         snd_pcm_t *pcm_rear;
    1734         snd_pcm_t *pcm_center_lfe;
    1735         snd_pcm_t *pcm_iec958;
     1716        struct dsp_spos_instance * dsp_spos_instance;
     1717
     1718        struct snd_pcm *pcm_rear;
     1719        struct snd_pcm *pcm_center_lfe;
     1720        struct snd_pcm *pcm_iec958;
    17361721#else /* for compatibility */
    1737         cs46xx_pcm_t *playback_pcm;
     1722        struct snd_cs46xx_pcm *playback_pcm;
    17381723        unsigned int play_ctl;
    17391724#endif
    17401725};
    17411726
    1742 int snd_cs46xx_create(snd_card_t *card,
     1727int snd_cs46xx_create(struct snd_card *card,
    17431728                      struct pci_dev *pci,
    17441729                      int external_amp, int thinkpad,
    1745                       cs46xx_t **rcodec);
    1746 
    1747 int snd_cs46xx_pcm(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
    1748 int snd_cs46xx_pcm_rear(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
    1749 int snd_cs46xx_pcm_iec958(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
    1750 int snd_cs46xx_pcm_center_lfe(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
    1751 int snd_cs46xx_mixer(cs46xx_t *chip);
    1752 int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi);
    1753 int snd_cs46xx_start_dsp(cs46xx_t *chip);
    1754 void snd_cs46xx_gameport(cs46xx_t *chip);
     1730                      struct snd_cs46xx **rcodec);
     1731int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state);
     1732int snd_cs46xx_resume(struct pci_dev *pci);
     1733
     1734int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
     1735int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
     1736int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
     1737int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
     1738int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device);
     1739int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi);
     1740int snd_cs46xx_start_dsp(struct snd_cs46xx *chip);
     1741int snd_cs46xx_gameport(struct snd_cs46xx *chip);
     1742
    17551743#endif /* __SOUND_CS46XX_H */
  • GPL/trunk/alsa-kernel/include/sound/cs46xx_dsp_scb_types.h

    r33 r34  
    2828#define __CS46XX_DSP_SCB_TYPES_H__
    2929
    30 #ifndef TARGET_OS2
    31 #include <asm/byteorder.h>
     30//#include <asm/byteorder.h>
     31
    3232#ifndef ___DSP_DUAL_16BIT_ALLOC
    3333#if   defined(__LITTLE_ENDIAN)
     
    3939#endif
    4040#endif
    41 #else // target_os2
    42 #define ___DSP_DUAL_16BIT_ALLOC(a,b) u16 a; u16 b;
    43 #endif // target_os2
    4441
    4542/* This structs are used internally by the SP */
    4643
    47 typedef struct _basic_dma_req_t {
     44struct dsp_basic_dma_req {
    4845        /* DMA Requestor Word 0 (DCW)  fields:
    4946
     
    5754        u32 saw;                 /* Source Address Word */
    5855        u32 daw;                 /* Destination Address Word  */
    59 } basic_dma_req_t;
    60 
    61 typedef struct _scatter_gather_ext_t {
     56};
     57
     58struct dsp_scatter_gather_ext {
    6259        u32 npaw;                /* Next-Page Address Word */
    6360
     
    7370        u32 nplbaw;              /* Next-Page after Loop-Begin Address Word */
    7471        u32 sgaw;                /* Scatter/Gather Address Word */
    75 } scatter_gather_ext_t;
    76 
    77 typedef struct _volume_control_t {
     72};
     73
     74struct dsp_volume_control {
    7875        ___DSP_DUAL_16BIT_ALLOC(
    7976           rightTarg,  /* Target volume for left & right channels */
     
    8481           leftVol
    8582        )
    86 } volume_control_t;
     83};
    8784
    8885/* Generic stream control block (SCB) structure definition */
    89 typedef struct _generic_scb_t {
     86struct dsp_generic_scb {
    9087        /* For streaming I/O, the DSP should never alter any words in the DMA
    9188           requestor or the scatter/gather extension.  Only ad hoc DMA request
     
    103100        /* Initialized by the host, only modified by DMA
    104101           R/O for the DSP task */
    105         basic_dma_req_t  basic_req;  /* Optional */
     102        struct dsp_basic_dma_req  basic_req;  /* Optional */
    106103
    107104        /* Scatter/gather DMA requestor extension   (5 ints)
     
    109106           DSP task never needs to even read these.
    110107        */
    111         scatter_gather_ext_t sg_ext;  /* Optional */
     108        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    112109
    113110        /* Sublist pointer & next stream control block (SCB) link.
     
    183180           These two 32-bit words are redefined for wavetable & 3-D voices.   
    184181        */
    185         volume_control_t vol_ctrl_t;   /* Optional */
    186 } generic_scb_t;
    187 
    188 
    189 typedef struct _spos_control_block_t {
     182        struct dsp_volume_control vol_ctrl_t;   /* Optional */
     183};
     184
     185
     186struct dsp_spos_control_block {
    190187        /* WARNING: Certain items in this structure are modified by the host
    191188                    Any dword that can be modified by the host, must not be
     
    277274        u32 r32_save_for_trap;
    278275        u32 r32_save_for_HFG;
    279 } spos_control_block_t;
     276};
    280277
    281278/* SPB for MIX_TO_OSTREAM algorithm family */
    282 typedef struct _mix2_ostream_spb_t
     279struct dsp_mix2_ostream_spb
    283280{
    284281        /* 16b.16b integer.frac approximation to the
     
    294291        */
    295292        u32 accumOutTriplets; 
    296 } mix2_ostream_spb_t;
     293};
    297294
    298295/* SCB for Timing master algorithm */
    299 typedef struct _timing_master_scb_t {
     296struct dsp_timing_master_scb {
    300297        /* First 12 dwords from generic_scb_t */
    301         basic_dma_req_t  basic_req;  /* Optional */
    302         scatter_gather_ext_t sg_ext;  /* Optional */
     298        struct dsp_basic_dma_req  basic_req;  /* Optional */
     299        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    303300        ___DSP_DUAL_16BIT_ALLOC(
    304301            next_scb,     /* REQUIRED */
     
    362359           (approximation must be floor, to insure */
    363360        u32 nsamp_per_frm_q15;
    364 } timing_master_scb_t;
     361};
    365362
    366363/* SCB for CODEC output algorithm */
    367 typedef struct _codec_output_scb_t {
     364struct dsp_codec_output_scb {
    368365        /* First 13 dwords from generic_scb_t */
    369         basic_dma_req_t  basic_req;  /* Optional */
    370         scatter_gather_ext_t sg_ext;  /* Optional */
     366        struct dsp_basic_dma_req  basic_req;  /* Optional */
     367        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    371368        ___DSP_DUAL_16BIT_ALLOC(
    372369            next_scb,       /* REQUIRED */
     
    426423            last_sub_ptr
    427424        )
    428 } codec_output_scb_t;
     425};
    429426
    430427/* SCB for CODEC input algorithm */
    431 typedef struct _codec_input_scb_t {
     428struct dsp_codec_input_scb {
    432429        /* First 13 dwords from generic_scb_t */
    433         basic_dma_req_t  basic_req;  /* Optional */
    434         scatter_gather_ext_t sg_ext;  /* Optional */
     430        struct dsp_basic_dma_req  basic_req;  /* Optional */
     431        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    435432        ___DSP_DUAL_16BIT_ALLOC(
    436433            next_scb,       /* REQUIRED */
     
    483480
    484481        u32  reserved2;
    485 } codec_input_scb_t;
    486 
    487 
    488 typedef struct _pcm_serial_input_scb_t {
     482};
     483
     484
     485struct dsp_pcm_serial_input_scb {
    489486        /* First 13 dwords from generic_scb_t */
    490         basic_dma_req_t  basic_req;  /* Optional */
    491         scatter_gather_ext_t sg_ext;  /* Optional */
     487        struct dsp_basic_dma_req  basic_req;  /* Optional */
     488        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    492489        ___DSP_DUAL_16BIT_ALLOC(
    493490            next_scb,       /* REQUIRED */
     
    516513
    517514        /* Initialized by the host (host updates target volumes) */
    518         volume_control_t psi_vol_ctrl;   
    519  
    520 } pcm_serial_input_scb_t;
    521 
    522 typedef struct _src_task_scb_t {
     515        struct dsp_volume_control psi_vol_ctrl;   
     516 
     517};
     518
     519struct dsp_src_task_scb {
    523520        ___DSP_DUAL_16BIT_ALLOC(
    524521            frames_left_in_gof,
     
    575572        u32   phiIncr6int_26frac;
    576573 
    577         volume_control_t src_vol_ctrl;
    578 } src_task_scb_t;
    579 
    580 typedef struct _decimate_by_pow2_scb_t {
     574        struct dsp_volume_control src_vol_ctrl;
     575};
     576
     577struct dsp_decimate_by_pow2_scb {
    581578        /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory
    582579                                          when compared to cascading decimators)
     
    652649        u32  dec2_reserved4;
    653650
    654         volume_control_t dec2_vol_ctrl; /* Not used! */
    655 } decimate_by_pow2_scb_t;
    656 
    657 typedef struct _vari_decimate_scb_t {
     651        struct dsp_volume_control dec2_vol_ctrl; /* Not used! */
     652};
     653
     654struct dsp_vari_decimate_scb {
    658655        ___DSP_DUAL_16BIT_ALLOC(
    659656            vdec_frames_left_in_gof,
     
    715712        u32 vdec_phi_incr_6int_26frac;
    716713
    717         volume_control_t vdec_vol_ctrl;
    718 } vari_decimate_scb_t;
     714        struct dsp_volume_control vdec_vol_ctrl;
     715};
    719716
    720717
    721718/* SCB for MIX_TO_OSTREAM algorithm family */
    722 typedef struct _mix2_ostream_scb_t {
     719struct dsp_mix2_ostream_scb {
    723720        /* First 13 dwords from generic_scb_t */
    724         basic_dma_req_t  basic_req;  /* Optional */
    725         scatter_gather_ext_t sg_ext;  /* Optional */
     721        struct dsp_basic_dma_req  basic_req;  /* Optional */
     722        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    726723        ___DSP_DUAL_16BIT_ALLOC(
    727724            next_scb,       /* REQUIRED */
     
    762759            const_zero
    763760        )
    764 } mix2_ostream_scb_t;
     761};
    765762
    766763
    767764/* SCB for S16_MIX algorithm */
    768 typedef struct _mix_only_scb_t {
     765struct dsp_mix_only_scb {
    769766        /* First 13 dwords from generic_scb_t */
    770         basic_dma_req_t  basic_req;  /* Optional */
    771         scatter_gather_ext_t sg_ext;  /* Optional */
     767        struct dsp_basic_dma_req  basic_req;  /* Optional */
     768        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    772769        ___DSP_DUAL_16BIT_ALLOC(
    773770            next_scb,       /* REQUIRED */
     
    784781
    785782        u32 reserved;
    786         volume_control_t vol_ctrl;
    787 } mix_only_scb_t;
     783        struct dsp_volume_control vol_ctrl;
     784};
    788785
    789786/* SCB for the async. CODEC input algorithm */
    790 typedef struct _async_codec_input_scb_t {               
     787struct dsp_async_codec_input_scb {
    791788        u32 io_free2;     
    792789 
     
    841838
    842839        u32 i_free;
    843 } async_codec_input_scb_t;
     840};
    844841
    845842
    846843/* SCB for the SP/DIF CODEC input and output */
    847 typedef struct _spdifiscb_t {
     844struct dsp_spdifiscb {
    848845        ___DSP_DUAL_16BIT_ALLOC(
    849846            status_ptr,     
     
    899896
    900897        u32  free1;
    901 } spdifiscb_t;
     898};
    902899
    903900
    904901/* SCB for the SP/DIF CODEC input and output  */
    905 typedef struct _spdifoscb_t {           
    906 
     902struct dsp_spdifoscb {           
    907903
    908904        u32 free2;     
     
    945941
    946942        u32  free1;                                         
    947 } spdifoscb_t;
    948 
    949 
    950 
    951 typedef struct _asynch_fg_rx_scb_t {
     943};
     944
     945
     946struct dsp_asynch_fg_rx_scb {
    952947        ___DSP_DUAL_16BIT_ALLOC(
    953948            bot_buf_mask,
     
    997992            left_vol
    998993        )
    999 } asynch_fg_rx_scb_t;
    1000 
    1001 
    1002 
    1003 typedef struct _asynch_fg_tx_scb_t {
     994};
     995
     996
     997struct dsp_asynch_fg_tx_scb {
    1004998        ___DSP_DUAL_16BIT_ALLOC(
    1005999            not_buf_mask,
     
    10561050            unused_left_vol
    10571051        )
    1058 } asynch_fg_tx_scb_t;
    1059 
    1060 
    1061 typedef struct _output_snoop_scb_t {
     1052};
     1053
     1054
     1055struct dsp_output_snoop_scb {
    10621056        /* First 13 dwords from generic_scb_t */
    1063         basic_dma_req_t  basic_req;  /* Optional */
    1064         scatter_gather_ext_t sg_ext;  /* Optional */
     1057        struct dsp_basic_dma_req  basic_req;  /* Optional */
     1058        struct dsp_scatter_gather_ext sg_ext;  /* Optional */
    10651059        ___DSP_DUAL_16BIT_ALLOC(
    10661060            next_scb,       /* REQUIRED */
     
    10871081            input_scb
    10881082        )
    1089 } output_snoop_scb_t;
    1090 
    1091 typedef struct _spio_write_scb_t {
     1083};
     1084
     1085struct dsp_spio_write_scb {
    10921086        ___DSP_DUAL_16BIT_ALLOC(
    10931087            address1,
     
    11261120
    11271121        u32 unused3[5];
    1128 } spio_write_scb_t;
    1129 
    1130 typedef struct _magic_snoop_task_t {
     1122};
     1123
     1124struct dsp_magic_snoop_task {
    11311125        u32 i0;
    11321126        u32 i1;
     
    11591153        u32 i8;
    11601154
    1161         volume_control_t vdec_vol_ctrl;
    1162 } magic_snoop_task_t;
    1163 
    1164 
    1165 typedef struct _filter_scb_t {
     1155        struct dsp_volume_control vdec_vol_ctrl;
     1156};
     1157
     1158
     1159struct dsp_filter_scb {
    11661160        ___DSP_DUAL_16BIT_ALLOC(
    11671161              a0_right,          /* 0x00 */
     
    12161210              b2_left
    12171211        )
    1218 } filter_scb_t;
     1212};
    12191213#endif /* __DSP_SCB_TYPES_H__ */
  • GPL/trunk/alsa-kernel/include/sound/cs46xx_dsp_spos.h

    r33 r34  
    6666#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED   8
    6767
    68 struct _dsp_module_desc_t;
    69 
    70 typedef struct _symbol_entry_t {
     68struct dsp_symbol_entry {
    7169        u32 address;
    7270        char symbol_name[DSP_MAX_SYMBOL_NAME];
     
    7472
    7573        /* initialized by driver */
    76         struct _dsp_module_desc_t * module;
     74        struct dsp_module_desc * module;
    7775        int deleted;
    78 } symbol_entry_t;
    79 
    80 typedef struct _symbol_desc_t {
     76};
     77
     78struct dsp_symbol_desc {
    8179        int nsymbols;
    8280
    83         symbol_entry_t * symbols;
     81        struct dsp_symbol_entry *symbols;
    8482
    8583        /* initialized by driver */
    8684        int highest_frag_index;
    87 } symbol_desc_t;
    88 
    89 
    90 typedef struct _segment_desc_t {
     85};
     86
     87struct dsp_segment_desc {
    9188        int segment_type;
    9289        u32 offset;
    9390        u32 size;
    9491        u32 * data;
    95 } segment_desc_t;
    96 
    97 typedef struct _dsp_module_desc_t {
     92};
     93
     94struct dsp_module_desc {
    9895        char * module_name;
    99         symbol_desc_t symbol_table;
     96        struct dsp_symbol_desc symbol_table;
    10097        int nsegments;
    101         segment_desc_t * segments;
     98        struct dsp_segment_desc * segments;
    10299
    103100        /* initialized by driver */
     
    105102        u32 load_address;
    106103        int nfixups;
    107 } dsp_module_desc_t;
    108 
    109 typedef struct _dsp_scb_descriptor_t {
     104};
     105
     106struct dsp_scb_descriptor {
    110107        char scb_name[DSP_MAX_SCB_NAME];
    111108        u32 address;
    112109        int index;
    113110
    114         struct _dsp_scb_descriptor_t * sub_list_ptr;
    115         struct _dsp_scb_descriptor_t * next_scb_ptr;
    116         struct _dsp_scb_descriptor_t * parent_scb_ptr;
    117 
    118         symbol_entry_t * task_entry;
    119         symbol_entry_t * scb_symbol;
    120 
    121         snd_info_entry_t *proc_info;
     111        struct dsp_scb_descriptor * sub_list_ptr;
     112        struct dsp_scb_descriptor * next_scb_ptr;
     113        struct dsp_scb_descriptor * parent_scb_ptr;
     114
     115        struct dsp_symbol_entry * task_entry;
     116        struct dsp_symbol_entry * scb_symbol;
     117
     118        struct snd_info_entry *proc_info;
    122119        int ref_count;
    123120        spinlock_t lock;
    124121
    125122        int deleted;
    126 } dsp_scb_descriptor_t;
    127 
    128 typedef struct _dsp_task_descriptor_t {
     123};
     124
     125struct dsp_task_descriptor {
    129126        char task_name[DSP_MAX_TASK_NAME];
    130127        int size;
    131128        u32 address;
    132129        int index;
    133 } dsp_task_descriptor_t;
    134 
    135 typedef struct _pcm_channel_descriptor_t {
     130};
     131
     132struct dsp_pcm_channel_descriptor {
    136133        int active;
    137134        int src_slot;
     
    139136        u32 sample_rate;
    140137        u32 unlinked;
    141         dsp_scb_descriptor_t * pcm_reader_scb;
    142         dsp_scb_descriptor_t * src_scb;
    143         dsp_scb_descriptor_t * mixer_scb;
     138        struct dsp_scb_descriptor * pcm_reader_scb;
     139        struct dsp_scb_descriptor * src_scb;
     140        struct dsp_scb_descriptor * mixer_scb;
    144141
    145142        void * private_data;
    146 } pcm_channel_descriptor_t;
    147 
    148 typedef struct _dsp_spos_instance_t {
    149         symbol_desc_t symbol_table; /* currently availble loaded symbols in SP */
     143};
     144
     145struct dsp_spos_instance {
     146        struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */
    150147
    151148        int nmodules;
    152         dsp_module_desc_t * modules; /* modules loaded into SP */
    153 
    154         segment_desc_t code;
     149        struct dsp_module_desc * modules; /* modules loaded into SP */
     150
     151        struct dsp_segment_desc code;
    155152
    156153        /* Main PCM playback mixer */
    157         dsp_scb_descriptor_t * master_mix_scb;
     154        struct dsp_scb_descriptor * master_mix_scb;
    158155        u16 dac_volume_right;
    159156        u16 dac_volume_left;
    160157
    161158        /* Rear/surround PCM playback mixer */
    162         dsp_scb_descriptor_t * rear_mix_scb;
     159        struct dsp_scb_descriptor * rear_mix_scb;
    163160
    164161        /* Center/LFE mixer */
    165         dsp_scb_descriptor_t * center_lfe_mix_scb;
     162        struct dsp_scb_descriptor * center_lfe_mix_scb;
    166163
    167164        int npcm_channels;
    168165        int nsrc_scb;
    169         pcm_channel_descriptor_t pcm_channels[DSP_MAX_PCM_CHANNELS];
     166        struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
    170167        int src_scb_slots[DSP_MAX_SRC_NR];
    171168
    172169        /* cache this symbols */
    173         symbol_entry_t * null_algorithm; /* used by PCMreaderSCB's */
    174         symbol_entry_t * s16_up;         /* used by SRCtaskSCB's */
     170        struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
     171        struct dsp_symbol_entry * s16_up;         /* used by SRCtaskSCB's */
    175172
    176173        /* proc fs */ 
    177         snd_card_t * snd_card;
    178         snd_info_entry_t * proc_dsp_dir;
    179         snd_info_entry_t * proc_sym_info_entry;
    180         snd_info_entry_t * proc_modules_info_entry;
    181         snd_info_entry_t * proc_parameter_dump_info_entry;
    182         snd_info_entry_t * proc_sample_dump_info_entry;
     174        struct snd_card *snd_card;
     175        struct snd_info_entry * proc_dsp_dir;
     176        struct snd_info_entry * proc_sym_info_entry;
     177        struct snd_info_entry * proc_modules_info_entry;
     178        struct snd_info_entry * proc_parameter_dump_info_entry;
     179        struct snd_info_entry * proc_sample_dump_info_entry;
    183180
    184181        /* SCB's descriptors */
    185182        int nscb;
    186183        int scb_highest_frag_index;
    187         dsp_scb_descriptor_t scbs[DSP_MAX_SCB_DESC];
    188         snd_info_entry_t * proc_scb_info_entry;
    189         dsp_scb_descriptor_t * the_null_scb;
     184        struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
     185        struct snd_info_entry * proc_scb_info_entry;
     186        struct dsp_scb_descriptor * the_null_scb;
    190187
    191188        /* Task's descriptors */
    192189        int ntask;
    193         dsp_task_descriptor_t tasks[DSP_MAX_TASK_DESC];
    194         snd_info_entry_t * proc_task_info_entry;
     190        struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
     191        struct snd_info_entry * proc_task_info_entry;
    195192
    196193        /* SPDIF status */
     
    205202
    206203        /* SPDIF input sample rate converter */
    207         dsp_scb_descriptor_t * spdif_in_src;
     204        struct dsp_scb_descriptor * spdif_in_src;
    208205        /* SPDIF input asynch. receiver */
    209         dsp_scb_descriptor_t * asynch_rx_scb;
     206        struct dsp_scb_descriptor * asynch_rx_scb;
    210207
    211208        /* Capture record mixer SCB */
    212         dsp_scb_descriptor_t * record_mixer_scb;
     209        struct dsp_scb_descriptor * record_mixer_scb;
    213210   
    214211        /* CODEC input SCB */
    215         dsp_scb_descriptor_t * codec_in_scb;
     212        struct dsp_scb_descriptor * codec_in_scb;
    216213
    217214        /* reference snooper */
    218         dsp_scb_descriptor_t * ref_snoop_scb;
     215        struct dsp_scb_descriptor * ref_snoop_scb;
    219216
    220217        /* SPDIF output  PCM reference  */
    221         dsp_scb_descriptor_t * spdif_pcm_input_scb;
     218        struct dsp_scb_descriptor * spdif_pcm_input_scb;
    222219
    223220        /* asynch TX task */
    224         dsp_scb_descriptor_t * asynch_tx_scb;
     221        struct dsp_scb_descriptor * asynch_tx_scb;
    225222
    226223        /* record sources */
    227         dsp_scb_descriptor_t * pcm_input;
    228         dsp_scb_descriptor_t * adc_input;
     224        struct dsp_scb_descriptor * pcm_input;
     225        struct dsp_scb_descriptor * adc_input;
    229226
    230227        int spdif_in_sample_rate;
    231 } dsp_spos_instance_t;
     228};
    232229
    233230#endif /* __DSP_SPOS_H__ */
  • GPL/trunk/alsa-kernel/include/sound/cs46xx_dsp_task_types.h

    r33 r34  
    7272
    7373/* Minimal context save area for Hyper Forground */
    74 typedef struct _hf_save_area_t {
     74struct dsp_hf_save_area {
    7575        u32     r10_save;
    7676        u32     r54_save;
     
    9797        )
    9898        /* saved as part of HFG context  */
    99 } hf_save_area_t;
     99};
    100100
    101101
    102102/* Task link data structure */
    103 typedef struct _tree_link_t {
     103struct dsp_tree_link {
    104104        ___DSP_DUAL_16BIT_ALLOC(
    105105        /* Pointer to sibling task control block */
     
    115115            this_spb
    116116        )
    117 } tree_link_t;
    118 
    119 
    120 typedef struct _task_tree_data_t {
     117};
     118
     119
     120struct dsp_task_tree_data {
    121121        ___DSP_DUAL_16BIT_ALLOC(
    122122        /* Initial tock count; controls task tree execution rate */
     
    156156        )
    157157
    158 } task_tree_data_t;
    159 
    160 
    161 
    162 typedef struct _interval_timer_data_t
     158};
     159
     160
     161struct dsp_interval_timer_data
    163162{
    164163        /* These data items have the same relative locations to those */
     
    173172             num_intervals
    174173        )
    175 } interval_timer_data_t;   
     174};
    176175
    177176
    178177/* This structure contains extra storage for the task tree
    179178   Currently, this additional data is related only to a full context save */
    180 typedef struct _task_tree_context_block_t {
     179struct dsp_task_tree_context_block {
    181180        /* Up to 10 values are saved onto the stack.  8 for the task tree, 1 for
    182181           The access to the context switch (call or interrupt), and 1 spare that
     
    239238        u32             savershouthl;
    240239        u32             savershoutxmacmode;
    241 } task_tree_context_block_t;                                             
     240};
    242241               
    243242
    244 typedef struct _task_tree_control_block_t       {
    245         hf_save_area_t                  context;
    246         tree_link_t                     links;
    247         task_tree_data_t                data;
    248         task_tree_context_block_t       context_blk;
    249         interval_timer_data_t           int_timer;
    250 } task_tree_control_block_t;
     243struct dsp_task_tree_control_block {
     244        struct dsp_hf_save_area                 context;
     245        struct dsp_tree_link                    links;
     246        struct dsp_task_tree_data               data;
     247        struct dsp_task_tree_context_block      context_blk;
     248        struct dsp_interval_timer_data          int_timer;
     249};
    251250
    252251
  • GPL/trunk/alsa-kernel/include/sound/driver.h

    r33 r34  
    6767#include <linux/version.h>
    6868
    69 #define IRQ_NONE        /*void*/
    70 #define IRQ_HANDLED     /*void*/
    71 #define IRQ_RETVAL(x)   /*void*/
    72 typedef void irqreturn_t;
     69#define IRQ_NONE      (0)  /*void*/
     70#define IRQ_HANDLED   (1)  /*void*/
     71#define IRQ_RETVAL(x) ((x) != 0)  /*void*/
     72typedef int irqreturn_t;
    7373
    7474#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 3)
     
    191191#include <sound/asound.h>
    192192#include <sound/asoundef.h>
     193
     194/* wrapper for getnstimeofday()
     195 * it's needed for recent 2.6 kernels, too, due to lack of EXPORT_SYMBOL
     196 */
     197#define getnstimeofday(x) do { \
     198        struct timeval __x; \
     199        do_gettimeofday(&__x); \
     200        (x)->tv_sec = __x.tv_sec;       \
     201        (x)->tv_nsec = __x.tv_usec * 1000; \
     202} while (0)
    193203
    194204struct work_struct {
     
    218228/* Name change */
    219229typedef struct timeval snd_timestamp_t;
    220 typedef struct sndrv_interval snd_interval_t;
    221230#ifndef TARGET_OS2
    222231typedef enum sndrv_card_type snd_card_type;
    223232#endif
    224 typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
    225 //typedef enum sndrv_hwdep_iface snd_hwdep_iface_t;
    226 typedef struct sndrv_hwdep_info snd_hwdep_info_t;
    227 //typedef enum sndrv_pcm_class snd_pcm_class_t;
    228 //typedef enum sndrv_pcm_subclass snd_pcm_subclass_t;
    229 //typedef enum sndrv_pcm_stream snd_pcm_stream_t;
    230 //typedef enum sndrv_pcm_access snd_pcm_access_t;
    231 //typedef enum sndrv_pcm_format snd_pcm_format_t;
    232 //typedef enum sndrv_pcm_subformat snd_pcm_subformat_t;
    233 //typedef enum sndrv_pcm_state snd_pcm_state_t;
    234233typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t;
    235 typedef struct sndrv_pcm_info snd_pcm_info_t;
    236 //typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
    237 typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
    238234#ifndef TARGET_OS2
    239235typedef enum sndrv_pcm_start snd_pcm_start_t;
    240236typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;
    241237#endif
    242 //typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
    243 typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
    244 typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t;
    245 typedef struct sndrv_pcm_status snd_pcm_status_t;
    246 typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t;
    247 typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t;
    248 typedef struct sndrv_xferi snd_xferi_t;
    249 typedef struct sndrv_xfern snd_xfern_t;
    250 //typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
    251 typedef struct sndrv_rawmidi_info snd_rawmidi_info_t;
    252 typedef struct sndrv_rawmidi_params snd_rawmidi_params_t;
    253 typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
    254 //typedef enum sndrv_timer_class snd_timer_class_t;
    255 //typedef enum sndrv_timer_slave_class snd_timer_slave_class_t;
    256238#ifdef TARGET_OS2
    257239typedef struct snd_pcm_volume snd_pcm_volume_t;
     
    259241typedef enum sndrv_timer_global snd_timer_global_t;
    260242#endif
    261 typedef struct sndrv_timer_id snd_timer_id_t;
    262 typedef struct sndrv_timer_select snd_timer_select_t;
    263 typedef struct sndrv_timer_info snd_timer_info_t;
    264 typedef struct sndrv_timer_params snd_timer_params_t;
    265 typedef struct sndrv_timer_status snd_timer_status_t;
    266 typedef struct sndrv_timer_read snd_timer_read_t;
    267 typedef struct sndrv_timer_tread snd_timer_tread_t;
    268 typedef struct sndrv_timer_ginfo snd_timer_ginfo_t;
    269 typedef struct sndrv_timer_gparams snd_timer_gparams_t;
    270 typedef struct sndrv_timer_gstatus snd_timer_gstatus_t;
    271 typedef struct sndrv_xferv snd_xferv_t;
    272243
    273244#ifdef CONFIG_SND_DEBUG_MEMORY
     
    378349};
    379350
    380 #define snd_device(n) list_entry(n, snd_device_t, list)
     351#define snd_device(n) list_entry(n, struct snd_device, list)
    381352
    382353/* various typedefs */
    383354
    384355typedef struct snd_info_entry snd_info_entry_t;
    385 typedef struct _snd_pcm snd_pcm_t;
    386 typedef struct _snd_pcm_str snd_pcm_str_t;
    387 typedef struct _snd_pcm_substream snd_pcm_substream_t;
    388 typedef struct _snd_mixer snd_kmixer_t;
    389 typedef struct _snd_rawmidi snd_rawmidi_t;
    390 typedef struct _snd_ctl_file snd_ctl_file_t;
    391 typedef struct _snd_kcontrol snd_kcontrol_t;
    392 typedef struct _snd_timer snd_timer_t;
    393 typedef struct _snd_timer_instance snd_timer_instance_t;
    394 typedef struct _snd_hwdep snd_hwdep_t;
    395356#ifdef CONFIG_SND_OSSEMUL
    396357typedef struct _snd_oss_mixer snd_mixer_oss_t;
     
    519480};
    520481
    521 typedef struct _snd_minor snd_minor_t;
    522 
    523482/* sound.c */
    524483
  • GPL/trunk/alsa-kernel/include/sound/emu10k1.h

    r33 r34  
    2626#ifdef __KERNEL__
    2727
    28 #include "pcm.h"
    29 #include "rawmidi.h"
    30 #include "hwdep.h"
    31 #include "ac97_codec.h"
    32 #include "util_mem.h"
     28#include <sound/pcm.h>
     29#include <sound/rawmidi.h>
     30#include <sound/hwdep.h>
     31#include <sound/ac97_codec.h>
     32#include <sound/util_mem.h>
    3333#include <sound/pcm-indirect.h>
     34#include <sound/timer.h>
     35#include <linux/interrupt.h>
    3436#include <asm/io.h>
    35 #include <sound/timer.h>
    36 
    37 #ifndef PCI_VENDOR_ID_CREATIVE
    38 #define PCI_VENDOR_ID_CREATIVE          0x1102
    39 #endif
    40 #ifndef PCI_DEVICE_ID_CREATIVE_EMU10K1
    41 #define PCI_DEVICE_ID_CREATIVE_EMU10K1  0x0002
    42 #endif
    4337
    4438/* ------------------- DEFINES -------------------- */
     
    5145#define NUM_G           64              /* use all channels */
    5246#define NUM_FXSENDS     4
    53 //#define NUM_EFX_PLAYBACK    16
    54 #define NUM_EFX_PLAYBACK    6
     47#define NUM_EFX_PLAYBACK    16
    5548
    5649/* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */
    5750#define EMU10K1_DMA_MASK        0x7fffffffUL    /* 31bit */
    58 #define AUDIGY_DMA_MASK         0xffffffffUL    /* 32bit */
    59 
     51#define AUDIGY_DMA_MASK         0x7fffffffUL    /* 31bit FIXME - 32 should work? */
     52                                                /* See ALSA bug #1276 - rlrevell */
    6053
    6154#define TMEMSIZE        256*1024
     
    8578                                                /* Clear pending interrupts by writing a 1 to   */
    8679                                                /* the relevant bits and zero to the other bits */
    87 
    88 #define IPR_P16V                0x80000000      /* Bit set when the CA0151 P16V chip wishes to interrupt */
    89 #define IPR_GPIOMSG             0x20000000      /* GPIO message interrupt (RE'd, still not sure which INTE bits enable it)                   */
     80#define IPR_P16V                0x80000000      /* Bit set when the CA0151 P16V chip wishes
     81                                                   to interrupt */
     82#define IPR_GPIOMSG             0x20000000      /* GPIO message interrupt (RE'd, still not sure
     83                                                   which INTE bits enable it)                   */
    9084
    9185/* The next two interrupts are for the midi port on the Audigy Drive (A_MPU1)                   */
     
    9387#define IPR_A_MIDIRECVBUFEMPTY2 0x08000000      /* MIDI UART receive buffer empty               */
    9488
    95 #define IPR_SPDIFBUFFULL        0x04000000      /* SPDIF capture related, 10k2 only? (RE)       */
    96 #define IPR_SPDIFBUFHALFFULL    0x02000000      /* SPDIF capture related? (RE)                  */
     89#define IPR_SPDIFBUFFULL        0x04000000      /* SPDIF capture related, 10k2 only? (RE)       */
     90#define IPR_SPDIFBUFHALFFULL    0x02000000      /* SPDIF capture related? (RE)                  */
     91
    9792#define IPR_SAMPLERATETRACKER   0x01000000      /* Sample rate tracker lock status change       */
    9893#define IPR_FXDSP               0x00800000      /* Enable FX DSP interrupts                     */
     
    113108#define IPR_MIDITRANSBUFEMPTY   0x00000100      /* MIDI UART transmit buffer empty              */
    114109#define IPR_MIDIRECVBUFEMPTY    0x00000080      /* MIDI UART receive buffer empty               */
    115 #define IPR_CHANNELLOOP         0x00000040      /* Channel (half) loop interrupt(s) pending     */
     110#define IPR_CHANNELLOOP         0x00000040      /* Channel (half) loop interrupt(s) pending     */
    116111#define IPR_CHANNELNUMBERMASK   0x0000003f      /* When IPR_CHANNELLOOP is set, indicates the   */
    117                                                 /* Highest set channel in CLIPL or CLIPH.  When */
    118                                                 /* IP is written with CL set, the bit in CLIPL  */
    119                                                 /* or CLIPH corresponding to the CIN value      */
    120                                                 /* written will be cleared.                     */
     112                                                /* highest set channel in CLIPL, CLIPH, HLIPL,  */
     113                                                /* or HLIPH.  When IP is written with CL set,   */
     114                                                /* the bit in H/CLIPL or H/CLIPH corresponding  */
     115                                                /* to the CIN value written will be cleared.    */
    121116
    122117#define INTE                    0x0c            /* Interrupt enable register                    */
     
    245240#define A_GPINPUT_MASK          0xff00
    246241#define A_GPOUTPUT_MASK         0x00ff
     242
    247243// Audigy output/GPIO stuff taken from the kX drivers
    248 #define A_IOCFG_GPOUT0          0x0044          /* analog/digital                               */
    249 #define A_IOCFG_DISABLE_ANALOG  0x0040          /* = 'enable' for Audigy2 (chiprev=4)           */
    250 #define A_IOCFG_ENABLE_DIGITAL  0x0004
     244#define A_IOCFG_GPOUT0          0x0044          /* analog/digital                               */
     245#define A_IOCFG_DISABLE_ANALOG  0x0040          /* = 'enable' for Audigy2 (chiprev=4)           */
     246#define A_IOCFG_ENABLE_DIGITAL  0x0004
    251247#define A_IOCFG_UNKNOWN_20      0x0020
    252 #define A_IOCFG_DISABLE_AC97_FRONT      0x0080  /* turn off ac97 front -> front (10k2.1)        */
    253 #define A_IOCFG_GPOUT1          0x0002          /* IR? drive's internal bypass (?)              */
     248#define A_IOCFG_DISABLE_AC97_FRONT      0x0080  /* turn off ac97 front -> front (10k2.1)        */
     249#define A_IOCFG_GPOUT1          0x0002          /* IR? drive's internal bypass (?)              */
    254250#define A_IOCFG_GPOUT2          0x0001          /* IR */
    255 
    256 #define A_IOCFG_MULTIPURPOSE_JACK       0x2000  /* center+lfe+rear_center (a2/a2ex)             */
    257 /* + digital for generic 10k2                   */
    258 #define A_IOCFG_DIGITAL_JACK    0x1000          /* digital for a2 platinum                      */
     251#define A_IOCFG_MULTIPURPOSE_JACK       0x2000  /* center+lfe+rear_center (a2/a2ex)             */
     252                                                /* + digital for generic 10k2                   */
     253#define A_IOCFG_DIGITAL_JACK    0x1000          /* digital for a2 platinum                      */
    259254#define A_IOCFG_FRONT_JACK      0x4000
    260255#define A_IOCFG_REAR_JACK       0x8000
    261 #define A_IOCFG_PHONES_JACK     0x0100          /* LiveDrive                                    */
     256#define A_IOCFG_PHONES_JACK     0x0100          /* LiveDrive                                    */
    262257
    263258/* outputs:
    264  *      for audigy2 platinum:   0xa00
    265  *      for a2 platinum ex:     0x1c00
    266  *      for a1 platinum:        0x0
     259 *      for audigy2 platinum:   0xa00
     260 *      for a2 platinum ex:     0x1c00
     261 *      for a1 platinum:        0x0
    267262 */
     263
    268264#define TIMER                   0x1a            /* Timer terminal count register                */
    269265                                                /* NOTE: After the rate is changed, a maximum   */
     
    281277
    282278/* Available on the Audigy 2 and Audigy 4 only. This is the P16V chip. */
    283 #define PTR2                    0x20            /* Indexed register set pointer register        */
    284 #define DATA2                   0x24            /* Indexed register set data register           */
    285 #define IPR2                    0x28            /* P16V interrupt pending register              */
     279#define PTR2                    0x20            /* Indexed register set pointer register        */
     280#define DATA2                   0x24            /* Indexed register set data register           */
     281#define IPR2                    0x28            /* P16V interrupt pending register              */
    286282#define IPR2_PLAYBACK_CH_0_LOOP      0x00001000 /* Playback Channel 0 loop                               */
    287283#define IPR2_PLAYBACK_CH_0_HALF_LOOP 0x00000100 /* Playback Channel 0 half loop                          */
    288284#define IPR2_CAPTURE_CH_0_LOOP       0x00100000 /* Capture Channel 0 loop                               */
    289285#define IPR2_CAPTURE_CH_0_HALF_LOOP  0x00010000 /* Capture Channel 0 half loop                          */
    290 /* 0x00000100 Playback. Only in once per period.
    291  * 0x00110000 Capture. Int on half buffer.
    292  */
    293 #define INTE2                   0x2c            /* P16V Interrupt enable register.      */
     286                                                /* 0x00000100 Playback. Only in once per period.
     287                                                * 0x00110000 Capture. Int on half buffer.
     288                                                */
     289#define INTE2                   0x2c            /* P16V Interrupt enable register.      */
    294290#define INTE2_PLAYBACK_CH_0_LOOP      0x00001000 /* Playback Channel 0 loop                               */
    295291#define INTE2_PLAYBACK_CH_0_HALF_LOOP 0x00000100 /* Playback Channel 0 half loop                          */
     
    302298#define INTE2_CAPTURE_CH_0_LOOP       0x00100000 /* Capture Channel 0 loop                               */
    303299#define INTE2_CAPTURE_CH_0_HALF_LOOP  0x00010000 /* Caputre Channel 0 half loop                          */
    304 #define HCFG2                   0x34            /* Defaults: 0, win2000 sets it to 00004201 */
    305 /* 0x00000000 2-channel output. */
    306 /* 0x00000200 8-channel output. */
    307 /* 0x00000004 pauses stream/irq fail. */
    308 /* Rest of bits no nothing to sound output */
    309 /* bit 0: Enable P16V audio.
    310  * bit 1: Lock P16V record memory cache.
    311  * bit 2: Lock P16V playback memory cache.
    312  * bit 3: Dummy record insert zero samples.
    313  * bit 8: Record 8-channel in phase.
    314  * bit 9: Playback 8-channel in phase.
    315  * bit 11-12: Playback mixer attenuation: 0=0dB, 1=-6dB, 2=-12dB, 3=Mute.
    316  * bit 13: Playback mixer enable.
    317  * bit 14: Route SRC48 mixer output to fx engine.
    318  * bit 15: Enable IEEE 1394 chip.
    319  */
    320 #define IPR3                    0x38            /* Cdif interrupt pending register              */
    321 #define INTE3                   0x3c            /* Cdif interrupt enable register.      */
     300#define HCFG2                   0x34            /* Defaults: 0, win2000 sets it to 00004201 */
     301                                                /* 0x00000000 2-channel output. */
     302                                                /* 0x00000200 8-channel output. */
     303                                                /* 0x00000004 pauses stream/irq fail. */
     304                                                /* Rest of bits no nothing to sound output */
     305                                                /* bit 0: Enable P16V audio.
     306                                                * bit 1: Lock P16V record memory cache.
     307                                                * bit 2: Lock P16V playback memory cache.
     308                                                * bit 3: Dummy record insert zero samples.
     309                                                * bit 8: Record 8-channel in phase.
     310                                                * bit 9: Playback 8-channel in phase.
     311                                                * bit 11-12: Playback mixer attenuation: 0=0dB, 1=-6dB, 2=-12dB, 3=Mute.
     312                                                * bit 13: Playback mixer enable.
     313                                                * bit 14: Route SRC48 mixer output to fx engine.
     314                                                * bit 15: Enable IEEE 1394 chip.
     315                                                */
     316#define IPR3                    0x38            /* Cdif interrupt pending register              */
     317#define INTE3                   0x3c            /* Cdif interrupt enable register.      */
    322318/************************************************************************************************/
    323319/* PCI function 1 registers, address = <val> + PCIBASE1                                         */
     
    443439
    444440#define ENVVOL                  0x10            /* Volume envelope register                             */
    445 #define ENVVOL_MASK             0x0000ffff      /* Current value of volume envelope state variable      */
     441#define ENVVOL_MASK             0x0000ffff      /* Current value of volume envelope state variable      */ 
    446442                                                /* 0x8000-n == 666*n usec delay                         */
    447443
     
    529525                                                /* NOTE: All channels contain internal variables; do    */
    530526                                                /* not write to these locations.                        */
     527
    531528/* 1f something */
     529
    532530#define CD0                     0x20            /* Cache data 0 register                                */
    533531#define CD1                     0x21            /* Cache data 1 register                                */
     
    579577#define FXWC                    0x43            /* FX output write channels register                    */
    580578                                                /* When set, each bit enables the writing of the        */
    581                                                 /* corresponding FX output channel into host memory     */
     579                                                /* corresponding FX output channel (internal registers  */
     580                                                /* 0x20-0x3f) to host memory.  This mode of recording   */
     581                                                /* is 16bit, 48KHz only. All 32 channels can be enabled */
     582                                                /* simultaneously.                                      */
     583
    582584#define FXWC_DEFAULTROUTE_C     (1<<0)          /* left emu out? */
    583585#define FXWC_DEFAULTROUTE_B     (1<<1)          /* right emu out? */
     
    613615#define FXBA                    0x47            /* FX Buffer Address */
    614616#define FXBA_MASK               0xfffff000      /* 20 bit base address                                  */
    615  /* 0x48 something - word access, defaults to 3f */
     617
     618/* 0x48 something - word access, defaults to 3f */
     619
    616620#define MICBS                   0x49            /* Microphone buffer size register                      */
    617621
     
    717721
    718722#define SPBYPASS                0x5e            /* SPDIF BYPASS mode register                   */
    719 #define SPBYPASS_SPDIF0_MASK    0x00000003      /* SPDIF 0 bypass mode                          */
    720 #define SPBYPASS_SPDIF1_MASK    0x0000000c      /* SPDIF 1 bypass mode                          */
    721 /* bypass mode: 0 - DSP; 1 - SPDIF A, 2 - SPDIF B, 3 - SPDIF C                                  */
    722 #define SPBYPASS_FORMAT         0x00000f00      /* If 1, SPDIF XX uses 24 bit, if 0 - 20 bit    */
     723#define SPBYPASS_SPDIF0_MASK    0x00000003      /* SPDIF 0 bypass mode                          */
     724#define SPBYPASS_SPDIF1_MASK    0x0000000c      /* SPDIF 1 bypass mode                          */
     725/* bypass mode: 0 - DSP; 1 - SPDIF A, 2 - SPDIF B, 3 - SPDIF C                                  */
     726#define SPBYPASS_FORMAT         0x00000f00      /* If 1, SPDIF XX uses 24 bit, if 0 - 20 bit    */
     727
    723728#define AC97SLOT                0x5f            /* additional AC97 slots enable bits            */
    724 #define AC97SLOT_REAR_RIGHT     0x01            /* Rear left */
    725 #define AC97SLOT_REAR_LEFT      0x02            /* Rear right */
     729#define AC97SLOT_REAR_RIGHT     0x01            /* Rear left */
     730#define AC97SLOT_REAR_LEFT      0x02            /* Rear right */
    726731#define AC97SLOT_CNTR           0x10            /* Center enable */
    727732#define AC97SLOT_LFE            0x20            /* LFE enable */
     
    737742
    738743/* These three bitfields apply to CDSRCS, GPSRCS, and (except as noted) ZVSRCS.                 */
    739 #define SRCS_SPDIFVALID         0x04000000      /* SPDIF stream valid                           */
     744#define SRCS_SPDIFVALID         0x04000000      /* SPDIF stream valid                           */
    740745#define SRCS_SPDIFLOCKED        0x02000000      /* SPDIF stream locked                          */
    741746#define SRCS_RATELOCKED         0x01000000      /* Sample rate locked                           */
     
    765770#define FXIDX_IDX               0x10000065
    766771
    767 /* The 32-bit HLIx and HLIPx registers all have one bit per channel control/status                      */
    768 #define HLIEL                   0x66            /* Channel half loop interrupt enable low register      */
    769 
    770 #define HLIEH                   0x67            /* Channel half loop interrupt enable high register     */
    771 
    772 #define HLIPL                   0x68            /* Channel half loop interrupt pending low register     */
    773 
    774 #define HLIPH                   0x69            /* Channel half loop interrupt pending high register    */
     772/* The 32-bit HLIx and HLIPx registers all have one bit per channel control/status                      */
     773#define HLIEL                   0x66            /* Channel half loop interrupt enable low register      */
     774
     775#define HLIEH                   0x67            /* Channel half loop interrupt enable high register     */
     776
     777#define HLIPL                   0x68            /* Channel half loop interrupt pending low register     */
     778
     779#define HLIPH                   0x69            /* Channel half loop interrupt pending high register    */
    775780
    776781// 0x6a,6b,6c used for some recording
     
    786791#define A_MUDATA2               0x72
    787792#define A_MUCMD2                0x73
    788 #define A_MUSTAT2               A_MUCMD2
     793#define A_MUSTAT2               A_MUCMD2       
    789794
    790795/* The next two are the Audigy equivalent of FXWC                                               */
     
    795800
    796801#define A_SPDIF_SAMPLERATE      0x76            /* Set the sample rate of SPDIF output          */
    797 #define A_SAMPLE_RATE           0x76            /* Various sample rate settings. */
    798 #define A_SAMPLE_RATE_NOT_USED  0x0ffc111e      /* Bits that are not used and cannot be set.    */
    799 #define A_SAMPLE_RATE_UNKNOWN   0xf0030001      /* Bits that can be set, but have unknown use.  */
    800 #define A_SPDIF_RATE_MASK       0x000000e0      /* Any other values for rates, just use 48000   */
    801 #define A_SPDIF_48000           0x00000000
    802 #define A_SPDIF_192000          0x00000020
    803 #define A_SPDIF_96000           0x00000040
    804 #define A_SPDIF_44100           0x00000080
    805 
    806 #define A_I2S_CAPTURE_RATE_MASK 0x00000e00      /* This sets the capture PCM rate, but it is    */
    807 #define A_I2S_CAPTURE_48000     0x00000000      /* unclear if this sets the ADC rate as well.   */
    808 #define A_I2S_CAPTURE_192000    0x00000200
    809 #define A_I2S_CAPTURE_96000     0x00000400
    810 #define A_I2S_CAPTURE_44100     0x00000800
    811 
    812 #define A_PCM_RATE_MASK         0x0000e000      /* This sets the playback PCM rate on the P16V  */
    813 #define A_PCM_48000             0x00000000
    814 #define A_PCM_192000            0x00002000
    815 #define A_PCM_96000             0x00004000
    816 #define A_PCM_44100             0x00008000
    817 /* 0x77,0x78,0x79 "something i2s-related" - default to 0x01080000 on my audigy 2 ZS --rlrevell  */
     802#define A_SAMPLE_RATE           0x76            /* Various sample rate settings. */
     803#define A_SAMPLE_RATE_NOT_USED  0x0ffc111e      /* Bits that are not used and cannot be set.    */
     804#define A_SAMPLE_RATE_UNKNOWN   0xf0030001      /* Bits that can be set, but have unknown use.  */
     805#define A_SPDIF_RATE_MASK       0x000000e0      /* Any other values for rates, just use 48000   */
     806#define A_SPDIF_48000           0x00000000
     807#define A_SPDIF_192000          0x00000020
     808#define A_SPDIF_96000           0x00000040
     809#define A_SPDIF_44100           0x00000080
     810
     811#define A_I2S_CAPTURE_RATE_MASK 0x00000e00      /* This sets the capture PCM rate, but it is    */
     812#define A_I2S_CAPTURE_48000     0x00000000      /* unclear if this sets the ADC rate as well.   */
     813#define A_I2S_CAPTURE_192000    0x00000200
     814#define A_I2S_CAPTURE_96000     0x00000400
     815#define A_I2S_CAPTURE_44100     0x00000800
     816
     817#define A_PCM_RATE_MASK         0x0000e000      /* This sets the playback PCM rate on the P16V  */
     818#define A_PCM_48000             0x00000000
     819#define A_PCM_192000            0x00002000
     820#define A_PCM_96000             0x00004000
     821#define A_PCM_44100             0x00008000
     822
     823/* 0x77,0x78,0x79 "something i2s-related" - default to 0x01080000 on my audigy 2 ZS --rlrevell  */
    818824/* 0x7a, 0x7b - lookup tables */
    819825
     
    830836#define A_FXSENDAMOUNT_H_MASK   0x000000FF
    831837/* 0x7c, 0x7e "high bit is used for filtering" */
     838 
    832839/* The send amounts for this one are the same as used with the emu10k1 */
    833840#define A_FXRT1                 0x7e
     
    842849#define A_FXGPREGBASE           0x400           /* Audigy GPRs, 0x400 to 0x5ff                  */
    843850
    844 #define A_TANKMEMCTLREGBASE     0x100           /* Tank memory control registers base - only for Audigy */
    845 #define A_TANKMEMCTLREG_MASK    0x1f            /* only 5 bits used - only for Audigy */
     851#define A_TANKMEMCTLREGBASE     0x100           /* Tank memory control registers base - only for Audigy */
     852#define A_TANKMEMCTLREG_MASK    0x1f            /* only 5 bits used - only for Audigy */
    846853
    847854/* Tank audio data is logarithmically compressed down to 16 bits before writing to TRAM and is  */
     
    881888/* ------------------- STRUCTURES -------------------- */
    882889
    883 typedef struct _snd_emu10k1 emu10k1_t;
    884 typedef struct _snd_emu10k1_voice emu10k1_voice_t;
    885 typedef struct _snd_emu10k1_pcm emu10k1_pcm_t;
    886 
    887 typedef enum {
    888     EMU10K1_EFX,
    889     EMU10K1_PCM,
    890     EMU10K1_SYNTH,
    891     EMU10K1_MIDI
    892 } emu10k1_voice_type_t;
    893 
    894 struct _snd_emu10k1_voice {
    895         emu10k1_t *emu;
     890enum {
     891        EMU10K1_EFX,
     892        EMU10K1_PCM,
     893        EMU10K1_SYNTH,
     894        EMU10K1_MIDI
     895};
     896
     897struct snd_emu10k1;
     898
     899struct snd_emu10k1_voice {
     900        struct snd_emu10k1 *emu;
    896901        int number;
    897         int use: 1,
    898         pcm: 1,
    899         efx: 1,
    900         synth: 1,
    901         midi: 1;
    902         void (*interrupt)(emu10k1_t *emu, emu10k1_voice_t *pvoice);
    903 
    904         emu10k1_pcm_t *epcm;
    905 };
    906 
    907 typedef enum {
    908     PLAYBACK_EMUVOICE,
    909     PLAYBACK_EFX,
    910     CAPTURE_AC97ADC,
    911     CAPTURE_AC97MIC,
    912     CAPTURE_EFX
    913 } snd_emu10k1_pcm_type_t;
    914 
    915 struct _snd_emu10k1_pcm {
    916         emu10k1_t *emu;
    917         snd_emu10k1_pcm_type_t type;
    918         snd_pcm_substream_t *substream;
    919         emu10k1_voice_t *voices[NUM_EFX_PLAYBACK];
    920         emu10k1_voice_t *extra;
     902        unsigned int use: 1,
     903            pcm: 1,
     904            efx: 1,
     905            synth: 1,
     906            midi: 1;
     907        void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
     908
     909        struct snd_emu10k1_pcm *epcm;
     910};
     911
     912enum {
     913        PLAYBACK_EMUVOICE,
     914        PLAYBACK_EFX,
     915        CAPTURE_AC97ADC,
     916        CAPTURE_AC97MIC,
     917        CAPTURE_EFX
     918};
     919
     920struct snd_emu10k1_pcm {
     921        struct snd_emu10k1 *emu;
     922        int type;
     923        struct snd_pcm_substream *substream;
     924        struct snd_emu10k1_voice *voices[NUM_EFX_PLAYBACK];
     925        struct snd_emu10k1_voice *extra;
    921926        unsigned short running;
    922927        unsigned short first_ptr;
    923         snd_util_memblk_t *memblk;
     928        struct snd_util_memblk *memblk;
    924929        unsigned int start_addr;
    925930        unsigned int ccca_start_addr;
     
    935940};
    936941
    937 typedef struct {
     942struct snd_emu10k1_pcm_mixer {
     943        /* mono, left, right x 8 sends (4 on emu10k1) */
    938944        unsigned char send_routing[3][8];
    939945        unsigned char send_volume[3][8];
    940946        unsigned short attn[3];
    941         emu10k1_pcm_t *epcm;
    942 } emu10k1_pcm_mixer_t;
     947        struct snd_emu10k1_pcm *epcm;
     948};
    943949
    944950#define snd_emu10k1_compose_send_routing(route) \
     
    951957((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24))
    952958
    953 typedef struct snd_emu10k1_memblk {
    954         snd_util_memblk_t mem;
     959struct snd_emu10k1_memblk {
     960        struct snd_util_memblk mem;
    955961        /* private part */
    956962        int first_page, last_page, pages, mapped_page;
     
    958964        struct list_head mapped_link;
    959965        struct list_head mapped_order_link;
    960 } emu10k1_memblk_t;
     966};
    961967
    962968#define snd_emu10k1_memblk_offset(blk)  (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1)))
     
    964970#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE        16
    965971
    966 typedef struct {
     972struct snd_emu10k1_fx8010_ctl {
    967973        struct list_head list;          /* list link container */
    968974        unsigned int vcount;
    969975        unsigned int count;             /* count of GPR (1..16) */
    970         unsigned short gpr[32];         /* GPR number(s) */
     976        unsigned short gpr[32];         /* GPR number(s) */
    971977        unsigned int value[32];
    972978        unsigned int min;               /* minimum range */
    973979        unsigned int max;               /* maximum range */
    974980        unsigned int translation;       /* translation type (EMU10K1_GPR_TRANSLATION*) */
    975         snd_kcontrol_t *kcontrol;
    976 } snd_emu10k1_fx8010_ctl_t;
    977 
    978 typedef void (snd_fx8010_irq_handler_t)(emu10k1_t *emu, void *private_data);
    979 
    980 typedef struct _snd_emu10k1_fx8010_irq {
    981         struct _snd_emu10k1_fx8010_irq *next;
    982         snd_fx8010_irq_handler_t *handler;
    983         unsigned short gpr_running;
     981        struct snd_kcontrol *kcontrol;
     982};
     983
     984typedef void (snd_fx8010_irq_handler_t)(struct snd_emu10k1 *emu, void *private_data);
     985
     986struct snd_emu10k1_fx8010_irq {
     987        struct snd_emu10k1_fx8010_irq *next;
     988        snd_fx8010_irq_handler_t *handler;
     989        unsigned short gpr_running;
    984990        void *private_data;
    985 } snd_emu10k1_fx8010_irq_t;
    986 
    987 typedef struct {
     991};
     992
     993struct snd_emu10k1_fx8010_pcm {
    988994        unsigned int valid: 1,
    989995                     opened: 1,
     
    991997        unsigned int channels;          /* 16-bit channels count */
    992998        unsigned int tram_start;        /* initial ring buffer position in TRAM (in samples) */
    993         unsigned int buffer_size;       /* count of buffered samples */
    994         unsigned short gpr_size;                /* GPR containing size of ring buffer in samples (host) */
    995         unsigned short gpr_ptr;         /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
    996         unsigned short gpr_count;       /* GPR containing count of samples between two interrupts (host) */
    997         unsigned short gpr_tmpcount;    /* GPR containing current count of samples to interrupt (host = set, FX8010) */
    998         unsigned short gpr_trigger;     /* GPR containing trigger (activate) information (host) */
    999         unsigned short gpr_running;     /* GPR containing info if PCM is running (FX8010) */
    1000         unsigned char etram[32];        /* external TRAM address & data */
    1001         snd_pcm_indirect_t pcm_rec;
     999        unsigned int buffer_size;       /* count of buffered samples */
     1000        unsigned short gpr_size;                /* GPR containing size of ring buffer in samples (host) */
     1001        unsigned short gpr_ptr;         /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
     1002        unsigned short gpr_count;       /* GPR containing count of samples between two interrupts (host) */
     1003        unsigned short gpr_tmpcount;    /* GPR containing current count of samples to interrupt (host = set, FX8010) */
     1004        unsigned short gpr_trigger;     /* GPR containing trigger (activate) information (host) */
     1005        unsigned short gpr_running;     /* GPR containing info if PCM is running (FX8010) */
     1006        unsigned char etram[32];        /* external TRAM address & data */
     1007        struct snd_pcm_indirect pcm_rec;
    10021008        unsigned int tram_pos;
    10031009        unsigned int tram_shift;
    1004         snd_emu10k1_fx8010_irq_t *irq;
    1005 } snd_emu10k1_fx8010_pcm_t;
    1006 
    1007 typedef struct {
     1010        struct snd_emu10k1_fx8010_irq *irq;
     1011};
     1012
     1013struct snd_emu10k1_fx8010 {
    10081014        unsigned short fxbus_mask;      /* used FX buses (bitmask) */
    10091015        unsigned short extin_mask;      /* used external inputs (bitmask) */
    10101016        unsigned short extout_mask;     /* used external outputs (bitmask) */
    10111017        unsigned short pad1;
    1012         unsigned int itram_size;        /* internal TRAM size in samples */
    1013         struct snd_dma_buffer etram_pages; /* external TRAM pages and size */
     1018        unsigned int itram_size;        /* internal TRAM size in samples */
     1019        struct snd_dma_buffer etram_pages; /* external TRAM pages and size */
    10141020        unsigned int dbg;               /* FX debugger register */
    10151021        unsigned char name[128];
     
    10181024        struct list_head gpr_ctl;       /* GPR controls */
    10191025        struct semaphore lock;
    1020         snd_emu10k1_fx8010_pcm_t pcm[8];
     1026        struct snd_emu10k1_fx8010_pcm pcm[8];
    10211027        spinlock_t irq_lock;
    1022         snd_emu10k1_fx8010_irq_t *irq_handlers;
    1023 } snd_emu10k1_fx8010_t;
    1024 
    1025 #define emu10k1_gpr_ctl(n) list_entry(n, snd_emu10k1_fx8010_ctl_t, list)
    1026 
    1027 typedef struct {
    1028         struct _snd_emu10k1 *emu;
    1029         snd_rawmidi_t *rmidi;
    1030         snd_rawmidi_substream_t *substream_input;
    1031         snd_rawmidi_substream_t *substream_output;
     1028        struct snd_emu10k1_fx8010_irq *irq_handlers;
     1029};
     1030
     1031#define emu10k1_gpr_ctl(n) list_entry(n, struct snd_emu10k1_fx8010_ctl, list)
     1032
     1033struct snd_emu10k1_midi {
     1034        struct snd_emu10k1 *emu;
     1035        struct snd_rawmidi *rmidi;
     1036        struct snd_rawmidi_substream *substream_input;
     1037        struct snd_rawmidi_substream *substream_output;
    10321038        unsigned int midi_mode;
    10331039        spinlock_t input_lock;
     
    10371043        int port;
    10381044        int ipr_tx, ipr_rx;
    1039         void (*interrupt)(emu10k1_t *emu, unsigned int status);
    1040 } emu10k1_midi_t;
    1041 
    1042 typedef struct {
    1043     u32 vendor;
    1044     u32 device;
    1045     u32 subsystem;
    1046     unsigned char revision;
    1047     unsigned char emu10k1_chip; /* Original SB Live. Not SB Live 24bit. */
    1048     unsigned char emu10k2_chip; /* Audigy 1 or Audigy 2. */
    1049     unsigned char ca0102_chip;  /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */
    1050     unsigned char ca_cardbus_chip; /* Audigy 2 ZS Notebook */
    1051     unsigned char ca0108_chip;  /* Audigy 2 Value */
    1052     unsigned char ca0151_chip;  /* P16V */
    1053     unsigned char spk71;        /* Has 7.1 speakers */
    1054     unsigned char sblive51;     /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */
    1055     unsigned char spdif_bug;    /* Has Spdif phasing bug */
    1056     unsigned char ac97_chip;    /* Has an AC97 chip */
    1057     unsigned char ecard;        /* APS EEPROM */
    1058     const char * driver;
    1059     const char * name;
    1060     const char *id;         /* for backward compatibility - can be NULL if not needed */
    1061 } emu_chip_details_t;
    1062 
    1063 struct _snd_emu10k1 {
     1045        void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status);
     1046};
     1047
     1048struct snd_emu_chip_details {
     1049        u32 vendor;
     1050        u32 device;
     1051        u32 subsystem;
     1052        unsigned char revision;
     1053        unsigned char emu10k1_chip; /* Original SB Live. Not SB Live 24bit. */
     1054        unsigned char emu10k2_chip; /* Audigy 1 or Audigy 2. */
     1055        unsigned char ca0102_chip;  /* Audigy 1 or Audigy 2. Not SB Audigy 2 Value. */
     1056        unsigned char ca0108_chip;  /* Audigy 2 Value */
     1057        unsigned char ca_cardbus_chip; /* Audigy 2 ZS Notebook */
     1058        unsigned char ca0151_chip;  /* P16V */
     1059        unsigned char spk71;        /* Has 7.1 speakers */
     1060        unsigned char sblive51;     /* SBLive! 5.1 - extout 0x11 -> center, 0x12 -> lfe */
     1061        unsigned char spdif_bug;    /* Has Spdif phasing bug */
     1062        unsigned char ac97_chip;    /* Has an AC97 chip: 1 = mandatory, 2 = optional */
     1063        unsigned char ecard;        /* APS EEPROM */
     1064        const char *driver;
     1065        const char *name;
     1066        const char *id;         /* for backward compatibility - can be NULL if not needed */
     1067};
     1068
     1069struct snd_emu10k1 {
    10641070        int irq;
    10651071
    1066         unsigned long port;                     /* I/O port number */
    1067         unsigned int tos_link: 1,               /* tos link detected */
    1068             rear_ac97: 1;                       /* rear channels are on AC'97 */
    1069         const emu_chip_details_t *card_capabilities;  /* Contains profile of card capabilities */
     1072        unsigned long port;                     /* I/O port number */
     1073        unsigned int tos_link: 1,               /* tos link detected */
     1074                rear_ac97: 1,                   /* rear channels are on AC'97 */
     1075                enable_ir: 1;
     1076        /* Contains profile of card capabilities */
     1077        const struct snd_emu_chip_details *card_capabilities;
    10701078        unsigned int audigy;                    /* is Audigy? */
    10711079        unsigned int revision;                  /* chip revision */
     
    10741082        unsigned int card_type;                 /* EMU10K1_CARD_* */
    10751083        unsigned int ecard_ctrl;                /* ecard control bits */
    1076         unsigned long dma_mask;                 /* PCI DMA mask */
    1077         int max_cache_pages;                    /* max memory size / PAGE_SIZE */
    1078         struct snd_dma_buffer silent_page;      /* silent page */
    1079         struct snd_dma_buffer ptb_pages;        /* page table pages */
    1080         struct snd_dma_device p16v_dma_dev;
    1081         struct snd_dma_buffer p16v_buffer;
    1082         snd_util_memhdr_t *memhdr;              /* page allocation list */
    1083         emu10k1_memblk_t *reserved_page;        /* reserved page */
     1084        unsigned long dma_mask;                 /* PCI DMA mask */
     1085        int max_cache_pages;                    /* max memory size / PAGE_SIZE */
     1086        struct snd_dma_buffer silent_page;      /* silent page */
     1087        struct snd_dma_buffer ptb_pages;        /* page table pages */
     1088        struct snd_dma_device p16v_dma_dev;
     1089        struct snd_dma_buffer p16v_buffer;
     1090
     1091        struct snd_util_memhdr *memhdr;         /* page allocation list */
     1092        struct snd_emu10k1_memblk *reserved_page;       /* reserved page */
    10841093
    10851094        struct list_head mapped_link_head;
     
    10911100        unsigned int spdif_bits[3];             /* s/pdif out setup */
    10921101
    1093         snd_emu10k1_fx8010_t fx8010;            /* FX8010 info */
     1102        struct snd_emu10k1_fx8010 fx8010;               /* FX8010 info */
    10941103        int gpr_base;
    1095 
    1096         ac97_t *ac97;
     1104       
     1105        struct snd_ac97 *ac97;
    10971106
    10981107        struct pci_dev *pci;
    1099         snd_card_t *card;
    1100         snd_pcm_t *pcm;
    1101         snd_pcm_t *pcm_mic;
    1102         snd_pcm_t *pcm_efx;
    1103         snd_pcm_t *pcm_p16v;
     1108        struct snd_card *card;
     1109        struct snd_pcm *pcm;
     1110        struct snd_pcm *pcm_mic;
     1111        struct snd_pcm *pcm_efx;
     1112        struct snd_pcm *pcm_multi;
     1113        struct snd_pcm *pcm_p16v;
    11041114
    11051115        spinlock_t synth_lock;
    11061116        void *synth;
    1107         int (*get_synth_voice)(emu10k1_t *emu);
     1117        int (*get_synth_voice)(struct snd_emu10k1 *emu);
    11081118
    11091119        spinlock_t reg_lock;
     
    11121122        struct semaphore ptb_lock;
    11131123
    1114         emu10k1_voice_t voices[NUM_G];
    1115         emu10k1_voice_t p16v_voices[4];
    1116         emu10k1_voice_t p16v_capture_voice;
    1117         int p16v_device_offset;
    1118         u32 p16v_capture_source;
    1119         u32 p16v_capture_channel;
    1120         emu10k1_pcm_mixer_t pcm_mixer[32];
    1121         emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK];
    1122         snd_kcontrol_t *ctl_send_routing;
    1123         snd_kcontrol_t *ctl_send_volume;
    1124         snd_kcontrol_t *ctl_attn;
    1125         snd_kcontrol_t *ctl_efx_send_routing;
    1126         snd_kcontrol_t *ctl_efx_send_volume;
    1127         snd_kcontrol_t *ctl_efx_attn;
    1128 
    1129         void (*hwvol_interrupt)(emu10k1_t *emu, unsigned int status);
    1130         void (*capture_interrupt)(emu10k1_t *emu, unsigned int status);
    1131         void (*capture_mic_interrupt)(emu10k1_t *emu, unsigned int status);
    1132         void (*capture_efx_interrupt)(emu10k1_t *emu, unsigned int status);
    1133         void (*spdif_interrupt)(emu10k1_t *emu, unsigned int status);
    1134         void (*dsp_interrupt)(emu10k1_t *emu);
    1135 
    1136         snd_pcm_substream_t *pcm_capture_substream;
    1137         snd_pcm_substream_t *pcm_capture_mic_substream;
    1138         snd_pcm_substream_t *pcm_capture_efx_substream;
    1139         snd_pcm_substream_t *pcm_playback_efx_substream;
    1140 
    1141         snd_timer_t *timer;
    1142 
    1143         emu10k1_midi_t midi;
    1144         emu10k1_midi_t midi2; /* for audigy */
    1145 
    1146         unsigned int efx_voices_mask[2];
    1147         unsigned int next_free_voice;
    1148 };
    1149 
    1150 int snd_emu10k1_create(snd_card_t * card,
     1124        struct snd_emu10k1_voice voices[NUM_G];
     1125        struct snd_emu10k1_voice p16v_voices[4];
     1126        struct snd_emu10k1_voice p16v_capture_voice;
     1127        int p16v_device_offset;
     1128        u32 p16v_capture_source;
     1129        u32 p16v_capture_channel;
     1130        struct snd_emu10k1_pcm_mixer pcm_mixer[32];
     1131        struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK];
     1132        struct snd_kcontrol *ctl_send_routing;
     1133        struct snd_kcontrol *ctl_send_volume;
     1134        struct snd_kcontrol *ctl_attn;
     1135        struct snd_kcontrol *ctl_efx_send_routing;
     1136        struct snd_kcontrol *ctl_efx_send_volume;
     1137        struct snd_kcontrol *ctl_efx_attn;
     1138
     1139        void (*hwvol_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
     1140        void (*capture_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
     1141        void (*capture_mic_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
     1142        void (*capture_efx_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
     1143        void (*spdif_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
     1144        void (*dsp_interrupt)(struct snd_emu10k1 *emu);
     1145
     1146        struct snd_pcm_substream *pcm_capture_substream;
     1147        struct snd_pcm_substream *pcm_capture_mic_substream;
     1148        struct snd_pcm_substream *pcm_capture_efx_substream;
     1149        struct snd_pcm_substream *pcm_playback_efx_substream;
     1150
     1151        struct snd_timer *timer;
     1152
     1153        struct snd_emu10k1_midi midi;
     1154        struct snd_emu10k1_midi midi2; /* for audigy */
     1155
     1156        unsigned int efx_voices_mask[2];
     1157        unsigned int next_free_voice;
     1158
     1159#ifdef CONFIG_PM
     1160        unsigned int *saved_ptr;
     1161        unsigned int *saved_gpr;
     1162        unsigned int *tram_val_saved;
     1163        unsigned int *tram_addr_saved;
     1164        unsigned int *saved_icode;
     1165        unsigned int *p16v_saved;
     1166        unsigned int saved_a_iocfg, saved_hcfg;
     1167#endif
     1168
     1169};
     1170
     1171int snd_emu10k1_create(struct snd_card *card,
    11511172                       struct pci_dev *pci,
    11521173                       unsigned short extin_mask,
    11531174                       unsigned short extout_mask,
    11541175                       long max_cache_bytes,
    1155                        int enable_ir,
    1156                        uint subsystem,
    1157                        emu10k1_t ** remu);
    1158 
    1159 int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
    1160 int snd_emu10k1_pcm_mic(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
    1161 int snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
    1162 int snd_p16v_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
    1163 int snd_p16v_free(emu10k1_t * emu);
    1164 int snd_p16v_mixer(emu10k1_t * emu);
    1165 int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
    1166 int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
    1167 int snd_emu10k1_mixer(emu10k1_t * emu, int pcm_device, int multi_device);
    1168 int snd_emu10k1_timer(emu10k1_t * emu, int device);
    1169 int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep);
     1176                       int enable_ir,
     1177                       uint subsystem,
     1178                       struct snd_emu10k1 ** remu);
     1179
     1180int snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
     1181int snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
     1182int snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
     1183int snd_p16v_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
     1184int snd_p16v_free(struct snd_emu10k1 * emu);
     1185int snd_p16v_mixer(struct snd_emu10k1 * emu);
     1186int snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
     1187int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
     1188int snd_emu10k1_mixer(struct snd_emu10k1 * emu, int pcm_device, int multi_device);
     1189int snd_emu10k1_timer(struct snd_emu10k1 * emu, int device);
     1190int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep);
    11701191
    11711192irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs);
    11721193
    1173 /* initialization */
    1174 void snd_emu10k1_voice_init(emu10k1_t * emu, int voice);
    1175 int snd_emu10k1_init_efx(emu10k1_t *emu);
    1176 void snd_emu10k1_free_efx(emu10k1_t *emu);
    1177 int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size);
     1194void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int voice);
     1195int snd_emu10k1_init_efx(struct snd_emu10k1 *emu);
     1196void snd_emu10k1_free_efx(struct snd_emu10k1 *emu);
     1197int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size);
     1198int snd_emu10k1_done(struct snd_emu10k1 * emu);
    11781199
    11791200/* I/O functions */
    1180 unsigned int snd_emu10k1_ptr_read(emu10k1_t * emu, unsigned int reg, unsigned int chn);
    1181 void snd_emu10k1_ptr_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data);
    1182 unsigned int snd_emu10k1_ptr20_read(emu10k1_t * emu, unsigned int reg, unsigned int chn);
    1183 void snd_emu10k1_ptr20_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data);
    1184 void snd_emu10k1_efx_write(emu10k1_t *emu, unsigned int pc, unsigned int data);
    1185 unsigned int snd_emu10k1_efx_read(emu10k1_t *emu, unsigned int pc);
    1186 void snd_emu10k1_intr_enable(emu10k1_t *emu, unsigned int intrenb);
    1187 void snd_emu10k1_intr_disable(emu10k1_t *emu, unsigned int intrenb);
    1188 void snd_emu10k1_voice_intr_enable(emu10k1_t *emu, unsigned int voicenum);
    1189 void snd_emu10k1_voice_intr_disable(emu10k1_t *emu, unsigned int voicenum);
    1190 void snd_emu10k1_voice_intr_ack(emu10k1_t *emu, unsigned int voicenum);
    1191 void snd_emu10k1_voice_half_loop_intr_enable(emu10k1_t *emu, unsigned int voicenum);
    1192 void snd_emu10k1_voice_half_loop_intr_disable(emu10k1_t *emu, unsigned int voicenum);
    1193 void snd_emu10k1_voice_half_loop_intr_ack(emu10k1_t *emu, unsigned int voicenum);
    1194 void snd_emu10k1_voice_set_loop_stop(emu10k1_t *emu, unsigned int voicenum);
    1195 void snd_emu10k1_voice_clear_loop_stop(emu10k1_t *emu, unsigned int voicenum);
    1196 void snd_emu10k1_wait(emu10k1_t *emu, unsigned int wait);
    1197 static inline unsigned int snd_emu10k1_wc(emu10k1_t *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; }
    1198 unsigned short snd_emu10k1_ac97_read(ac97_t *ac97, unsigned short reg);
    1199 void snd_emu10k1_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short data);
     1201unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
     1202void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
     1203unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
     1204void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
     1205unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc);
     1206void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb);
     1207void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb);
     1208void snd_emu10k1_voice_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
     1209void snd_emu10k1_voice_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
     1210void snd_emu10k1_voice_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
     1211void snd_emu10k1_voice_half_loop_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
     1212void snd_emu10k1_voice_half_loop_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
     1213void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
     1214void snd_emu10k1_voice_set_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
     1215void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
     1216void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait);
     1217static inline unsigned int snd_emu10k1_wc(struct snd_emu10k1 *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; }
     1218unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
     1219void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
    12001220unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
    1201 unsigned char snd_emu10k1_sum_vol_attn(unsigned int value);
     1221
     1222#ifdef CONFIG_PM
     1223void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu);
     1224void snd_emu10k1_resume_init(struct snd_emu10k1 *emu);
     1225void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu);
     1226int snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu);
     1227void snd_emu10k1_efx_free_pm_buffer(struct snd_emu10k1 *emu);
     1228void snd_emu10k1_efx_suspend(struct snd_emu10k1 *emu);
     1229void snd_emu10k1_efx_resume(struct snd_emu10k1 *emu);
     1230int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu);
     1231void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu);
     1232void snd_p16v_suspend(struct snd_emu10k1 *emu);
     1233void snd_p16v_resume(struct snd_emu10k1 *emu);
     1234#endif
    12021235
    12031236/* memory allocation */
    1204 snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, snd_pcm_substream_t *substream);
    1205 int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk);
    1206 snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size);
    1207 int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk);
    1208 int snd_emu10k1_synth_bzero(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, int size);
    1209 int snd_emu10k1_synth_copy_from_user(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, const char *data, int size);
    1210 int snd_emu10k1_memblk_map(emu10k1_t *emu, emu10k1_memblk_t *blk);
     1237struct snd_util_memblk *snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream);
     1238int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
     1239struct snd_util_memblk *snd_emu10k1_synth_alloc(struct snd_emu10k1 *emu, unsigned int size);
     1240int snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
     1241int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, int size);
     1242int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, const char __user *data, int size);
     1243int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk);
    12111244
    12121245/* voice allocation */
    1213 int snd_emu10k1_voice_alloc(emu10k1_t *emu, emu10k1_voice_type_t type, int pair, emu10k1_voice_t **rvoice);
    1214 int snd_emu10k1_voice_free(emu10k1_t *emu, emu10k1_voice_t *pvoice);
     1246int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int pair, struct snd_emu10k1_voice **rvoice);
     1247int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
    12151248
    12161249/* MIDI uart */
    1217 int snd_emu10k1_midi(emu10k1_t * emu);
    1218 int snd_emu10k1_audigy_midi(emu10k1_t * emu);
     1250int snd_emu10k1_midi(struct snd_emu10k1 * emu);
     1251int snd_emu10k1_audigy_midi(struct snd_emu10k1 * emu);
    12191252
    12201253/* proc interface */
    1221 int snd_emu10k1_proc_init(emu10k1_t * emu);
     1254int snd_emu10k1_proc_init(struct snd_emu10k1 * emu);
    12221255
    12231256/* fx8010 irq handler */
    1224 int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu,
    1225                                             snd_fx8010_irq_handler_t *handler,
    1226                                             unsigned char gpr_running,
    1227                                             void *private_data,
    1228                                             snd_emu10k1_fx8010_irq_t **r_irq);
    1229 int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu,
    1230                                               snd_emu10k1_fx8010_irq_t *irq);
     1257int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
     1258                                            snd_fx8010_irq_handler_t *handler,
     1259                                            unsigned char gpr_running,
     1260                                            void *private_data,
     1261                                            struct snd_emu10k1_fx8010_irq **r_irq);
     1262int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
     1263                                              struct snd_emu10k1_fx8010_irq *irq);
    12311264
    12321265#endif /* __KERNEL__ */
     
    12621295#define FXBUS(x)        (0x00 + (x))    /* x = 0x00 - 0x0f */
    12631296#define EXTIN(x)        (0x10 + (x))    /* x = 0x00 - 0x0f */
    1264 #define EXTOUT(x)       (0x20 + (x))    /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
    1265 #define FXBUS2(x)       (0x30 + (x))    /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
    1266 /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
     1297#define EXTOUT(x)       (0x20 + (x))    /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
     1298#define FXBUS2(x)       (0x30 + (x))    /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
     1299                                        /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
    12671300
    12681301#define C_00000000      0x40
     
    13001333#define ETRAM_ADDR(x)   (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
    13011334
    1302 #define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
    1303 #define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
    1304 #define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
    1305 #define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
    1306 #define A_ITRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
    1307 #define A_ETRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
    1308 
    1309 #define A_FXBUS(x)      (0x00 + (x))    /* x = 0x00 - 0x3f FX buses */
    1310 #define A_EXTIN(x)      (0x40 + (x))    /* x = 0x00 - 0x0f physical ins */
    1311 #define A_P16VIN(x)     (0x50 + (x))    /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
    1312 #define A_EXTOUT(x)     (0x60 + (x))    /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown   */
    1313 #define A_FXBUS2(x)     (0x80 + (x))    /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
    1314 #define A_EMU32OUTH(x)  (0xa0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
    1315 #define A_EMU32OUTL(x)  (0xb0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
     1335#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
     1336#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
     1337#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
     1338#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
     1339#define A_ITRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
     1340#define A_ETRAM_CTL(x)  (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
     1341
     1342#define A_FXBUS(x)      (0x00 + (x))    /* x = 0x00 - 0x3f FX buses */
     1343#define A_EXTIN(x)      (0x40 + (x))    /* x = 0x00 - 0x0f physical ins */
     1344#define A_P16VIN(x)     (0x50 + (x))    /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
     1345#define A_EXTOUT(x)     (0x60 + (x))    /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown   */
     1346#define A_FXBUS2(x)     (0x80 + (x))    /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
     1347#define A_EMU32OUTH(x)  (0xa0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
     1348#define A_EMU32OUTL(x)  (0xb0 + (x))    /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
    13161349#define A_GPR(x)        (A_FXGPREGBASE + (x))
    13171350
     
    13371370#define FXBUS_MIDI_REVERB       0x0c
    13381371#define FXBUS_MIDI_CHORUS       0x0d
    1339 #define FXBUS_PCM_LEFT_SIDE     0x0e
    1340 #define FXBUS_PCM_RIGHT_SIDE    0x0f
     1372#define FXBUS_PCM_LEFT_SIDE     0x0e
     1373#define FXBUS_PCM_RIGHT_SIDE    0x0f
    13411374#define FXBUS_PT_LEFT           0x14
    13421375#define FXBUS_PT_RIGHT          0x15
     
    13631396#define EXTOUT_TOSLINK_L   0x02 /* LiveDrive - TOSLink Optical - left */
    13641397#define EXTOUT_TOSLINK_R   0x03 /* LiveDrive - TOSLink Optical - right */
    1365 #define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
    1366 #define EXTOUT_AC97_LFE    0x05 /* SB Live 5.1 - LFE */
     1398#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
     1399#define EXTOUT_AC97_LFE    0x05 /* SB Live 5.1 - LFE */
    13671400#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
    13681401#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
     
    13721405#define EXTOUT_ADC_CAP_R   0x0b /* ADC Capture buffer - right */
    13731406#define EXTOUT_MIC_CAP     0x0c /* MIC Capture buffer */
    1374 #define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
    1375 #define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
     1407#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
     1408#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
    13761409#define EXTOUT_ACENTER     0x11 /* Analog Center */
    13771410#define EXTOUT_ALFE        0x12 /* Analog LFE */
     
    13831416#define A_EXTIN_SPDIF_CD_R      0x03    /* digital CD left */
    13841417#define A_EXTIN_OPT_SPDIF_L     0x04    /* audigy drive Optical SPDIF - left */
    1385 #define A_EXTIN_OPT_SPDIF_R     0x05    /*                              right */
     1418#define A_EXTIN_OPT_SPDIF_R     0x05    /*                              right */ 
    13861419#define A_EXTIN_LINE2_L         0x08    /* audigy drive line2/mic2 - left */
    13871420#define A_EXTIN_LINE2_R         0x09    /*                           right */
     
    14041437#define A_EXTOUT_ACENTER        0x0a    /* analog center */
    14051438#define A_EXTOUT_ALFE           0x0b    /* analog LFE */
    1406 #define A_EXTOUT_ASIDE_L        0x0c    /* analog side left  - Audigy 2 ZS */
    1407 #define A_EXTOUT_ASIDE_R        0x0d    /*             right - Audigy 2 ZS */
     1439#define A_EXTOUT_ASIDE_L        0x0c    /* analog side left  - Audigy 2 ZS */
     1440#define A_EXTOUT_ASIDE_R        0x0d    /*             right - Audigy 2 ZS */
    14081441#define A_EXTOUT_AREAR_L        0x0e    /* analog rear left */
    14091442#define A_EXTOUT_AREAR_R        0x0f    /*             right */
     
    14391472#define A_GPR_ACCU      0xd6            /* ACCUM, accumulator */
    14401473#define A_GPR_COND      0xd7            /* CCR, condition register */
    1441 #define A_GPR_NOISE0    0xd8            /* noise source */
    1442 #define A_GPR_NOISE1    0xd9            /* noise source */
    1443 #define A_GPR_IRQ       0xda            /* IRQ register */
    1444 #define A_GPR_DBAC      0xdb            /* TRAM Delay Base Address Counter - internal */
    1445 #define A_GPR_DBACE     0xde            /* TRAM Delay Base Address Counter - external */
     1474#define A_GPR_NOISE0    0xd8            /* noise source */
     1475#define A_GPR_NOISE1    0xd9            /* noise source */
     1476#define A_GPR_IRQ       0xda            /* IRQ register */
     1477#define A_GPR_DBAC      0xdb            /* TRAM Delay Base Address Counter - internal */
     1478#define A_GPR_DBACE     0xde            /* TRAM Delay Base Address Counter - external */
    14461479
    14471480/* definitions for debug register */
     
    14631496#endif
    14641497
    1465 typedef struct {
     1498struct snd_emu10k1_fx8010_info {
    14661499        unsigned int internal_tram_size;        /* in samples */
    14671500        unsigned int external_tram_size;        /* in samples */
     
    14701503        char extout_names[32][32];              /* names of external outputs */
    14711504        unsigned int gpr_controls;              /* count of GPR controls */
    1472 } emu10k1_fx8010_info_t;
     1505};
    14731506
    14741507#define EMU10K1_GPR_TRANSLATION_NONE            0
     
    14781511#define EMU10K1_GPR_TRANSLATION_ONOFF           4
    14791512
    1480 typedef struct {
    1481         snd_ctl_elem_id_t id;           /* full control ID definition */
     1513struct snd_emu10k1_fx8010_control_gpr {
     1514        struct snd_ctl_elem_id id;              /* full control ID definition */
    14821515        unsigned int vcount;            /* visible count */
    14831516        unsigned int count;             /* count of GPR (1..16) */
    1484         unsigned short gpr[32];         /* GPR number(s) */
     1517        unsigned short gpr[32];         /* GPR number(s) */
    14851518        unsigned int value[32];         /* initial values */
    14861519        unsigned int min;               /* minimum range */
    14871520        unsigned int max;               /* maximum range */
    14881521        unsigned int translation;       /* translation type (EMU10K1_GPR_TRANSLATION*) */
    1489 } emu10k1_fx8010_control_gpr_t;
    1490 
    1491 typedef struct {
     1522};
     1523
     1524struct snd_emu10k1_fx8010_code {
    14921525        char name[128];
    14931526
    1494         DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
    1495         u_int32_t __user *gpr_map;      /* initializers */
     1527        DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
     1528        u_int32_t __user *gpr_map;        /* initializers */
    14961529
    14971530        unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
    1498         emu10k1_fx8010_control_gpr_t *gpr_add_controls; /* GPR controls to add/replace */
     1531        struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
    14991532
    15001533        unsigned int gpr_del_control_count; /* count of GPR controls to remove */
    1501         snd_ctl_elem_id_t *gpr_del_controls; /* IDs of GPR controls to remove */
     1534        struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
    15021535
    15031536        unsigned int gpr_list_control_count; /* count of GPR controls to list */
    15041537        unsigned int gpr_list_control_total; /* total count of GPR controls */
    1505         emu10k1_fx8010_control_gpr_t *gpr_list_controls; /* listed GPR controls */
    1506 
    1507         DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
    1508         u_int32_t __user *tram_data_map;  /* data initializers */
    1509         u_int32_t __user *tram_addr_map;  /* map initializers */
    1510 
    1511         DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
    1512         u_int32_t __user *code;           /* one instruction - 64 bits */
    1513 } emu10k1_fx8010_code_t;
    1514 
    1515 typedef struct {
     1538        struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
     1539
     1540        DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
     1541        u_int32_t __user *tram_data_map;  /* data initializers */
     1542        u_int32_t __user *tram_addr_map;  /* map initializers */
     1543
     1544        DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
     1545        u_int32_t __user *code;           /* one instruction - 64 bits */
     1546};
     1547
     1548struct snd_emu10k1_fx8010_tram {
    15161549        unsigned int address;           /* 31.bit == 1 -> external TRAM */
    15171550        unsigned int size;              /* size in samples (4 bytes) */
    15181551        unsigned int *samples;          /* pointer to samples (20-bit) */
    15191552                                        /* NULL->clear memory */
    1520 } emu10k1_fx8010_tram_t;
    1521 
    1522 typedef struct {
     1553};
     1554
     1555struct snd_emu10k1_fx8010_pcm_rec {
    15231556        unsigned int substream;         /* substream number */
    15241557        unsigned int res1;              /* reserved */
    15251558        unsigned int channels;          /* 16-bit channels count, zero = remove this substream */
    15261559        unsigned int tram_start;        /* ring buffer position in TRAM (in samples) */
    1527         unsigned int buffer_size;       /* count of buffered samples */
    1528         unsigned short gpr_size;                /* GPR containing size of ringbuffer in samples (host) */
    1529         unsigned short gpr_ptr;         /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
    1530         unsigned short gpr_count;       /* GPR containing count of samples between two interrupts (host) */
    1531         unsigned short gpr_tmpcount;    /* GPR containing current count of samples to interrupt (host = set, FX8010) */
    1532         unsigned short gpr_trigger;     /* GPR containing trigger (activate) information (host) */
    1533         unsigned short gpr_running;     /* GPR containing info if PCM is running (FX8010) */
     1560        unsigned int buffer_size;       /* count of buffered samples */
     1561        unsigned short gpr_size;                /* GPR containing size of ringbuffer in samples (host) */
     1562        unsigned short gpr_ptr;         /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
     1563        unsigned short gpr_count;       /* GPR containing count of samples between two interrupts (host) */
     1564        unsigned short gpr_tmpcount;    /* GPR containing current count of samples to interrupt (host = set, FX8010) */
     1565        unsigned short gpr_trigger;     /* GPR containing trigger (activate) information (host) */
     1566        unsigned short gpr_running;     /* GPR containing info if PCM is running (FX8010) */
    15341567        unsigned char pad;              /* reserved */
    15351568        unsigned char etram[32];        /* external TRAM address & data (one per channel) */
    15361569        unsigned int res2;              /* reserved */
    1537 } emu10k1_fx8010_pcm_t;
    1538 
    1539 #define SNDRV_EMU10K1_IOCTL_INFO        _IOR ('H', 0x10, emu10k1_fx8010_info_t)
    1540 #define SNDRV_EMU10K1_IOCTL_CODE_POKE   _IOW ('H', 0x11, emu10k1_fx8010_code_t)
    1541 #define SNDRV_EMU10K1_IOCTL_CODE_PEEK   _IOWR('H', 0x12, emu10k1_fx8010_code_t)
     1570};
     1571
     1572#define SNDRV_EMU10K1_IOCTL_INFO        _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
     1573#define SNDRV_EMU10K1_IOCTL_CODE_POKE   _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
     1574#define SNDRV_EMU10K1_IOCTL_CODE_PEEK   _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
    15421575#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP  _IOW ('H', 0x20, int)
    1543 #define SNDRV_EMU10K1_IOCTL_TRAM_POKE   _IOW ('H', 0x21, emu10k1_fx8010_tram_t)
    1544 #define SNDRV_EMU10K1_IOCTL_TRAM_PEEK   _IOWR('H', 0x22, emu10k1_fx8010_tram_t)
    1545 #define SNDRV_EMU10K1_IOCTL_PCM_POKE    _IOW ('H', 0x30, emu10k1_fx8010_pcm_t)
    1546 #define SNDRV_EMU10K1_IOCTL_PCM_PEEK    _IOWR('H', 0x31, emu10k1_fx8010_pcm_t)
     1576#define SNDRV_EMU10K1_IOCTL_TRAM_POKE   _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
     1577#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK   _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
     1578#define SNDRV_EMU10K1_IOCTL_PCM_POKE    _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
     1579#define SNDRV_EMU10K1_IOCTL_PCM_PEEK    _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
    15471580#define SNDRV_EMU10K1_IOCTL_STOP        _IO  ('H', 0x80)
    15481581#define SNDRV_EMU10K1_IOCTL_CONTINUE    _IO  ('H', 0x81)
     
    15511584#define SNDRV_EMU10K1_IOCTL_DBG_READ    _IOR ('H', 0x84, int)
    15521585
     1586/* typedefs for compatibility to user-space */
     1587typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
     1588typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
     1589typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
     1590typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
     1591typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
     1592
    15531593#endif  /* __SOUND_EMU10K1_H */
  • GPL/trunk/alsa-kernel/include/sound/emu10k1_synth.h

    r33 r34  
    2828
    2929/* argument for snd_seq_device_new */
    30 typedef struct snd_emu10k1_synth_arg {
    31         emu10k1_t *hwptr;       /* chip */
     30struct snd_emu10k1_synth_arg {
     31        struct snd_emu10k1 *hwptr;      /* chip */
    3232        int index;              /* sequencer client index */
    3333        int seq_ports;          /* number of sequencer ports to be created */
    3434        int max_voices;         /* maximum number of voices for wavetable */
    35 } snd_emu10k1_synth_arg_t;
     35};
    3636
    3737#define EMU10K1_MAX_MEMSIZE     (32 * 1024 * 1024) /* 32MB */
  • GPL/trunk/alsa-kernel/include/sound/emux_synth.h

    r33 r34  
    2626#include "soundfont.h"
    2727#include "seq_midi_emul.h"
    28 #ifdef CONFIG_SND_OSSEMUL
     28#ifdef CONFIG_SND_SEQUENCER_OSS
    2929#include "seq_oss.h"
    3030#endif
     
    3737#define SNDRV_EMUX_USE_RAW_EFFECT
    3838
    39 
    40 /*
    41  * typedefs
    42  */
    43 typedef struct snd_emux_effect_table snd_emux_effect_table_t;
    44 typedef struct snd_emux_port snd_emux_port_t;
    45 typedef struct snd_emux_voice snd_emux_voice_t;
    46 typedef struct snd_emux snd_emux_t;
    47 
     39struct snd_emux;
     40struct snd_emux_port;
     41struct snd_emux_voice;
     42struct snd_emux_effect_table;
    4843
    4944/*
    5045 * operators
    5146 */
    52 typedef struct snd_emux_operators {
     47struct snd_emux_operators {
    5348        struct module *owner;
    54         snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port);
    55         int (*prepare)(snd_emux_voice_t *vp);
    56         void (*trigger)(snd_emux_voice_t *vp);
    57         void (*release)(snd_emux_voice_t *vp);
    58         void (*update)(snd_emux_voice_t *vp, int update);
    59         void (*terminate)(snd_emux_voice_t *vp);
    60         void (*free_voice)(snd_emux_voice_t *vp);
    61         void (*reset)(snd_emux_t *emu, int ch);
    62         /* the first parameters are snd_emux_t */
    63         int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void *data, long count);
    64         int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr);
    65         void (*sample_reset)(snd_emux_t *emu);
    66         int (*load_fx)(snd_emux_t *emu, int type, int arg, const void *data, long count);
    67         void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset);
    68 #ifdef CONFIG_SND_OSSEMUL
    69         int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2);
    70 #endif
    71 } snd_emux_operators_t;
     49        struct snd_emux_voice *(*get_voice)(struct snd_emux *emu,
     50                                            struct snd_emux_port *port);
     51        int (*prepare)(struct snd_emux_voice *vp);
     52        void (*trigger)(struct snd_emux_voice *vp);
     53        void (*release)(struct snd_emux_voice *vp);
     54        void (*update)(struct snd_emux_voice *vp, int update);
     55        void (*terminate)(struct snd_emux_voice *vp);
     56        void (*free_voice)(struct snd_emux_voice *vp);
     57        void (*reset)(struct snd_emux *emu, int ch);
     58        /* the first parameters are struct snd_emux */
     59        int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp,
     60                          struct snd_util_memhdr *hdr,
     61                          const void __user *data, long count);
     62        int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp,
     63                           struct snd_util_memhdr *hdr);
     64        void (*sample_reset)(struct snd_emux *emu);
     65        int (*load_fx)(struct snd_emux *emu, int type, int arg,
     66                       const void __user *data, long count);
     67        void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
     68                      struct snd_midi_channel_set *chset);
     69#ifdef CONFIG_SND_SEQUENCER_OSS
     70        int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
     71#endif
     72};
    7273
    7374
     
    9192struct snd_emux {
    9293
    93         snd_card_t *card;       /* assigned card */
     94        struct snd_card *card;  /* assigned card */
    9495
    9596        /* following should be initialized before registration */
     
    9899        int num_ports;          /* number of ports to be created */
    99100        int pitch_shift;        /* pitch shift value (for Emu10k1) */
    100         snd_emux_operators_t ops;       /* operators */
     101        struct snd_emux_operators ops;  /* operators */
    101102        void *hw;               /* hardware */
    102103        unsigned long flags;    /* other conditions */
     
    105106        unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */
    106107        int hwdep_idx;          /* hwdep device index */
    107         snd_hwdep_t *hwdep;     /* hwdep device */
     108        struct snd_hwdep *hwdep;        /* hwdep device */
    108109
    109110        /* private */
    110111        int num_voices;         /* current number of voices */
    111         snd_sf_list_t *sflist;  /* root of SoundFont list */
    112         snd_emux_voice_t *voices;       /* Voices (EMU 'channel') */
     112        struct snd_sf_list *sflist;     /* root of SoundFont list */
     113        struct snd_emux_voice *voices;  /* Voices (EMU 'channel') */
    113114        int use_time;   /* allocation counter */
    114115        spinlock_t voice_lock;  /* Lock for voice access */
     
    116117        int client;             /* For the sequencer client */
    117118        int ports[SNDRV_EMUX_MAX_PORTS];        /* The ports for this device */
     119        struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
    118120        int used;       /* use counter */
    119         snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS];
    120121        char *name;     /* name of the device (internal) */
    121         snd_rawmidi_t **vmidi;
     122        struct snd_rawmidi **vmidi;
    122123        struct timer_list tlist;        /* for pending note-offs */
    123124        int timer_active;
    124125
    125         snd_util_memhdr_t *memhdr;      /* memory chunk information */
     126        struct snd_util_memhdr *memhdr; /* memory chunk information */
    126127
    127128#ifdef CONFIG_PROC_FS
    128         snd_info_entry_t *proc;
    129 #endif
    130 
    131 #ifdef CONFIG_SND_OSSEMUL
    132         snd_seq_device_t *oss_synth;
     129        struct snd_info_entry *proc;
     130#endif
     131
     132#ifdef CONFIG_SND_SEQUENCER_OSS
     133        struct snd_seq_device *oss_synth;
    133134#endif
    134135};
     
    140141struct snd_emux_port {
    141142
    142         snd_midi_channel_set_t chset;
    143         snd_emux_t *emu;
     143        struct snd_midi_channel_set chset;
     144        struct snd_emux *emu;
    144145
    145146        char port_mode;                 /* operation mode */
     
    148149        int ctrls[EMUX_MD_END];         /* control parameters */
    149150#ifdef SNDRV_EMUX_USE_RAW_EFFECT
    150         snd_emux_effect_table_t *effect;
    151 #endif
    152 #ifdef CONFIG_SND_OSSEMUL
    153         snd_seq_oss_arg_t *oss_arg;
     151        struct snd_emux_effect_table *effect;
     152#endif
     153#ifdef CONFIG_SND_SEQUENCER_OSS
     154        struct snd_seq_oss_arg *oss_arg;
    154155#endif
    155156};
     
    180181        unsigned char velocity; /* Velocity of current note */
    181182
    182         snd_sf_zone_t *zone;    /* Zone assigned to this note */
     183        struct snd_sf_zone *zone;       /* Zone assigned to this note */
    183184        void *block;            /* sample block pointer (optional) */
    184         snd_midi_channel_t *chan;       /* Midi channel for this note */
    185         snd_emux_port_t *port;  /* associated port */
    186         snd_emux_t *emu;        /* assigned root info */
    187         void *hw;               /* hardware pointer (emu8000_t or emu10k1_t) */
     185        struct snd_midi_channel *chan;  /* Midi channel for this note */
     186        struct snd_emux_port *port;     /* associated port */
     187        struct snd_emux *emu;   /* assigned root info */
     188        void *hw;               /* hardware pointer (emu8000 or emu10k1) */
    188189        unsigned long ontime;   /* jiffies at note triggered */
    189190       
    190191        /* Emu8k/Emu10k1 registers */
    191         soundfont_voice_info_t reg;
     192        struct soundfont_voice_info reg;
    192193
    193194        /* additional registers */
     
    230231 * prototypes - interface to Emu10k1 and Emu8k routines
    231232 */
    232 int snd_emux_new(snd_emux_t **remu);
    233 int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name);
    234 int snd_emux_free(snd_emux_t *emu);
     233int snd_emux_new(struct snd_emux **remu);
     234int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name);
     235int snd_emux_free(struct snd_emux *emu);
    235236
    236237/*
    237238 * exported functions
    238239 */
    239 void snd_emux_terminate_all(snd_emux_t *emu);
    240 void snd_emux_lock_voice(snd_emux_t *emu, int voice);
    241 void snd_emux_unlock_voice(snd_emux_t *emu, int voice);
     240void snd_emux_terminate_all(struct snd_emux *emu);
     241void snd_emux_lock_voice(struct snd_emux *emu, int voice);
     242void snd_emux_unlock_voice(struct snd_emux *emu, int voice);
    242243
    243244#endif /* __SOUND_EMUX_SYNTH_H */
  • GPL/trunk/alsa-kernel/include/sound/instr.h

    r33 r34  
    4242
    4343/** container for sequencer instrument header */
    44 typedef struct sndrv_seq_instr_header snd_instr_header_t;
     44typedef struct snd_seq_instr_header snd_instr_header_t;
    4545
    4646size_t snd_instr_header_sizeof(void);
  • GPL/trunk/alsa-kernel/include/sound/pcm-indirect.h

    r33 r34  
    2525#include <sound/pcm.h>
    2626
    27 typedef struct sndrv_pcm_indirect {
    28     unsigned int hw_buffer_size;        /* Byte size of hardware buffer */
    29     unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */
    30     unsigned int hw_data;       /* Offset to next dst (or src) in hw ring buffer */
    31     unsigned int hw_io; /* Ring buffer hw pointer */
    32     int hw_ready;               /* Bytes ready for play (or captured) in hw ring buffer */
    33     unsigned int sw_buffer_size;        /* Byte size of software buffer */
    34     unsigned int sw_data;       /* Offset to next dst (or src) in sw ring buffer */
    35     unsigned int sw_io; /* Current software pointer in bytes */
    36     int sw_ready;               /* Bytes ready to be transferred to/from hw */
    37     snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */
    38 } snd_pcm_indirect_t;
     27struct snd_pcm_indirect {
     28        unsigned int hw_buffer_size;    /* Byte size of hardware buffer */
     29        unsigned int hw_queue_size;     /* Max queue size of hw buffer (0 = buffer size) */
     30        unsigned int hw_data;   /* Offset to next dst (or src) in hw ring buffer */
     31        unsigned int hw_io;     /* Ring buffer hw pointer */
     32        int hw_ready;           /* Bytes ready for play (or captured) in hw ring buffer */
     33        unsigned int sw_buffer_size;    /* Byte size of software buffer */
     34        unsigned int sw_data;   /* Offset to next dst (or src) in sw ring buffer */
     35        unsigned int sw_io;     /* Current software pointer in bytes */
     36        int sw_ready;           /* Bytes ready to be transferred to/from hw */
     37        snd_pcm_uframes_t appl_ptr;     /* Last seen appl_ptr */
     38};
    3939
    40 typedef void (*snd_pcm_indirect_copy_t)(snd_pcm_substream_t *substream,
    41                                         snd_pcm_indirect_t *rec, size_t bytes);
     40typedef void (*snd_pcm_indirect_copy_t)(struct snd_pcm_substream *substream,
     41                                        struct snd_pcm_indirect *rec, size_t bytes);
    4242
    4343/*
     
    4545 */
    4646static inline void
    47     snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream,
    48                                        snd_pcm_indirect_t *rec,
    49                                        snd_pcm_indirect_copy_t copy)
     47snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream,
     48                                   struct snd_pcm_indirect *rec,
     49                                   snd_pcm_indirect_copy_t copy)
    5050{
    51     snd_pcm_runtime_t *runtime = substream->runtime;
    52     snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
    53     snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
    54     int qsize;
     51        struct snd_pcm_runtime *runtime = substream->runtime;
     52        snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
     53        snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
     54        int qsize;
    5555
    56     if (diff) {
    57         if (diff < -(snd_pcm_sframes_t) (runtime->boundary / 2))
    58             diff += runtime->boundary;
    59         rec->sw_ready += (int)frames_to_bytes(runtime, diff);
    60         rec->appl_ptr = appl_ptr;
    61     }
    62     qsize = rec->hw_queue_size ? rec->hw_queue_size : rec->hw_buffer_size;
    63     while (rec->hw_ready < qsize && rec->sw_ready > 0) {
    64         unsigned int hw_to_end = rec->hw_buffer_size - rec->hw_data;
    65         unsigned int sw_to_end = rec->sw_buffer_size - rec->sw_data;
    66         unsigned int bytes = qsize - rec->hw_ready;
    67         if (rec->sw_ready < (int)bytes)
    68             bytes = rec->sw_ready;
    69         if (hw_to_end < bytes)
    70             bytes = hw_to_end;
    71         if (sw_to_end < bytes)
    72             bytes = sw_to_end;
    73         if (! bytes)
    74             break;
    75         copy(substream, rec, bytes);
    76         rec->hw_data += bytes;
    77         if (rec->hw_data == rec->hw_buffer_size)
    78             rec->hw_data = 0;
    79         rec->sw_data += bytes;
    80         if (rec->sw_data == rec->sw_buffer_size)
    81             rec->sw_data = 0;
    82         rec->hw_ready += bytes;
    83         rec->sw_ready -= bytes;
    84     }
     56        if (diff) {
     57                if (diff < -(snd_pcm_sframes_t) (runtime->boundary / 2))
     58                        diff += runtime->boundary;
     59                rec->sw_ready += (int)frames_to_bytes(runtime, diff);
     60                rec->appl_ptr = appl_ptr;
     61        }
     62        qsize = rec->hw_queue_size ? rec->hw_queue_size : rec->hw_buffer_size;
     63        while (rec->hw_ready < qsize && rec->sw_ready > 0) {
     64                unsigned int hw_to_end = rec->hw_buffer_size - rec->hw_data;
     65                unsigned int sw_to_end = rec->sw_buffer_size - rec->sw_data;
     66                unsigned int bytes = qsize - rec->hw_ready;
     67                if (rec->sw_ready < (int)bytes)
     68                        bytes = rec->sw_ready;
     69                if (hw_to_end < bytes)
     70                        bytes = hw_to_end;
     71                if (sw_to_end < bytes)
     72                        bytes = sw_to_end;
     73                if (! bytes)
     74                        break;
     75                copy(substream, rec, bytes);
     76                rec->hw_data += bytes;
     77                if (rec->hw_data == rec->hw_buffer_size)
     78                        rec->hw_data = 0;
     79                rec->sw_data += bytes;
     80                if (rec->sw_data == rec->sw_buffer_size)
     81                        rec->sw_data = 0;
     82                rec->hw_ready += bytes;
     83                rec->sw_ready -= bytes;
     84        }
    8585}
    8686
     
    9090 */
    9191static inline snd_pcm_uframes_t
    92 snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
    93                                   snd_pcm_indirect_t *rec, unsigned int ptr)
     92snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream,
     93                                  struct snd_pcm_indirect *rec, unsigned int ptr)
    9494{
    95     int bytes = ptr - rec->hw_io;
    96     if (bytes < 0)
    97         bytes += rec->hw_buffer_size;
    98     rec->hw_io = ptr;
    99     rec->hw_ready -= bytes;
    100     rec->sw_io += bytes;
    101     if (rec->sw_io >= rec->sw_buffer_size)
    102         rec->sw_io -= rec->sw_buffer_size;
    103     if (substream->ops->ack)
    104         substream->ops->ack(substream);
    105     return bytes_to_frames(substream->runtime, rec->sw_io);
     95        int bytes = ptr - rec->hw_io;
     96        if (bytes < 0)
     97                bytes += rec->hw_buffer_size;
     98        rec->hw_io = ptr;
     99        rec->hw_ready -= bytes;
     100        rec->sw_io += bytes;
     101        if (rec->sw_io >= rec->sw_buffer_size)
     102                rec->sw_io -= rec->sw_buffer_size;
     103        if (substream->ops->ack)
     104                substream->ops->ack(substream);
     105        return bytes_to_frames(substream->runtime, rec->sw_io);
    106106}
    107107
     
    111111 */
    112112static inline void
    113 snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream,
    114                                   snd_pcm_indirect_t *rec,
    115                                   snd_pcm_indirect_copy_t copy)
     113snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream,
     114                                  struct snd_pcm_indirect *rec,
     115                                  snd_pcm_indirect_copy_t copy)
    116116{
    117     snd_pcm_runtime_t *runtime = substream->runtime;
    118     snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
    119     snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
     117        struct snd_pcm_runtime *runtime = substream->runtime;
     118        snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
     119        snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
    120120
    121     if (diff) {
    122         if (diff < -(snd_pcm_sframes_t) (runtime->boundary / 2))
    123             diff += runtime->boundary;
    124         rec->sw_ready -= frames_to_bytes(runtime, diff);
    125         rec->appl_ptr = appl_ptr;
    126     }
    127     while (rec->hw_ready > 0 &&
    128            rec->sw_ready < (int)rec->sw_buffer_size) {
    129         size_t hw_to_end = rec->hw_buffer_size - rec->hw_data;
    130         size_t sw_to_end = rec->sw_buffer_size - rec->sw_data;
    131         size_t bytes = rec->sw_buffer_size - rec->sw_ready;
    132         if (rec->hw_ready < (int)bytes)
    133             bytes = rec->hw_ready;
    134         if (hw_to_end < bytes)
    135             bytes = hw_to_end;
    136         if (sw_to_end < bytes)
    137             bytes = sw_to_end;
    138         if (! bytes)
    139             break;
    140         copy(substream, rec, bytes);
    141         rec->hw_data += bytes;
    142         if ((int)rec->hw_data == rec->hw_buffer_size)
    143             rec->hw_data = 0;
    144         rec->sw_data += bytes;
    145         if (rec->sw_data == rec->sw_buffer_size)
    146             rec->sw_data = 0;
    147         rec->hw_ready -= bytes;
    148         rec->sw_ready += bytes;
    149     }
     121        if (diff) {
     122                if (diff < -(snd_pcm_sframes_t) (runtime->boundary / 2))
     123                        diff += runtime->boundary;
     124                rec->sw_ready -= frames_to_bytes(runtime, diff);
     125                rec->appl_ptr = appl_ptr;
     126        }
     127        while (rec->hw_ready > 0 &&
     128               rec->sw_ready < (int)rec->sw_buffer_size) {
     129                size_t hw_to_end = rec->hw_buffer_size - rec->hw_data;
     130                size_t sw_to_end = rec->sw_buffer_size - rec->sw_data;
     131                size_t bytes = rec->sw_buffer_size - rec->sw_ready;
     132                if (rec->hw_ready < (int)bytes)
     133                        bytes = rec->hw_ready;
     134                if (hw_to_end < bytes)
     135                        bytes = hw_to_end;
     136                if (sw_to_end < bytes)
     137                        bytes = sw_to_end;
     138                if (! bytes)
     139                        break;
     140                copy(substream, rec, bytes);
     141                rec->hw_data += bytes;
     142                if ((int)rec->hw_data == rec->hw_buffer_size)
     143                        rec->hw_data = 0;
     144                rec->sw_data += bytes;
     145                if (rec->sw_data == rec->sw_buffer_size)
     146                        rec->sw_data = 0;
     147                rec->hw_ready -= bytes;
     148                rec->sw_ready += bytes;
     149        }
    150150}
    151151
     
    155155 */
    156156static inline snd_pcm_uframes_t
    157 snd_pcm_indirect_capture_pointer(snd_pcm_substream_t *substream,
    158                                  snd_pcm_indirect_t *rec, unsigned int ptr)
     157snd_pcm_indirect_capture_pointer(struct snd_pcm_substream *substream,
     158                                 struct snd_pcm_indirect *rec, unsigned int ptr)
    159159{
    160     int qsize;
    161     int bytes = ptr - rec->hw_io;
    162     if (bytes < 0)
    163         bytes += rec->hw_buffer_size;
    164     rec->hw_io = ptr;
    165     rec->hw_ready += bytes;
    166     qsize = rec->hw_queue_size ? rec->hw_queue_size : rec->hw_buffer_size;
    167     if (rec->hw_ready > qsize)
    168         return SNDRV_PCM_POS_XRUN;
    169     rec->sw_io += bytes;
    170     if (rec->sw_io >= rec->sw_buffer_size)
    171         rec->sw_io -= rec->sw_buffer_size;
    172     if (substream->ops->ack)
    173         substream->ops->ack(substream);
    174     return bytes_to_frames(substream->runtime, rec->sw_io);
     160        int qsize;
     161        int bytes = ptr - rec->hw_io;
     162        if (bytes < 0)
     163                bytes += rec->hw_buffer_size;
     164        rec->hw_io = ptr;
     165        rec->hw_ready += bytes;
     166        qsize = rec->hw_queue_size ? rec->hw_queue_size : rec->hw_buffer_size;
     167        if (rec->hw_ready > qsize)
     168                return SNDRV_PCM_POS_XRUN;
     169        rec->sw_io += bytes;
     170        if (rec->sw_io >= rec->sw_buffer_size)
     171                rec->sw_io -= rec->sw_buffer_size;
     172        if (substream->ops->ack)
     173                substream->ops->ack(substream);
     174        return bytes_to_frames(substream->runtime, rec->sw_io);
    175175}
    176176
  • GPL/trunk/alsa-kernel/include/sound/seq_midi_event.h

    r33 r34  
     1#ifndef __SOUND_SEQ_MIDI_EVENT_H
     2#define __SOUND_SEQ_MIDI_EVENT_H
     3
    14/*
    25 *  MIDI byte <-> sequencer event coder
     
    1720 *   You should have received a copy of the GNU General Public License
    1821 *   along with this program; if not, write to the Free Software
    19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     22 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2023 */
    21 
    22 #ifndef __MIDI_CODER_H
    23 #define __MIDI_CODER_H
    2424
    2525#include "asequencer.h"
     
    2727#define MAX_MIDI_EVENT_BUF      256
    2828
    29 typedef struct snd_midi_event_t snd_midi_event_t;
    30 
    3129/* midi status */
    32 struct snd_midi_event_t {
    33         int qlen;       /* queue length */
    34         int read;       /* chars read */
    35         int type;       /* current event type */
    36         unsigned char lastcmd;
    37         int bufsize;
     30struct snd_midi_event {
     31        int qlen;               /* queue length */
     32        int read;               /* chars read */
     33        int type;               /* current event type */
     34        unsigned char lastcmd;  /* last command (for MIDI state handling) */
     35        unsigned char nostat;   /* no state flag */
     36        int bufsize;            /* allocated buffer size */
    3837        unsigned char *buf;     /* input buffer */
    3938        spinlock_t lock;
    4039};
    4140
    42 int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev);
    43 int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize);
    44 void snd_midi_event_free(snd_midi_event_t *dev);
    45 void snd_midi_event_init(snd_midi_event_t *dev);
    46 void snd_midi_event_reset_encode(snd_midi_event_t *dev);
    47 void snd_midi_event_reset_decode(snd_midi_event_t *dev);
     41int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
     42void snd_midi_event_free(struct snd_midi_event *dev);
     43void snd_midi_event_reset_encode(struct snd_midi_event *dev);
     44void snd_midi_event_reset_decode(struct snd_midi_event *dev);
     45void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
    4846/* encode from byte stream - return number of written bytes if success */
    49 long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev);
    50 int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev);
     47long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
     48                           struct snd_seq_event *ev);
     49int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
    5150/* decode from event to bytes - return number of written bytes if success */
    52 long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev);
     51long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
     52                           struct snd_seq_event *ev);
    5353
    54 #endif
     54#endif /* __SOUND_SEQ_MIDI_EVENT_H */
  • GPL/trunk/alsa-kernel/include/sound/seq_virmidi.h

    r33 r34  
    1 #ifndef __SEQ_VIRMIDI_H
    2 #define __SEQ_VIRMIDI_H
     1#ifndef __SOUND_SEQ_VIRMIDI_H
     2#define __SOUND_SEQ_VIRMIDI_H
    33
    44/*
     
    1919 *   You should have received a copy of the GNU General Public License
    2020 *   along with this program; if not, write to the Free Software
    21  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2222 *
    2323 */
     
    2525#include "rawmidi.h"
    2626#include "seq_midi_event.h"
    27 
    28 typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
    2927
    3028/*
     
    3432 * (buffer), and is associated with the device instance.
    3533 */
    36 typedef struct _snd_virmidi {
     34struct snd_virmidi {
    3735        struct list_head list;
    3836        int seq_mode;
    3937        int client;
    4038        int port;
    41         int trigger: 1;
    42         snd_midi_event_t *parser;
    43         snd_seq_event_t event;
    44         snd_virmidi_dev_t *rdev;
    45         snd_rawmidi_substream_t *substream;
    46 } snd_virmidi_t;
     39        unsigned int trigger: 1;
     40        struct snd_midi_event *parser;
     41        struct snd_seq_event event;
     42        struct snd_virmidi_dev *rdev;
     43        struct snd_rawmidi_substream *substream;
     44};
    4745
    48 #define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
     46#define SNDRV_VIRMIDI_SUBSCRIBE         (1<<0)
    4947#define SNDRV_VIRMIDI_USE               (1<<1)
    5048
     
    5452 * common information and the linked-list of opened files,
    5553 */
    56 struct _snd_virmidi_dev {
    57         snd_card_t *card;               /* associated card */
    58         snd_rawmidi_t *rmidi;           /* rawmidi device */
     54struct snd_virmidi_dev {
     55        struct snd_card *card;          /* associated card */
     56        struct snd_rawmidi *rmidi;              /* rawmidi device */
    5957        int seq_mode;                   /* SNDRV_VIRMIDI_XXX */
    6058        int device;                     /* sequencer device */
     
    7068 *          attached sequencer port.  sequencer port is not created
    7169 *          by virmidi itself.
     70 *          the input to rawmidi must be processed by passing the
     71 *          incoming events via snd_virmidi_receive()
    7272 * DISPATCH = input/output events are routed to subscribers.
    7373 *            sequencer port is created in virmidi.
    7474 */
    7575#define SNDRV_VIRMIDI_SEQ_NONE          0
    76 #define SNDRV_VIRMIDI_SEQ_ATTACH                1
     76#define SNDRV_VIRMIDI_SEQ_ATTACH        1
    7777#define SNDRV_VIRMIDI_SEQ_DISPATCH      2
    7878
    79 int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi);
     79int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
    8080
    81 #endif
     81#endif /* __SOUND_SEQ_VIRMIDI */
  • GPL/trunk/alsa-kernel/include/sound/sfnt_info.h

    r33 r34  
     1#ifndef __SOUND_SFNT_INFO_H
     2#define __SOUND_SFNT_INFO_H
     3
    14/*
    25 *  Patch record compatible with AWE driver on OSS
     
    1619 *   You should have received a copy of the GNU General Public License
    1720 *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    19  *
    20  */
    21 
    22 #ifndef __SFNT_INFO_H
    23 #define __SFNT_INFO_H
    24 
    25 #include "seq_oss_legacy.h"
     21 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
     22 *
     23 */
     24
     25#include <sound/asound.h>
    2626
    2727/*
     
    2929 */
    3030
     31#ifdef SNDRV_BIG_ENDIAN
     32#define SNDRV_OSS_PATCHKEY(id) (0xfd00|id)
     33#else
     34#define SNDRV_OSS_PATCHKEY(id) ((id<<8)|0xfd)
     35#endif
     36
    3137/* patch interface header: 16 bytes */
    32 typedef struct soundfont_patch_info_t {
     38struct soundfont_patch_info {
    3339        unsigned short key;             /* use the key below */
    34 #define SNDRV_OSS_SOUNDFONT_PATCH               _PATCHKEY(0x07)
     40#define SNDRV_OSS_SOUNDFONT_PATCH               SNDRV_OSS_PATCHKEY(0x07)
    3541
    3642        short device_no;                /* synthesizer number */
     
    5460
    5561        /* the actual patch data begins after this */
    56 } soundfont_patch_info_t;
     62};
    5763
    5864
     
    6369#define SNDRV_SFNT_PATCH_NAME_LEN       32
    6470
    65 typedef struct soundfont_open_parm_t {
     71struct soundfont_open_parm {
    6672        unsigned short type;            /* sample type */
    6773#define SNDRV_SFNT_PAT_TYPE_MISC        0
     
    7379        short reserved;
    7480        char name[SNDRV_SFNT_PATCH_NAME_LEN];
    75 } soundfont_open_parm_t;
     81};
    7682
    7783
     
    8187
    8288/* wave table envelope & effect parameters to control EMU8000 */
    83 typedef struct soundfont_voice_parm_t {
     89struct soundfont_voice_parm {
    8490        unsigned short moddelay;        /* modulation delay (0x8000) */
    8591        unsigned short modatkhld;       /* modulation attack & hold time (0x7f7f) */
     
    103109        unsigned char reverb;           /* reverb send (0x00) */
    104110        unsigned short reserved[4];     /* not used */
    105 } soundfont_voice_parm_t;
     111};
    106112
    107113
    108114/* wave table parameters: 92 bytes */
    109 typedef struct soundfont_voice_info_t {
     115struct soundfont_voice_info {
    110116        unsigned short sf_id;           /* file id (should be zero) */
    111117        unsigned short sample;          /* sample id */
     
    130136        unsigned char attenuation;      /* attenuation (0.375dB) */
    131137        short scaleTuning;              /* pitch scale tuning(%), normally 100 */
    132         soundfont_voice_parm_t parm;    /* voice envelope parameters */
     138        struct soundfont_voice_parm parm;       /* voice envelope parameters */
    133139        unsigned short sample_mode;     /* sample mode_flag (set by driver) */
    134 } soundfont_voice_info_t;
     140};
    135141
    136142
    137143/* instrument info header: 4 bytes */
    138 typedef struct soundfont_voice_rec_hdr_t {
     144struct soundfont_voice_rec_hdr {
    139145        unsigned char bank;             /* midi bank number */
    140146        unsigned char instr;            /* midi preset number */
     
    144150#define SNDRV_SFNT_WR_EXCLUSIVE         1       /* skip if already exists */
    145151#define SNDRV_SFNT_WR_REPLACE           2       /* replace if already exists */
    146 } soundfont_voice_rec_hdr_t;
     152};
    147153
    148154
     
    152158
    153159/* wave table sample header: 32 bytes */
    154 typedef struct soundfont_sample_info_t {
     160struct soundfont_sample_info {
    155161        unsigned short sf_id;           /* file id (should be zero) */
    156162        unsigned short sample;          /* sample id */
     
    169175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP  128     /* reverse looping */
    170176        unsigned int truesize;          /* used memory size (set by driver) */
    171 } soundfont_sample_info_t;
     177};
    172178
    173179
     
    176182 */
    177183
    178 typedef struct soundfont_voice_map_t {
     184struct soundfont_voice_map {
    179185        int map_bank, map_instr, map_key;       /* key = -1 means all keys */
    180186        int src_bank, src_instr, src_key;
    181 } soundfont_voice_map_t;
    182 
    183 
    184 #endif
     187};
     188
     189
     190/*
     191 * ioctls for hwdep
     192 */
     193
     194#define SNDRV_EMUX_HWDEP_NAME   "Emux WaveTable"
     195
     196#define SNDRV_EMUX_VERSION      ((1 << 16) | (0 << 8) | 0)      /* 1.0.0 */
     197
     198struct snd_emux_misc_mode {
     199        int port;       /* -1 = all */
     200        int mode;
     201        int value;
     202        int value2;     /* reserved */
     203};
     204
     205enum {
     206        SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int),
     207        SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info),
     208        SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82),
     209        SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83),
     210        SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int),
     211        SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
     212};
     213
     214#endif /* __SOUND_SFNT_INFO_H */
  • GPL/trunk/alsa-kernel/include/sound/soundfont.h

    r33 r34  
     1#ifndef __SOUND_SOUNDFONT_H
     2#define __SOUND_SOUNDFONT_H
     3
    14/*
    25 *  Soundfont defines and definitions.
     
    1720 *   You should have received a copy of the GNU General Public License
    1821 *   along with this program; if not, write to the Free Software
    19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     22 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    2023 */
    21 
    22 #ifndef __SOUNDFONT_H
    23 #define __SOUNDFONT_H
    2424
    2525#include "sfnt_info.h"
     
    3030#define SF_IS_DRUM_BANK(z) ((z) == 128)
    3131
    32 typedef struct snd_sf_zone {
     32struct snd_sf_zone {
    3333        struct snd_sf_zone *next;       /* Link to next */
    3434        unsigned char bank;             /* Midi bank for this zone */
     
    3636        unsigned char mapped;           /* True if mapped to something else */
    3737
    38         soundfont_voice_info_t v;       /* All the soundfont parameters */
     38        struct soundfont_voice_info v;  /* All the soundfont parameters */
    3939        int counter;
    4040        struct snd_sf_sample *sample;   /* Link to sample */
     
    4343        struct snd_sf_zone *next_instr; /* Next zone of this instrument */
    4444        struct snd_sf_zone *next_zone;  /* Next zone in play list */
    45 } snd_sf_zone_t;
     45};
    4646
    47 typedef struct snd_sf_sample {
    48         soundfont_sample_info_t v;
     47struct snd_sf_sample {
     48        struct soundfont_sample_info v;
    4949        int counter;
    50         snd_util_memblk_t *block;       /* allocated data block */
     50        struct snd_util_memblk *block;  /* allocated data block */
    5151        struct snd_sf_sample *next;
    52 } snd_sf_sample_t;
     52};
    5353
    5454/*
    5555 * This represents all the information relating to a soundfont.
    5656 */
    57 typedef struct snd_soundfont {
     57struct snd_soundfont {
    5858        struct snd_soundfont *next;     /* Link to next */
    5959        /*struct snd_soundfont *prev;*/ /* Link to previous */
     
    6161        short  type;            /* font type */
    6262        unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN];  /* identifier */
    63         snd_sf_zone_t *zones; /* Font information */
    64         snd_sf_sample_t *samples; /* The sample headers */
    65 } snd_soundfont_t;
     63        struct snd_sf_zone *zones; /* Font information */
     64        struct snd_sf_sample *samples; /* The sample headers */
     65};
    6666
    6767/*
    6868 * Type of the sample access callback
    6969 */
    70 typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp,
    71                                    snd_util_memhdr_t *hdr, const void *buf, long count);
    72 typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp,
    73                                     snd_util_memhdr_t *hdr);
    74 typedef void (*snd_sf_sample_reset_t)(void *private);
    75 
    76 typedef struct snd_sf_callback {
     70struct snd_sf_callback {
    7771        void *private_data;
    78         snd_sf_sample_new_t sample_new;
    79         snd_sf_sample_free_t sample_free;
    80         snd_sf_sample_reset_t sample_reset;
    81 } snd_sf_callback_t;
     72        int (*sample_new)(void *private_data, struct snd_sf_sample *sp,
     73                          struct snd_util_memhdr *hdr,
     74                          const void __user *buf, long count);
     75        int (*sample_free)(void *private_data, struct snd_sf_sample *sp,
     76                           struct snd_util_memhdr *hdr);
     77        void (*sample_reset)(void *private);
     78};
    8279
    8380/*
    8481 * List of soundfonts.
    8582 */
    86 typedef struct snd_sf_list {
    87         snd_soundfont_t *currsf; /* The currently open soundfont */
     83struct snd_sf_list {
     84        struct snd_soundfont *currsf; /* The currently open soundfont */
    8885        int open_client;        /* client pointer for lock */
    8986        int mem_used;           /* used memory size */
    90         snd_sf_zone_t *presets[SF_MAX_PRESETS];
    91         snd_soundfont_t *fonts; /* The list of soundfonts */
     87        struct snd_sf_zone *presets[SF_MAX_PRESETS];
     88        struct snd_soundfont *fonts; /* The list of soundfonts */
    9289        int fonts_size; /* number of fonts allocated */
    9390        int zone_counter;       /* last allocated time for zone */
     
    9592        int zone_locked;        /* locked time for zone */
    9693        int sample_locked;      /* locked time for sample */
    97         snd_sf_callback_t callback;     /* callback functions */
    98         char sf_locked;         /* font lock flag */
     94        struct snd_sf_callback callback;        /* callback functions */
     95        int presets_locked;
    9996        struct semaphore presets_mutex;
    10097        spinlock_t lock;
    101         snd_util_memhdr_t *memhdr;
    102 } snd_sf_list_t;
     98        struct snd_util_memhdr *memhdr;
     99};
    103100
    104101/* Prototypes for soundfont.c */
    105 int snd_soundfont_load(snd_sf_list_t *sflist, const void *data, long count, int client);
    106 int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char *data,
     102int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
     103                       long count, int client);
     104int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
    107105                                long count, int client);
    108 int snd_soundfont_close_check(snd_sf_list_t *sflist, int client);
     106int snd_soundfont_close_check(struct snd_sf_list *sflist, int client);
    109107
    110 snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr);
    111 void snd_sf_free(snd_sf_list_t *sflist);
     108struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback,
     109                               struct snd_util_memhdr *hdr);
     110void snd_sf_free(struct snd_sf_list *sflist);
    112111
    113 int snd_soundfont_remove_samples(snd_sf_list_t *sflist);
    114 int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist);
    115 int snd_soundfont_mem_used(snd_sf_list_t *sflist);
     112int snd_soundfont_remove_samples(struct snd_sf_list *sflist);
     113int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist);
    116114
    117 int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
     115int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
    118116                              int preset, int bank,
    119117                              int def_preset, int def_bank,
    120                               snd_sf_zone_t **table, int max_layers);
     118                              struct snd_sf_zone **table, int max_layers);
    121119
    122120/* Parameter conversions */
     
    126124#define snd_sf_calc_parm_delay(msec) (0x8000 - (msec) * 1000 / 725);
    127125extern int snd_sf_vol_table[128];
     126int snd_sf_linear_to_log(unsigned int amount, int offset, int ratio);
    128127
    129128
    130 #endif
     129#endif /* __SOUND_SOUNDFONT_H */
  • 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.