| @@ -26,7 +26,9 @@ · 25 unmodified lines |
| 26 | 26 | |
| 27 | 27 | #if defined(__KERNEL__) || defined(__linux__) |
| 28 | 28 | #include <linux/types.h> |
| 29 | +#include <asm/byteorder.h> |
| 29 | 30 | #else |
| 31 | +#include <endian.h> |
| 30 | 32 | #include <sys/ioctl.h> |
| 31 | 33 | #endif |
| 32 | 34 | |
| @@ -154,7 +156,7 @@ struct snd_hwdep_dsp_image { · 121 unmodified lines |
| 154 | 156 | * * |
| 155 | 157 | *****************************************************************************/ |
| 156 | 158 | |
| 157 | | −#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) |
| 159 | +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15) |
| 158 | 160 | |
| 159 | 161 | typedef unsigned long snd_pcm_uframes_t; |
| 160 | 162 | typedef signed long snd_pcm_sframes_t; |
| @@ -301,7 +303,9 @@ typedef int __bitwise snd_pcm_subformat_t; · 140 unmodified lines |
| 301 | 303 | #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ |
| 302 | 304 | #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ |
| 303 | 305 | |
| 304 | | − |
| 306 | +#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__ |
| 307 | +#define __SND_STRUCT_TIME64 |
| 308 | +#endif |
| 305 | 309 | |
| 306 | 310 | typedef int __bitwise snd_pcm_state_t; |
| 307 | 311 | #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ |
| @@ -317,8 +321,17 @@ typedef int __bitwise snd_pcm_state_t; · 9 unmodified lines |
| 317 | 321 | |
| 318 | 322 | enum { |
| 319 | 323 | SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, |
| 320 | | − SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, |
| 321 | | − 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 |
| 322 | 335 | }; |
| 323 | 336 | |
| 324 | 337 | union snd_pcm_sync_id { |
| @@ -456,8 +469,13 @@ enum { · 131 unmodified lines |
| 456 | 469 | SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED |
| 457 | 470 | }; |
| 458 | 471 | |
| 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 | + |
| 459 | 476 | struct snd_pcm_status { |
| 460 | 477 | snd_pcm_state_t state; /* stream state */ |
| 478 | + __time_pad pad1; /* align to timespec */ |
| 461 | 479 | struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ |
| 462 | 480 | struct timespec tstamp; /* reference timestamp */ |
| 463 | 481 | snd_pcm_uframes_t appl_ptr; /* appl ptr */ |
| @@ -473,17 +491,48 @@ struct snd_pcm_status { · 9 unmodified lines |
| 473 | 491 | __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ |
| 474 | 492 | unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ |
| 475 | 493 | }; |
| 494 | +#endif |
| 495 | + |
| 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 | +}; |
| 476 | 523 | |
| 477 | | −struct snd_pcm_mmap_status { |
| 524 | +#endif |
| 525 | + |
| 526 | +struct __snd_pcm_mmap_status { |
| 478 | 527 | snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ |
| 479 | 528 | int pad1; /* Needed for 64 bit alignment */ |
| 480 | 529 | snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ |
| 481 | | − struct timespec tstamp; /* Timestamp */ |
| 530 | + struct __snd_timespec tstamp; /* Timestamp */ |
| 482 | 531 | snd_pcm_state_t suspended_state; /* RO: suspended stream state */ |
| 483 | | − struct timespec audio_tstamp; /* from sample counter or wall clock */ |
| 532 | + struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */ |
| 484 | 533 | }; |
| 485 | 534 | |
| 486 | | −struct snd_pcm_mmap_control { |
| 535 | +struct __snd_pcm_mmap_control { |
| 487 | 536 | snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ |
| 488 | 537 | snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ |
| 489 | 538 | }; |
| @@ -492,14 +541,59 @@ struct snd_pcm_mmap_control { · 2 unmodified lines |
| 492 | 541 | #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ |
| 493 | 542 | #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ |
| 494 | 543 | |
| 495 | | −struct snd_pcm_sync_ptr { |
| 544 | +struct __snd_pcm_sync_ptr { |
| 496 | 545 | unsigned int flags; |
| 497 | 546 | union { |
| 498 | | − struct snd_pcm_mmap_status status; |
| 547 | + struct __snd_pcm_mmap_status status; |
| 499 | 548 | unsigned char reserved[64]; |
| 500 | 549 | } s; |
| 501 | 550 | union { |
| 502 | | − 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 | + __s32 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 | + __s32 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; |
| 503 | 597 | unsigned char reserved[64]; |
| 504 | 598 | } c; |
| 505 | 599 | }; |
| @@ -584,6 +678,8 @@ enum { · 78 unmodified lines |
| 584 | 678 | #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) |
| 585 | 679 | #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) |
| 586 | 680 | #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) |
| 587 | 683 | #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) |
| 588 | 684 | #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) |
| 589 | 685 | #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) |
| @@ -614,7 +710,7 @@ enum { · 24 unmodified lines |
| 614 | 710 | * Raw MIDI section - /dev/snd/midi?? |
| 615 | 711 | */ |
| 616 | 712 | |
| 617 | | −#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) |
| 713 | +#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1) |
| 618 | 714 | |
| 619 | 715 | enum { |
| 620 | 716 | SNDRV_RAWMIDI_STREAM_OUTPUT = 0, |
| @@ -648,13 +744,16 @@ struct snd_rawmidi_params { · 27 unmodified lines |
| 648 | 744 | unsigned char reserved[16]; /* reserved for future use */ |
| 649 | 745 | }; |
| 650 | 746 | |
| 747 | +#ifndef __KERNEL__ |
| 651 | 748 | struct snd_rawmidi_status { |
| 652 | 749 | int stream; |
| 750 | + __time_pad pad1; |
| 653 | 751 | struct timespec tstamp; /* Timestamp */ |
| 654 | 752 | size_t avail; /* available bytes */ |
| 655 | 753 | size_t xruns; /* count of overruns since last status (in bytes) */ |
| 656 | 754 | unsigned char reserved[16]; /* reserved for future use */ |
| 657 | 755 | }; |
| 756 | +#endif |
| 658 | 757 | |
| 659 | 758 | #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) |
| 660 | 759 | #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) |
| @@ -667,7 +766,7 @@ struct snd_rawmidi_status { · 6 unmodified lines |
| 667 | 766 | * Timer section - /dev/snd/timer |
| 668 | 767 | */ |
| 669 | 768 | |
| 670 | | −#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) |
| 769 | +#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) |
| 671 | 770 | |
| 672 | 771 | enum { |
| 673 | 772 | SNDRV_TIMER_CLASS_NONE = -1, |
| @@ -761,6 +860,7 @@ struct snd_timer_params { · 87 unmodified lines |
| 761 | 860 | unsigned char reserved[60]; /* reserved */ |
| 762 | 861 | }; |
| 763 | 862 | |
| 863 | +#ifndef __KERNEL__ |
| 764 | 864 | struct snd_timer_status { |
| 765 | 865 | struct timespec tstamp; /* Timestamp - last update */ |
| 766 | 866 | unsigned int resolution; /* current period resolution in ns */ |
| @@ -769,10 +869,11 @@ struct snd_timer_status { · 2 unmodified lines |
| 769 | 869 | unsigned int queue; /* used queue size */ |
| 770 | 870 | unsigned char reserved[64]; /* reserved */ |
| 771 | 871 | }; |
| 872 | +#endif |
| 772 | 873 | |
| 773 | 874 | #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) |
| 774 | 875 | #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) |
| 775 | | −#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) |
| 876 | +#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int) |
| 776 | 877 | #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) |
| 777 | 878 | #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) |
| 778 | 879 | #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) |
| @@ -785,6 +886,15 @@ struct snd_timer_status { · 6 unmodified lines |
| 785 | 886 | #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) |
| 786 | 887 | #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) |
| 787 | 888 | #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 |
| 788 | 898 | |
| 789 | 899 | struct snd_timer_read { |
| 790 | 900 | unsigned int resolution; |
| @@ -810,11 +920,15 @@ enum { · 19 unmodified lines |
| 810 | 920 | SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, |
| 811 | 921 | }; |
| 812 | 922 | |
| 923 | +#ifndef __KERNEL__ |
| 813 | 924 | struct snd_timer_tread { |
| 814 | 925 | int event; |
| 926 | + __time_pad pad1; |
| 815 | 927 | struct timespec tstamp; |
| 816 | 928 | unsigned int val; |
| 929 | + __time_pad pad2; |
| 817 | 930 | }; |
| 931 | +#endif |
| 818 | 932 | |
| 819 | 933 | /**************************************************************************** |
| 820 | 934 | * * |
| @@ -822,7 +936,7 @@ struct snd_timer_tread { · 1 unmodified line |
| 822 | 936 | * * |
| 823 | 937 | ****************************************************************************/ |
| 824 | 938 | |
| 825 | | −#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) |
| 939 | +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8) |
| 826 | 940 | |
| 827 | 941 | struct snd_ctl_card_info { |
| 828 | 942 | int card; /* card number */ |
| @@ -860,7 +974,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; · 31 unmodified lines |
| 860 | 974 | #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) |
| 861 | 975 | #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) |
| 862 | 976 | #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ |
| 863 | | −#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ |
| 977 | +// (1 << 3) is unused. |
| 864 | 978 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ |
| 865 | 979 | #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ |
| 866 | 980 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) |
| @@ -926,11 +1040,7 @@ struct snd_ctl_elem_info { · 59 unmodified lines |
| 926 | 1040 | } enumerated; |
| 927 | 1041 | unsigned char reserved[128]; |
| 928 | 1042 | } value; |
| 929 | | − union { |
| 930 | | − unsigned short d[4]; /* dimensions */ |
| 931 | | − unsigned short *d_ptr; /* indirect - obsoleted */ |
| 932 | | − } dimen; |
| 933 | | − unsigned char reserved[64-4*sizeof(unsigned short)]; |
| 1043 | + unsigned char reserved[64]; |
| 934 | 1044 | }; |
| 935 | 1045 | |
| 936 | 1046 | struct snd_ctl_elem_value { |
| @@ -955,8 +1065,7 @@ struct snd_ctl_elem_value { · 18 unmodified lines |
| 955 | 1065 | } bytes; |
| 956 | 1066 | struct snd_aes_iec958 iec958; |
| 957 | 1067 | } value; /* RO */ |
| 958 | | − struct timespec tstamp; |
| 959 | | − unsigned char reserved[128-sizeof(struct timespec)]; |
| 1068 | + unsigned char reserved[128]; |
| 960 | 1069 | }; |
| 961 | 1070 | |
| 962 | 1071 | struct snd_ctl_tlv { |