OSDN Git Service

Merge kernel uapi/sound/asound.h and asequencer.h
authorTakashi Iwai <tiwai@suse.de>
Mon, 26 Nov 2012 16:54:29 +0000 (17:54 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 26 Nov 2012 17:02:17 +0000 (18:02 +0100)
Instead of keeping modified asound.h and asequencer.h, copy the files
in the kernel include/uapi/sound as is, and give some renames for
avoiding conflicts with alsa-lib's definitions.

Some structs, unions and typedefs in asound.h and asequencer.h are
once renamed in local.h before inclusion, then renamed back again.

A bonus by this action is that some local codes don't have to refer to
sndrv_xxx any longer.  However, some codes like src/seq/seq.c need
explicit cast because of unavoidable conflicts of struct types.

Another significant change is that now snd_pcm_sw_params.period_event
field is removed.  Instead, try to access the last reserved field
internally.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 files changed:
include/local.h
include/sound/asequencer.h
include/sound/asound.h
src/control/control_hw.c
src/pcm/pcm.c
src/pcm/pcm_hw.c
src/pcm/pcm_local.h
src/pcm/pcm_params.c
src/seq/seq.c
src/seq/seq_hw.c
src/seq/seq_local.h
src/timer/timer_hw.c

index 4dc6562..b0a9368 100644 (file)
@@ -32,6 +32,7 @@
 #include <stdarg.h>
 #include <sys/poll.h>
 #include <errno.h>
+#include <linux/ioctl.h>
 
 #include "config.h"
 #ifdef SUPPORT_RESMGR
 #endif
 
 #define _snd_config_iterator list_head
-#define _snd_interval sndrv_interval
-#define _snd_pcm_info sndrv_pcm_info
-#define _snd_pcm_hw_params sndrv_pcm_hw_params
-#define _snd_pcm_sw_params sndrv_pcm_sw_params
-#define _snd_pcm_status sndrv_pcm_status
-
-#define _snd_ctl_card_info sndrv_ctl_card_info
-#define _snd_ctl_elem_id sndrv_ctl_elem_id
-#define _snd_ctl_elem_list sndrv_ctl_elem_list
-#define _snd_ctl_elem_info sndrv_ctl_elem_info
-#define _snd_ctl_elem_value sndrv_ctl_elem_value
-#define _snd_ctl_event sndrv_ctl_event
-
-#define _snd_rawmidi_info sndrv_rawmidi_info
-#define _snd_rawmidi_params sndrv_rawmidi_params
-#define _snd_rawmidi_status sndrv_rawmidi_status
-
-#define _snd_hwdep_info sndrv_hwdep_info
-#define _snd_hwdep_dsp_status sndrv_hwdep_dsp_status
-#define _snd_hwdep_dsp_image sndrv_hwdep_dsp_image
-
-#define _snd_seq_queue_tempo sndrv_seq_queue_tempo
-#define _snd_seq_client_info sndrv_seq_client_info
-#define _snd_seq_port_info sndrv_seq_port_info
-#define _snd_seq_system_info sndrv_seq_system_info
-#define _snd_seq_queue_info sndrv_seq_queue_info
-#define _snd_seq_queue_status sndrv_seq_queue_status
-#define _snd_seq_queue_timer sndrv_seq_queue_timer
-#define _snd_seq_port_subscribe sndrv_seq_port_subscribe
-#define _snd_seq_query_subscribe sndrv_seq_query_subs
-#define _snd_seq_client_pool sndrv_seq_client_pool
-#define _snd_seq_remove_events sndrv_seq_remove_events
-
-#define sndrv_seq_addr snd_seq_addr
-#define sndrv_seq_tick_time_t  snd_seq_tick_time_t
-#define sndrv_seq_real_time    snd_seq_real_time
-#define sndrv_seq_timestamp    snd_seq_timestamp
-#define sndrv_seq_event                snd_seq_event
-
-#if 0
-typedef struct sndrv_seq_addr snd_seq_addr_t;
-#define snd_seq_tick_time_t sndrv_seq_tick_time_t
-typedef struct sndrv_seq_real_time snd_seq_real_time_t;
-typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
-typedef struct sndrv_seq_event snd_seq_event_t;
-#endif
-
-#define _snd_timer_id sndrv_timer_id
-#define _snd_timer_ginfo sndrv_timer_ginfo
-#define _snd_timer_gparams sndrv_timer_gparams
-#define _snd_timer_gstatus sndrv_timer_gstatus
-#define _snd_timer_select sndrv_timer_select
-#define _snd_timer_info sndrv_timer_info
-#define _snd_timer_params sndrv_timer_params
-#define _snd_timer_status sndrv_timer_status
+#define _snd_interval snd_interval
+#define _snd_pcm_info snd_pcm_info
+#define _snd_pcm_hw_params snd_pcm_hw_params
+#define _snd_pcm_sw_params snd_pcm_sw_params
+#define _snd_pcm_status snd_pcm_status
+
+#define _snd_ctl_card_info snd_ctl_card_info
+#define _snd_ctl_elem_id snd_ctl_elem_id
+#define _snd_ctl_elem_list snd_ctl_elem_list
+#define _snd_ctl_elem_info snd_ctl_elem_info
+#define _snd_ctl_elem_value snd_ctl_elem_value
+#define _snd_ctl_event snd_ctl_event
+
+#define _snd_rawmidi_info snd_rawmidi_info
+#define _snd_rawmidi_params snd_rawmidi_params
+#define _snd_rawmidi_status snd_rawmidi_status
+
+#define _snd_hwdep_info snd_hwdep_info
+#define _snd_hwdep_dsp_status snd_hwdep_dsp_status
+#define _snd_hwdep_dsp_image snd_hwdep_dsp_image
+
+#define _snd_seq_queue_tempo snd_seq_queue_tempo
+#define _snd_seq_client_info snd_seq_client_info
+#define _snd_seq_port_info snd_seq_port_info
+#define _snd_seq_system_info snd_seq_system_info
+#define _snd_seq_queue_info snd_seq_queue_info
+#define _snd_seq_queue_status snd_seq_queue_status
+#define _snd_seq_queue_timer snd_seq_queue_timer
+#define _snd_seq_port_subscribe snd_seq_port_subscribe
+#define _snd_seq_query_subscribe snd_seq_query_subs
+#define _snd_seq_client_pool snd_seq_client_pool
+#define _snd_seq_remove_events snd_seq_remove_events
+
+#define _snd_timer_id snd_timer_id
+#define _snd_timer_ginfo snd_timer_ginfo
+#define _snd_timer_gparams snd_timer_gparams
+#define _snd_timer_gstatus snd_timer_gstatus
+#define _snd_timer_select snd_timer_select
+#define _snd_timer_info snd_timer_info
+#define _snd_timer_params snd_timer_params
+#define _snd_timer_status snd_timer_status
 
 #define ALSA_LIBRARY_BUILD
 
+/* rename some types for avoiding conflicts with alsalib's definitions */
+#define snd_aes_iec958         sndrv_aes_iec958
+#define snd_pcm_uframes_t      sndrv_pcm_uframes_t
+#define snd_pcm_sframes_t      sndrv_pcm_sframes_t
+#define snd_pcm_access_t       sndrv_pcm_access_t
+#define snd_pcm_format_t       sndrv_pcm_format_t
+#define snd_pcm_subformat_t    sndrv_pcm_subformat_t
+#define snd_pcm_state_t                sndrv_pcm_state_t
+#define snd_interval           sndrv_interval
+#define snd_mask               sndrv_mask
+#define snd_ctl_elem_type_t    sndrv_ctl_elem_type_t
+#define snd_ctl_elem_iface_t   sndrv_ctl_elem_iface_t
+#define snd_ctl_tlv            sndrv_ctl_tlv
+
+/* kill and replace kernel-specific types */
+#define __user
+#define __force
+#define __kernel_off_t         off_t
+
 #include <sound/asound.h>
+
+/* take back superfluous renames; some can be kept as is */
+#undef snd_aes_iec958
+#undef snd_pcm_uframes_t
+#undef snd_pcm_sframes_t
+#undef snd_pcm_access_t
+#undef snd_pcm_format_t
+#undef snd_pcm_subformat_t
+#undef snd_pcm_state_t
+#undef snd_ctl_elem_type_t
+#undef snd_ctl_elem_iface_t
+
 #include <sound/asoundef.h>
 #include "alsa-symbols.h"
 #include "version.h"
@@ -120,7 +138,31 @@ typedef struct sndrv_seq_event snd_seq_event_t;
 #include "mixer.h"
 #include "seq_event.h"
 #include "seq.h"
+
+/* rename some types for avoiding conflicts with alsalib's definitions */
+#define snd_seq_addr           sndrv_seq_addr
+#define snd_seq_tick_time_t    sndrv_seq_tick_time_t
+#define snd_seq_real_time      sndrv_seq_real_time
+#define snd_seq_timestamp      sndrv_seq_timestamp
+#define snd_seq_event          sndrv_seq_event
+#define snd_seq_connect                sndrv_seq_connect
+#define snd_seq_ev_note                sndrv_seq_ev_note
+#define snd_seq_ev_ctrl                sndrv_seq_ev_ctrl
+#define snd_seq_ev_raw8                sndrv_seq_ev_raw8
+#define snd_seq_ev_raw32       sndrv_seq_ev_raw32
+#define snd_seq_ev_ext         sndrv_seq_ev_ext
+#define snd_seq_result         sndrv_seq_result
+#define snd_seq_queue_skew     sndrv_seq_queue_skew
+#define snd_seq_ev_queue_control       sndrv_seq_ev_queue_control
+#define snd_seq_client_t       sndrv_seq_client_t
+#define snd_seq_client_type_t  sndrv_seq_client_type_t
+
 #include <sound/asequencer.h>
+
+/* take back some renames */
+#undef snd_seq_client_t
+#undef snd_seq_client_type_t
+
 #include "seqmid.h"
 #include "seq_midi_event.h"
 #include "list.h"
index 6d14fb1..09c8a00 100644 (file)
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
-#ifndef __SOUND_ASEQUENCER_H
-#define __SOUND_ASEQUENCER_H
+#ifndef _UAPI__SOUND_ASEQUENCER_H
+#define _UAPI__SOUND_ASEQUENCER_H
 
-#ifdef __KERNEL__
-#include <linux/ioctl.h>
-#endif
-
-#include <sound/asound.h>
 
 /** version of the sequencer */
 #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
 
-#ifdef __KERNEL__
 /**
  * definition of sequencer event types
  */
 
 /** system messages
- * event data type = #sndrv_seq_result_t
+ * event data type = #snd_seq_result
  */
 #define SNDRV_SEQ_EVENT_SYSTEM         0
 #define SNDRV_SEQ_EVENT_RESULT         1
 
 /** note messages (channel specific)
- * event data type = #sndrv_seq_ev_note
+ * event data type = #snd_seq_ev_note
  */
 #define SNDRV_SEQ_EVENT_NOTE           5
 #define SNDRV_SEQ_EVENT_NOTEON         6
@@ -51,7 +45,7 @@
 #define SNDRV_SEQ_EVENT_KEYPRESS       8
        
 /** control messages (channel specific)
- * event data type = #sndrv_seq_ev_ctrl
+ * event data type = #snd_seq_ev_ctrl
  */
 #define SNDRV_SEQ_EVENT_CONTROLLER     10
 #define SNDRV_SEQ_EVENT_PGMCHANGE      11
@@ -62,7 +56,7 @@
 #define SNDRV_SEQ_EVENT_REGPARAM       16      /**< 14 bit RPN address + 14 bit unsigned value */
 
 /** synchronisation messages
- * event data type = #sndrv_seq_ev_ctrl
+ * event data type = #snd_seq_ev_ctrl
  */
 #define SNDRV_SEQ_EVENT_SONGPOS                20      /* Song Position Pointer with LSB and MSB values */
 #define SNDRV_SEQ_EVENT_SONGSEL                21      /* Song Select with song ID number */
@@ -71,7 +65,7 @@
 #define SNDRV_SEQ_EVENT_KEYSIGN                24      /* SMF Key Signature event */
                
 /** timer messages
- * event data type = sndrv_seq_ev_queue_control_t
+ * event data type = snd_seq_ev_queue_control
  */
 #define SNDRV_SEQ_EVENT_START          30      /* midi Real Time Start message */
 #define SNDRV_SEQ_EVENT_CONTINUE       31      /* midi Real Time Continue message */
@@ -97,7 +91,7 @@
 #define SNDRV_SEQ_EVENT_OSS            51      /* OSS raw event */
 
 /** system status messages (broadcast for subscribers)
- * event data type = sndrv_seq_addr_t
+ * event data type = snd_seq_addr
  */
 #define SNDRV_SEQ_EVENT_CLIENT_START   60      /* new client has connected */
 #define SNDRV_SEQ_EVENT_CLIENT_EXIT    61      /* client has left the system */
 #define SNDRV_SEQ_EVENT_PORT_CHANGE    65      /* port status/info has changed */
 
 /** port connection changes
- * event data type = sndrv_seq_connect_t
+ * event data type = snd_seq_connect
  */
 #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED        66      /* ports connected */
 #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67   /* ports disconnected */
 /* 119-129: reserved */
 
 /* 130-139: variable length events
- * event data type = sndrv_seq_ev_ext
+ * event data type = snd_seq_ev_ext
  * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
  */
 #define SNDRV_SEQ_EVENT_SYSEX          130     /* system exclusive data (variable length) */
 #define SNDRV_SEQ_EVENT_NONE           255
 
 
-typedef unsigned char sndrv_seq_event_type_t;
+typedef unsigned char snd_seq_event_type_t;
 
 /** event address */
-struct sndrv_seq_addr {
+struct snd_seq_addr {
        unsigned char client;   /**< Client number:         0..255, 255 = broadcast to all clients */
        unsigned char port;     /**< Port within client:    0..255, 255 = broadcast to all ports */
 };
 
 /** port connection */
-struct sndrv_seq_connect {
-       struct sndrv_seq_addr sender;
-       struct sndrv_seq_addr dest;
+struct snd_seq_connect {
+       struct snd_seq_addr sender;
+       struct snd_seq_addr dest;
 };
 
 
@@ -196,7 +190,7 @@ struct sndrv_seq_connect {
 
 
        /* note event */
-struct sndrv_seq_ev_note {
+struct snd_seq_ev_note {
        unsigned char channel;
        unsigned char note;
        unsigned char velocity;
@@ -205,7 +199,7 @@ struct sndrv_seq_ev_note {
 };
 
        /* controller event */
-struct sndrv_seq_ev_ctrl {
+struct snd_seq_ev_ctrl {
        unsigned char channel;
        unsigned char unused1, unused2, unused3;        /* pad */
        unsigned int param;
@@ -213,91 +207,91 @@ struct sndrv_seq_ev_ctrl {
 };
 
        /* generic set of bytes (12x8 bit) */
-struct sndrv_seq_ev_raw8 {
+struct snd_seq_ev_raw8 {
        unsigned char d[12];    /* 8 bit value */
 };
 
        /* generic set of integers (3x32 bit) */
-struct sndrv_seq_ev_raw32 {
+struct snd_seq_ev_raw32 {
        unsigned int d[3];      /* 32 bit value */
 };
 
        /* external stored data */
-struct sndrv_seq_ev_ext {
+struct snd_seq_ev_ext {
        unsigned int len;       /* length of data */
        void *ptr;              /* pointer to data (note: maybe 64-bit) */
 } __attribute__((packed));
 
-struct sndrv_seq_result {
+struct snd_seq_result {
        int event;              /* processed event type */
        int result;
 };
 
 
-struct sndrv_seq_real_time {
+struct snd_seq_real_time {
        unsigned int tv_sec;    /* seconds */
        unsigned int tv_nsec;   /* nanoseconds */
 };
 
-typedef unsigned int sndrv_seq_tick_time_t;    /* midi ticks */
+typedef unsigned int snd_seq_tick_time_t;      /* midi ticks */
 
-union sndrv_seq_timestamp {
-       sndrv_seq_tick_time_t tick;
-       struct sndrv_seq_real_time time;
+union snd_seq_timestamp {
+       snd_seq_tick_time_t tick;
+       struct snd_seq_real_time time;
 };
 
-struct sndrv_seq_queue_skew {
+struct snd_seq_queue_skew {
        unsigned int value;
        unsigned int base;
 };
 
        /* queue timer control */
-struct sndrv_seq_ev_queue_control {
+struct snd_seq_ev_queue_control {
        unsigned char queue;                    /* affected queue */
        unsigned char pad[3];                   /* reserved */
        union {
                signed int value;               /* affected value (e.g. tempo) */
-               union sndrv_seq_timestamp time; /* time */
+               union snd_seq_timestamp time;   /* time */
                unsigned int position;          /* sync position */
-               struct sndrv_seq_queue_skew skew;
+               struct snd_seq_queue_skew skew;
                unsigned int d32[2];
                unsigned char d8[8];
        } param;
 };
 
        /* quoted event - inside the kernel only */
-struct sndrv_seq_ev_quote {
-       struct sndrv_seq_addr origin;           /* original sender */
+struct snd_seq_ev_quote {
+       struct snd_seq_addr origin;             /* original sender */
        unsigned short value;           /* optional data */
-       struct sndrv_seq_event *event;          /* quoted event */
+       struct snd_seq_event *event;            /* quoted event */
 } __attribute__((packed));
 
 
        /* sequencer event */
-struct sndrv_seq_event {
-       sndrv_seq_event_type_t type;    /* event type */
+struct snd_seq_event {
+       snd_seq_event_type_t type;      /* event type */
        unsigned char flags;            /* event flags */
        char tag;
        
        unsigned char queue;            /* schedule queue */
-       union sndrv_seq_timestamp time; /* schedule time */
+       union snd_seq_timestamp time;   /* schedule time */
 
 
-       struct sndrv_seq_addr source;   /* source address */
-       struct sndrv_seq_addr dest;     /* destination address */
+       struct snd_seq_addr source;     /* source address */
+       struct snd_seq_addr dest;       /* destination address */
 
        union {                         /* event data... */
-               struct sndrv_seq_ev_note note;
-               struct sndrv_seq_ev_ctrl control;
-               struct sndrv_seq_ev_raw8 raw8;
-               struct sndrv_seq_ev_raw32 raw32;
-               struct sndrv_seq_ev_ext ext;
-               struct sndrv_seq_ev_queue_control queue;
-               union sndrv_seq_timestamp time;
-               struct sndrv_seq_addr addr;
-               struct sndrv_seq_connect connect;
-               struct sndrv_seq_result result;
-               struct sndrv_seq_ev_quote quote;
+               struct snd_seq_ev_note note;
+               struct snd_seq_ev_ctrl control;
+               struct snd_seq_ev_raw8 raw8;
+               struct snd_seq_ev_raw32 raw32;
+               struct snd_seq_ev_ext ext;
+               struct snd_seq_ev_queue_control queue;
+               union snd_seq_timestamp time;
+               struct snd_seq_addr addr;
+               struct snd_seq_connect connect;
+               struct snd_seq_result result;
+               struct snd_seq_ev_quote quote;
        } data;
 };
 
@@ -305,72 +299,15 @@ struct sndrv_seq_event {
 /*
  * bounce event - stored as variable size data
  */
-struct sndrv_seq_event_bounce {
+struct snd_seq_event_bounce {
        int err;
-       struct sndrv_seq_event event;
+       struct snd_seq_event event;
        /* external data follows here. */
 };
 
-#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t)))
-
-/*
- * type check macros
- */
-/* result events: 0-4 */
-#define sndrv_seq_ev_is_result_type(ev)        ((ev)->type < 5)
-/* channel specific events: 5-19 */
-#define sndrv_seq_ev_is_channel_type(ev)       ((ev)->type >= 5 && (ev)->type < 20)
-/* note events: 5-9 */
-#define sndrv_seq_ev_is_note_type(ev)  ((ev)->type >= 5 && (ev)->type < 10)
-/* control events: 10-19 */
-#define sndrv_seq_ev_is_control_type(ev)       ((ev)->type >= 10 && (ev)->type < 20)
-/* queue control events: 30-39 */
-#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
-/* system status messages */
-#define sndrv_seq_ev_is_message_type(ev)       ((ev)->type >= 60 && (ev)->type < 69)
-/* sample messages */
-#define sndrv_seq_ev_is_sample_type(ev)        ((ev)->type >= 70 && (ev)->type < 79)
-/* user-defined messages */
-#define sndrv_seq_ev_is_user_type(ev)  ((ev)->type >= 90 && (ev)->type < 99)
-/* fixed length events: 0-99 */
-#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
-/* variable length events: 130-139 */
-#define sndrv_seq_ev_is_variable_type(ev)      ((ev)->type >= 130 && (ev)->type < 140)
-/* reserved for kernel */
-#define sndrv_seq_ev_is_reserved(ev)   ((ev)->type >= 150)
-
-/* direct dispatched events */
-#define sndrv_seq_ev_is_direct(ev)     ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
-
-/*
- * macros to check event flags
- */
-/* prior events */
-#define sndrv_seq_ev_is_prior(ev)              (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
-
-/* event length type */
-#define sndrv_seq_ev_length_type(ev)   ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
-#define sndrv_seq_ev_is_fixed(ev)              (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
-#define sndrv_seq_ev_is_variable(ev)   (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
-#define sndrv_seq_ev_is_varusr(ev)     (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
-
-/* time-stamp type */
-#define sndrv_seq_ev_timestamp_type(ev)        ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
-#define sndrv_seq_ev_is_tick(ev)               (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
-#define sndrv_seq_ev_is_real(ev)               (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
-
-/* time-mode type */
-#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
-#define sndrv_seq_ev_is_abstime(ev)    (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
-#define sndrv_seq_ev_is_reltime(ev)    (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
-
-/* queue sync port */
-#define sndrv_seq_queue_sync_port(q)   ((q) + 16)
-
-#endif /* __KERNEL__ */
 
        /* system information */
-struct sndrv_seq_system_info {
+struct snd_seq_system_info {
        int queues;                     /* maximum queues count */
        int clients;                    /* maximum clients count */
        int ports;                      /* maximum ports per client */
@@ -382,7 +319,7 @@ struct sndrv_seq_system_info {
 
 
        /* system running information */
-struct sndrv_seq_running_info {
+struct snd_seq_running_info {
        unsigned char client;           /* client id */
        unsigned char big_endian;       /* 1 = big-endian */
        unsigned char cpu_mode;         /* 4 = 32bit, 8 = 64bit */
@@ -399,11 +336,10 @@ struct sndrv_seq_running_info {
 
 
        /* client types */
-enum sndrv_seq_client_type {
-       NO_CLIENT       = 0,
-       USER_CLIENT     = 1,
-       KERNEL_CLIENT   = 2
-};
+typedef int __bitwise snd_seq_client_type_t;
+#define        NO_CLIENT       ((__force snd_seq_client_type_t) 0)
+#define        USER_CLIENT     ((__force snd_seq_client_type_t) 1)
+#define        KERNEL_CLIENT   ((__force snd_seq_client_type_t) 2)
                         
        /* event filter flags */
 #define SNDRV_SEQ_FILTER_BROADCAST     (1<<0)  /* accept broadcast messages */
@@ -411,9 +347,9 @@ enum sndrv_seq_client_type {
 #define SNDRV_SEQ_FILTER_BOUNCE                (1<<2)  /* accept bounce event in error */
 #define SNDRV_SEQ_FILTER_USE_EVENT     (1<<31) /* use event filter */
 
-struct sndrv_seq_client_info {
+struct snd_seq_client_info {
        int client;                     /* client number to inquire */
-       int type;                       /* client type */
+       snd_seq_client_type_t type;     /* client type */
        char name[64];                  /* client name */
        unsigned int filter;            /* filter flags */
        unsigned char multicast_filter[8]; /* multicast filter bitmap */
@@ -425,7 +361,7 @@ struct sndrv_seq_client_info {
 
 
 /* client pool size */
-struct sndrv_seq_client_pool {
+struct snd_seq_client_pool {
        int client;                     /* client number to inquire */
        int output_pool;                /* outgoing (write) pool size */
        int input_pool;                 /* incoming (read) pool size */
@@ -449,13 +385,13 @@ struct sndrv_seq_client_pool {
 #define SNDRV_SEQ_REMOVE_IGNORE_OFF    (1<<8)  /* Do not flush off events */
 #define SNDRV_SEQ_REMOVE_TAG_MATCH     (1<<9)  /* Restrict to events with given tag */
 
-struct sndrv_seq_remove_events {
+struct snd_seq_remove_events {
        unsigned int  remove_mode;      /* Flags that determine what gets removed */
 
-       union sndrv_seq_timestamp time;
+       union snd_seq_timestamp time;
 
        unsigned char queue;    /* Queue for REMOVE_DEST */
-       struct sndrv_seq_addr dest;     /* Address for REMOVE_DEST */
+       struct snd_seq_addr dest;       /* Address for REMOVE_DEST */
        unsigned char channel;  /* Channel for REMOVE_DEST */
 
        int  type;      /* For REMOVE_EVENT_TYPE */
@@ -508,8 +444,8 @@ struct sndrv_seq_remove_events {
 #define SNDRV_SEQ_PORT_FLG_TIMESTAMP   (1<<1)
 #define SNDRV_SEQ_PORT_FLG_TIME_REAL   (1<<2)
 
-struct sndrv_seq_port_info {
-       struct sndrv_seq_addr addr;     /* client/port numbers */
+struct snd_seq_port_info {
+       struct snd_seq_addr addr;       /* client/port numbers */
        char name[64];                  /* port name */
 
        unsigned int capability;        /* port capability bits */
@@ -532,7 +468,7 @@ struct sndrv_seq_port_info {
 #define SNDRV_SEQ_QUEUE_FLG_SYNC       (1<<0)  /* sync enabled */
 
 /* queue information */
-struct sndrv_seq_queue_info {
+struct snd_seq_queue_info {
        int queue;              /* queue id */
 
        /*
@@ -540,7 +476,7 @@ struct sndrv_seq_queue_info {
         *  etc. if the queue is locked for other clients
         */
        int owner;              /* client id for owner of the queue */
-       int locked:1;           /* timing queue locked for other queues */
+       unsigned locked:1;      /* timing queue locked for other queues */
        char name[64];          /* name of this queue */
        unsigned int flags;     /* flags */
        char reserved[60];      /* for future use */
@@ -548,11 +484,11 @@ struct sndrv_seq_queue_info {
 };
 
 /* queue info/status */
-struct sndrv_seq_queue_status {
+struct snd_seq_queue_status {
        int queue;                      /* queue id */
        int events;                     /* read-only - queue size */
-       sndrv_seq_tick_time_t tick;     /* current tick */
-       struct sndrv_seq_real_time time; /* current time */
+       snd_seq_tick_time_t tick;       /* current tick */
+       struct snd_seq_real_time time;  /* current time */
        int running;                    /* running state of queue */
        int flags;                      /* various flags */
        char reserved[64];              /* for the future */
@@ -560,7 +496,7 @@ struct sndrv_seq_queue_status {
 
 
 /* queue tempo */
-struct sndrv_seq_queue_tempo {
+struct snd_seq_queue_tempo {
        int queue;                      /* sequencer queue */
        unsigned int tempo;             /* current tempo, us/tick */
        int ppq;                        /* time resolution, ticks/quarter */
@@ -576,12 +512,12 @@ struct sndrv_seq_queue_tempo {
 #define SNDRV_SEQ_TIMER_MIDI_TICK      2       /* Midi Timer Tick (TICK event) */
 
 /* queue timer info */
-struct sndrv_seq_queue_timer {
+struct snd_seq_queue_timer {
        int queue;                      /* sequencer queue */
        int type;                       /* source timer type */
        union {
                struct {
-                       struct sndrv_timer_id id;       /* ALSA's timer ID */
+                       struct snd_timer_id id; /* ALSA's timer ID */
                        unsigned int resolution;        /* resolution in Hz */
                } alsa;
        } u;
@@ -589,7 +525,7 @@ struct sndrv_seq_queue_timer {
 };
 
 
-struct sndrv_seq_queue_client {
+struct snd_seq_queue_client {
        int queue;              /* sequencer queue */
        int client;             /* sequencer client */
        int used;               /* queue is used with this client
@@ -603,9 +539,9 @@ struct sndrv_seq_queue_client {
 #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP  (1<<1)
 #define SNDRV_SEQ_PORT_SUBS_TIME_REAL  (1<<2)
 
-struct sndrv_seq_port_subscribe {
-       struct sndrv_seq_addr sender;   /* sender address */
-       struct sndrv_seq_addr dest;     /* destination address */
+struct snd_seq_port_subscribe {
+       struct snd_seq_addr sender;     /* sender address */
+       struct snd_seq_addr dest;       /* destination address */
        unsigned int voices;            /* number of voices to be allocated (0 = don't care) */
        unsigned int flags;             /* modes */
        unsigned char queue;            /* input time-stamp queue (optional) */
@@ -617,12 +553,12 @@ struct sndrv_seq_port_subscribe {
 #define SNDRV_SEQ_QUERY_SUBS_READ      0
 #define SNDRV_SEQ_QUERY_SUBS_WRITE     1
 
-struct sndrv_seq_query_subs {
-       struct sndrv_seq_addr root;     /* client/port id to be searched */
+struct snd_seq_query_subs {
+       struct snd_seq_addr root;       /* client/port id to be searched */
        int type;               /* READ or WRITE */
        int index;              /* 0..N-1 */
        int num_subs;           /* R/O: number of subscriptions on this port */
-       struct sndrv_seq_addr addr;     /* R/O: result */
+       struct snd_seq_addr addr;       /* R/O: result */
        unsigned char queue;    /* R/O: result */
        unsigned int flags;     /* R/O: result */
        char reserved[64];      /* for future use */
@@ -635,44 +571,44 @@ struct sndrv_seq_query_subs {
 
 #define SNDRV_SEQ_IOCTL_PVERSION       _IOR ('S', 0x00, int)
 #define SNDRV_SEQ_IOCTL_CLIENT_ID      _IOR ('S', 0x01, int)
-#define SNDRV_SEQ_IOCTL_SYSTEM_INFO    _IOWR('S', 0x02, struct sndrv_seq_system_info)
-#define SNDRV_SEQ_IOCTL_RUNNING_MODE   _IOWR('S', 0x03, struct sndrv_seq_running_info)
-
-#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO        _IOWR('S', 0x10, struct sndrv_seq_client_info)
-#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO        _IOW ('S', 0x11, struct sndrv_seq_client_info)
-
-#define SNDRV_SEQ_IOCTL_CREATE_PORT    _IOWR('S', 0x20, struct sndrv_seq_port_info)
-#define SNDRV_SEQ_IOCTL_DELETE_PORT    _IOW ('S', 0x21, struct sndrv_seq_port_info)
-#define SNDRV_SEQ_IOCTL_GET_PORT_INFO  _IOWR('S', 0x22, struct sndrv_seq_port_info)
-#define SNDRV_SEQ_IOCTL_SET_PORT_INFO  _IOW ('S', 0x23, struct sndrv_seq_port_info)
-
-#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe)
-#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe)
-
-#define SNDRV_SEQ_IOCTL_CREATE_QUEUE   _IOWR('S', 0x32, struct sndrv_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_DELETE_QUEUE   _IOW ('S', 0x33, struct sndrv_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE        _IOWR('S', 0x36, struct sndrv_seq_queue_info)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO        _IOWR('S', 0x41, struct sndrv_seq_queue_tempo)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO        _IOW ('S', 0x42, struct sndrv_seq_queue_tempo)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER        _IOWR('S', 0x43, struct sndrv_seq_queue_owner)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER        _IOW ('S', 0x44, struct sndrv_seq_queue_owner)
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER        _IOWR('S', 0x45, struct sndrv_seq_queue_timer)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER        _IOW ('S', 0x46, struct sndrv_seq_queue_timer)
+#define SNDRV_SEQ_IOCTL_SYSTEM_INFO    _IOWR('S', 0x02, struct snd_seq_system_info)
+#define SNDRV_SEQ_IOCTL_RUNNING_MODE   _IOWR('S', 0x03, struct snd_seq_running_info)
+
+#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO        _IOWR('S', 0x10, struct snd_seq_client_info)
+#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO        _IOW ('S', 0x11, struct snd_seq_client_info)
+
+#define SNDRV_SEQ_IOCTL_CREATE_PORT    _IOWR('S', 0x20, struct snd_seq_port_info)
+#define SNDRV_SEQ_IOCTL_DELETE_PORT    _IOW ('S', 0x21, struct snd_seq_port_info)
+#define SNDRV_SEQ_IOCTL_GET_PORT_INFO  _IOWR('S', 0x22, struct snd_seq_port_info)
+#define SNDRV_SEQ_IOCTL_SET_PORT_INFO  _IOW ('S', 0x23, struct snd_seq_port_info)
+
+#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
+#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
+
+#define SNDRV_SEQ_IOCTL_CREATE_QUEUE   _IOWR('S', 0x32, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_DELETE_QUEUE   _IOW ('S', 0x33, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE        _IOWR('S', 0x36, struct snd_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO        _IOWR('S', 0x41, struct snd_seq_queue_tempo)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO        _IOW ('S', 0x42, struct snd_seq_queue_tempo)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER        _IOWR('S', 0x43, struct snd_seq_queue_owner)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER        _IOW ('S', 0x44, struct snd_seq_queue_owner)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER        _IOWR('S', 0x45, struct snd_seq_queue_timer)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER        _IOW ('S', 0x46, struct snd_seq_queue_timer)
 /* XXX
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
 */
-#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT       _IOWR('S', 0x49, struct sndrv_seq_queue_client)
-#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT       _IOW ('S', 0x4a, struct sndrv_seq_queue_client)
-#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL        _IOWR('S', 0x4b, struct sndrv_seq_client_pool)
-#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL        _IOW ('S', 0x4c, struct sndrv_seq_client_pool)
-#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS  _IOW ('S', 0x4e, struct sndrv_seq_remove_events)
-#define SNDRV_SEQ_IOCTL_QUERY_SUBS     _IOWR('S', 0x4f, struct sndrv_seq_query_subs)
-#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION       _IOWR('S', 0x50, struct sndrv_seq_port_subscribe)
-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT      _IOWR('S', 0x51, struct sndrv_seq_client_info)
-#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT        _IOWR('S', 0x52, struct sndrv_seq_port_info)
-
-#endif /* __SOUND_ASEQUENCER_H */
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT       _IOWR('S', 0x49, struct snd_seq_queue_client)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT       _IOW ('S', 0x4a, struct snd_seq_queue_client)
+#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL        _IOWR('S', 0x4b, struct snd_seq_client_pool)
+#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL        _IOW ('S', 0x4c, struct snd_seq_client_pool)
+#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS  _IOW ('S', 0x4e, struct snd_seq_remove_events)
+#define SNDRV_SEQ_IOCTL_QUERY_SUBS     _IOWR('S', 0x4f, struct snd_seq_query_subs)
+#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION       _IOWR('S', 0x50, struct snd_seq_port_subscribe)
+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT      _IOWR('S', 0x51, struct snd_seq_client_info)
+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT        _IOWR('S', 0x52, struct snd_seq_port_info)
+
+#endif /* _UAPI__SOUND_ASEQUENCER_H */
index 8fdad91..515b8fc 100644 (file)
  *
  */
 
-#ifndef __SOUND_ASOUND_H
-#define __SOUND_ASOUND_H
+#ifndef _UAPI__SOUND_ASOUND_H
+#define _UAPI__SOUND_ASOUND_H
 
-#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
-
-#include <linux/ioctl.h>
 #include <linux/types.h>
 
-#ifdef __KERNEL__
-
-#include <linux/time.h>
-#include <asm/byteorder.h>
-
-#if  __LITTLE_ENDIAN == 1234
-#define SNDRV_LITTLE_ENDIAN
-#elif __BIG_ENDIAN == 4321
-#define SNDRV_BIG_ENDIAN
-#else
-#error "Unsupported endian..."
-#endif
-
-#else /* !__KERNEL__ */
-
-#include <endian.h>
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define SNDRV_LITTLE_ENDIAN
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define SNDRV_BIG_ENDIAN
-#else
-#error "Unsupported endian..."
-#endif
-
-#endif /* __KERNEL **/
-
-#endif /* LINUX */
-
-#ifndef __KERNEL__
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#endif
 
 /*
  *  protocol version
@@ -81,7 +45,7 @@
  *                                                                          *
  ****************************************************************************/
 
-struct sndrv_aes_iec958 {
+struct snd_aes_iec958 {
        unsigned char status[24];       /* AES/IEC958 channel status bits */
        unsigned char subcode[147];     /* AES/IEC958 subcode bits */
        unsigned char pad;              /* nothing */
@@ -90,13 +54,27 @@ struct sndrv_aes_iec958 {
 
 /****************************************************************************
  *                                                                          *
+ *        CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort                    *
+ *                                                                          *
+ ****************************************************************************/
+
+struct snd_cea_861_aud_if {
+       unsigned char db1_ct_cc; /* coding type and channel count */
+       unsigned char db2_sf_ss; /* sample frequency and size */
+       unsigned char db3; /* not used, all zeros */
+       unsigned char db4_ca; /* channel allocation code */
+       unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
+};
+
+/****************************************************************************
+ *                                                                          *
  *      Section for driver hardware dependent interface - /dev/snd/hw?      *
  *                                                                          *
  ****************************************************************************/
 
 #define SNDRV_HWDEP_VERSION            SNDRV_PROTOCOL_VERSION(1, 0, 1)
 
-enum sndrv_hwdep_iface {
+enum {
        SNDRV_HWDEP_IFACE_OPL2 = 0,
        SNDRV_HWDEP_IFACE_OPL3,
        SNDRV_HWDEP_IFACE_OPL4,
@@ -120,7 +98,7 @@ enum sndrv_hwdep_iface {
        SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
 };
 
-struct sndrv_hwdep_info {
+struct snd_hwdep_info {
        unsigned int device;            /* WR: device number */
        int card;                       /* R: card number */
        unsigned char id[64];           /* ID (user selectable) */
@@ -130,7 +108,7 @@ struct sndrv_hwdep_info {
 };
 
 /* generic DSP loader */
-struct sndrv_hwdep_dsp_status {
+struct snd_hwdep_dsp_status {
        unsigned int version;           /* R: driver-specific version */
        unsigned char id[32];           /* R: driver-specific ID string */
        unsigned int num_dsps;          /* R: number of DSP images to transfer */
@@ -139,20 +117,18 @@ struct sndrv_hwdep_dsp_status {
        unsigned char reserved[16];     /* reserved for future use */
 };
 
-struct sndrv_hwdep_dsp_image {
+struct snd_hwdep_dsp_image {
        unsigned int index;             /* W: DSP index */
        unsigned char name[64];         /* W: ID (e.g. file name) */
-       unsigned char *image;           /* W: binary image */
+       unsigned char __user *image;    /* W: binary image */
        size_t length;                  /* W: size of image in bytes */
        unsigned long driver_data;      /* W: driver-specific data */
 };
 
-enum {
-       SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int),
-       SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info),
-       SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status),
-       SNDRV_HWDEP_IOCTL_DSP_LOAD   = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image)
-};
+#define SNDRV_HWDEP_IOCTL_PVERSION     _IOR ('H', 0x00, int)
+#define SNDRV_HWDEP_IOCTL_INFO         _IOR ('H', 0x01, struct snd_hwdep_info)
+#define SNDRV_HWDEP_IOCTL_DSP_STATUS   _IOR('H', 0x02, struct snd_hwdep_dsp_status)
+#define SNDRV_HWDEP_IOCTL_DSP_LOAD     _IOW('H', 0x03, struct snd_hwdep_dsp_image)
 
 /*****************************************************************************
  *                                                                           *
@@ -162,10 +138,10 @@ enum {
 
 #define SNDRV_PCM_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 11)
 
-typedef unsigned long sndrv_pcm_uframes_t;
-typedef long sndrv_pcm_sframes_t;
+typedef unsigned long snd_pcm_uframes_t;
+typedef signed long snd_pcm_sframes_t;
 
-enum sndrv_pcm_class {
+enum {
        SNDRV_PCM_CLASS_GENERIC = 0,    /* standard mono or stereo device */
        SNDRV_PCM_CLASS_MULTI,          /* multichannel device */
        SNDRV_PCM_CLASS_MODEM,          /* software modem class */
@@ -174,101 +150,98 @@ enum sndrv_pcm_class {
        SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
 };
 
-enum sndrv_pcm_subclass {
+enum {
        SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
        SNDRV_PCM_SUBCLASS_MULTI_MIX,   /* multichannel subdevices are mixed together */
        /* Don't forget to change the following: */
        SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
 };
 
-enum sndrv_pcm_stream {
+enum {
        SNDRV_PCM_STREAM_PLAYBACK = 0,
        SNDRV_PCM_STREAM_CAPTURE,
        SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
 };
 
-enum sndrv_pcm_access {
-       SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0,  /* interleaved mmap */
-       SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED,   /* noninterleaved mmap */
-       SNDRV_PCM_ACCESS_MMAP_COMPLEX,          /* complex mmap */
-       SNDRV_PCM_ACCESS_RW_INTERLEAVED,        /* readi/writei */
-       SNDRV_PCM_ACCESS_RW_NONINTERLEAVED,     /* readn/writen */
-       SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED,
-};
-
-enum sndrv_pcm_format {
-       SNDRV_PCM_FORMAT_S8 = 0,
-       SNDRV_PCM_FORMAT_U8,
-       SNDRV_PCM_FORMAT_S16_LE,
-       SNDRV_PCM_FORMAT_S16_BE,
-       SNDRV_PCM_FORMAT_U16_LE,
-       SNDRV_PCM_FORMAT_U16_BE,
-       SNDRV_PCM_FORMAT_S24_LE,        /* low three bytes */
-       SNDRV_PCM_FORMAT_S24_BE,        /* low three bytes */
-       SNDRV_PCM_FORMAT_U24_LE,        /* low three bytes */
-       SNDRV_PCM_FORMAT_U24_BE,        /* low three bytes */
-       SNDRV_PCM_FORMAT_S32_LE,
-       SNDRV_PCM_FORMAT_S32_BE,
-       SNDRV_PCM_FORMAT_U32_LE,
-       SNDRV_PCM_FORMAT_U32_BE,
-       SNDRV_PCM_FORMAT_FLOAT_LE,      /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-       SNDRV_PCM_FORMAT_FLOAT_BE,      /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-       SNDRV_PCM_FORMAT_FLOAT64_LE,    /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-       SNDRV_PCM_FORMAT_FLOAT64_BE,    /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-       SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE,    /* IEC-958 subframe, Little Endian */
-       SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE,    /* IEC-958 subframe, Big Endian */
-       SNDRV_PCM_FORMAT_MU_LAW,
-       SNDRV_PCM_FORMAT_A_LAW,
-       SNDRV_PCM_FORMAT_IMA_ADPCM,
-       SNDRV_PCM_FORMAT_MPEG,
-       SNDRV_PCM_FORMAT_GSM,
-       SNDRV_PCM_FORMAT_SPECIAL = 31,
-       SNDRV_PCM_FORMAT_S24_3LE = 32,  /* in three bytes */
-       SNDRV_PCM_FORMAT_S24_3BE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_U24_3LE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_U24_3BE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_S20_3LE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_S20_3BE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_U20_3LE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_U20_3BE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_S18_3LE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_S18_3BE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_U18_3LE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_U18_3BE,       /* in three bytes */
-       SNDRV_PCM_FORMAT_G723_24,       /* 8 samples in 3 bytes */
-       SNDRV_PCM_FORMAT_G723_24_1B,    /* 1 sample in 1 byte */
-       SNDRV_PCM_FORMAT_G723_40,       /* 8 Samples in 5 bytes */
-       SNDRV_PCM_FORMAT_G723_40_1B,    /* 1 sample in 1 byte */
-       SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_G723_40_1B,
+typedef int __bitwise snd_pcm_access_t;
+#define        SNDRV_PCM_ACCESS_MMAP_INTERLEAVED       ((__force snd_pcm_access_t) 0) /* interleaved mmap */
+#define        SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED    ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
+#define        SNDRV_PCM_ACCESS_MMAP_COMPLEX           ((__force snd_pcm_access_t) 2) /* complex mmap */
+#define        SNDRV_PCM_ACCESS_RW_INTERLEAVED         ((__force snd_pcm_access_t) 3) /* readi/writei */
+#define        SNDRV_PCM_ACCESS_RW_NONINTERLEAVED      ((__force snd_pcm_access_t) 4) /* readn/writen */
+#define        SNDRV_PCM_ACCESS_LAST           SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
+
+typedef int __bitwise snd_pcm_format_t;
+#define        SNDRV_PCM_FORMAT_S8     ((__force snd_pcm_format_t) 0)
+#define        SNDRV_PCM_FORMAT_U8     ((__force snd_pcm_format_t) 1)
+#define        SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
+#define        SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
+#define        SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
+#define        SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
+#define        SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
+#define        SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
+#define        SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
+#define        SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
+#define        SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
+#define        SNDRV_PCM_FORMAT_FLOAT_LE       ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_FLOAT_BE       ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_FLOAT64_LE     ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_FLOAT64_BE     ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
+#define        SNDRV_PCM_FORMAT_MU_LAW         ((__force snd_pcm_format_t) 20)
+#define        SNDRV_PCM_FORMAT_A_LAW          ((__force snd_pcm_format_t) 21)
+#define        SNDRV_PCM_FORMAT_IMA_ADPCM      ((__force snd_pcm_format_t) 22)
+#define        SNDRV_PCM_FORMAT_MPEG           ((__force snd_pcm_format_t) 23)
+#define        SNDRV_PCM_FORMAT_GSM            ((__force snd_pcm_format_t) 24)
+#define        SNDRV_PCM_FORMAT_SPECIAL        ((__force snd_pcm_format_t) 31)
+#define        SNDRV_PCM_FORMAT_S24_3LE        ((__force snd_pcm_format_t) 32) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S24_3BE        ((__force snd_pcm_format_t) 33) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U24_3LE        ((__force snd_pcm_format_t) 34) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U24_3BE        ((__force snd_pcm_format_t) 35) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S20_3LE        ((__force snd_pcm_format_t) 36) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S20_3BE        ((__force snd_pcm_format_t) 37) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U20_3LE        ((__force snd_pcm_format_t) 38) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U20_3BE        ((__force snd_pcm_format_t) 39) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S18_3LE        ((__force snd_pcm_format_t) 40) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_S18_3BE        ((__force snd_pcm_format_t) 41) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U18_3LE        ((__force snd_pcm_format_t) 42) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_U18_3BE        ((__force snd_pcm_format_t) 43) /* in three bytes */
+#define        SNDRV_PCM_FORMAT_G723_24        ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
+#define        SNDRV_PCM_FORMAT_G723_24_1B     ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
+#define        SNDRV_PCM_FORMAT_G723_40        ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
+#define        SNDRV_PCM_FORMAT_G723_40_1B     ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
+#define        SNDRV_PCM_FORMAT_LAST           SNDRV_PCM_FORMAT_G723_40_1B
 
 #ifdef SNDRV_LITTLE_ENDIAN
-       SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE,
-       SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE,
-       SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE,
-       SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE,
-       SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE,
-       SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE,
-       SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE,
-       SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE,
-       SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE,
+#define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_LE
+#define        SNDRV_PCM_FORMAT_U16            SNDRV_PCM_FORMAT_U16_LE
+#define        SNDRV_PCM_FORMAT_S24            SNDRV_PCM_FORMAT_S24_LE
+#define        SNDRV_PCM_FORMAT_U24            SNDRV_PCM_FORMAT_U24_LE
+#define        SNDRV_PCM_FORMAT_S32            SNDRV_PCM_FORMAT_S32_LE
+#define        SNDRV_PCM_FORMAT_U32            SNDRV_PCM_FORMAT_U32_LE
+#define        SNDRV_PCM_FORMAT_FLOAT          SNDRV_PCM_FORMAT_FLOAT_LE
+#define        SNDRV_PCM_FORMAT_FLOAT64        SNDRV_PCM_FORMAT_FLOAT64_LE
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
 #endif
 #ifdef SNDRV_BIG_ENDIAN
-       SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE,
-       SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE,
-       SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE,
-       SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE,
-       SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE,
-       SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE,
-       SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE,
-       SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE,
-       SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE,
+#define        SNDRV_PCM_FORMAT_S16            SNDRV_PCM_FORMAT_S16_BE
+#define        SNDRV_PCM_FORMAT_U16            SNDRV_PCM_FORMAT_U16_BE
+#define        SNDRV_PCM_FORMAT_S24            SNDRV_PCM_FORMAT_S24_BE
+#define        SNDRV_PCM_FORMAT_U24            SNDRV_PCM_FORMAT_U24_BE
+#define        SNDRV_PCM_FORMAT_S32            SNDRV_PCM_FORMAT_S32_BE
+#define        SNDRV_PCM_FORMAT_U32            SNDRV_PCM_FORMAT_U32_BE
+#define        SNDRV_PCM_FORMAT_FLOAT          SNDRV_PCM_FORMAT_FLOAT_BE
+#define        SNDRV_PCM_FORMAT_FLOAT64        SNDRV_PCM_FORMAT_FLOAT64_BE
+#define        SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
 #endif
-};
 
-enum sndrv_pcm_subformat {
-       SNDRV_PCM_SUBFORMAT_STD = 0,
-       SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD,
-};
+typedef int __bitwise snd_pcm_subformat_t;
+#define        SNDRV_PCM_SUBFORMAT_STD         ((__force snd_pcm_subformat_t) 0)
+#define        SNDRV_PCM_SUBFORMAT_LAST        SNDRV_PCM_SUBFORMAT_STD
 
 #define SNDRV_PCM_INFO_MMAP            0x00000001      /* hardware supports mmap */
 #define SNDRV_PCM_INFO_MMAP_VALID      0x00000002      /* period data are valid during transfer */
@@ -286,19 +259,19 @@ enum sndrv_pcm_subformat {
 #define SNDRV_PCM_INFO_SYNC_START      0x00400000      /* pcm support some kind of sync go */
 #define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP        0x00800000      /* period wakeup can be disabled */
 #define SNDRV_PCM_INFO_HAS_WALL_CLOCK   0x01000000      /* has audio wall clock for audio/system time sync */
-
-enum sndrv_pcm_state {
-       SNDRV_PCM_STATE_OPEN = 0,       /* stream is open */
-       SNDRV_PCM_STATE_SETUP,          /* stream has a setup */
-       SNDRV_PCM_STATE_PREPARED,       /* stream is ready to start */
-       SNDRV_PCM_STATE_RUNNING,        /* stream is running */
-       SNDRV_PCM_STATE_XRUN,           /* stream reached an xrun */
-       SNDRV_PCM_STATE_DRAINING,       /* stream is draining */
-       SNDRV_PCM_STATE_PAUSED,         /* stream is paused */
-       SNDRV_PCM_STATE_SUSPENDED,      /* hardware is suspended */
-       SNDRV_PCM_STATE_DISCONNECTED,   /* hardware is disconnected */
-       SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED,
-};
+#define SNDRV_PCM_INFO_FIFO_IN_FRAMES  0x80000000      /* internal kernel flag - FIFO size is in frames */
+
+typedef int __bitwise snd_pcm_state_t;
+#define        SNDRV_PCM_STATE_OPEN            ((__force snd_pcm_state_t) 0) /* stream is open */
+#define        SNDRV_PCM_STATE_SETUP           ((__force snd_pcm_state_t) 1) /* stream has a setup */
+#define        SNDRV_PCM_STATE_PREPARED        ((__force snd_pcm_state_t) 2) /* stream is ready to start */
+#define        SNDRV_PCM_STATE_RUNNING         ((__force snd_pcm_state_t) 3) /* stream is running */
+#define        SNDRV_PCM_STATE_XRUN            ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
+#define        SNDRV_PCM_STATE_DRAINING        ((__force snd_pcm_state_t) 5) /* stream is draining */
+#define        SNDRV_PCM_STATE_PAUSED          ((__force snd_pcm_state_t) 6) /* stream is paused */
+#define        SNDRV_PCM_STATE_SUSPENDED       ((__force snd_pcm_state_t) 7) /* hardware is suspended */
+#define        SNDRV_PCM_STATE_DISCONNECTED    ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
+#define        SNDRV_PCM_STATE_LAST            SNDRV_PCM_STATE_DISCONNECTED
 
 enum {
        SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
@@ -306,13 +279,13 @@ enum {
        SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
 };
 
-union sndrv_pcm_sync_id {
+union snd_pcm_sync_id {
        unsigned char id[16];
        unsigned short id16[8];
        unsigned int id32[4];
 };
 
-struct sndrv_pcm_info {
+struct snd_pcm_info {
        unsigned int device;            /* RO/WR (control): device number */
        unsigned int subdevice;         /* RO/WR (control): subdevice number */
        int stream;                     /* RO/WR (control): stream direction */
@@ -324,39 +297,47 @@ struct sndrv_pcm_info {
        int dev_subclass;               /* SNDRV_PCM_SUBCLASS_* */
        unsigned int subdevices_count;
        unsigned int subdevices_avail;
-       union sndrv_pcm_sync_id sync;   /* hardware synchronization ID */
+       union snd_pcm_sync_id sync;     /* hardware synchronization ID */
        unsigned char reserved[64];     /* reserved for future... */
 };
 
-enum sndrv_pcm_hw_param {
-       SNDRV_PCM_HW_PARAM_ACCESS = 0,  /* Access type */
-       SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS,
-       SNDRV_PCM_HW_PARAM_FORMAT,      /* Format */
-       SNDRV_PCM_HW_PARAM_SUBFORMAT,   /* Subformat */
-       SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT,
-
-       SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */
-       SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
-       SNDRV_PCM_HW_PARAM_FRAME_BITS,  /* Bits per frame */
-       SNDRV_PCM_HW_PARAM_CHANNELS,    /* Channels */
-       SNDRV_PCM_HW_PARAM_RATE,        /* Approx rate */
-       SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts
-                                          in us */
-       SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */
-       SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */
-       SNDRV_PCM_HW_PARAM_PERIODS,     /* Approx interrupts per buffer */
-       SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */
-       SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */
-       SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */
-       SNDRV_PCM_HW_PARAM_TICK_TIME,   /* Approx tick duration in us */
-       SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME
-};
+typedef int snd_pcm_hw_param_t;
+#define        SNDRV_PCM_HW_PARAM_ACCESS       0       /* Access type */
+#define        SNDRV_PCM_HW_PARAM_FORMAT       1       /* Format */
+#define        SNDRV_PCM_HW_PARAM_SUBFORMAT    2       /* Subformat */
+#define        SNDRV_PCM_HW_PARAM_FIRST_MASK   SNDRV_PCM_HW_PARAM_ACCESS
+#define        SNDRV_PCM_HW_PARAM_LAST_MASK    SNDRV_PCM_HW_PARAM_SUBFORMAT
+
+#define        SNDRV_PCM_HW_PARAM_SAMPLE_BITS  8       /* Bits per sample */
+#define        SNDRV_PCM_HW_PARAM_FRAME_BITS   9       /* Bits per frame */
+#define        SNDRV_PCM_HW_PARAM_CHANNELS     10      /* Channels */
+#define        SNDRV_PCM_HW_PARAM_RATE         11      /* Approx rate */
+#define        SNDRV_PCM_HW_PARAM_PERIOD_TIME  12      /* Approx distance between
+                                                * interrupts in us
+                                                */
+#define        SNDRV_PCM_HW_PARAM_PERIOD_SIZE  13      /* Approx frames between
+                                                * interrupts
+                                                */
+#define        SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14      /* Approx bytes between
+                                                * interrupts
+                                                */
+#define        SNDRV_PCM_HW_PARAM_PERIODS      15      /* Approx interrupts per
+                                                * buffer
+                                                */
+#define        SNDRV_PCM_HW_PARAM_BUFFER_TIME  16      /* Approx duration of buffer
+                                                * in us
+                                                */
+#define        SNDRV_PCM_HW_PARAM_BUFFER_SIZE  17      /* Size of buffer in frames */
+#define        SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18      /* Size of buffer in bytes */
+#define        SNDRV_PCM_HW_PARAM_TICK_TIME    19      /* Approx tick duration in us */
+#define        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL       SNDRV_PCM_HW_PARAM_SAMPLE_BITS
+#define        SNDRV_PCM_HW_PARAM_LAST_INTERVAL        SNDRV_PCM_HW_PARAM_TICK_TIME
 
 #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0)  /* avoid rate resampling */
 #define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER      (1<<1)  /* export buffer */
 #define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP   (1<<2)  /* disable period wakeups */
 
-struct sndrv_interval {
+struct snd_interval {
        unsigned int min, max;
        unsigned int openmin:1,
                     openmax:1,
@@ -366,115 +347,113 @@ struct sndrv_interval {
 
 #define SNDRV_MASK_MAX 256
 
-struct sndrv_mask {
-       u_int32_t bits[(SNDRV_MASK_MAX+31)/32];
+struct snd_mask {
+       __u32 bits[(SNDRV_MASK_MAX+31)/32];
 };
 
-struct sndrv_pcm_hw_params {
+struct snd_pcm_hw_params {
        unsigned int flags;
-       struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 
+       struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 
                               SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
-       struct sndrv_mask mres[5];      /* reserved masks */
-       struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
+       struct snd_mask mres[5];        /* reserved masks */
+       struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
                                        SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
-       struct sndrv_interval ires[9];  /* reserved intervals */
+       struct snd_interval ires[9];    /* reserved intervals */
        unsigned int rmask;             /* W: requested masks */
        unsigned int cmask;             /* R: changed masks */
        unsigned int info;              /* R: Info flags for returned setup */
        unsigned int msbits;            /* R: used most significant bits */
        unsigned int rate_num;          /* R: rate numerator */
        unsigned int rate_den;          /* R: rate denominator */
-       sndrv_pcm_uframes_t fifo_size;  /* R: chip FIFO size in frames */
+       snd_pcm_uframes_t fifo_size;    /* R: chip FIFO size in frames */
        unsigned char reserved[64];     /* reserved for future */
 };
 
-enum sndrv_pcm_tstamp {
+enum {
        SNDRV_PCM_TSTAMP_NONE = 0,
        SNDRV_PCM_TSTAMP_ENABLE,
        SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
 };
 
-struct sndrv_pcm_sw_params {
+struct snd_pcm_sw_params {
        int tstamp_mode;                        /* timestamp mode */
        unsigned int period_step;
        unsigned int sleep_min;                 /* min ticks to sleep */
-       sndrv_pcm_uframes_t avail_min;          /* min avail frames for wakeup */
-       sndrv_pcm_uframes_t xfer_align;         /* xfer size need to be a multiple */
-       sndrv_pcm_uframes_t start_threshold;    /* min hw_avail frames for automatic start */
-       sndrv_pcm_uframes_t stop_threshold;     /* min avail frames for automatic stop */
-       sndrv_pcm_uframes_t silence_threshold;  /* min distance from noise for silence filling */
-       sndrv_pcm_uframes_t silence_size;       /* silence block size */
-       sndrv_pcm_uframes_t boundary;           /* pointers wrap point */
-       unsigned char reserved[60];             /* reserved for future */
-       unsigned int period_event;              /* for alsa-lib implementation */
-};
-
-struct sndrv_pcm_channel_info {
+       snd_pcm_uframes_t avail_min;            /* min avail frames for wakeup */
+       snd_pcm_uframes_t xfer_align;           /* obsolete: xfer size need to be a multiple */
+       snd_pcm_uframes_t start_threshold;      /* min hw_avail frames for automatic start */
+       snd_pcm_uframes_t stop_threshold;       /* min avail frames for automatic stop */
+       snd_pcm_uframes_t silence_threshold;    /* min distance from noise for silence filling */
+       snd_pcm_uframes_t silence_size;         /* silence block size */
+       snd_pcm_uframes_t boundary;             /* pointers wrap point */
+       unsigned char reserved[64];             /* reserved for future */
+};
+
+struct snd_pcm_channel_info {
        unsigned int channel;
-       long offset;                    /* mmap offset */
+       __kernel_off_t offset;          /* mmap offset */
        unsigned int first;             /* offset to first sample in bits */
        unsigned int step;              /* samples distance in bits */
 };
 
-struct sndrv_pcm_status {
-       int state;                      /* stream state */
+struct snd_pcm_status {
+       snd_pcm_state_t state;          /* stream state */
        struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
        struct timespec tstamp;         /* reference timestamp */
-       sndrv_pcm_uframes_t appl_ptr;   /* appl ptr */
-       sndrv_pcm_uframes_t hw_ptr;     /* hw ptr */
-       sndrv_pcm_sframes_t delay;      /* current delay in frames */
-       sndrv_pcm_uframes_t avail;      /* number of frames available */
-       sndrv_pcm_uframes_t avail_max;  /* max frames available on hw since last status */
-       sndrv_pcm_uframes_t overrange;  /* count of ADC (capture) overrange detections from last status */
-       int suspended_state;            /* suspended stream state */
-       u_int32_t reserved_alignment;   /* must be filled with zero */
+       snd_pcm_uframes_t appl_ptr;     /* appl ptr */
+       snd_pcm_uframes_t hw_ptr;       /* hw ptr */
+       snd_pcm_sframes_t delay;        /* current delay in frames */
+       snd_pcm_uframes_t avail;        /* number of frames available */
+       snd_pcm_uframes_t avail_max;    /* max frames available on hw since last status */
+       snd_pcm_uframes_t overrange;    /* count of ADC (capture) overrange detections from last status */
+       snd_pcm_state_t suspended_state; /* suspended stream state */
+       __u32 reserved_alignment;       /* must be filled with zero */
        struct timespec audio_tstamp;   /* from sample counter or wall clock */
        unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */
 };
 
-struct sndrv_pcm_mmap_status {
-       int state;                      /* RO: state - SNDRV_PCM_STATE_XXXX */
+struct snd_pcm_mmap_status {
+       snd_pcm_state_t state;          /* RO: state - SNDRV_PCM_STATE_XXXX */
        int pad1;                       /* Needed for 64 bit alignment */
-       sndrv_pcm_uframes_t hw_ptr;     /* RO: hw ptr (0...boundary-1) */
+       snd_pcm_uframes_t hw_ptr;       /* RO: hw ptr (0...boundary-1) */
        struct timespec tstamp;         /* Timestamp */
-       int suspended_state;            /* RO: suspended stream state */
+       snd_pcm_state_t suspended_state; /* RO: suspended stream state */
        struct timespec audio_tstamp;   /* from sample counter or wall clock */
 };
 
-struct sndrv_pcm_mmap_control {
-       sndrv_pcm_uframes_t appl_ptr;   /* RW: appl ptr (0...boundary-1) */
-       sndrv_pcm_uframes_t avail_min;  /* RW: min available frames for wakeup */
+struct snd_pcm_mmap_control {
+       snd_pcm_uframes_t appl_ptr;     /* RW: appl ptr (0...boundary-1) */
+       snd_pcm_uframes_t avail_min;    /* RW: min available frames for wakeup */
 };
 
 #define SNDRV_PCM_SYNC_PTR_HWSYNC      (1<<0)  /* execute hwsync */
 #define SNDRV_PCM_SYNC_PTR_APPL                (1<<1)  /* get appl_ptr from driver (r/w op) */
 #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN   (1<<2)  /* get avail_min from driver */
 
-struct sndrv_pcm_sync_ptr {
+struct snd_pcm_sync_ptr {
        unsigned int flags;
        union {
-               struct sndrv_pcm_mmap_status status;
+               struct snd_pcm_mmap_status status;
                unsigned char reserved[64];
        } s;
        union {
-               struct sndrv_pcm_mmap_control control;
+               struct snd_pcm_mmap_control control;
                unsigned char reserved[64];
        } c;
 };
 
-struct sndrv_xferi {
-       sndrv_pcm_sframes_t result;
-       void *buf;
-       sndrv_pcm_uframes_t frames;
+struct snd_xferi {
+       snd_pcm_sframes_t result;
+       void __user *buf;
+       snd_pcm_uframes_t frames;
 };
 
-struct sndrv_xfern {
-       sndrv_pcm_sframes_t result;
-       void **bufs;
-       sndrv_pcm_uframes_t frames;
+struct snd_xfern {
+       snd_pcm_sframes_t result;
+       void __user * __user *bufs;
+       snd_pcm_uframes_t frames;
 };
 
-
 enum {
        SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
        SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,        /* posix_clock_monotonic equivalent */
@@ -520,40 +499,35 @@ enum {
 #define SNDRV_CHMAP_PHASE_INVERSE      (0x01 << 16)
 #define SNDRV_CHMAP_DRIVER_SPEC                (0x02 << 16)
 
-enum {
-       SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
-       SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info),
-       SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
-       SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int),
-       SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params),
-       SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params),
-       SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
-       SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params),
-       SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status),
-       SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t),
-       SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22),
-       SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr),
-       SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info),
-       SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
-       SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
-       SNDRV_PCM_IOCTL_START = _IO('A', 0x42),
-       SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43),
-       SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44),
-       SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int),
-       SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t),
-       SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47),
-       SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48),
-       SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t),
-       SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi),
-       SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi),
-       SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern),
-       SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern),
-       SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int),
-       SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
-};
-
-/* Trick to make alsa-lib/acinclude.m4 happy */
-#define SNDRV_PCM_IOCTL_REWIND SNDRV_PCM_IOCTL_REWIND
+#define SNDRV_PCM_IOCTL_PVERSION       _IOR('A', 0x00, int)
+#define SNDRV_PCM_IOCTL_INFO           _IOR('A', 0x01, struct snd_pcm_info)
+#define SNDRV_PCM_IOCTL_TSTAMP         _IOW('A', 0x02, int)
+#define SNDRV_PCM_IOCTL_TTSTAMP                _IOW('A', 0x03, int)
+#define SNDRV_PCM_IOCTL_HW_REFINE      _IOWR('A', 0x10, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_PARAMS      _IOWR('A', 0x11, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_FREE                _IO('A', 0x12)
+#define SNDRV_PCM_IOCTL_SW_PARAMS      _IOWR('A', 0x13, struct snd_pcm_sw_params)
+#define SNDRV_PCM_IOCTL_STATUS         _IOR('A', 0x20, struct snd_pcm_status)
+#define SNDRV_PCM_IOCTL_DELAY          _IOR('A', 0x21, snd_pcm_sframes_t)
+#define SNDRV_PCM_IOCTL_HWSYNC         _IO('A', 0x22)
+#define SNDRV_PCM_IOCTL_SYNC_PTR       _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
+#define SNDRV_PCM_IOCTL_CHANNEL_INFO   _IOR('A', 0x32, struct snd_pcm_channel_info)
+#define SNDRV_PCM_IOCTL_PREPARE                _IO('A', 0x40)
+#define SNDRV_PCM_IOCTL_RESET          _IO('A', 0x41)
+#define SNDRV_PCM_IOCTL_START          _IO('A', 0x42)
+#define SNDRV_PCM_IOCTL_DROP           _IO('A', 0x43)
+#define SNDRV_PCM_IOCTL_DRAIN          _IO('A', 0x44)
+#define SNDRV_PCM_IOCTL_PAUSE          _IOW('A', 0x45, int)
+#define SNDRV_PCM_IOCTL_REWIND         _IOW('A', 0x46, snd_pcm_uframes_t)
+#define SNDRV_PCM_IOCTL_RESUME         _IO('A', 0x47)
+#define SNDRV_PCM_IOCTL_XRUN           _IO('A', 0x48)
+#define SNDRV_PCM_IOCTL_FORWARD                _IOW('A', 0x49, snd_pcm_uframes_t)
+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES  _IOW('A', 0x50, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_READI_FRAMES   _IOR('A', 0x51, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES  _IOW('A', 0x52, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_READN_FRAMES   _IOR('A', 0x53, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_LINK           _IOW('A', 0x60, int)
+#define SNDRV_PCM_IOCTL_UNLINK         _IO('A', 0x61)
 
 /*****************************************************************************
  *                                                                           *
@@ -567,7 +541,7 @@ enum {
 
 #define SNDRV_RAWMIDI_VERSION          SNDRV_PROTOCOL_VERSION(2, 0, 0)
 
-enum sndrv_rawmidi_stream {
+enum {
        SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
        SNDRV_RAWMIDI_STREAM_INPUT,
        SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
@@ -577,7 +551,7 @@ enum sndrv_rawmidi_stream {
 #define SNDRV_RAWMIDI_INFO_INPUT               0x00000002
 #define SNDRV_RAWMIDI_INFO_DUPLEX              0x00000004
 
-struct sndrv_rawmidi_info {
+struct snd_rawmidi_info {
        unsigned int device;            /* RO/WR (control): device number */
        unsigned int subdevice;         /* RO/WR (control): subdevice number */
        int stream;                     /* WR: stream */
@@ -591,7 +565,7 @@ struct sndrv_rawmidi_info {
        unsigned char reserved[64];     /* reserved for future use */
 };
 
-struct sndrv_rawmidi_params {
+struct snd_rawmidi_params {
        int stream;
        size_t buffer_size;             /* queue size in bytes */
        size_t avail_min;               /* minimum avail bytes for wakeup */
@@ -599,7 +573,7 @@ struct sndrv_rawmidi_params {
        unsigned char reserved[16];     /* reserved for future use */
 };
 
-struct sndrv_rawmidi_status {
+struct snd_rawmidi_status {
        int stream;
        struct timespec tstamp;         /* Timestamp */
        size_t avail;                   /* available bytes */
@@ -607,14 +581,12 @@ struct sndrv_rawmidi_status {
        unsigned char reserved[16];     /* reserved for future use */
 };
 
-enum {
-       SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int),
-       SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info),
-       SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params),
-       SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status),
-       SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int),
-       SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
-};
+#define SNDRV_RAWMIDI_IOCTL_PVERSION   _IOR('W', 0x00, int)
+#define SNDRV_RAWMIDI_IOCTL_INFO       _IOR('W', 0x01, struct snd_rawmidi_info)
+#define SNDRV_RAWMIDI_IOCTL_PARAMS     _IOWR('W', 0x10, struct snd_rawmidi_params)
+#define SNDRV_RAWMIDI_IOCTL_STATUS     _IOWR('W', 0x20, struct snd_rawmidi_status)
+#define SNDRV_RAWMIDI_IOCTL_DROP       _IOW('W', 0x30, int)
+#define SNDRV_RAWMIDI_IOCTL_DRAIN      _IOW('W', 0x31, int)
 
 /*
  *  Timer section - /dev/snd/timer
@@ -622,7 +594,7 @@ enum {
 
 #define SNDRV_TIMER_VERSION            SNDRV_PROTOCOL_VERSION(2, 0, 6)
 
-enum sndrv_timer_class {
+enum {
        SNDRV_TIMER_CLASS_NONE = -1,
        SNDRV_TIMER_CLASS_SLAVE = 0,
        SNDRV_TIMER_CLASS_GLOBAL,
@@ -632,7 +604,7 @@ enum sndrv_timer_class {
 };
 
 /* slave timer classes */
-enum sndrv_timer_slave_class {
+enum {
        SNDRV_TIMER_SCLASS_NONE = 0,
        SNDRV_TIMER_SCLASS_APPLICATION,
        SNDRV_TIMER_SCLASS_SEQUENCER,           /* alias */
@@ -649,7 +621,7 @@ enum sndrv_timer_slave_class {
 /* info flags */
 #define SNDRV_TIMER_FLG_SLAVE          (1<<0)  /* cannot be controlled */
 
-struct sndrv_timer_id {
+struct snd_timer_id {
        int dev_class;
        int dev_sclass;
        int card;
@@ -657,8 +629,8 @@ struct sndrv_timer_id {
        int subdevice;
 };
 
-struct sndrv_timer_ginfo {
-       struct sndrv_timer_id tid;      /* requested timer ID */
+struct snd_timer_ginfo {
+       struct snd_timer_id tid;        /* requested timer ID */
        unsigned int flags;             /* timer flags - SNDRV_TIMER_FLG_* */
        int card;                       /* card number */
        unsigned char id[64];           /* timer identification */
@@ -671,27 +643,27 @@ struct sndrv_timer_ginfo {
        unsigned char reserved[32];
 };
 
-struct sndrv_timer_gparams {
-       struct sndrv_timer_id tid;      /* requested timer ID */
+struct snd_timer_gparams {
+       struct snd_timer_id tid;        /* requested timer ID */
        unsigned long period_num;       /* requested precise period duration (in seconds) - numerator */
        unsigned long period_den;       /* requested precise period duration (in seconds) - denominator */
        unsigned char reserved[32];
 };
 
-struct sndrv_timer_gstatus {
-       struct sndrv_timer_id tid;      /* requested timer ID */
+struct snd_timer_gstatus {
+       struct snd_timer_id tid;        /* requested timer ID */
        unsigned long resolution;       /* current period resolution in ns */
        unsigned long resolution_num;   /* precise current period resolution (in seconds) - numerator */
        unsigned long resolution_den;   /* precise current period resolution (in seconds) - denominator */
        unsigned char reserved[32];
 };
 
-struct sndrv_timer_select {
-       struct sndrv_timer_id id;       /* bind to timer ID */
+struct snd_timer_select {
+       struct snd_timer_id id; /* bind to timer ID */
        unsigned char reserved[32];     /* reserved */
 };
 
-struct sndrv_timer_info {
+struct snd_timer_info {
        unsigned int flags;             /* timer flags - SNDRV_TIMER_FLG_* */
        int card;                       /* card number */
        unsigned char id[64];           /* timer identificator */
@@ -705,7 +677,7 @@ struct sndrv_timer_info {
 #define SNDRV_TIMER_PSFLG_EXCLUSIVE    (1<<1)  /* exclusive use, precise start/stop/pause/continue */
 #define SNDRV_TIMER_PSFLG_EARLY_EVENT  (1<<2)  /* write early event to the poll queue */
 
-struct sndrv_timer_params {
+struct snd_timer_params {
        unsigned int flags;             /* flags - SNDRV_MIXER_PSFLG_* */
        unsigned int ticks;             /* requested resolution in ticks */
        unsigned int queue_size;        /* total size of queue (32-1024) */
@@ -714,7 +686,7 @@ struct sndrv_timer_params {
        unsigned char reserved[60];     /* reserved */
 };
 
-struct sndrv_timer_status {
+struct snd_timer_status {
        struct timespec tstamp;         /* Timestamp - last update */
        unsigned int resolution;        /* current period resolution in ns */
        unsigned int lost;              /* counter of master tick lost */
@@ -723,30 +695,28 @@ struct sndrv_timer_status {
        unsigned char reserved[64];     /* reserved */
 };
 
-enum {
-       SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
-       SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id),
-       SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int),
-       SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo),
-       SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams),
-       SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus),
-       SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select),
-       SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info),
-       SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params),
-       SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status),
-       /* The following four ioctls are changed since 1.0.9 due to confliction */
-       SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0),
-       SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1),
-       SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2),
-       SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
-};
-
-struct sndrv_timer_read {
+#define SNDRV_TIMER_IOCTL_PVERSION     _IOR('T', 0x00, int)
+#define SNDRV_TIMER_IOCTL_NEXT_DEVICE  _IOWR('T', 0x01, struct snd_timer_id)
+#define SNDRV_TIMER_IOCTL_TREAD                _IOW('T', 0x02, int)
+#define SNDRV_TIMER_IOCTL_GINFO                _IOWR('T', 0x03, struct snd_timer_ginfo)
+#define SNDRV_TIMER_IOCTL_GPARAMS      _IOW('T', 0x04, struct snd_timer_gparams)
+#define SNDRV_TIMER_IOCTL_GSTATUS      _IOWR('T', 0x05, struct snd_timer_gstatus)
+#define SNDRV_TIMER_IOCTL_SELECT       _IOW('T', 0x10, struct snd_timer_select)
+#define SNDRV_TIMER_IOCTL_INFO         _IOR('T', 0x11, struct snd_timer_info)
+#define SNDRV_TIMER_IOCTL_PARAMS       _IOW('T', 0x12, struct snd_timer_params)
+#define SNDRV_TIMER_IOCTL_STATUS       _IOR('T', 0x14, struct snd_timer_status)
+/* The following four ioctls are changed since 1.0.9 due to confliction */
+#define SNDRV_TIMER_IOCTL_START                _IO('T', 0xa0)
+#define SNDRV_TIMER_IOCTL_STOP         _IO('T', 0xa1)
+#define SNDRV_TIMER_IOCTL_CONTINUE     _IO('T', 0xa2)
+#define SNDRV_TIMER_IOCTL_PAUSE                _IO('T', 0xa3)
+
+struct snd_timer_read {
        unsigned int resolution;
        unsigned int ticks;
 };
 
-enum sndrv_timer_event {
+enum {
        SNDRV_TIMER_EVENT_RESOLUTION = 0,       /* val = resolution in ns */
        SNDRV_TIMER_EVENT_TICK,                 /* val = ticks */
        SNDRV_TIMER_EVENT_START,                /* val = resolution in ns */
@@ -765,7 +735,7 @@ enum sndrv_timer_event {
        SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
 };
 
-struct sndrv_timer_tread {
+struct snd_timer_tread {
        int event;
        struct timespec tstamp;
        unsigned int val;
@@ -779,7 +749,7 @@ struct sndrv_timer_tread {
 
 #define SNDRV_CTL_VERSION              SNDRV_PROTOCOL_VERSION(2, 0, 7)
 
-struct sndrv_ctl_card_info {
+struct snd_ctl_card_info {
        int card;                       /* card number */
        int pad;                        /* reserved for future (was type) */
        unsigned char id[16];           /* ID of card (user selectable) */
@@ -791,27 +761,25 @@ struct sndrv_ctl_card_info {
        unsigned char components[128];  /* card components / fine identification, delimited with one space (AC97 etc..) */
 };
 
-enum sndrv_ctl_elem_type {
-       SNDRV_CTL_ELEM_TYPE_NONE = 0,           /* invalid */
-       SNDRV_CTL_ELEM_TYPE_BOOLEAN,            /* boolean type */
-       SNDRV_CTL_ELEM_TYPE_INTEGER,            /* integer type */
-       SNDRV_CTL_ELEM_TYPE_ENUMERATED,         /* enumerated type */
-       SNDRV_CTL_ELEM_TYPE_BYTES,              /* byte array */
-       SNDRV_CTL_ELEM_TYPE_IEC958,             /* IEC958 (S/PDIF) setup */
-       SNDRV_CTL_ELEM_TYPE_INTEGER64,          /* 64-bit integer type */
-       SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64,
-};
-
-enum sndrv_ctl_elem_iface {
-       SNDRV_CTL_ELEM_IFACE_CARD = 0,          /* global control */
-       SNDRV_CTL_ELEM_IFACE_HWDEP,             /* hardware dependent device */
-       SNDRV_CTL_ELEM_IFACE_MIXER,             /* virtual mixer device */
-       SNDRV_CTL_ELEM_IFACE_PCM,               /* PCM device */
-       SNDRV_CTL_ELEM_IFACE_RAWMIDI,           /* RawMidi device */
-       SNDRV_CTL_ELEM_IFACE_TIMER,             /* timer device */
-       SNDRV_CTL_ELEM_IFACE_SEQUENCER,         /* sequencer client */
-       SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
-};
+typedef int __bitwise snd_ctl_elem_type_t;
+#define        SNDRV_CTL_ELEM_TYPE_NONE        ((__force snd_ctl_elem_type_t) 0) /* invalid */
+#define        SNDRV_CTL_ELEM_TYPE_BOOLEAN     ((__force snd_ctl_elem_type_t) 1) /* boolean type */
+#define        SNDRV_CTL_ELEM_TYPE_INTEGER     ((__force snd_ctl_elem_type_t) 2) /* integer type */
+#define        SNDRV_CTL_ELEM_TYPE_ENUMERATED  ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
+#define        SNDRV_CTL_ELEM_TYPE_BYTES       ((__force snd_ctl_elem_type_t) 4) /* byte array */
+#define        SNDRV_CTL_ELEM_TYPE_IEC958      ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
+#define        SNDRV_CTL_ELEM_TYPE_INTEGER64   ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
+#define        SNDRV_CTL_ELEM_TYPE_LAST        SNDRV_CTL_ELEM_TYPE_INTEGER64
+
+typedef int __bitwise snd_ctl_elem_iface_t;
+#define        SNDRV_CTL_ELEM_IFACE_CARD       ((__force snd_ctl_elem_iface_t) 0) /* global control */
+#define        SNDRV_CTL_ELEM_IFACE_HWDEP      ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
+#define        SNDRV_CTL_ELEM_IFACE_MIXER      ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
+#define        SNDRV_CTL_ELEM_IFACE_PCM        ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
+#define        SNDRV_CTL_ELEM_IFACE_RAWMIDI    ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
+#define        SNDRV_CTL_ELEM_IFACE_TIMER      ((__force snd_ctl_elem_iface_t) 5) /* timer device */
+#define        SNDRV_CTL_ELEM_IFACE_SEQUENCER  ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
+#define        SNDRV_CTL_ELEM_IFACE_LAST       SNDRV_CTL_ELEM_IFACE_SEQUENCER
 
 #define SNDRV_CTL_ELEM_ACCESS_READ             (1<<0)
 #define SNDRV_CTL_ELEM_ACCESS_WRITE            (1<<1)
@@ -837,30 +805,30 @@ enum sndrv_ctl_elem_iface {
 #define SNDRV_CTL_POWER_D3hot          (SNDRV_CTL_POWER_D3|0x0000)     /* Off, with power */
 #define SNDRV_CTL_POWER_D3cold         (SNDRV_CTL_POWER_D3|0x0001)     /* Off, without power */
 
-struct sndrv_ctl_elem_id {
+struct snd_ctl_elem_id {
        unsigned int numid;             /* numeric identifier, zero = invalid */
-       int iface;                      /* interface identifier */
+       snd_ctl_elem_iface_t iface;     /* interface identifier */
        unsigned int device;            /* device/client number */
        unsigned int subdevice;         /* subdevice (substream) number */
        unsigned char name[44];         /* ASCII name of item */
        unsigned int index;             /* index of item */
 };
 
-struct sndrv_ctl_elem_list {
+struct snd_ctl_elem_list {
        unsigned int offset;            /* W: first element ID to get */
        unsigned int space;             /* W: count of element IDs to get */
        unsigned int used;              /* R: count of element IDs set */
        unsigned int count;             /* R: count of all elements */
-       struct sndrv_ctl_elem_id *pids; /* R: IDs */
+       struct snd_ctl_elem_id __user *pids; /* R: IDs */
        unsigned char reserved[50];
 };
 
-struct sndrv_ctl_elem_info {
-       struct sndrv_ctl_elem_id id;    /* W: element ID */
-       int type;                       /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
+struct snd_ctl_elem_info {
+       struct snd_ctl_elem_id id;      /* W: element ID */
+       snd_ctl_elem_type_t type;       /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
        unsigned int access;            /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
        unsigned int count;             /* count of values */
-       pid_t owner;                    /* owner's PID of this control */
+       __kernel_pid_t owner;           /* owner's PID of this control */
        union {
                struct {
                        long min;               /* R: minimum value */
@@ -888,8 +856,8 @@ struct sndrv_ctl_elem_info {
        unsigned char reserved[64-4*sizeof(unsigned short)];
 };
 
-struct sndrv_ctl_elem_value {
-       struct sndrv_ctl_elem_id id;    /* W: element ID */
+struct snd_ctl_elem_value {
+       struct snd_ctl_elem_id id;      /* W: element ID */
        unsigned int indirect: 1;       /* W: indirect access - obsoleted */
        union {
                union {
@@ -908,45 +876,43 @@ struct sndrv_ctl_elem_value {
                        unsigned char data[512];
                        unsigned char *data_ptr;        /* obsoleted */
                } bytes;
-               struct sndrv_aes_iec958 iec958;
+               struct snd_aes_iec958 iec958;
        } value;                /* RO */
        struct timespec tstamp;
        unsigned char reserved[128-sizeof(struct timespec)];
 };
 
-struct sndrv_ctl_tlv {
+struct snd_ctl_tlv {
        unsigned int numid;     /* control element numeric identification */
        unsigned int length;    /* in bytes aligned to 4 */
        unsigned int tlv[0];    /* first TLV */
 };
 
-enum {
-       SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
-       SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info),
-       SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list),
-       SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info),
-       SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value),
-       SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value),
-       SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id),
-       SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id),
-       SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int),
-       SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct sndrv_ctl_elem_info),
-       SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct sndrv_ctl_elem_info),
-       SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct sndrv_ctl_elem_id),
-       SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct sndrv_ctl_tlv),
-       SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct sndrv_ctl_tlv),
-       SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct sndrv_ctl_tlv),
-       SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
-       SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info),
-       SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
-       SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info),
-       SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int),
-       SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int),
-       SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info),
-       SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
-       SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
-       SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
-};
+#define SNDRV_CTL_IOCTL_PVERSION       _IOR('U', 0x00, int)
+#define SNDRV_CTL_IOCTL_CARD_INFO      _IOR('U', 0x01, struct snd_ctl_card_info)
+#define SNDRV_CTL_IOCTL_ELEM_LIST      _IOWR('U', 0x10, struct snd_ctl_elem_list)
+#define SNDRV_CTL_IOCTL_ELEM_INFO      _IOWR('U', 0x11, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_READ      _IOWR('U', 0x12, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_WRITE     _IOWR('U', 0x13, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_LOCK      _IOW('U', 0x14, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_ELEM_UNLOCK    _IOW('U', 0x15, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
+#define SNDRV_CTL_IOCTL_ELEM_ADD       _IOWR('U', 0x17, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REPLACE   _IOWR('U', 0x18, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REMOVE    _IOWR('U', 0x19, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_TLV_READ       _IOWR('U', 0x1a, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_TLV_WRITE      _IOWR('U', 0x1b, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_TLV_COMMAND    _IOWR('U', 0x1c, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
+#define SNDRV_CTL_IOCTL_HWDEP_INFO     _IOR('U', 0x21, struct snd_hwdep_info)
+#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE        _IOR('U', 0x30, int)
+#define SNDRV_CTL_IOCTL_PCM_INFO       _IOWR('U', 0x31, struct snd_pcm_info)
+#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
+#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
+#define SNDRV_CTL_IOCTL_RAWMIDI_INFO   _IOWR('U', 0x41, struct snd_rawmidi_info)
+#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
+#define SNDRV_CTL_IOCTL_POWER          _IOWR('U', 0xd0, int)
+#define SNDRV_CTL_IOCTL_POWER_STATE    _IOR('U', 0xd1, int)
 
 /*
  *  Read interface.
@@ -963,12 +929,12 @@ enum sndrv_ctl_event_type {
 #define SNDRV_CTL_EVENT_MASK_TLV       (1<<3)  /* element TLV tree was changed */
 #define SNDRV_CTL_EVENT_MASK_REMOVE    (~0U)   /* element was removed */
 
-struct sndrv_ctl_event {
+struct snd_ctl_event {
        int type;       /* event type - SNDRV_CTL_EVENT_* */
        union {
                struct {
                        unsigned int mask;
-                       struct sndrv_ctl_elem_id id;
+                       struct snd_ctl_elem_id id;
                } elem;
                unsigned char data8[60];
        } data;
@@ -992,4 +958,4 @@ struct sndrv_ctl_event {
 #define SNDRV_CTL_NAME_IEC958_PCM_STREAM               "PCM Stream"
 #define SNDRV_CTL_NAME_IEC958(expl,direction,what)     "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
 
-#endif /* __SOUND_ASOUND_H */
+#endif /* _UAPI__SOUND_ASOUND_H */
index 1920c99..90c4ba7 100644 (file)
@@ -217,7 +217,7 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
 {
        int inum;
        snd_ctl_hw_t *hw = handle->private_data;
-       struct sndrv_ctl_tlv *xtlv;
+       struct snd_ctl_tlv *xtlv;
        
        /* we don't support TLV on protocol ver 2.0.3 or earlier */
        if (hw->protocol < SNDRV_PROTOCOL_VERSION(2, 0, 4))
@@ -229,7 +229,7 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
        case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break;
        default: return -EINVAL;
        }
-       xtlv = malloc(sizeof(struct sndrv_ctl_tlv) + tlv_size);
+       xtlv = malloc(sizeof(struct snd_ctl_tlv) + tlv_size);
        if (xtlv == NULL)
                return -ENOMEM; 
        xtlv->numid = numid;
index f8b68ed..e16b07f 100644 (file)
@@ -895,7 +895,7 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
        pcm->tstamp_mode = params->tstamp_mode;
        pcm->period_step = params->period_step;
        pcm->avail_min = params->avail_min;
-       pcm->period_event = params->period_event;
+       pcm->period_event = sw_get_period_event(params);
        pcm->start_threshold = params->start_threshold;
        pcm->stop_threshold = params->stop_threshold;
        pcm->silence_threshold = params->silence_threshold;
@@ -5572,7 +5572,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
        params->period_step = pcm->period_step;
        params->sleep_min = 0;
        params->avail_min = pcm->avail_min;
-       params->period_event = pcm->period_event;
+       sw_set_period_event(params, pcm->period_event);
        params->xfer_align = 1;
        params->start_threshold = pcm->start_threshold;
        params->stop_threshold = pcm->stop_threshold;
@@ -5880,7 +5880,7 @@ int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_u
 int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val)
 {
        assert(pcm && params);
-       params->period_event = val;
+       sw_set_period_event(params, val);
        return 0;
 }
 
@@ -5893,7 +5893,7 @@ int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *para
 int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val)
 {
        assert(params && val);
-       *val = params->period_event;
+       *val = sw_get_period_event(params);
        return 0;
 }
 
index 649bf9d..0f3226d 100644 (file)
@@ -63,7 +63,7 @@ struct sndrv_pcm_hw_params_old {
        unsigned int flags;
        unsigned int masks[SNDRV_PCM_HW_PARAM_SUBFORMAT -
                           SNDRV_PCM_HW_PARAM_ACCESS + 1];
-       struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME -
+       struct snd_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME -
                                        SNDRV_PCM_HW_PARAM_SAMPLE_BITS + 1];
        unsigned int rmask;
        unsigned int cmask;
@@ -92,9 +92,9 @@ typedef struct {
        int fd;
        int card, device, subdevice;
        int sync_ptr_ioctl;
-       volatile struct sndrv_pcm_mmap_status * mmap_status;
-       struct sndrv_pcm_mmap_control *mmap_control;
-       struct sndrv_pcm_sync_ptr *sync_ptr;
+       volatile struct snd_pcm_mmap_status * mmap_status;
+       struct snd_pcm_mmap_control *mmap_control;
+       struct snd_pcm_sync_ptr *sync_ptr;
        snd_pcm_uframes_t hw_ptr;
        snd_pcm_uframes_t appl_ptr;
        int period_event;
@@ -116,7 +116,7 @@ typedef struct {
 
 /* update appl_ptr with driver */
 #define FAST_PCM_STATE(hw) \
-       ((enum sndrv_pcm_state) (hw)->mmap_status->state)
+       ((snd_pcm_state_t) (hw)->mmap_status->state)
 #define FAST_PCM_TSTAMP(hw) \
        ((hw)->mmap_status->tstamp)
 
@@ -434,8 +434,8 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
 {
        snd_pcm_hw_t *hw = pcm->private_data;
        int fd = hw->fd, err;
-       int old_period_event = params->period_event;
-       params->period_event = 0;
+       int old_period_event = sw_get_period_event(params);
+       sw_set_period_event(params, 0);
        if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode &&
            params->period_step == pcm->period_step &&
            params->start_threshold == pcm->start_threshold &&
@@ -451,7 +451,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
                SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
                return err;
        }
-       params->period_event = old_period_event;
+       sw_set_period_event(params, old_period_event);
        hw->mmap_control->avail_min = params->avail_min;
        if (hw->period_event != old_period_event) {
                err = snd_pcm_hw_change_timer(pcm, old_period_event);
@@ -465,7 +465,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
 static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
 {
        snd_pcm_hw_t *hw = pcm->private_data;
-       struct sndrv_pcm_channel_info i;
+       struct snd_pcm_channel_info i;
        int fd = hw->fd, err;
        i.channel = info->channel;
        if (ioctl(fd, SNDRV_PCM_IOCTL_CHANNEL_INFO, &i) < 0) {
@@ -761,7 +761,7 @@ static snd_pcm_sframes_t snd_pcm_hw_writei(snd_pcm_t *pcm, const void *buffer, s
        int err;
        snd_pcm_hw_t *hw = pcm->private_data;
        int fd = hw->fd;
-       struct sndrv_xferi xferi;
+       struct snd_xferi xferi;
        xferi.buf = (char*) buffer;
        xferi.frames = size;
        xferi.result = 0; /* make valgrind happy */
@@ -780,7 +780,7 @@ static snd_pcm_sframes_t snd_pcm_hw_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_
        int err;
        snd_pcm_hw_t *hw = pcm->private_data;
        int fd = hw->fd;
-       struct sndrv_xfern xfern;
+       struct snd_xfern xfern;
        memset(&xfern, 0, sizeof(xfern)); /* make valgrind happy */
        xfern.bufs = bufs;
        xfern.frames = size;
@@ -799,7 +799,7 @@ static snd_pcm_sframes_t snd_pcm_hw_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_
        int err;
        snd_pcm_hw_t *hw = pcm->private_data;
        int fd = hw->fd;
-       struct sndrv_xferi xferi;
+       struct snd_xferi xferi;
        xferi.buf = buffer;
        xferi.frames = size;
        xferi.result = 0; /* make valgrind happy */
@@ -818,7 +818,7 @@ static snd_pcm_sframes_t snd_pcm_hw_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_u
        int err;
        snd_pcm_hw_t *hw = pcm->private_data;
        int fd = hw->fd;
-       struct sndrv_xfern xfern;
+       struct snd_xfern xfern;
        memset(&xfern, 0, sizeof(xfern)); /* make valgrind happy */
        xfern.bufs = bufs;
        xfern.frames = size;
@@ -835,12 +835,12 @@ static snd_pcm_sframes_t snd_pcm_hw_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_u
 static int snd_pcm_hw_mmap_status(snd_pcm_t *pcm)
 {
        snd_pcm_hw_t *hw = pcm->private_data;
-       struct sndrv_pcm_sync_ptr sync_ptr;
+       struct snd_pcm_sync_ptr sync_ptr;
        void *ptr;
        int err;
        ptr = MAP_FAILED;
        if (hw->sync_ptr_ioctl == 0)
-               ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_status)),
+               ptr = mmap(NULL, page_align(sizeof(struct snd_pcm_mmap_status)),
                           PROT_READ, MAP_FILE|MAP_SHARED, 
                           hw->fd, SNDRV_PCM_MMAP_OFFSET_STATUS);
        if (ptr == MAP_FAILED || ptr == NULL) {
@@ -853,7 +853,7 @@ static int snd_pcm_hw_mmap_status(snd_pcm_t *pcm)
                        SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
                        return err;
                }
-               hw->sync_ptr = calloc(1, sizeof(struct sndrv_pcm_sync_ptr));
+               hw->sync_ptr = calloc(1, sizeof(struct snd_pcm_sync_ptr));
                if (hw->sync_ptr == NULL)
                        return -ENOMEM;
                hw->mmap_status = &hw->sync_ptr->s.status;
@@ -862,7 +862,7 @@ static int snd_pcm_hw_mmap_status(snd_pcm_t *pcm)
        } else {
                hw->mmap_status = ptr;
        }
-       snd_pcm_set_hw_ptr(pcm, &hw->mmap_status->hw_ptr, hw->fd, SNDRV_PCM_MMAP_OFFSET_STATUS + offsetof(struct sndrv_pcm_mmap_status, hw_ptr));
+       snd_pcm_set_hw_ptr(pcm, &hw->mmap_status->hw_ptr, hw->fd, SNDRV_PCM_MMAP_OFFSET_STATUS + offsetof(struct snd_pcm_mmap_status, hw_ptr));
        return 0;
 }
 
@@ -872,7 +872,7 @@ static int snd_pcm_hw_mmap_control(snd_pcm_t *pcm)
        void *ptr;
        int err;
        if (hw->sync_ptr == NULL) {
-               ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_control)),
+               ptr = mmap(NULL, page_align(sizeof(struct snd_pcm_mmap_control)),
                           PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, 
                           hw->fd, SNDRV_PCM_MMAP_OFFSET_CONTROL);
                if (ptr == MAP_FAILED || ptr == NULL) {
index 8cf7c3d..c616e56 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <sys/uio.h>
+#include <sys/time.h>
 
 #define _snd_mask sndrv_mask
 #define _snd_pcm_access_mask _snd_mask
@@ -38,7 +39,6 @@
 #define SND_MASK_INLINE
 #include "mask.h"
 
-typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
 #define SND_PCM_HW_PARAM_ACCESS SNDRV_PCM_HW_PARAM_ACCESS
 #define SND_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_FIRST_MASK
 #define SND_PCM_HW_PARAM_FORMAT SNDRV_PCM_HW_PARAM_FORMAT
@@ -578,7 +578,7 @@ static inline int muldiv_near(int a, int b, int c)
 }
 
 int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
-int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
 int snd_pcm_hw_refine_soft(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
 int snd_pcm_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
                            int (*cprepare)(snd_pcm_t *pcm,
@@ -995,3 +995,13 @@ static inline int snd_pcm_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes
        return 1;
 }
 
+/* hack to access to internal period_event in snd_pcm_sw_parmams */
+static inline int sw_get_period_event(const snd_pcm_sw_params_t *params)
+{
+       return params->reserved[sizeof(params->reserved) / sizeof(params->reserved[0])- 1];
+}
+
+static inline void sw_set_period_event(snd_pcm_sw_params_t *params, int val)
+{
+       params->reserved[sizeof(params->reserved) / sizeof(params->reserved[0]) - 1] = val;
+}
index b085d42..0b66e8c 100644 (file)
@@ -2309,7 +2309,7 @@ int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
    max periods
    Return 0 on success otherwise a negative error code
 */
-int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 {
        int err;
        snd_pcm_sw_params_t sw;
index f5dfe9c..620ca3f 100644 (file)
@@ -1899,7 +1899,7 @@ int snd_seq_port_info_get_port(const snd_seq_port_info_t *info)
 const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info)
 {
        assert(info);
-       return &info->addr;
+       return (const snd_seq_addr_t *) &info->addr;
 }
 
 /**
@@ -2094,7 +2094,7 @@ void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port)
 void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr)
 {
        assert(info);
-       info->addr = *addr;
+       info->addr = *(const struct sndrv_seq_addr *)addr;
 }
 
 /**
@@ -2444,7 +2444,7 @@ void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_po
 const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info)
 {
        assert(info);
-       return &info->sender;
+       return (const snd_seq_addr_t *)&info->sender;
 }
 
 /**
@@ -2456,7 +2456,7 @@ const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subsc
 const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info)
 {
        assert(info);
-       return &info->dest;
+       return (const snd_seq_addr_t *)&info->dest;
 }
 
 /**
@@ -2729,7 +2729,7 @@ int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info)
 const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info)
 {
        assert(info);
-       return &info->root;
+       return (const snd_seq_addr_t *)&info->root;
 }
 
 /**
@@ -2781,7 +2781,7 @@ int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info)
 const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info)
 {
        assert(info);
-       return &info->addr;
+       return (const snd_seq_addr_t *)&info->addr;
 }
 
 /**
@@ -2872,7 +2872,7 @@ void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port)
 void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr)
 {
        assert(info);
-       info->root = *addr;
+       info->root = *(const struct snd_seq_addr *)addr;
 }
 
 /**
@@ -3227,7 +3227,7 @@ int snd_seq_query_named_queue(snd_seq_t *seq, const char *name)
  */
 int snd_seq_get_queue_usage(snd_seq_t *seq, int q)
 {
-       struct sndrv_seq_queue_client info;
+       struct snd_seq_queue_client info;
        int err;
        assert(seq);
        memset(&info, 0, sizeof(info));
@@ -3249,7 +3249,7 @@ int snd_seq_get_queue_usage(snd_seq_t *seq, int q)
  */
 int snd_seq_set_queue_usage(snd_seq_t *seq, int q, int used)
 {
-       struct sndrv_seq_queue_client info;
+       struct snd_seq_queue_client info;
        assert(seq);
        memset(&info, 0, sizeof(info));
        info.queue = q;
@@ -3351,7 +3351,7 @@ snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_statu
 const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info)
 {
        assert(info);
-       return &info->time;
+       return (const snd_seq_real_time_t *)&info->time;
 }
 
 /**
@@ -4289,7 +4289,7 @@ int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info)
 const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info)
 {
        assert(info);
-       return &info->time;
+       return (const snd_seq_timestamp_t *)&info->time;
 }
 
 /**
@@ -4302,7 +4302,7 @@ const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_e
 const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info)
 {
        assert(info);
-       return &info->dest;
+       return (const snd_seq_addr_t *)&info->dest;
 }
 
 /**
@@ -4380,7 +4380,7 @@ void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue)
 void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time)
 {
        assert(info);
-       info->time = *time;
+       info->time = *(const union sndrv_seq_timestamp *)time;
 }
 
 /**
@@ -4393,7 +4393,7 @@ void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq
 void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr)
 {
        assert(info);
-       info->dest = *addr;
+       info->dest = *(const struct sndrv_seq_addr *)addr;
 }
 
 /**
@@ -4475,7 +4475,7 @@ static int remove_match(snd_seq_remove_events_t *info, snd_seq_event_t *ev)
                if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_TICK)
                        res = snd_seq_compare_tick_time(&ev->time.tick, &info->time.tick);
                else
-                       res = snd_seq_compare_real_time(&ev->time.time, &info->time.time);
+                       res = snd_seq_compare_real_time(&ev->time.time, (snd_seq_real_time_t *)&info->time.time);
                if (!res)
                        return 0;
        }
@@ -4483,7 +4483,7 @@ static int remove_match(snd_seq_remove_events_t *info, snd_seq_event_t *ev)
                if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_TICK)
                        res = snd_seq_compare_tick_time(&ev->time.tick, &info->time.tick);
                else
-                       res = snd_seq_compare_real_time(&ev->time.time, &info->time.time);
+                       res = snd_seq_compare_real_time(&ev->time.time, (snd_seq_real_time_t *)&info->time.time);
                if (res)
                        return 0;
        }
index 5bb26f3..6cb31d6 100644 (file)
@@ -518,7 +518,7 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
 
 #ifdef SNDRV_SEQ_IOCTL_RUNNING_MODE
        {
-               struct sndrv_seq_running_info run_mode;
+               struct snd_seq_running_info run_mode;
                /* check running mode */
                memset(&run_mode, 0, sizeof(run_mode));
                run_mode.client = client;
index f0a0acd..e600011 100644 (file)
@@ -32,7 +32,7 @@
 #define SND_SEQ_IBUF_SIZE      500             /* in event_size aligned */
 #define DEFAULT_TMPBUF_SIZE    20
 
-typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
+typedef struct snd_seq_queue_client snd_seq_queue_client_t;
 
 
 typedef struct {
index 2fae75e..aa6a0b1 100644 (file)
@@ -35,7 +35,7 @@ const char *_snd_module_timer_hw = "";
 #define SNDRV_FILE_TIMER               ALSA_DEVICE_DIRECTORY "timer"
 #define SNDRV_TIMER_VERSION_MAX        SNDRV_PROTOCOL_VERSION(2, 0, 5)
 
-#define SNDRV_TIMER_IOCTL_STATUS_OLD   _IOW('T', 0x14, struct sndrv_timer_status)
+#define SNDRV_TIMER_IOCTL_STATUS_OLD   _IOW('T', 0x14, struct snd_timer_status)
 
 enum {
        SNDRV_TIMER_IOCTL_START_OLD = _IO('T', 0x20),
@@ -225,7 +225,7 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
 {
        int fd, ver, tmode, ret;
        snd_timer_t *tmr;
-       struct sndrv_timer_select sel;
+       struct snd_timer_select sel;
 
        *handle = NULL;