Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 1 | /* |
| 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 Koul | f15a95c | 2011-09-09 06:03:51 +0530 | [diff] [blame] | 32 | * @fragments: number of such fragments |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 33 | */ |
| 34 | struct snd_compressed_buffer { |
| 35 | size_t fragment_size; |
Vinod Koul | f15a95c | 2011-09-09 06:03:51 +0530 | [diff] [blame] | 36 | int fragments; |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | /* */ |
| 40 | struct snd_compr_params { |
| 41 | struct snd_compressed_buffer buffer; |
Vinod Koul | f15a95c | 2011-09-09 06:03:51 +0530 | [diff] [blame] | 42 | struct snd_codec codec; |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 43 | }; |
| 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 | */ |
| 53 | struct 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; |
Asish Bhattacharya | 8664b25 | 2011-12-30 05:43:23 +0530 | [diff] [blame^] | 59 | uint64_t timestamp; |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | /** |
| 63 | * struct snd_compr_avail: avail descriptor |
| 64 | * @avail: Number of bytes available in ring buffer for writing/reading |
| 65 | * @tstamp: timestamp infomation |
| 66 | */ |
| 67 | struct snd_compr_avail { |
| 68 | size_t avail; |
| 69 | struct snd_compr_tstamp tstamp; |
| 70 | }; |
| 71 | |
| 72 | /** |
| 73 | * struct snd_compr_caps: caps descriptor |
| 74 | * @codecs: pointer to array of codecs |
| 75 | * @min_fragment_size: minimum fragment supported by DSP |
| 76 | * @max_fragment_size: maximum fragment supported by DSP |
Vinod Koul | f15a95c | 2011-09-09 06:03:51 +0530 | [diff] [blame] | 77 | * @min_fragments: min fragments supported by DSP |
| 78 | * @max_fragments: max fragments supported by DSP |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 79 | * @num_codecs: number of codecs supported |
| 80 | * @reserved: reserved field |
| 81 | */ |
| 82 | struct snd_compr_caps { |
| 83 | __u32 num_codecs; |
| 84 | __u32 min_fragment_size; |
| 85 | __u32 max_fragment_size; |
Vinod Koul | f15a95c | 2011-09-09 06:03:51 +0530 | [diff] [blame] | 86 | __u32 min_fragments; |
| 87 | __u32 max_fragments; |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 88 | __u32 codecs[MAX_NUM_CODECS]; |
| 89 | __u32 reserved[11]; |
| 90 | }; |
| 91 | |
| 92 | /** |
| 93 | * struct snd_compr_codec_caps: query capability of codec |
| 94 | * @codec: codec for which capability is queried |
| 95 | * @num_descriptors: number of codec descriptors |
| 96 | * @descriptor: array of codec capability descriptor |
| 97 | */ |
| 98 | struct snd_compr_codec_caps { |
| 99 | __u32 codec; |
| 100 | __u32 num_descriptors; |
Vinod Koul | f15a95c | 2011-09-09 06:03:51 +0530 | [diff] [blame] | 101 | struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | /** |
| 105 | * compress path ioctl definitions |
| 106 | * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP |
| 107 | * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec |
| 108 | * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters |
| 109 | * Note: only codec params can be changed runtime and stream params cant be |
| 110 | * SNDRV_COMPRESS_GET_PARAMS: Query codec and stream params |
| 111 | * SNDRV_COMPRESS_TSTAMP: get the current timestamp value |
| 112 | * SNDRV_COMPRESS_AVAIL: get the current buffer avail value. |
| 113 | * This also queries the tstamp properties |
| 114 | * SNDRV_COMPRESS_PAUSE: Pause the running stream |
| 115 | * SNDRV_COMPRESS_RESUME: resume a paused stream |
| 116 | * SNDRV_COMPRESS_START: Start a stream |
Vinod Koul | f15a95c | 2011-09-09 06:03:51 +0530 | [diff] [blame] | 117 | * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content |
| 118 | * and the buffers currently with DSP |
Vinod Koul | c78fe9c | 2011-09-02 11:36:23 +0530 | [diff] [blame] | 119 | * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that |
| 120 | */ |
| 121 | #define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x00, struct snd_compr_caps *) |
| 122 | #define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x01, struct snd_compr_codec_caps *) |
| 123 | #define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x02, struct snd_compr_params *) |
| 124 | #define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x03, struct snd_compr_params *) |
| 125 | #define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x10, struct snd_compr_tstamp *) |
| 126 | #define SNDRV_COMPRESS_AVAIL _IOR('C', 0x11, struct snd_compr_avail *) |
| 127 | #define SNDRV_COMPRESS_PAUSE _IO('C', 0x20) |
| 128 | #define SNDRV_COMPRESS_RESUME _IO('C', 0x21) |
| 129 | #define SNDRV_COMPRESS_START _IO('C', 0x22) |
| 130 | #define SNDRV_COMPRESS_STOP _IO('C', 0x23) |
| 131 | #define SNDRV_COMPRESS_DRAIN _IO('C', 0x24) |
| 132 | /* |
| 133 | * TODO |
| 134 | * 1. add mmap support |
| 135 | * |
| 136 | */ |
| 137 | #define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */ |
| 138 | #endif |