| 1 |
|
| 2 | |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or
|
| 4 | * redistributing this file, you may do so under either license.
|
| 5 | *
|
| 6 | * Copyright(c) 2018 Intel Corporation
|
| 7 |
|
| 8 |
|
| 9 | #ifndef __INCLUDE_SOUND_SOF_STREAM_H__
|
| 10 | #define __INCLUDE_SOUND_SOF_STREAM_H__
|
| 11 |
|
| 12 | #include <sound/sof/header.h>
|
| 13 |
|
| 14 | |
| 15 | * Stream configuration.
|
| 16 |
|
| 17 |
|
| 18 | #define SOF_IPC_MAX_CHANNELS 8
|
| 19 |
|
| 20 |
|
| 21 | #define SOF_RATE_8000 (1 << 0)
|
| 22 | #define SOF_RATE_11025 (1 << 1)
|
| 23 | #define SOF_RATE_12000 (1 << 2)
|
| 24 | #define SOF_RATE_16000 (1 << 3)
|
| 25 | #define SOF_RATE_22050 (1 << 4)
|
| 26 | #define SOF_RATE_24000 (1 << 5)
|
| 27 | #define SOF_RATE_32000 (1 << 6)
|
| 28 | #define SOF_RATE_44100 (1 << 7)
|
| 29 | #define SOF_RATE_48000 (1 << 8)
|
| 30 | #define SOF_RATE_64000 (1 << 9)
|
| 31 | #define SOF_RATE_88200 (1 << 10)
|
| 32 | #define SOF_RATE_96000 (1 << 11)
|
| 33 | #define SOF_RATE_176400 (1 << 12)
|
| 34 | #define SOF_RATE_192000 (1 << 13)
|
| 35 |
|
| 36 |
|
| 37 | #define SOF_RATE_CONTINUOUS (1 << 30)
|
| 38 | #define SOF_RATE_KNOT (1 << 31)
|
| 39 |
|
| 40 |
|
| 41 | #define SOF_PCM_FLAG_XRUN_STOP (1 << 0)
|
| 42 |
|
| 43 |
|
| 44 | enum sof_ipc_frame {
|
| 45 | SOF_IPC_FRAME_S16_LE = 0,
|
| 46 | SOF_IPC_FRAME_S24_4LE,
|
| 47 | SOF_IPC_FRAME_S32_LE,
|
| 48 | SOF_IPC_FRAME_FLOAT,
|
| 49 |
|
| 50 | };
|
| 51 |
|
| 52 |
|
| 53 | enum sof_ipc_buffer_format {
|
| 54 | SOF_IPC_BUFFER_INTERLEAVED,
|
| 55 | SOF_IPC_BUFFER_NONINTERLEAVED,
|
| 56 |
|
| 57 | };
|
| 58 |
|
| 59 |
|
| 60 | enum sof_ipc_stream_direction {
|
| 61 | SOF_IPC_STREAM_PLAYBACK = 0,
|
| 62 | SOF_IPC_STREAM_CAPTURE,
|
| 63 | };
|
| 64 |
|
| 65 |
|
| 66 | struct sof_ipc_host_buffer {
|
| 67 | struct sof_ipc_hdr hdr;
|
| 68 | uint32_t phy_addr;
|
| 69 | uint32_t pages;
|
| 70 | uint32_t size;
|
| 71 | uint32_t reserved[3];
|
| 72 | } __packed;
|
| 73 |
|
| 74 | struct sof_ipc_stream_params {
|
| 75 | struct sof_ipc_hdr hdr;
|
| 76 | struct sof_ipc_host_buffer buffer;
|
| 77 | uint32_t direction;
|
| 78 | uint32_t frame_fmt;
|
| 79 | uint32_t buffer_fmt;
|
| 80 | uint32_t rate;
|
| 81 | uint16_t stream_tag;
|
| 82 | uint16_t channels;
|
| 83 | uint16_t sample_valid_bytes;
|
| 84 | uint16_t sample_container_bytes;
|
| 85 |
|
| 86 | uint32_t host_period_bytes;
|
| 87 | uint16_t no_stream_position;
|
| 88 | uint8_t cont_update_posn;
|
| 89 | uint8_t reserved0;
|
| 90 | int16_t ext_data_length;
|
| 91 | uint8_t reserved[2];
|
| 92 | uint16_t chmap[SOF_IPC_MAX_CHANNELS];
|
| 93 | uint8_t ext_data[];
|
| 94 | } __packed;
|
| 95 |
|
| 96 |
|
| 97 | struct sof_ipc_pcm_params {
|
| 98 | struct sof_ipc_cmd_hdr hdr;
|
| 99 | uint32_t comp_id;
|
| 100 | uint32_t flags;
|
| 101 | uint32_t reserved[2];
|
| 102 | struct sof_ipc_stream_params params;
|
| 103 | } __packed;
|
| 104 |
|
| 105 |
|
| 106 | struct sof_ipc_pcm_params_reply {
|
| 107 | struct sof_ipc_reply rhdr;
|
| 108 | uint32_t comp_id;
|
| 109 | uint32_t posn_offset;
|
| 110 | } __packed;
|
| 111 |
|
| 112 |
|
| 113 | struct sof_ipc_stream {
|
| 114 | struct sof_ipc_cmd_hdr hdr;
|
| 115 | uint32_t comp_id;
|
| 116 | } __packed;
|
| 117 |
|
| 118 |
|
| 119 | #define SOF_TIME_HOST_SYNC (1 << 0)
|
| 120 | #define SOF_TIME_DAI_SYNC (1 << 1)
|
| 121 | #define SOF_TIME_WALL_SYNC (1 << 2)
|
| 122 | #define SOF_TIME_STAMP_SYNC (1 << 3)
|
| 123 |
|
| 124 |
|
| 125 | #define SOF_TIME_HOST_VALID (1 << 8)
|
| 126 | #define SOF_TIME_DAI_VALID (1 << 9)
|
| 127 | #define SOF_TIME_WALL_VALID (1 << 10)
|
| 128 | #define SOF_TIME_STAMP_VALID (1 << 11)
|
| 129 |
|
| 130 |
|
| 131 | #define SOF_TIME_HOST_64 (1 << 16)
|
| 132 | #define SOF_TIME_DAI_64 (1 << 17)
|
| 133 | #define SOF_TIME_WALL_64 (1 << 18)
|
| 134 | #define SOF_TIME_STAMP_64 (1 << 19)
|
| 135 |
|
| 136 | struct sof_ipc_stream_posn {
|
| 137 | struct sof_ipc_reply rhdr;
|
| 138 | uint32_t comp_id;
|
| 139 | uint32_t flags;
|
| 140 | uint32_t wallclock_hz;
|
| 141 | uint32_t timestamp_ns;
|
| 142 | uint64_t host_posn;
|
| 143 | uint64_t dai_posn;
|
| 144 | uint64_t comp_posn;
|
| 145 | uint64_t wallclock;
|
| 146 | uint64_t timestamp;
|
| 147 | uint32_t xrun_comp_id;
|
| 148 | int32_t xrun_size;
|
| 149 | } __packed;
|
| 150 |
|
| 151 | #endif
|