Skip to content

Commit 3a8a794

Browse files
committed
[doxygen][audio] Fix doxygen comments for audio component
Added comments for data structure and rt_audio_ops in dev_audio.h. Enriched comments for macro group. Moved and renamed folder audio. Signed-off-by: 1078249029 <[email protected]>
1 parent f7d5421 commit 3a8a794

File tree

5 files changed

+54
-41
lines changed

5 files changed

+54
-41
lines changed

components/drivers/audio/dev_audio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Date Author Notes
88
* 2017-05-09 Urey first version
99
* 2019-07-09 Zero-Free improve device ops interface and data flows
10+
* 2025-03-04 wumingzi add doxygen comments.
1011
*/
1112

1213
#include <stdio.h>
@@ -23,7 +24,7 @@
2324
#endif
2425

2526
/**
26-
* @addtogroup group_AudioPipe
27+
* @addtogroup group_Audio
2728
*/
2829

2930
/** @{ */

components/drivers/audio/dev_audio_pipe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2012-09-30 Bernard first version.
9+
* 2025-03-04 wumingzi add doxygen comments.
910
*/
1011

1112
#include <rthw.h>

components/drivers/audio/dev_audio_pipe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* Change Logs:
77
* Date Author Notes
8+
* 2025-03-04 wumingzi add doxygen comments.
89
*/
910
#ifndef __DEV_AUDIO_PIPE_H__
1011
#define __DEV_AUDIO_PIPE_H__

components/drivers/include/drivers/dev_audio.h

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Date Author Notes
88
* 2017-05-09 Urey first version
99
* 2019-07-09 Zero-Free improve device ops interface and data flows
10-
*
10+
* 2025-03-04 wumingzi add doxygen comments.
1111
*/
1212

1313
#ifndef __DEV_AUDIO_H__
@@ -120,7 +120,8 @@
120120
/**
121121
* @defgroup audio_dsp AUDIO_DSP
122122
*
123-
* @brief Support Dsp(input/output) Units controls
123+
* @brief Support Dsp(input/output) Units controls. The macro group from application level, can
124+
* set audio mixer parameters including samplerate, channels etc.
124125
*/
125126

126127
/**
@@ -136,7 +137,8 @@
136137
/**
137138
* @defgroup audio_mixer AUDIO_MIXER
138139
*
139-
* @brief Supported Mixer Units controls
140+
* @brief Supported Mixer Units controls. The macro group from driver level, can set audio mixer
141+
* parameters including volume, frequence db, microphone etc.
140142
*/
141143

142144
/**
@@ -181,25 +183,30 @@ enum
181183
*/
182184
struct rt_audio_buf_info
183185
{
184-
rt_uint8_t *buffer;
185-
rt_uint16_t block_size;
186-
rt_uint16_t block_count;
187-
rt_uint32_t total_size;
186+
rt_uint8_t *buffer; /**< Audio buffer information */
187+
rt_uint16_t block_size; /**< Audio block_size information for replay function */
188+
rt_uint16_t block_count; /**< Audio block_count information for replay function */
189+
rt_uint32_t total_size; /**< Audio total_size which is equal to block_size multiplying
190+
block_count information for replay function */
191+
188192
};
189193

190194
struct rt_audio_device;
191195
struct rt_audio_caps;
192196
struct rt_audio_configure;
197+
198+
/**
199+
* @brief Aduio device operators
200+
*/
193201
struct rt_audio_ops
194202
{
195-
rt_err_t (*getcaps)(struct rt_audio_device *audio, struct rt_audio_caps *caps);
196-
rt_err_t (*configure)(struct rt_audio_device *audio, struct rt_audio_caps *caps);
197-
rt_err_t (*init)(struct rt_audio_device *audio);
198-
rt_err_t (*start)(struct rt_audio_device *audio, int stream);
199-
rt_err_t (*stop)(struct rt_audio_device *audio, int stream);
200-
rt_ssize_t (*transmit)(struct rt_audio_device *audio, const void *writeBuf, void *readBuf, rt_size_t size);
201-
/* get page size of codec or private buffer's info */
202-
void (*buffer_info)(struct rt_audio_device *audio, struct rt_audio_buf_info *info);
203+
rt_err_t (*getcaps)(struct rt_audio_device *audio, struct rt_audio_caps *caps); /**< Get audio capabilities information */
204+
rt_err_t (*configure)(struct rt_audio_device *audio, struct rt_audio_caps *caps); /**< Configure audio devices */
205+
rt_err_t (*init)(struct rt_audio_device *audio); /**< Initialize audio device */
206+
rt_err_t (*start)(struct rt_audio_device *audio, int stream); /**< Turn on the audio device */
207+
rt_err_t (*stop)(struct rt_audio_device *audio, int stream); /**< Turn off the audio device */
208+
rt_ssize_t (*transmit)(struct rt_audio_device *audio, const void *writeBuf, void *readBuf, rt_size_t size); /**< Transmit data between application and device */
209+
void (*buffer_info)(struct rt_audio_device *audio, struct rt_audio_buf_info *info); /**< Get page size of codec or private buffer's info */
203210
};
204211

205212
/**
@@ -211,43 +218,45 @@ struct rt_audio_ops
211218
*/
212219
struct rt_audio_configure
213220
{
214-
rt_uint32_t samplerate;
215-
rt_uint16_t channels;
216-
rt_uint16_t samplebits;
221+
rt_uint32_t samplerate; /**< Audio samplerate information */
222+
rt_uint16_t channels; /**< Audio channels information */
223+
rt_uint16_t samplebits; /**< Audio samplebits information */
217224
};
218225

219226
/**
220227
* @brief Audio capabilities
221228
*/
222229
struct rt_audio_caps
223230
{
224-
int main_type;
225-
int sub_type;
231+
int main_type; /**< Audio main type, one value of @ref audio_type */
232+
int sub_type; /**< Audio sub type, one value of @ref audio_dsp @ref audio_mixer */
226233

227234
union
228235
{
229-
rt_uint32_t mask;
230-
int value;
231-
struct rt_audio_configure config;
232-
} udata;
236+
rt_uint32_t mask; /**< Capabilities mask */
237+
int value; /**< Capabilities value */
238+
struct rt_audio_configure config; /**< Audio samplebits information */
239+
} udata; /**< User data */
233240
};
234241

235242
/**
236243
* @brief Audio replay
237244
*/
238245
struct rt_audio_replay
239246
{
240-
struct rt_mempool *mp;
241-
struct rt_data_queue queue;
242-
struct rt_mutex lock;
243-
struct rt_completion cmp;
244-
struct rt_audio_buf_info buf_info;
245-
rt_uint8_t *write_data;
246-
rt_uint16_t write_index;
247-
rt_uint16_t read_index;
248-
rt_uint32_t pos;
249-
rt_uint8_t event;
250-
rt_bool_t activated;
247+
struct rt_mempool *mp; /**< Memory pool for audio replay */
248+
struct rt_data_queue queue; /**< Replay data queue */
249+
struct rt_mutex lock; /**< Replay mutex lock*/
250+
struct rt_completion cmp; /**< Replay completion, it will be */
251+
struct rt_audio_buf_info buf_info; /**< Replay buffer information */
252+
rt_uint8_t *write_data; /**< Pointer to the data to be written into data queue */
253+
rt_uint16_t write_index; /**< Index of pointer write_data.It records how much data
254+
has been written in currently being played block */
255+
rt_uint16_t read_index; /**< Index of replaying data for audio device, it indicates index of replay
256+
in the blocks which is currently being played */
257+
rt_uint32_t pos; /**< Global position of audio replay */
258+
rt_uint8_t event; /**< Event flag */
259+
rt_bool_t activated; /**< Activaty flag */
251260
};
252261

253262
/**
@@ -264,10 +273,10 @@ struct rt_audio_record
264273
*/
265274
struct rt_audio_device
266275
{
267-
struct rt_device parent;
268-
struct rt_audio_ops *ops;
269-
struct rt_audio_replay *replay;
270-
struct rt_audio_record *record;
276+
struct rt_device parent; /**< Audio device parents */
277+
struct rt_audio_ops *ops; /**< Audio device operator*/
278+
struct rt_audio_replay *replay; /**< Pointer to audio replay structure */
279+
struct rt_audio_record *record; /**< Pointer to audio record structure */
271280
};
272281

273282
rt_err_t rt_audio_register(struct rt_audio_device *audio, const char *name, rt_uint32_t flag, void *data);
@@ -277,7 +286,8 @@ void rt_audio_rx_done(struct rt_audio_device *audio, rt_uint8_t *pbuf, rt
277286
/**
278287
* @defgroup audio_codec_cmd CODEC_CMD
279288
*
280-
* @brief Device Control Commands
289+
* @brief Device Control Commands. The macro group from hardware level, can set codec
290+
* parametes including volume, EQ and 3D etc.
281291
*/
282292

283293
/**

0 commit comments

Comments
 (0)