]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/uapi/sound/asound.h
ALSA: Avoid using timespec for struct snd_timer_tread
[linux.git] / include / uapi / sound / asound.h
index df1153cea0b7ee2a27e19682837f81922fef353e..ad86c5a7a1e2f2fe86081c737aedf802ea1691c1 100644 (file)
@@ -456,8 +456,13 @@ enum {
        SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
 };
 
+#ifndef __KERNEL__
+/* explicit padding avoids incompatibility between i386 and x86-64 */
+typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)] __time_pad;
+
 struct snd_pcm_status {
        snd_pcm_state_t state;          /* stream state */
+       __time_pad pad1;                /* align to timespec */
        struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
        struct timespec tstamp;         /* reference timestamp */
        snd_pcm_uframes_t appl_ptr;     /* appl ptr */
@@ -473,6 +478,7 @@ struct snd_pcm_status {
        __u32 audio_tstamp_accuracy;    /* in ns units, only valid if indicated in audio_tstamp_data */
        unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
 };
+#endif
 
 struct snd_pcm_mmap_status {
        snd_pcm_state_t state;          /* RO: state - SNDRV_PCM_STATE_XXXX */
@@ -648,13 +654,16 @@ struct snd_rawmidi_params {
        unsigned char reserved[16];     /* reserved for future use */
 };
 
+#ifndef __KERNEL__
 struct snd_rawmidi_status {
        int stream;
+       __time_pad pad1;
        struct timespec tstamp;         /* Timestamp */
        size_t avail;                   /* available bytes */
        size_t xruns;                   /* count of overruns since last status (in bytes) */
        unsigned char reserved[16];     /* reserved for future use */
 };
+#endif
 
 #define SNDRV_RAWMIDI_IOCTL_PVERSION   _IOR('W', 0x00, int)
 #define SNDRV_RAWMIDI_IOCTL_INFO       _IOR('W', 0x01, struct snd_rawmidi_info)
@@ -761,6 +770,7 @@ struct snd_timer_params {
        unsigned char reserved[60];     /* reserved */
 };
 
+#ifndef __KERNEL__
 struct snd_timer_status {
        struct timespec tstamp;         /* Timestamp - last update */
        unsigned int resolution;        /* current period resolution in ns */
@@ -769,10 +779,11 @@ struct snd_timer_status {
        unsigned int queue;             /* used queue size */
        unsigned char reserved[64];     /* reserved */
 };
+#endif
 
 #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_TREAD_OLD    _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)
@@ -785,6 +796,15 @@ struct snd_timer_status {
 #define SNDRV_TIMER_IOCTL_STOP         _IO('T', 0xa1)
 #define SNDRV_TIMER_IOCTL_CONTINUE     _IO('T', 0xa2)
 #define SNDRV_TIMER_IOCTL_PAUSE                _IO('T', 0xa3)
+#define SNDRV_TIMER_IOCTL_TREAD64      _IOW('T', 0xa4, int)
+
+#if __BITS_PER_LONG == 64
+#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
+#else
+#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
+                                SNDRV_TIMER_IOCTL_TREAD_OLD : \
+                                SNDRV_TIMER_IOCTL_TREAD64)
+#endif
 
 struct snd_timer_read {
        unsigned int resolution;
@@ -810,11 +830,15 @@ enum {
        SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
 };
 
+#ifndef __KERNEL__
 struct snd_timer_tread {
        int event;
+       __time_pad pad1;
        struct timespec tstamp;
        unsigned int val;
+       __time_pad pad2;
 };
+#endif
 
 /****************************************************************************
  *                                                                          *
@@ -955,8 +979,7 @@ struct snd_ctl_elem_value {
                } bytes;
                struct snd_aes_iec958 iec958;
        } value;                /* RO */
-       struct timespec tstamp;
-       unsigned char reserved[128-sizeof(struct timespec)];
+       unsigned char reserved[128];
 };
 
 struct snd_ctl_tlv {