.. | .. |
---|
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 | |
---|
33 | 35 | #ifndef __KERNEL__ |
---|
34 | 36 | #include <stdlib.h> |
---|
| 37 | +#include <time.h> |
---|
35 | 38 | #endif |
---|
36 | 39 | |
---|
37 | 40 | /* |
---|
.. | .. |
---|
153 | 156 | * * |
---|
154 | 157 | *****************************************************************************/ |
---|
155 | 158 | |
---|
156 | | -#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) |
---|
| 159 | +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15) |
---|
157 | 160 | |
---|
158 | 161 | typedef unsigned long snd_pcm_uframes_t; |
---|
159 | 162 | typedef signed long snd_pcm_sframes_t; |
---|
.. | .. |
---|
300 | 303 | #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ |
---|
301 | 304 | #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ |
---|
302 | 305 | |
---|
303 | | - |
---|
| 306 | +#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__ |
---|
| 307 | +#define __SND_STRUCT_TIME64 |
---|
| 308 | +#endif |
---|
304 | 309 | |
---|
305 | 310 | typedef int __bitwise snd_pcm_state_t; |
---|
306 | 311 | #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ |
---|
.. | .. |
---|
316 | 321 | |
---|
317 | 322 | enum { |
---|
318 | 323 | 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 |
---|
321 | 335 | }; |
---|
322 | 336 | |
---|
323 | 337 | union snd_pcm_sync_id { |
---|
.. | .. |
---|
455 | 469 | SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED |
---|
456 | 470 | }; |
---|
457 | 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 | + |
---|
458 | 476 | struct snd_pcm_status { |
---|
459 | 477 | snd_pcm_state_t state; /* stream state */ |
---|
| 478 | + __time_pad pad1; /* align to timespec */ |
---|
460 | 479 | struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ |
---|
461 | 480 | struct timespec tstamp; /* reference timestamp */ |
---|
462 | 481 | snd_pcm_uframes_t appl_ptr; /* appl ptr */ |
---|
.. | .. |
---|
472 | 491 | __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ |
---|
473 | 492 | unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ |
---|
474 | 493 | }; |
---|
| 494 | +#endif |
---|
475 | 495 | |
---|
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 { |
---|
477 | 527 | snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ |
---|
478 | 528 | int pad1; /* Needed for 64 bit alignment */ |
---|
479 | 529 | snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ |
---|
480 | | - struct timespec tstamp; /* Timestamp */ |
---|
| 530 | + struct __snd_timespec tstamp; /* Timestamp */ |
---|
481 | 531 | 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 */ |
---|
483 | 533 | }; |
---|
484 | 534 | |
---|
485 | | -struct snd_pcm_mmap_control { |
---|
| 535 | +struct __snd_pcm_mmap_control { |
---|
486 | 536 | snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ |
---|
487 | 537 | snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ |
---|
488 | 538 | }; |
---|
.. | .. |
---|
491 | 541 | #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ |
---|
492 | 542 | #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ |
---|
493 | 543 | |
---|
494 | | -struct snd_pcm_sync_ptr { |
---|
| 544 | +struct __snd_pcm_sync_ptr { |
---|
495 | 545 | unsigned int flags; |
---|
496 | 546 | union { |
---|
497 | | - struct snd_pcm_mmap_status status; |
---|
| 547 | + struct __snd_pcm_mmap_status status; |
---|
498 | 548 | unsigned char reserved[64]; |
---|
499 | 549 | } s; |
---|
500 | 550 | 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; |
---|
502 | 597 | unsigned char reserved[64]; |
---|
503 | 598 | } c; |
---|
504 | 599 | }; |
---|
.. | .. |
---|
583 | 678 | #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) |
---|
584 | 679 | #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) |
---|
585 | 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) |
---|
586 | 683 | #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) |
---|
587 | 684 | #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) |
---|
588 | 685 | #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) |
---|
.. | .. |
---|
613 | 710 | * Raw MIDI section - /dev/snd/midi?? |
---|
614 | 711 | */ |
---|
615 | 712 | |
---|
616 | | -#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) |
---|
| 713 | +#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1) |
---|
617 | 714 | |
---|
618 | 715 | enum { |
---|
619 | 716 | SNDRV_RAWMIDI_STREAM_OUTPUT = 0, |
---|
.. | .. |
---|
647 | 744 | unsigned char reserved[16]; /* reserved for future use */ |
---|
648 | 745 | }; |
---|
649 | 746 | |
---|
| 747 | +#ifndef __KERNEL__ |
---|
650 | 748 | struct snd_rawmidi_status { |
---|
651 | 749 | int stream; |
---|
| 750 | + __time_pad pad1; |
---|
652 | 751 | struct timespec tstamp; /* Timestamp */ |
---|
653 | 752 | size_t avail; /* available bytes */ |
---|
654 | 753 | size_t xruns; /* count of overruns since last status (in bytes) */ |
---|
655 | 754 | unsigned char reserved[16]; /* reserved for future use */ |
---|
656 | 755 | }; |
---|
| 756 | +#endif |
---|
657 | 757 | |
---|
658 | 758 | #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) |
---|
659 | 759 | #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) |
---|
.. | .. |
---|
666 | 766 | * Timer section - /dev/snd/timer |
---|
667 | 767 | */ |
---|
668 | 768 | |
---|
669 | | -#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) |
---|
| 769 | +#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) |
---|
670 | 770 | |
---|
671 | 771 | enum { |
---|
672 | 772 | SNDRV_TIMER_CLASS_NONE = -1, |
---|
.. | .. |
---|
752 | 852 | #define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ |
---|
753 | 853 | |
---|
754 | 854 | struct snd_timer_params { |
---|
755 | | - unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ |
---|
| 855 | + unsigned int flags; /* flags - SNDRV_TIMER_PSFLG_* */ |
---|
756 | 856 | unsigned int ticks; /* requested resolution in ticks */ |
---|
757 | 857 | unsigned int queue_size; /* total size of queue (32-1024) */ |
---|
758 | 858 | unsigned int reserved0; /* reserved, was: failure locations */ |
---|
.. | .. |
---|
760 | 860 | unsigned char reserved[60]; /* reserved */ |
---|
761 | 861 | }; |
---|
762 | 862 | |
---|
| 863 | +#ifndef __KERNEL__ |
---|
763 | 864 | struct snd_timer_status { |
---|
764 | 865 | struct timespec tstamp; /* Timestamp - last update */ |
---|
765 | 866 | unsigned int resolution; /* current period resolution in ns */ |
---|
.. | .. |
---|
768 | 869 | unsigned int queue; /* used queue size */ |
---|
769 | 870 | unsigned char reserved[64]; /* reserved */ |
---|
770 | 871 | }; |
---|
| 872 | +#endif |
---|
771 | 873 | |
---|
772 | 874 | #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) |
---|
773 | 875 | #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) |
---|
775 | 877 | #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) |
---|
776 | 878 | #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) |
---|
777 | 879 | #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) |
---|
.. | .. |
---|
784 | 886 | #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) |
---|
785 | 887 | #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) |
---|
786 | 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 |
---|
787 | 898 | |
---|
788 | 899 | struct snd_timer_read { |
---|
789 | 900 | unsigned int resolution; |
---|
.. | .. |
---|
809 | 920 | SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, |
---|
810 | 921 | }; |
---|
811 | 922 | |
---|
| 923 | +#ifndef __KERNEL__ |
---|
812 | 924 | struct snd_timer_tread { |
---|
813 | 925 | int event; |
---|
| 926 | + __time_pad pad1; |
---|
814 | 927 | struct timespec tstamp; |
---|
815 | 928 | unsigned int val; |
---|
| 929 | + __time_pad pad2; |
---|
816 | 930 | }; |
---|
| 931 | +#endif |
---|
817 | 932 | |
---|
818 | 933 | /**************************************************************************** |
---|
819 | 934 | * * |
---|
.. | .. |
---|
821 | 936 | * * |
---|
822 | 937 | ****************************************************************************/ |
---|
823 | 938 | |
---|
824 | | -#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) |
---|
| 939 | +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8) |
---|
825 | 940 | |
---|
826 | 941 | struct snd_ctl_card_info { |
---|
827 | 942 | int card; /* card number */ |
---|
.. | .. |
---|
859 | 974 | #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) |
---|
860 | 975 | #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) |
---|
861 | 976 | #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. |
---|
863 | 978 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ |
---|
864 | 979 | #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ |
---|
865 | 980 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) |
---|
.. | .. |
---|
925 | 1040 | } enumerated; |
---|
926 | 1041 | unsigned char reserved[128]; |
---|
927 | 1042 | } 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]; |
---|
933 | 1044 | }; |
---|
934 | 1045 | |
---|
935 | 1046 | struct snd_ctl_elem_value { |
---|
.. | .. |
---|
954 | 1065 | } bytes; |
---|
955 | 1066 | struct snd_aes_iec958 iec958; |
---|
956 | 1067 | } value; /* RO */ |
---|
957 | | - struct timespec tstamp; |
---|
958 | | - unsigned char reserved[128-sizeof(struct timespec)]; |
---|
| 1068 | + unsigned char reserved[128]; |
---|
959 | 1069 | }; |
---|
960 | 1070 | |
---|
961 | 1071 | struct snd_ctl_tlv { |
---|