Changeset 94


Ignore:
Timestamp:
May 5, 2007, 6:58:41 AM (18 years ago)
Author:
Brendan Oakley
Message:

Partial merge of driver.h from beta10 to beta11.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/driver.h

    r93 r94  
    1 #ifndef __DRIVER_H
    2 #define __DRIVER_H
     1#ifndef __SOUND_DRIVER_H
     2#define __SOUND_DRIVER_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 */
     
    2727#endif
    2828
     29#include <linux/config.h>
     30#include <linux/version.h>
     31
    2932#define SNDRV_CARDS             8       /* number of supported soundcards - don't change - minor numbers */
    3033
     
    3639#undef CONFIG_SND_DEBUG_MEMORY
    3740#endif
     41
     42#ifdef ALSA_BUILD
     43#include "adriver.h"
     44#endif
     45
     46#include <linux/module.h>
    3847
    3948#ifndef __iomem
     
    5160#endif
    5261
    53 /*
    54  *  ==========================================================================
    55  */
    56 
    57 #ifdef ALSA_BUILD
    58 #undef MODULE
    59 #define MODULE
    60 #endif
    61 
    62 #include <linux/config.h>
    63 #include <linux/version.h>
    64 
    6562#define IRQ_NONE      (0)  /*void*/
    6663#define IRQ_HANDLED   (1)  /*void*/
    6764#define IRQ_RETVAL(x) ((x) != 0)  /*void*/
    6865typedef int irqreturn_t;
    69 
    70 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 3)
    71 #error "This driver requires Linux 2.2.3 and higher."
    72 #endif
    73 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 2, 0)
    74 #define LINUX_2_2
    75 #endif
    76 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 1)
    77 #define LINUX_2_3
    78 #endif
    79 #if defined(LINUX_2_3) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
    80 #error "This code requires Linux 2.4.0-test1 and higher."
    81 #endif
    82 
    83 #ifdef ALSA_BUILD
    84 #if defined(CONFIG_MODVERSIONS) && !defined(__GENKSYMS__) && !defined(__DEPEND__)
    85 #define MODVERSIONS
    86 #include <linux/modversions.h>
    87 #include "sndversions.h"
    88 #endif
    89 #ifdef SNDRV_NO_MODVERS
    90 #undef MODVERSIONS
    91 #undef _set_ver
    92 #endif
    93 #endif /* ALSA_BUILD */
    94 
    95 #ifndef SNDRV_MAIN_OBJECT_FILE
    96 #define __NO_VERSION__
    97 #endif
    98 #include <linux/module.h>
    99 
    100 #include <linux/utsname.h>
    101 #include <linux/errno.h>
    102 #include <linux/kernel.h>
    103 #include <linux/sched.h>
    104 #include <linux/slab.h>
    105 #include <linux/delay.h>
    106 #include <linux/bitops.h>
    107 
    108 #include <linux/ioport.h>
    109 
    110 #include <asm/io.h>
    111 #include <asm/irq.h>
    112 #include <asm/dma.h>
    113 #include <asm/segment.h>
    114 #include <asm/uaccess.h>
    115 #include <asm/system.h>
    116 #include <asm/string.h>
    117 
    118 #ifdef CONFIG_PCI
    119 #include <linux/pci.h>
    120 #endif
    121 #include <linux/interrupt.h>
    122 #include <linux/pagemap.h>
    123 #include <linux/fs.h>
    124 #include <linux/fcntl.h>
    125 #include <linux/vmalloc.h>
    126 #include <linux/proc_fs.h>
    127 #include <linux/poll.h>
    128 #include <linux/reboot.h>
    129 
    130 #ifdef LINUX_2_2
    131 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 2, 18)
    132 #include <linux/init.h>
    133 #endif
    134 #include "compat_22.h"
    135 #endif /* LINUX_2_2 */
    136 
    137 #ifdef LINUX_2_3
    138 #include <linux/init.h>
    139 #include <linux/pm.h>
    140 #define PCI_GET_DRIVER_DATA(pci) pci->driver_data
    141 #define PCI_SET_DRIVER_DATA(pci, data) pci->driver_data = data
    142 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3)
    143 #define pci_set_dma_mask(pci, mask) pci->dma_mask = mask
    144 #endif
    145 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 7)
    146 #define PCI_NEW_SUSPEND
    147 #endif
    148 #ifndef virt_to_page
    149 #define virt_to_page(x) (&mem_map[MAP_NR(x)])
    150 #endif
    151 #define snd_request_region request_region
    152 #ifndef rwlock_init
    153 #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
    154 #endif
    155 #define snd_kill_fasync(fp, sig, band) kill_fasync(fp, sig, band)
    156 #if defined(__i386__) || defined(__ppc__)
    157 /*
    158  * Here a dirty hack for 2.4 kernels.. See kernel/memory.c.
    159  */
    160 #define HACK_PCI_ALLOC_CONSISTENT
    161 void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size,
    162                                     dma_addr_t *dma_handle);
    163 #undef pci_alloc_consistent
    164 #define pci_alloc_consistent snd_pci_hack_alloc_consistent
    165 #endif /* i386 or ppc */
    166 #ifndef list_for_each_safe
    167 #define list_for_each_safe(pos, n, head) \
    168         for (pos = (head)->next, n = pos->next; pos != (head); pos = n, n = pos->next)
    169 #endif
    170 #endif
    171 
    172 #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
    173 #if (defined(CONFIG_ISAPNP_KERNEL) && defined(ALSA_BUILD)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 30) && !defined(ALSA_BUILD))
    174 #include <linux/isapnp.h>
    175 #define isapnp_dev pci_dev
    176 #define isapnp_card pci_bus
    177 #else
    178 #include "isapnp.h"
    179 #endif
    180 #undef __ISAPNP__
    181 #define __ISAPNP__
    182 #endif
    183 
    184 #ifndef MODULE_LICENSE
    185 #define MODULE_LICENSE(license)
    18666#ifndef PCI_D0
    18767#define PCI_D0     0
     
    19272#define pci_choose_state(pci,state)     ((state) ? PCI_D3hot : PCI_D0)
    19373#endif
    194 
    195 
    196 #include <sound/asound.h>
    197 #include <sound/asoundef.h>
    19874
    19975/* wrapper for getnstimeofday()
     
    231107#define schedule_work(w) snd_compat_schedule_work(w)
    232108
    233 /* Typedef's */
    234 typedef struct timeval snd_timestamp_t;
    235 #ifndef TARGET_OS2
    236 typedef enum sndrv_card_type snd_card_type;
    237 #endif
    238 typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t;
    239 #ifndef TARGET_OS2
    240 typedef enum sndrv_pcm_start snd_pcm_start_t;
    241 typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;
    242 #endif
    243 #ifdef TARGET_OS2
    244 typedef struct snd_pcm_volume snd_pcm_volume_t;
    245 #else
    246 typedef enum sndrv_timer_global snd_timer_global_t;
    247 #endif
     109/*
     110 *  ==========================================================================
     111 */
     112
     113#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
     114#if defined(__i386__) || defined(__ppc__)
     115/*
     116 * Here a dirty hack for 2.4 kernels.. See kernel/memory.c.
     117 */
     118#define HACK_PCI_ALLOC_CONSISTENT
     119#include <linux/pci.h>
     120void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size,
     121                                    dma_addr_t *dma_handle);
     122#undef pci_alloc_consistent
     123#define pci_alloc_consistent snd_pci_hack_alloc_consistent
     124#endif /* i386 or ppc */
     125#endif /* 2.4.0 */
    248126
    249127#ifdef CONFIG_SND_DEBUG_MEMORY
     128#include <linux/slab.h>
     129#include <linux/vmalloc.h>
    250130void *snd_wrapper_kmalloc(size_t, int);
    251131#undef kmalloc
     
    257137#undef vfree
    258138#endif
     139#ifdef TARGET_OS2
     140typedef struct snd_pcm_volume snd_pcm_volume_t;
     141#endif
     142
     143#include "sndmagic.h"
    259144
    260145#ifdef TARGET_OS2
     
    262147#define snd_leave_user(a)
    263148#define dec_mod_count(a)        (*(unsigned long *)a)--
    264 
    265 #else
    266 static inline mm_segment_t snd_enter_user(void)
    267 {
    268         mm_segment_t fs = get_fs();
    269         set_fs(get_ds());
    270         return fs;
    271 }
    272 static inline void snd_leave_user(mm_segment_t fs)
    273 {
    274         set_fs(fs);
    275 }
    276 static inline void dec_mod_count(struct module *module)
    277 {
    278         if (module)
    279                 __MOD_DEC_USE_COUNT(module);
    280 }
    281 #endif
    282 
    283 #if defined(__alpha__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 14)
    284 #undef writeb
    285 #define writeb(v, a) do { __writeb((v),(a)); mb(); } while(0)
    286 #undef writew
    287 #define writew(v, a) do {__writew((v),(a)); mb(); } while(0)
    288 #undef writel
    289 #define writel(v, a) do {__writel((v),(a)); mb(); } while(0)
    290 #undef writeq
    291 #define writeq(v, a) do {__writeq((v),(a)); mb(); } while(0)
    292 #endif
    293 
    294 /* do we have virt_to_bus? */
    295 #if defined(CONFIG_SPARC64)
    296 #undef HAVE_VIRT_TO_BUS
    297 #else
    298 #define HAVE_VIRT_TO_BUS  1
    299149#endif
    300150
Note: See TracChangeset for help on using the changeset viewer.