blob: 423264ddf319fabc17fe5a8d068b872dcc7b3924 [file] [log] [blame]
Vinod Koulc78fe9c2011-09-02 11:36:23 +05301/*
2 * compress_offload.h - compress offload header definations
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Authors: Vinod Koul <vinod.koul@linux.intel.com>
6 * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 *
24 */
25#ifndef __COMPRESS_OFFLOAD_H
26#define __COMPRESS_OFFLOAD_H
27
28#include <linux/types.h>
29/**
30 * struct snd_compressed_buffer:compressed buffer
31 * @fragment_size: size of buffer fragment in bytes
Vinod Koulf15a95c2011-09-09 06:03:51 +053032 * @fragments: number of such fragments
Vinod Koulc78fe9c2011-09-02 11:36:23 +053033 */
34struct snd_compressed_buffer {
35 size_t fragment_size;
Vinod Koulf15a95c2011-09-09 06:03:51 +053036 int fragments;
Vinod Koulc78fe9c2011-09-02 11:36:23 +053037};
38
39/* */
40struct snd_compr_params {
41 struct snd_compressed_buffer buffer;
Vinod Koulf15a95c2011-09-09 06:03:51 +053042 struct snd_codec codec;
Vinod Koulc78fe9c2011-09-02 11:36:23 +053043};
44
45/**
46 * struct snd_compr_tstamp: timestamp descriptor
47 * @copied_bytes: Number of bytes offset in ring buffer to DSP
48 * @copied_total: Total number of bytes copied from ring buffer to DSP
49 * @decoded: Frames decoded by DSP
50 * @rendered: Frames rendered by DSP into a mixer or an audio output
51 * @sampling_rate: sampling rate of audio
52 */
53struct snd_compr_tstamp {
54 size_t copied_bytes;
55 size_t copied_total;
56 size_t decoded;
57 size_t rendered;
58 __u32 sampling_rate;
59};
60
61/**
62 * struct snd_compr_avail: avail descriptor
63 * @avail: Number of bytes available in ring buffer for writing/reading
64 * @tstamp: timestamp infomation
65 */
66struct snd_compr_avail {
67 size_t avail;
68 struct snd_compr_tstamp tstamp;
69};
70
71/**
72 * struct snd_compr_caps: caps descriptor
73 * @codecs: pointer to array of codecs
74 * @min_fragment_size: minimum fragment supported by DSP
75 * @max_fragment_size: maximum fragment supported by DSP
Vinod Koulf15a95c2011-09-09 06:03:51 +053076 * @min_fragments: min fragments supported by DSP
77 * @max_fragments: max fragments supported by DSP
Vinod Koulc78fe9c2011-09-02 11:36:23 +053078 * @num_codecs: number of codecs supported
79 * @reserved: reserved field
80 */
81struct snd_compr_caps {
82 __u32 num_codecs;
83 __u32 min_fragment_size;
84 __u32 max_fragment_size;
Vinod Koulf15a95c2011-09-09 06:03:51 +053085 __u32 min_fragments;
86 __u32 max_fragments;
Vinod Koulc78fe9c2011-09-02 11:36:23 +053087 __u32 codecs[MAX_NUM_CODECS];
88 __u32 reserved[11];
89};
90
91/**
92 * struct snd_compr_codec_caps: query capability of codec
93 * @codec: codec for which capability is queried
94 * @num_descriptors: number of codec descriptors
95 * @descriptor: array of codec capability descriptor
96 */
97struct snd_compr_codec_caps {
98 __u32 codec;
99 __u32 num_descriptors;
Vinod Koulf15a95c2011-09-09 06:03:51 +0530100 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
Vinod Koulc78fe9c2011-09-02 11:36:23 +0530101};
102
103/**
104 * compress path ioctl definitions
105 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
106 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
107 * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters
108 * Note: only codec params can be changed runtime and stream params cant be
109 * SNDRV_COMPRESS_GET_PARAMS: Query codec and stream params
110 * SNDRV_COMPRESS_TSTAMP: get the current timestamp value
111 * SNDRV_COMPRESS_AVAIL: get the current buffer avail value.
112 * This also queries the tstamp properties
113 * SNDRV_COMPRESS_PAUSE: Pause the running stream
114 * SNDRV_COMPRESS_RESUME: resume a paused stream
115 * SNDRV_COMPRESS_START: Start a stream
Vinod Koulf15a95c2011-09-09 06:03:51 +0530116 * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content
117 * and the buffers currently with DSP
Vinod Koulc78fe9c2011-09-02 11:36:23 +0530118 * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that
119 */
120#define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x00, struct snd_compr_caps *)
121#define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x01, struct snd_compr_codec_caps *)
122#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x02, struct snd_compr_params *)
123#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x03, struct snd_compr_params *)
124#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x10, struct snd_compr_tstamp *)
125#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x11, struct snd_compr_avail *)
126#define SNDRV_COMPRESS_PAUSE _IO('C', 0x20)
127#define SNDRV_COMPRESS_RESUME _IO('C', 0x21)
128#define SNDRV_COMPRESS_START _IO('C', 0x22)
129#define SNDRV_COMPRESS_STOP _IO('C', 0x23)
130#define SNDRV_COMPRESS_DRAIN _IO('C', 0x24)
131/*
132 * TODO
133 * 1. add mmap support
134 *
135 */
136#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */
137#endif