Developer World
Spresense SDK Library v3.2.0-ebc0364
audio_common_defs.h
Go to the documentation of this file.
1/****************************************************************************
2 * modules/include/audio/audio_common_defs.h
3 *
4 * Copyright 2018 Sony Semiconductor Solutions Corporation
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************/
35
36#ifndef __MODULES_INCLUDE_AUDIO_AUDIO_COMMON_DEFS_H
37#define __MODULES_INCLUDE_AUDIO_AUDIO_COMMON_DEFS_H
38
39#include <arch/chip/audio.h>
40
46/* API Documents creater with Doxgen */
47
57/****************************************************************************
58 * Included Files
59 ****************************************************************************/
60
62
63/****************************************************************************
64 * Pre-processor Definitions
65 ****************************************************************************/
66
67/* const for baseband */
71#define AS_VOLUME_DAC -20
72
73/* TODO:Be removed in future */
74
75#define AS_AC_CODEC_VOL_DAC -20
76
79/* ---------------------------------*/
80
86#define AS_MIC_CHANNEL_MAX 8
87
88
91#define AS_MICGAIN_HOLD 215
92
98#define AS_VOLUME_HOLD 255
99
102#define AS_VOLUME_MUTE -1025
103
106#define AS_BEEP_VOL_HOLD 255
107
110#define AS_BEEP_FREQ_HOLD 0
111
114#define AS_MICGAIN_MUTE -7855
115
123#define AS_CODECTYPE_MP3 0
124
127#define AS_CODECTYPE_WAV 1
128
131#define AS_CODECTYPE_AAC 2
132
135#define AS_CODECTYPE_OPUS 3
136
139#define AS_CODECTYPE_MEDIA 4
140
143#define AS_CODECTYPE_LPCM 5
144
152#define AS_BITLENGTH_16 16
153
156#define AS_BITLENGTH_24 24
157
160#define AS_BITLENGTH_32 32
161
169#define AS_CHANNEL_MONO 1
170
173#define AS_CHANNEL_STEREO 2
174
177#define AS_CHANNEL_4CH 4
178
181#define AS_CHANNEL_6CH 6
182
185#define AS_CHANNEL_8CH 8
186
192/* Auto */
193
194#define AS_SAMPLINGRATE_AUTO 0
195
198#define AS_SAMPLINGRATE_8000 8000
199
202#define AS_SAMPLINGRATE_11025 11025
203
206#define AS_SAMPLINGRATE_12000 12000
207
210#define AS_SAMPLINGRATE_16000 16000
211
214#define AS_SAMPLINGRATE_22050 22050
215
218#define AS_SAMPLINGRATE_24000 24000
219
222#define AS_SAMPLINGRATE_32000 32000
223
226#define AS_SAMPLINGRATE_44100 44100
227
230#define AS_SAMPLINGRATE_48000 48000
231
234#define AS_SAMPLINGRATE_64000 64000
235
238#define AS_SAMPLINGRATE_88200 88200
239
242#define AS_SAMPLINGRATE_96000 96000
243
246#define AS_SAMPLINGRATE_128000 128000
247
250#define AS_SAMPLINGRATE_176400 176400
251
254#define AS_SAMPLINGRATE_192000 192000
255
263#define AS_BITRATE_8000 8000
264
267#define AS_BITRATE_16000 16000
268
271#define AS_BITRATE_24000 24000
272
275#define AS_BITRATE_32000 32000
276
279#define AS_BITRATE_40000 40000
280
283#define AS_BITRATE_48000 48000
284
287#define AS_BITRATE_56000 56000
288
291#define AS_BITRATE_64000 64000
292
295#define AS_BITRATE_80000 80000
296
299#define AS_BITRATE_96000 96000
300
303#define AS_BITRATE_112000 112000
304
307#define AS_BITRATE_128000 128000
308
311#define AS_BITRATE_144000 144000
312
315#define AS_BITRATE_160000 160000
316
319#define AS_BITRATE_192000 192000
320
323#define AS_BITRATE_224000 224000
324
327#define AS_BITRATE_256000 256000
328
331#define AS_BITRATE_320000 320000
332
335#define AS_BITRATE_384000 384000
336
339#define AS_BITRATE_448000 448000
340
343#define AS_BITRATE_510000 510000
344
352typedef enum
353{
357
360
364
368
372
376
380
384
388
392
396
400
404
408
412
416
420
424
428
429 AS_MODULE_ID_NUM,
430} AsModuleId;
431
441#define AS_ATTENTION_CODE_INFORMATION 0x00
442
449#define AS_ATTENTION_CODE_WARNING 0x01
450
457#define AS_ATTENTION_CODE_ERROR 0x02
458
464#define AS_ATTENTION_CODE_FATAL 0x03
465
477#define AS_ATTENTION_SUB_CODE_DMA_UNDERFLOW 0x01
478
485#define AS_ATTENTION_SUB_CODE_DMA_OVERFLOW 0x02
486
491#define AS_ATTENTION_SUB_CODE_DMA_ERROR 0x03
492
497#define AS_ATTENTION_SUB_CODE_APU_QUEUE_FULL 0x04
498
505#define AS_ATTENTION_SUB_CODE_SIMPLE_FIFO_UNDERFLOW 0x05
506
513#define AS_ATTENTION_SUB_CODE_SIMPLE_FIFO_OVERFLOW 0x06
514
519#define AS_ATTENTION_SUB_CODE_ILLEGAL_REQUEST 0x07
520
525#define AS_ATTENTION_SUB_CODE_INTERNAL_STATE_ERROR 0x08
526
531#define AS_ATTENTION_SUB_CODE_UNEXPECTED_PARAM 0x09
532
537#define AS_ATTENTION_SUB_CODE_QUEUE_POP_ERROR 0x0A
538
543#define AS_ATTENTION_SUB_CODE_QUEUE_PUSH_ERROR 0x0B
544
549#define AS_ATTENTION_SUB_CODE_QUEUE_MISSING_ERROR 0x0C
550
556#define AS_ATTENTION_SUB_CODE_MEMHANDLE_ALLOC_ERROR 0x0D
557
562#define AS_ATTENTION_SUB_CODE_MEMHANDLE_FREE_ERROR 0x0E
563
569#define AS_ATTENTION_SUB_CODE_TASK_CREATE_ERROR 0x0F
570
577#define AS_ATTENTION_SUB_CODE_RESOURCE_ERROR 0x10
578
583#define AS_ATTENTION_SUB_CODE_DECODED_SIZE_ZERO 0x11
584
590#define AS_ATTENTION_SUB_CODE_DSP_LOAD_ERROR 0x12
591
597#define AS_ATTENTION_SUB_CODE_DSP_UNLOAD_ERROR 0x13
598
603#define AS_ATTENTION_SUB_CODE_DSP_EXEC_ERROR 0x14
604
609#define AS_ATTENTION_SUB_CODE_DSP_RESULT_ERROR 0x15
610
616#define AS_ATTENTION_SUB_CODE_DSP_ILLEGAL_REPLY 0x16
617
622#define AS_ATTENTION_SUB_CODE_DSP_UNLOAD_DONE 0x17
623
628#define AS_ATTENTION_SUB_CODE_DSP_VERSION_ERROR 0x18
629
634#define AS_ATTENTION_SUB_CODE_BASEBAND_ERROR 0x19
635
641#define AS_ATTENTION_SUB_CODE_STREAM_PARSER_ERROR 0x1A
642
647#define AS_ATTENTION_SUB_CODE_DSP_LOAD_DONE 0x1B
648
653#define AS_ATTENTION_SUB_CODE_RECSTART 0x1C
654
659#define AS_ATTENTION_SUB_CODE_RECSTOP 0x1D
660
666#define AS_ATTENTION_SUB_CODE_DSP_LOG_ALLOC_ERROR 0x1E
667
672#define AS_ATTENTION_SUB_CODE_DSP_ASSETION_FAIL 0x1F
673
678#define AS_ATTENTION_SUB_CODE_DSP_SEND_ERROR 0x20
679
685#define AS_ATTENTION_SUB_CODE_ALLOC_HEAP_MEMORY 0x21
686
687#define AS_ATTENTION_SUB_CODE_NUM AS_ATTENTION_SUB_CODE_ALLOC_HEAP_MEMORY
688
693#define AS_AUDIO_DSP_PATH_LEN 24
694
695/****************************************************************************
696 * Public Types
697 ****************************************************************************/
698typedef void (*PcmProcDoneCallback)(int32_t identifier, bool is_end);
699
702typedef struct
703{
706 int32_t identifier;
707
710 PcmProcDoneCallback callback;
711
715
718 uint32_t sample;
719
722 uint32_t size;
723
726 bool is_end;
727
731
734 uint8_t bit_length;
735
737
738typedef struct
739{
743
746 uint32_t size;
747
749
752#define ATTENTION_FILE_NAME_LEN 32
753
754typedef struct
755{
758 uint32_t reserved1;
759
762 uint8_t error_code;
763
766 uint8_t cpu_id;
767
771
774 uint8_t module_id;
775
779
782 uint32_t reserved2;
783
786 uint16_t line_number;
787
790 uint8_t task_id;
791
794 uint8_t reserved3;
795
798 union
799 {
800 uint32_t align_dummy;
801 char error_filename[ATTENTION_FILE_NAME_LEN];
802 };
803
805
810typedef void (*AudioAttentionCb)(const ErrorAttentionParam *attparam);
811
812#ifndef ATTENTION_USE_FILENAME_LINE
813typedef void (*obs_AudioAttentionCb)(uint8_t module_id,
814 uint8_t error_code,
815 uint8_t sub_code);
816#else
817typedef void (*obs_AudioAttentionCb)(uint8_t module_id,
818 uint8_t error_code,
819 uint8_t sub_code,
820 FAR const char *file_name,
821 uint32_t line);
822#endif
823
824#endif /* __MODULES_INCLUDE_AUDIO_AUDIO_COMMON_DEFS_H */
Memory Handler API.
Memory Handler Class for "Memory Manager Lite". This is only wrapper class for convert project-specif...
Definition: MemManager.h:107
#define ATTENTION_FILE_NAME_LEN
Definition: audio_common_defs.h:752
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:810
AsModuleId
Definition: audio_common_defs.h:353
@ AS_MODULE_ID_DECODER_CMP
Decoder Component ID.
Definition: audio_common_defs.h:399
@ AS_MODULE_ID_FILTER_CMP
Filter Component ID.
Definition: audio_common_defs.h:407
@ AS_MODULE_ID_CAPTURE_CMP
Capture Component ID.
Definition: audio_common_defs.h:395
@ AS_MODULE_ID_CUSTOM_CMP
Custom Component ID.
Definition: audio_common_defs.h:427
@ AS_MODULE_ID_PLAYER_OBJ
Player Object ID.
Definition: audio_common_defs.h:379
@ AS_MODULE_ID_RENDERER_CMP
Renderer Component ID.
Definition: audio_common_defs.h:415
@ AS_MODULE_ID_MEDIA_RECORDER_OBJ
Media Recorder Object ID.
Definition: audio_common_defs.h:371
@ AS_MODULE_ID_SYNTHESIZER_OBJ
Synthesizer Object ID.
Definition: audio_common_defs.h:391
@ AS_MODULE_ID_RECOGNITION_CMP
Recognition Component ID.
Definition: audio_common_defs.h:411
@ AS_MODULE_ID_RECOGNITION_OBJ
Recognition Object ID.
Definition: audio_common_defs.h:383
@ AS_MODULE_ID_POSTPROC_CMP
Postfilter Component ID.
Definition: audio_common_defs.h:419
@ AS_MODULE_ID_AUDIO_MANAGER
Audio Manager Module ID.
Definition: audio_common_defs.h:356
@ AS_MODULE_ID_INPUT_DATA_MNG_OBJ
Input Data Manager Object ID.
Definition: audio_common_defs.h:367
@ AS_MODULE_ID_ENCODER_CMP
Encoder Component ID.
Definition: audio_common_defs.h:403
@ AS_MODULE_ID_AUDIO_DRIVER
Audio Baseband Driver Module ID.
Definition: audio_common_defs.h:359
@ AS_MODULE_ID_OUTPUT_MIX_OBJ
Output Mix Object ID.
Definition: audio_common_defs.h:375
@ AS_MODULE_ID_OSCILLATOR_CMP
Oscillator Component ID.
Definition: audio_common_defs.h:423
@ AS_MODULE_ID_SOUND_EFFECT_OBJ
Sound Effect Object ID.
Definition: audio_common_defs.h:387
@ AS_MODULE_ID_MIC_FRONTEND_OBJ
FrontEnd Object ID.
Definition: audio_common_defs.h:363
Definition: audio_common_defs.h:703
bool is_valid
[in] True: Valid PCM frame.
Definition: audio_common_defs.h:730
uint32_t sample
[in] Sample number of PCM data
Definition: audio_common_defs.h:718
uint32_t size
[in] Byte size of input data
Definition: audio_common_defs.h:722
MemMgrLite::MemHandle mh
[in] Memory handle for output PCM data
Definition: audio_common_defs.h:714
uint8_t bit_length
[in] Data bit length
Definition: audio_common_defs.h:734
int32_t identifier
[in] Data identifier, use anyway
Definition: audio_common_defs.h:706
bool is_end
[in] True: Last data of current session.
Definition: audio_common_defs.h:726
Definition: audio_common_defs.h:739
uint32_t size
[in] Size recognition result information.
Definition: audio_common_defs.h:746
MemMgrLite::MemHandle mh
[in] Memory handle for recognition result information.
Definition: audio_common_defs.h:742
Definition: audio_common_defs.h:755
uint8_t task_id
[out] Task ID (internal use only)
Definition: audio_common_defs.h:790
uint8_t error_code
[out] Error Infomation, T.B.D.
Definition: audio_common_defs.h:762
uint32_t error_att_sub_code
[out] Detailed Error Infomation, T.B.D.
Definition: audio_common_defs.h:778
uint8_t cpu_id
[out] CPU ID (internal use only)
Definition: audio_common_defs.h:766
uint8_t module_id
[out] Error module infomation, T.B.D.
Definition: audio_common_defs.h:774
uint8_t sub_module_id
[out] for debug purpose
Definition: audio_common_defs.h:770
uint16_t line_number
[out] Line No (internal use only)
Definition: audio_common_defs.h:786
uint8_t reserved3
[out] reserved
Definition: audio_common_defs.h:794
uint32_t reserved2
[out] reserved
Definition: audio_common_defs.h:782
uint32_t reserved1
[out] reserved
Definition: audio_common_defs.h:758