hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/include/uapi/sound/asound.h
....@@ -26,12 +26,15 @@
2626
2727 #if defined(__KERNEL__) || defined(__linux__)
2828 #include <linux/types.h>
29
+#include <asm/byteorder.h>
2930 #else
31
+#include <endian.h>
3032 #include <sys/ioctl.h>
3133 #endif
3234
3335 #ifndef __KERNEL__
3436 #include <stdlib.h>
37
+#include <time.h>
3538 #endif
3639
3740 /*
....@@ -153,7 +156,7 @@
153156 * *
154157 *****************************************************************************/
155158
156
-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14)
159
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15)
157160
158161 typedef unsigned long snd_pcm_uframes_t;
159162 typedef signed long snd_pcm_sframes_t;
....@@ -300,7 +303,9 @@
300303 #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
301304 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
302305
303
-
306
+#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__
307
+#define __SND_STRUCT_TIME64
308
+#endif
304309
305310 typedef int __bitwise snd_pcm_state_t;
306311 #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
....@@ -316,8 +321,17 @@
316321
317322 enum {
318323 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
319
- SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
320
- SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
324
+ SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
325
+ SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
326
+ SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
327
+ SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
328
+#ifdef __SND_STRUCT_TIME64
329
+ SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
330
+ SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
331
+#else
332
+ SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
333
+ SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
334
+#endif
321335 };
322336
323337 union snd_pcm_sync_id {
....@@ -455,8 +469,13 @@
455469 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
456470 };
457471
472
+#ifndef __KERNEL__
473
+/* explicit padding avoids incompatibility between i386 and x86-64 */
474
+typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad;
475
+
458476 struct snd_pcm_status {
459477 snd_pcm_state_t state; /* stream state */
478
+ __time_pad pad1; /* align to timespec */
460479 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
461480 struct timespec tstamp; /* reference timestamp */
462481 snd_pcm_uframes_t appl_ptr; /* appl ptr */
....@@ -472,17 +491,48 @@
472491 __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
473492 unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
474493 };
494
+#endif
475495
476
-struct snd_pcm_mmap_status {
496
+/*
497
+ * For mmap operations, we need the 64-bit layout, both for compat mode,
498
+ * and for y2038 compatibility. For 64-bit applications, the two definitions
499
+ * are identical, so we keep the traditional version.
500
+ */
501
+#ifdef __SND_STRUCT_TIME64
502
+#define __snd_pcm_mmap_status64 snd_pcm_mmap_status
503
+#define __snd_pcm_mmap_control64 snd_pcm_mmap_control
504
+#define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr
505
+#ifdef __KERNEL__
506
+#define __snd_timespec64 __kernel_timespec
507
+#else
508
+#define __snd_timespec64 timespec
509
+#endif
510
+struct __snd_timespec {
511
+ __s32 tv_sec;
512
+ __s32 tv_nsec;
513
+};
514
+#else
515
+#define __snd_pcm_mmap_status snd_pcm_mmap_status
516
+#define __snd_pcm_mmap_control snd_pcm_mmap_control
517
+#define __snd_pcm_sync_ptr snd_pcm_sync_ptr
518
+#define __snd_timespec timespec
519
+struct __snd_timespec64 {
520
+ __s64 tv_sec;
521
+ __s64 tv_nsec;
522
+};
523
+
524
+#endif
525
+
526
+struct __snd_pcm_mmap_status {
477527 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
478528 int pad1; /* Needed for 64 bit alignment */
479529 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
480
- struct timespec tstamp; /* Timestamp */
530
+ struct __snd_timespec tstamp; /* Timestamp */
481531 snd_pcm_state_t suspended_state; /* RO: suspended stream state */
482
- struct timespec audio_tstamp; /* from sample counter or wall clock */
532
+ struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */
483533 };
484534
485
-struct snd_pcm_mmap_control {
535
+struct __snd_pcm_mmap_control {
486536 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
487537 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
488538 };
....@@ -491,14 +541,59 @@
491541 #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
492542 #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
493543
494
-struct snd_pcm_sync_ptr {
544
+struct __snd_pcm_sync_ptr {
495545 unsigned int flags;
496546 union {
497
- struct snd_pcm_mmap_status status;
547
+ struct __snd_pcm_mmap_status status;
498548 unsigned char reserved[64];
499549 } s;
500550 union {
501
- struct snd_pcm_mmap_control control;
551
+ struct __snd_pcm_mmap_control control;
552
+ unsigned char reserved[64];
553
+ } c;
554
+};
555
+
556
+#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
557
+typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
558
+typedef char __pad_after_uframe[0];
559
+#endif
560
+
561
+#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
562
+typedef char __pad_before_uframe[0];
563
+typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
564
+#endif
565
+
566
+struct __snd_pcm_mmap_status64 {
567
+ snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
568
+ __u32 pad1; /* Needed for 64 bit alignment */
569
+ __pad_before_uframe __pad1;
570
+ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
571
+ __pad_after_uframe __pad2;
572
+ struct __snd_timespec64 tstamp; /* Timestamp */
573
+ snd_pcm_state_t suspended_state;/* RO: suspended stream state */
574
+ __u32 pad3; /* Needed for 64 bit alignment */
575
+ struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */
576
+};
577
+
578
+struct __snd_pcm_mmap_control64 {
579
+ __pad_before_uframe __pad1;
580
+ snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
581
+ __pad_before_uframe __pad2;
582
+
583
+ __pad_before_uframe __pad3;
584
+ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
585
+ __pad_after_uframe __pad4;
586
+};
587
+
588
+struct __snd_pcm_sync_ptr64 {
589
+ __u32 flags;
590
+ __u32 pad1;
591
+ union {
592
+ struct __snd_pcm_mmap_status64 status;
593
+ unsigned char reserved[64];
594
+ } s;
595
+ union {
596
+ struct __snd_pcm_mmap_control64 control;
502597 unsigned char reserved[64];
503598 } c;
504599 };
....@@ -583,6 +678,8 @@
583678 #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
584679 #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
585680 #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
681
+#define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
682
+#define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
586683 #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
587684 #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
588685 #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
....@@ -613,7 +710,7 @@
613710 * Raw MIDI section - /dev/snd/midi??
614711 */
615712
616
-#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
713
+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
617714
618715 enum {
619716 SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
....@@ -647,13 +744,16 @@
647744 unsigned char reserved[16]; /* reserved for future use */
648745 };
649746
747
+#ifndef __KERNEL__
650748 struct snd_rawmidi_status {
651749 int stream;
750
+ __time_pad pad1;
652751 struct timespec tstamp; /* Timestamp */
653752 size_t avail; /* available bytes */
654753 size_t xruns; /* count of overruns since last status (in bytes) */
655754 unsigned char reserved[16]; /* reserved for future use */
656755 };
756
+#endif
657757
658758 #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
659759 #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
....@@ -666,7 +766,7 @@
666766 * Timer section - /dev/snd/timer
667767 */
668768
669
-#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
769
+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
670770
671771 enum {
672772 SNDRV_TIMER_CLASS_NONE = -1,
....@@ -752,7 +852,7 @@
752852 #define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
753853
754854 struct snd_timer_params {
755
- unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
855
+ unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */
756856 unsigned int ticks; /* requested resolution in ticks */
757857 unsigned int queue_size; /* total size of queue (32-1024) */
758858 unsigned int reserved0; /* reserved, was: failure locations */
....@@ -760,6 +860,7 @@
760860 unsigned char reserved[60]; /* reserved */
761861 };
762862
863
+#ifndef __KERNEL__
763864 struct snd_timer_status {
764865 struct timespec tstamp; /* Timestamp - last update */
765866 unsigned int resolution; /* current period resolution in ns */
....@@ -768,10 +869,11 @@
768869 unsigned int queue; /* used queue size */
769870 unsigned char reserved[64]; /* reserved */
770871 };
872
+#endif
771873
772874 #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
773875 #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
774
-#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
876
+#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
775877 #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
776878 #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
777879 #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
....@@ -784,6 +886,15 @@
784886 #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
785887 #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
786888 #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
889
+#define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
890
+
891
+#if __BITS_PER_LONG == 64
892
+#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
893
+#else
894
+#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
895
+ SNDRV_TIMER_IOCTL_TREAD_OLD : \
896
+ SNDRV_TIMER_IOCTL_TREAD64)
897
+#endif
787898
788899 struct snd_timer_read {
789900 unsigned int resolution;
....@@ -809,11 +920,15 @@
809920 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
810921 };
811922
923
+#ifndef __KERNEL__
812924 struct snd_timer_tread {
813925 int event;
926
+ __time_pad pad1;
814927 struct timespec tstamp;
815928 unsigned int val;
929
+ __time_pad pad2;
816930 };
931
+#endif
817932
818933 /****************************************************************************
819934 * *
....@@ -821,7 +936,7 @@
821936 * *
822937 ****************************************************************************/
823938
824
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
939
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
825940
826941 struct snd_ctl_card_info {
827942 int card; /* card number */
....@@ -859,7 +974,7 @@
859974 #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
860975 #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
861976 #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
862
-#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
977
+// (1 << 3) is unused.
863978 #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
864979 #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
865980 #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
....@@ -925,11 +1040,7 @@
9251040 } enumerated;
9261041 unsigned char reserved[128];
9271042 } value;
928
- union {
929
- unsigned short d[4]; /* dimensions */
930
- unsigned short *d_ptr; /* indirect - obsoleted */
931
- } dimen;
932
- unsigned char reserved[64-4*sizeof(unsigned short)];
1043
+ unsigned char reserved[64];
9331044 };
9341045
9351046 struct snd_ctl_elem_value {
....@@ -954,8 +1065,7 @@
9541065 } bytes;
9551066 struct snd_aes_iec958 iec958;
9561067 } value; /* RO */
957
- struct timespec tstamp;
958
- unsigned char reserved[128-sizeof(struct timespec)];
1068
+ unsigned char reserved[128];
9591069 };
9601070
9611071 struct snd_ctl_tlv {