|
@@ -5,7 +5,7 @@
|
|
|
|
|
|
|
|
|
/* AUDIO command */
|
|
|
-#define _AUDIO_CTL(a) (0x10 + a)
|
|
|
+#define _AUDIO_CTL(a) (0x10 + a)
|
|
|
|
|
|
#define AUDIO_CTL_GETCAPS _AUDIO_CTL(1)
|
|
|
#define AUDIO_CTL_CONFIGURE _AUDIO_CTL(2)
|
|
@@ -29,21 +29,21 @@
|
|
|
#define AUDIO_TYPE_EFFECT 0x10
|
|
|
|
|
|
/* Audio Format Types */
|
|
|
-#define AUDIO_FMT_PCM_U8 0x0001
|
|
|
-#define AUDIO_FMT_PCM_S8 0x0002
|
|
|
-
|
|
|
-#define AUDIO_FMT_PCM_U16_LE 0x0010
|
|
|
-#define AUDIO_FMT_PCM_S16_BE 0x0020
|
|
|
-#define AUDIO_FMT_PCM_S16_LE 0x0040
|
|
|
-#define AUDIO_FMT_PCM_U16_BE 0x0080
|
|
|
-#define AUDIO_FMT_PCM_U24_LE 0x0100
|
|
|
-#define AUDIO_FMT_PCM_S24_BE 0x0200
|
|
|
-#define AUDIO_FMT_PCM_S24_LE 0x0400
|
|
|
-#define AUDIO_FMT_PCM_U24_BE 0x0800
|
|
|
-#define AUDIO_FMT_PCM_U32_LE 0x1000
|
|
|
-#define AUDIO_FMT_PCM_S32_BE 0x2000
|
|
|
-#define AUDIO_FMT_PCM_S32_LE 0x4000
|
|
|
-#define AUDIO_FMT_PCM_U32_BE 0x8000
|
|
|
+#define AUDIO_FMT_PCM_U8 0x0001
|
|
|
+#define AUDIO_FMT_PCM_S8 0x0002
|
|
|
+
|
|
|
+#define AUDIO_FMT_PCM_U16_LE 0x0010
|
|
|
+#define AUDIO_FMT_PCM_S16_BE 0x0020
|
|
|
+#define AUDIO_FMT_PCM_S16_LE 0x0040
|
|
|
+#define AUDIO_FMT_PCM_U16_BE 0x0080
|
|
|
+#define AUDIO_FMT_PCM_U24_LE 0x0100
|
|
|
+#define AUDIO_FMT_PCM_S24_BE 0x0200
|
|
|
+#define AUDIO_FMT_PCM_S24_LE 0x0400
|
|
|
+#define AUDIO_FMT_PCM_U24_BE 0x0800
|
|
|
+#define AUDIO_FMT_PCM_U32_LE 0x1000
|
|
|
+#define AUDIO_FMT_PCM_S32_BE 0x2000
|
|
|
+#define AUDIO_FMT_PCM_S32_LE 0x4000
|
|
|
+#define AUDIO_FMT_PCM_U32_BE 0x8000
|
|
|
|
|
|
/* Supported Sampling Rates */
|
|
|
#define AUDIO_SAMP_RATE_8K 0x0001
|
|
@@ -72,10 +72,10 @@
|
|
|
|
|
|
|
|
|
/* Support Dsp(input/output) Units controls */
|
|
|
-#define AUDIO_DSP_PARAM 0 /* get/set all params */
|
|
|
-#define AUDIO_DSP_SAMPLERATE 1 /* ²ÉÑùƵÂÊ */
|
|
|
-#define AUDIO_DSP_FMT 2
|
|
|
-#define AUDIO_DSP_CHANNELS 3
|
|
|
+#define AUDIO_DSP_PARAM 0 /* get/set all params */
|
|
|
+#define AUDIO_DSP_SAMPLERATE 1 /* ²ÉÑùƵÂÊ */
|
|
|
+#define AUDIO_DSP_FMT 2
|
|
|
+#define AUDIO_DSP_CHANNELS 3
|
|
|
|
|
|
/* Supported Mixer Units controls */
|
|
|
#define AUDIO_MIXER_QUERY 0x0000
|
|
@@ -85,14 +85,14 @@
|
|
|
#define AUDIO_MIXER_MID 0x0008
|
|
|
#define AUDIO_MIXER_TREBLE 0x0010
|
|
|
#define AUDIO_MIXER_EQUALIZER 0x0020
|
|
|
-#define AUDIO_MIXER_LINE 0x0040
|
|
|
-#define AUDIO_MIXER_DIGITAL 0x0080
|
|
|
-#define AUDIO_MIXER_MIC 0x0100
|
|
|
+#define AUDIO_MIXER_LINE 0x0040
|
|
|
+#define AUDIO_MIXER_DIGITAL 0x0080
|
|
|
+#define AUDIO_MIXER_MIC 0x0100
|
|
|
|
|
|
-#define AUDIO_MIXER_EXTEND 0x8000 //extend mixer command
|
|
|
+#define AUDIO_MIXER_EXTEND 0x8000 //extend mixer command
|
|
|
|
|
|
-#define CFG_AUDIO_REPLAY_QUEUE_COUNT 4
|
|
|
-#define CFG_AUDIO_RECORD_PIPE_SIZE (8 * 1024)
|
|
|
+#define CFG_AUDIO_REPLAY_QUEUE_COUNT 4
|
|
|
+#define CFG_AUDIO_RECORD_PIPE_SIZE (8 * 1024)
|
|
|
|
|
|
enum
|
|
|
{
|
|
@@ -104,25 +104,25 @@ enum
|
|
|
/* the preferred number and size of audio pipeline buffer for the audio device */
|
|
|
struct rt_audio_buf_info
|
|
|
{
|
|
|
- rt_uint32_t buffer_size; /* Preferred qty of buffers */
|
|
|
- rt_uint32_t buffer_count; /* Preferred size of the buffers */
|
|
|
+ rt_uint32_t buffer_size; /* Preferred qty of buffers */
|
|
|
+ rt_uint32_t buffer_count; /* Preferred size of the buffers */
|
|
|
};
|
|
|
struct rt_audio_buf_desc
|
|
|
{
|
|
|
- rt_uint8_t *data_ptr;
|
|
|
- rt_size_t data_size;
|
|
|
+ rt_uint8_t *data_ptr;
|
|
|
+ rt_size_t data_size;
|
|
|
};
|
|
|
|
|
|
struct rt_audio_frame
|
|
|
{
|
|
|
const void *data_ptr;
|
|
|
- rt_size_t data_size;
|
|
|
- rt_size_t data_ofs;
|
|
|
+ rt_size_t data_size;
|
|
|
+ rt_size_t data_ofs;
|
|
|
};
|
|
|
|
|
|
struct rt_audio_queue
|
|
|
{
|
|
|
- rt_uint16_t count;
|
|
|
+ rt_uint16_t count;
|
|
|
rt_uint16_t size;
|
|
|
rt_uint16_t lwm;
|
|
|
rt_bool_t waiting_lwm;
|
|
@@ -141,24 +141,24 @@ struct rt_audio_caps;
|
|
|
struct rt_audio_configure;
|
|
|
struct rt_audio_ops
|
|
|
{
|
|
|
- rt_err_t (*getcaps) (struct rt_audio_device *audio,struct rt_audio_caps *caps);
|
|
|
- rt_err_t (*configure) (struct rt_audio_device *audio,struct rt_audio_caps *caps);
|
|
|
+ rt_err_t (*getcaps) (struct rt_audio_device *audio,struct rt_audio_caps *caps);
|
|
|
+ rt_err_t (*configure) (struct rt_audio_device *audio,struct rt_audio_caps *caps);
|
|
|
|
|
|
- rt_err_t (*init) (struct rt_audio_device *audio);
|
|
|
- rt_err_t (*shutdown) (struct rt_audio_device *audio);
|
|
|
- rt_err_t (*start) (struct rt_audio_device *audio,int stream);
|
|
|
- rt_err_t (*stop) (struct rt_audio_device *audio,int stream);
|
|
|
- rt_err_t (*suspend) (struct rt_audio_device *audio,int stream);
|
|
|
- rt_err_t (*resume) (struct rt_audio_device *audio,int stream);
|
|
|
+ rt_err_t (*init) (struct rt_audio_device *audio);
|
|
|
+ rt_err_t (*shutdown) (struct rt_audio_device *audio);
|
|
|
+ rt_err_t (*start) (struct rt_audio_device *audio,int stream);
|
|
|
+ rt_err_t (*stop) (struct rt_audio_device *audio,int stream);
|
|
|
+ rt_err_t (*suspend) (struct rt_audio_device *audio,int stream);
|
|
|
+ rt_err_t (*resume) (struct rt_audio_device *audio,int stream);
|
|
|
|
|
|
- rt_err_t (*control) (struct rt_audio_device *audio, rt_uint8_t cmd, void *arg);
|
|
|
- rt_size_t (*transmit) (struct rt_audio_device *audio, const void *writeBuf,void *readBuf, rt_size_t size);
|
|
|
+ rt_err_t (*control) (struct rt_audio_device *audio, rt_uint8_t cmd, void *arg);
|
|
|
+ rt_size_t (*transmit) (struct rt_audio_device *audio, const void *writeBuf,void *readBuf, rt_size_t size);
|
|
|
|
|
|
//get page size of codec or private buffer's info
|
|
|
- void (*buffer_info) (struct rt_audio_device *audio,struct rt_audio_buf_info *info );
|
|
|
+ void (*buffer_info) (struct rt_audio_device *audio,struct rt_audio_buf_info *info );
|
|
|
#ifdef AUDIO_DEVICE_USE_PRIVATE_BUFFER
|
|
|
- rt_err_t (*buffer_alloc) (struct rt_audio_device *audio,rt_uint8_t **data_ptr,rt_size_t *size);
|
|
|
- void (*buffer_free) (struct rt_audio_device *audio,rt_uint8_t *data_ptr);
|
|
|
+ rt_err_t (*buffer_alloc) (struct rt_audio_device *audio,rt_uint8_t **data_ptr,rt_size_t *size);
|
|
|
+ void (*buffer_free) (struct rt_audio_device *audio,rt_uint8_t *data_ptr);
|
|
|
#endif
|
|
|
};
|
|
|
|
|
@@ -174,35 +174,35 @@ struct rt_audio_configure
|
|
|
|
|
|
struct rt_audio_caps
|
|
|
{
|
|
|
- int main_type;
|
|
|
- int sub_type;
|
|
|
-
|
|
|
- union
|
|
|
- {
|
|
|
- rt_uint32_t mask;
|
|
|
- int value;
|
|
|
- struct rt_audio_configure config;
|
|
|
- }udata;
|
|
|
+ int main_type;
|
|
|
+ int sub_type;
|
|
|
+
|
|
|
+ union
|
|
|
+ {
|
|
|
+ rt_uint32_t mask;
|
|
|
+ int value;
|
|
|
+ struct rt_audio_configure config;
|
|
|
+ }udata;
|
|
|
};
|
|
|
|
|
|
struct rt_audio_replay
|
|
|
{
|
|
|
rt_bool_t activated;
|
|
|
- struct rt_audio_queue queue;
|
|
|
+ struct rt_audio_queue queue;
|
|
|
};
|
|
|
|
|
|
struct rt_audio_record
|
|
|
{
|
|
|
rt_bool_t activated;
|
|
|
- struct rt_pipe_device pipe;
|
|
|
+ struct rt_pipe_device pipe;
|
|
|
};
|
|
|
|
|
|
struct rt_audio_device
|
|
|
{
|
|
|
- struct rt_device parent;
|
|
|
- struct rt_audio_ops *ops;
|
|
|
+ struct rt_device parent;
|
|
|
+ struct rt_audio_ops *ops;
|
|
|
|
|
|
- struct rt_audio_replay *replay;
|
|
|
+ struct rt_audio_replay *replay;
|
|
|
struct rt_audio_record *record;
|
|
|
};
|
|
|
|
|
@@ -219,6 +219,7 @@ rt_uint32_t rt_audio_format_to_bits(rt_uint32_t format);
|
|
|
#define CODEC_CMD_SAMPLERATE 3
|
|
|
#define CODEC_CMD_EQ 4
|
|
|
#define CODEC_CMD_3D 5
|
|
|
+#define CODEC_CMD_SWITCH 6
|
|
|
|
|
|
#define CODEC_VOLUME_MAX (63)
|
|
|
|