|
33 | 33 | extern "C" {
|
34 | 34 | #endif
|
35 | 35 |
|
36 |
| -/** \brief Types of DAI |
| 36 | +/** @brief Types of DAI |
37 | 37 | *
|
38 | 38 | * The type of the DAI. This ID type is used to configure bespoke DAI HW
|
39 | 39 | * settings.
|
@@ -61,7 +61,7 @@ enum dai_type {
|
61 | 61 | };
|
62 | 62 |
|
63 | 63 | /**
|
64 |
| - * @brief Dai Direction |
| 64 | + * @brief DAI Direction |
65 | 65 | */
|
66 | 66 | enum dai_dir {
|
67 | 67 | /** Receive data */
|
@@ -124,7 +124,7 @@ enum dai_trigger_cmd {
|
124 | 124 | *
|
125 | 125 | * Pause the transmission / reception of data at the end of the current
|
126 | 126 | * memory block. Behavior is implementation specific but usually this
|
127 |
| - * state doesn't completely stop the clocks or transmission. The dai could |
| 127 | + * state doesn't completely stop the clocks or transmission. The DAI could |
128 | 128 | * be transmitting 0's (silence), but it is not consuming data from outside.
|
129 | 129 | */
|
130 | 130 | DAI_TRIGGER_PAUSE,
|
@@ -169,65 +169,80 @@ enum dai_trigger_cmd {
|
169 | 169 | DAI_TRIGGER_COPY,
|
170 | 170 | };
|
171 | 171 |
|
172 |
| -/** @brief Properties of DAI |
| 172 | +/** @brief DAI properties |
173 | 173 | *
|
174 | 174 | * This struct is used with APIs get_properties function to query DAI
|
175 | 175 | * properties like fifo address and dma handshake. These are needed
|
176 | 176 | * for example to setup dma outside the driver code.
|
177 |
| - * |
178 |
| - * @param fifo_address Fifo hw address for e.g. when connecting to dma. |
179 |
| - * @param fifo_depth Fifo depth. |
180 |
| - * @param dma_hs_id Dma handshake id. |
181 |
| - * @param reg_init_delay Delay for initializing registers. |
182 |
| - * @param stream_id Stream ID. |
183 | 177 | */
|
184 | 178 | struct dai_properties {
|
185 |
| - uint32_t fifo_address; /* fifo address */ |
186 |
| - uint32_t fifo_depth; /* fifo depth */ |
187 |
| - uint32_t dma_hs_id; /* dma handshake id */ |
188 |
| - uint32_t reg_init_delay; /* delay for register init */ |
189 |
| - int stream_id; /* stream id */ |
| 179 | + /** Fifo hw address for e.g. when connecting to dma. */ |
| 180 | + uint32_t fifo_address; |
| 181 | + /** Fifo depth. */ |
| 182 | + uint32_t fifo_depth; |
| 183 | + /** DMA handshake id. */ |
| 184 | + uint32_t dma_hs_id; |
| 185 | + /** Delay for initializing registers. */ |
| 186 | + uint32_t reg_init_delay; |
| 187 | + /** Stream ID. */ |
| 188 | + int stream_id; |
190 | 189 | };
|
191 | 190 |
|
192 |
| -/** Main dai config struct |
193 |
| - * @brief Generic Dai interface configuration options. |
| 191 | +/** @brief Main DAI config structure |
194 | 192 | *
|
195 |
| - * @param dai_type Type of the dai. |
196 |
| - * @param dai_index Index of the dai. |
197 |
| - * @param channels Number of audio channels, words in frame. |
198 |
| - * @param rate Frame clock (WS) frequency, sampling rate. |
199 |
| - * @param format Dai specific data stream format. |
200 |
| - * @param options Dai specific configuration options. |
201 |
| - * @param word_size Number of bits representing one data word. |
202 |
| - * @param block_size Size of one RX/TX memory block (buffer) in bytes. |
203 |
| - * @param link_config Dai specific link configuration. |
| 193 | + * Generic DAI interface configuration options. |
204 | 194 | */
|
205 | 195 | struct dai_config {
|
| 196 | + /** Type of the DAI. */ |
206 | 197 | enum dai_type type;
|
| 198 | + /** Index of the DAI. */ |
207 | 199 | uint32_t dai_index;
|
| 200 | + /** Number of audio channels, words in frame. */ |
208 | 201 | uint8_t channels;
|
| 202 | + /** Frame clock (WS) frequency, sampling rate. */ |
209 | 203 | uint32_t rate;
|
| 204 | + /** DAI specific data stream format. */ |
210 | 205 | uint16_t format;
|
| 206 | + /** DAI specific configuration options. */ |
211 | 207 | uint8_t options;
|
| 208 | + /** Number of bits representing one data word. */ |
212 | 209 | uint8_t word_size;
|
| 210 | + /** Size of one RX/TX memory block (buffer) in bytes. */ |
213 | 211 | size_t block_size;
|
| 212 | + /** DAI specific link configuration. */ |
214 | 213 | uint16_t link_config;
|
215 | 214 | };
|
216 | 215 |
|
| 216 | +/** |
| 217 | + * @brief DAI timestamp configuration |
| 218 | + */ |
217 | 219 | struct dai_ts_cfg {
|
218 |
| - uint32_t walclk_rate; /* Rate in Hz, e.g. 19200000 */ |
219 |
| - int type; /* SSP, DMIC, HDA, etc. */ |
220 |
| - int direction; /* Playback, capture */ |
221 |
| - int index; /* For SSPx to select correct timestamp register */ |
222 |
| - int dma_id; /* DMA instance id */ |
223 |
| - int dma_chan_index; /* Used DMA channel */ |
224 |
| - int dma_chan_count; /* Channels in single DMA */ |
| 220 | + /** Rate in Hz, e.g. 19200000 */ |
| 221 | + uint32_t walclk_rate; |
| 222 | + /** Type of the DAI (SSP, DMIC, HDA, etc.). */ |
| 223 | + int type; |
| 224 | + /** Direction (playback/capture) */ |
| 225 | + int direction; |
| 226 | + /** Index for SSPx to select correct timestamp register */ |
| 227 | + int index; |
| 228 | + /** DMA instance id */ |
| 229 | + int dma_id; |
| 230 | + /** Used DMA channel index */ |
| 231 | + int dma_chan_index; |
| 232 | + /** Number of channels in single DMA */ |
| 233 | + int dma_chan_count; |
225 | 234 | };
|
226 | 235 |
|
| 236 | +/** |
| 237 | + * @brief DAI timestamp data |
| 238 | + */ |
227 | 239 | struct dai_ts_data {
|
228 |
| - uint64_t walclk; /* Wall clock */ |
229 |
| - uint64_t sample; /* Sample count */ |
230 |
| - uint32_t walclk_rate; /* Rate in Hz, e.g. 19200000 */ |
| 240 | + /** Wall clock */ |
| 241 | + uint64_t walclk; |
| 242 | + /** Sample count */ |
| 243 | + uint64_t sample; |
| 244 | + /** Rate in Hz, e.g. 19200000 */ |
| 245 | + uint32_t walclk_rate; |
231 | 246 | };
|
232 | 247 |
|
233 | 248 | /**
|
@@ -332,7 +347,7 @@ static inline int dai_config_set(const struct device *dev,
|
332 | 347 | * @param dev Pointer to the device structure for the driver instance
|
333 | 348 | * @param cfg Pointer to the config structure to be filled by the instance
|
334 | 349 | * @param dir Stream direction: RX or TX as defined by DAI_DIR_*
|
335 |
| - * @retval 0 if success, negative if invalid parameters or dai un-configured |
| 350 | + * @retval 0 if success, negative if invalid parameters or DAI un-configured |
336 | 351 | */
|
337 | 352 | static inline int dai_config_get(const struct device *dev,
|
338 | 353 | struct dai_config *cfg,
|
|
0 commit comments