1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef __COMPRESS_OFFLOAD_H
20 #define __COMPRESS_OFFLOAD_H
21 #include <linux/types.h>
22 #include <sound/asound.h>
23 #include <sound/compress_params.h>
24 #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
25 struct snd_compressed_buffer {
26   __u32 fragment_size;
27   __u32 fragments;
28 } __attribute__((packed, aligned(4)));
29 struct snd_compr_params {
30   struct snd_compressed_buffer buffer;
31   struct snd_codec codec;
32   __u8 no_wake_mode;
33 } __attribute__((packed, aligned(4)));
34 struct snd_compr_tstamp {
35   __u32 byte_offset;
36   __u64 copied_total;
37   __u32 pcm_frames;
38   __u32 pcm_io_frames;
39   __u32 sampling_rate;
40   __u64 timestamp;
41 } __attribute__((packed, aligned(4)));
42 struct snd_compr_avail {
43   __u64 avail;
44   struct snd_compr_tstamp tstamp;
45 } __attribute__((packed, aligned(4)));
46 enum snd_compr_direction {
47   SND_COMPRESS_PLAYBACK = 0,
48   SND_COMPRESS_CAPTURE
49 };
50 struct snd_compr_caps {
51   __u32 num_codecs;
52   __u32 direction;
53   __u32 min_fragment_size;
54   __u32 max_fragment_size;
55   __u32 min_fragments;
56   __u32 max_fragments;
57   __u32 codecs[MAX_NUM_CODECS];
58   __u32 reserved[11];
59 } __attribute__((packed, aligned(4)));
60 struct snd_compr_codec_caps {
61   __u32 codec;
62   __u32 num_descriptors;
63   struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
64 } __attribute__((packed, aligned(4)));
65 struct snd_compr_audio_info {
66   __u32 frame_size;
67   __u32 reserved[15];
68 } __attribute__((packed, aligned(4)));
69 #define SNDRV_COMPRESS_RENDER_MODE_AUDIO_MASTER 0
70 #define SNDRV_COMPRESS_RENDER_MODE_STC_MASTER 1
71 #define SNDRV_COMPRESS_RENDER_MODE_TTP 2
72 #define SNDRV_COMPRESS_CLK_REC_MODE_NONE 0
73 #define SNDRV_COMPRESS_CLK_REC_MODE_AUTO 1
74 #define SNDRV_COMPRESS_TIMESTAMP_VALID 0x00000000
75 #define SNDRV_COMPRESS_TIMESTAMP_CONTINUE 0x00000001
76 enum sndrv_compress_latency_mode {
77   SNDRV_COMPRESS_LEGACY_LATENCY_MODE = 0,
78   SNDRV_COMPRESS_LOW_LATENCY_MODE = 1,
79 };
80 enum sndrv_compress_encoder {
81   SNDRV_COMPRESS_ENCODER_PADDING = 1,
82   SNDRV_COMPRESS_ENCODER_DELAY = 2,
83   SNDRV_COMPRESS_MIN_BLK_SIZE = 3,
84   SNDRV_COMPRESS_MAX_BLK_SIZE = 4,
85   SNDRV_COMPRESS_PATH_DELAY = 5,
86   SNDRV_COMPRESS_RENDER_MODE = 6,
87   SNDRV_COMPRESS_CLK_REC_MODE = 7,
88   SNDRV_COMPRESS_RENDER_WINDOW = 8,
89   SNDRV_COMPRESS_START_DELAY = 9,
90   SNDRV_COMPRESS_ENABLE_ADJUST_SESSION_CLOCK = 10,
91   SNDRV_COMPRESS_ADJUST_SESSION_CLOCK = 11,
92   SNDRV_COMPRESS_LATENCY_MODE = 12,
93   SNDRV_COMPRESS_IN_TTP_OFFSET = 13,
94 };
95 #define SNDRV_COMPRESS_MIN_BLK_SIZE SNDRV_COMPRESS_MIN_BLK_SIZE
96 #define SNDRV_COMPRESS_MAX_BLK_SIZE SNDRV_COMPRESS_MAX_BLK_SIZE
97 #define SNDRV_COMPRESS_PATH_DELAY SNDRV_COMPRESS_PATH_DELAY
98 #define SNDRV_COMPRESS_RENDER_MODE SNDRV_COMPRESS_RENDER_MODE
99 #define SNDRV_COMPRESS_CLK_REC_MODE SNDRV_COMPRESS_CLK_REC_MODE
100 #define SNDRV_COMPRESS_RENDER_WINDOW SNDRV_COMPRESS_RENDER_WINDOW
101 #define SNDRV_COMPRESS_START_DELAY SNDRV_COMPRESS_START_DELAY
102 #define SNDRV_COMPRESS_ENABLE_ADJUST_SESSION_CLOCK SNDRV_COMPRESS_ENABLE_ADJUST_SESSION_CLOCK
103 #define SNDRV_COMPRESS_ADJUST_SESSION_CLOCK SNDRV_COMPRESS_ADJUST_SESSION_CLOCK
104 #define SNDRV_COMPRESS_LATENCY_MODE SNDRV_COMPRESS_LATENCY_MODE
105 #define SNDRV_COMPRESS_IN_TTP_OFFSET SNDRV_COMPRESS_IN_TTP_OFFSET
106 struct snd_compr_metadata {
107   __u32 key;
108   __u32 value[8];
109 } __attribute__((packed, aligned(4)));
110 #define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int)
111 #define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps)
112 #define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11, struct snd_compr_codec_caps)
113 #define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params)
114 #define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec)
115 #define SNDRV_COMPRESS_SET_METADATA _IOW('C', 0x14, struct snd_compr_metadata)
116 #define SNDRV_COMPRESS_GET_METADATA _IOWR('C', 0x15, struct snd_compr_metadata)
117 #define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp)
118 #define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail)
119 #define SNDRV_COMPRESS_PAUSE _IO('C', 0x30)
120 #define SNDRV_COMPRESS_RESUME _IO('C', 0x31)
121 #define SNDRV_COMPRESS_START _IO('C', 0x32)
122 #define SNDRV_COMPRESS_STOP _IO('C', 0x33)
123 #define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)
124 #define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35)
125 #define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36)
126 #define SNDRV_COMPRESS_SET_NEXT_TRACK_PARAM _IOW('C', 0x80, union snd_codec_options)
127 #define SND_COMPR_TRIGGER_DRAIN 7
128 #define SND_COMPR_TRIGGER_NEXT_TRACK 8
129 #define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9
130 #define SNDRV_COMPRESS_DSP_POSITION 10
131 #endif
132