Developer World
Spresense SDK Library v1.4.2-3df2e9d
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 
44 /* API Documents creater with Doxgen */
45 
55 /****************************************************************************
56  * Included Files
57  ****************************************************************************/
58 
60 
61 /****************************************************************************
62  * Pre-processor Definitions
63  ****************************************************************************/
64 
65 /* const for baseband */
69 #define AS_VOLUME_DAC -20
70 
71 /* TODO:Be removed in future */
72 
73 #define AS_AC_CODEC_VOL_DAC -20
74 
77 /* ---------------------------------*/
78 
84 #define AS_MIC_CHANNEL_MAX 8
85 
86 
89 #define AS_MICGAIN_HOLD 215
90 
96 #define AS_VOLUME_HOLD 255
97 
100 #define AS_VOLUME_MUTE -1025
101 
104 #define AS_BEEP_VOL_HOLD 255
105 
108 #define AS_BEEP_FREQ_HOLD 0
109 
112 #define AS_MICGAIN_MUTE -7855
113 
121 #define AS_CODECTYPE_MP3 0
122 
125 #define AS_CODECTYPE_WAV 1
126 
129 #define AS_CODECTYPE_AAC 2
130 
133 #define AS_CODECTYPE_OPUS 3
134 
137 #define AS_CODECTYPE_MEDIA 4
138 
141 #define AS_CODECTYPE_LPCM 5
142 
150 #define AS_BITLENGTH_16 16
151 
154 #define AS_BITLENGTH_24 24
155 
158 #define AS_BITLENGTH_32 32
159 
167 #define AS_CHANNEL_MONO 1
168 
171 #define AS_CHANNEL_STEREO 2
172 
175 #define AS_CHANNEL_4CH 4
176 
179 #define AS_CHANNEL_6CH 6
180 
183 #define AS_CHANNEL_8CH 8
184 
190 /* Auto */
191 
192 #define AS_SAMPLINGRATE_AUTO 0
193 
196 #define AS_SAMPLINGRATE_8000 8000
197 
200 #define AS_SAMPLINGRATE_11025 11025
201 
204 #define AS_SAMPLINGRATE_12000 12000
205 
208 #define AS_SAMPLINGRATE_16000 16000
209 
212 #define AS_SAMPLINGRATE_22050 22050
213 
216 #define AS_SAMPLINGRATE_24000 24000
217 
220 #define AS_SAMPLINGRATE_32000 32000
221 
224 #define AS_SAMPLINGRATE_44100 44100
225 
228 #define AS_SAMPLINGRATE_48000 48000
229 
232 #define AS_SAMPLINGRATE_64000 64000
233 
236 #define AS_SAMPLINGRATE_88200 88200
237 
240 #define AS_SAMPLINGRATE_96000 96000
241 
244 #define AS_SAMPLINGRATE_128000 128000
245 
248 #define AS_SAMPLINGRATE_176400 176400
249 
252 #define AS_SAMPLINGRATE_192000 192000
253 
261 #define AS_BITRATE_8000 8000
262 
265 #define AS_BITRATE_16000 16000
266 
269 #define AS_BITRATE_24000 24000
270 
273 #define AS_BITRATE_32000 32000
274 
277 #define AS_BITRATE_40000 40000
278 
281 #define AS_BITRATE_48000 48000
282 
285 #define AS_BITRATE_56000 56000
286 
289 #define AS_BITRATE_64000 64000
290 
293 #define AS_BITRATE_80000 80000
294 
297 #define AS_BITRATE_96000 96000
298 
301 #define AS_BITRATE_112000 112000
302 
305 #define AS_BITRATE_128000 128000
306 
309 #define AS_BITRATE_144000 144000
310 
313 #define AS_BITRATE_160000 160000
314 
317 #define AS_BITRATE_192000 192000
318 
321 #define AS_BITRATE_224000 224000
322 
325 #define AS_BITRATE_256000 256000
326 
329 #define AS_BITRATE_320000 320000
330 
333 #define AS_BITRATE_384000 384000
334 
337 #define AS_BITRATE_448000 448000
338 
341 #define AS_BITRATE_510000 510000
342 
352 #define AS_ATTENTION_CODE_INFORMATION 0x00
353 
360 #define AS_ATTENTION_CODE_WARNING 0x01
361 
368 #define AS_ATTENTION_CODE_ERROR 0x02
369 
375 #define AS_ATTENTION_CODE_FATAL 0x03
376 
388 #define AS_ATTENTION_SUB_CODE_DMA_UNDERFLOW 0x01
389 
396 #define AS_ATTENTION_SUB_CODE_DMA_OVERFLOW 0x02
397 
402 #define AS_ATTENTION_SUB_CODE_DMA_ERROR 0x03
403 
408 #define AS_ATTENTION_SUB_CODE_APU_QUEUE_FULL 0x04
409 
416 #define AS_ATTENTION_SUB_CODE_SIMPLE_FIFO_UNDERFLOW 0x05
417 
424 #define AS_ATTENTION_SUB_CODE_SIMPLE_FIFO_OVERFLOW 0x06
425 
430 #define AS_ATTENTION_SUB_CODE_ILLEGAL_REQUEST 0x07
431 
436 #define AS_ATTENTION_SUB_CODE_INTERNAL_STATE_ERROR 0x08
437 
442 #define AS_ATTENTION_SUB_CODE_UNEXPECTED_PARAM 0x09
443 
448 #define AS_ATTENTION_SUB_CODE_QUEUE_POP_ERROR 0x0A
449 
454 #define AS_ATTENTION_SUB_CODE_QUEUE_PUSH_ERROR 0x0B
455 
460 #define AS_ATTENTION_SUB_CODE_QUEUE_MISSING_ERROR 0x0C
461 
467 #define AS_ATTENTION_SUB_CODE_MEMHANDLE_ALLOC_ERROR 0x0D
468 
473 #define AS_ATTENTION_SUB_CODE_MEMHANDLE_FREE_ERROR 0x0E
474 
480 #define AS_ATTENTION_SUB_CODE_TASK_CREATE_ERROR 0x0F
481 
488 #define AS_ATTENTION_SUB_CODE_RESOURCE_ERROR 0x10
489 
494 #define AS_ATTENTION_SUB_CODE_DECODED_SIZE_ZERO 0x11
495 
501 #define AS_ATTENTION_SUB_CODE_DSP_LOAD_ERROR 0x12
502 
508 #define AS_ATTENTION_SUB_CODE_DSP_UNLOAD_ERROR 0x13
509 
514 #define AS_ATTENTION_SUB_CODE_DSP_EXEC_ERROR 0x14
515 
520 #define AS_ATTENTION_SUB_CODE_DSP_RESULT_ERROR 0x15
521 
527 #define AS_ATTENTION_SUB_CODE_DSP_ILLEGAL_REPLY 0x16
528 
533 #define AS_ATTENTION_SUB_CODE_DSP_UNLOAD_DONE 0x17
534 
539 #define AS_ATTENTION_SUB_CODE_DSP_VERSION_ERROR 0x18
540 
545 #define AS_ATTENTION_SUB_CODE_BASEBAND_ERROR 0x19
546 
552 #define AS_ATTENTION_SUB_CODE_STREAM_PARSER_ERROR 0x1A
553 
558 #define AS_ATTENTION_SUB_CODE_DSP_LOAD_DONE 0x1B
559 
564 #define AS_ATTENTION_SUB_CODE_RECSTART 0x1C
565 
570 #define AS_ATTENTION_SUB_CODE_RECSTOP 0x1D
571 
577 #define AS_ATTENTION_SUB_CODE_DSP_LOG_ALLOC_ERROR 0x1E
578 
583 #define AS_ATTENTION_SUB_CODE_DSP_ASSETION_FAIL 0x1F
584 
589 #define AS_ATTENTION_SUB_CODE_DSP_SEND_ERROR 0x20
590 
596 #define AS_ATTENTION_SUB_CODE_ALLOC_HEAP_MEMORY 0x21
597 
598 #define AS_ATTENTION_SUB_CODE_NUM AS_ATTENTION_SUB_CODE_ALLOC_HEAP_MEMORY
599 
604 #define AS_AUDIO_DSP_PATH_LEN 24
605 
606 /****************************************************************************
607  * Public Types
608  ****************************************************************************/
609 typedef void (*PcmProcDoneCallback)(int32_t identifier, bool is_end);
610 
613 typedef struct
614 {
617  int32_t identifier;
618 
621  PcmProcDoneCallback callback;
622 
626 
629  uint32_t sample;
630 
633  uint32_t size;
634 
637  bool is_end;
638 
641  bool is_valid;
642 
645  uint8_t bit_length;
646 
648 
649 typedef struct
650 {
654 
657  uint32_t size;
658 
660 
663 #define ATTENTION_FILE_NAME_LEN 32
664 
665 typedef struct
666 {
669  uint32_t reserved1;
670 
673  uint8_t error_code;
674 
677  uint8_t cpu_id;
678 
681  uint8_t sub_module_id;
682 
685  uint8_t module_id;
686 
690 
693  uint32_t reserved2;
694 
697  uint16_t line_number;
698 
701  uint8_t task_id;
702 
705  uint8_t reserved3;
706 
709  union
710  {
711  uint32_t align_dummy;
712  char error_filename[ATTENTION_FILE_NAME_LEN];
713  };
714 
716 
721 typedef void (*AudioAttentionCb)(const ErrorAttentionParam *attparam);
722 
723 #ifndef ATTENTION_USE_FILENAME_LINE
724 typedef void (*obs_AudioAttentionCb)(uint8_t module_id,
725  uint8_t error_code,
726  uint8_t sub_code);
727 #else
728 typedef void (*obs_AudioAttentionCb)(uint8_t module_id,
729  uint8_t error_code,
730  uint8_t sub_code,
731  FAR const char *file_name,
732  uint32_t line);
733 #endif
734 
735 #endif /* __MODULES_INCLUDE_AUDIO_AUDIO_COMMON_DEFS_H */
736 
Definition: audio_common_defs.h:613
uint8_t bit_length
[in] Data bit length
Definition: audio_common_defs.h:645
uint8_t reserved3
[out] reserved
Definition: audio_common_defs.h:705
int32_t identifier
[in] Data identifier, use anyway
Definition: audio_common_defs.h:617
uint32_t error_att_sub_code
[out] Detailed Error Infomation, T.B.D.
Definition: audio_common_defs.h:689
uint8_t task_id
[out] Task ID (internal use only)
Definition: audio_common_defs.h:701
uint32_t sample
[in] Sample number of PCM data
Definition: audio_common_defs.h:629
uint8_t error_code
[out] Error Infomation, T.B.D.
Definition: audio_common_defs.h:673
MemMgrLite::MemHandle mh
[in] Memory handle for recognition result information.
Definition: audio_common_defs.h:653
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:721
Memory Handler API.
uint8_t module_id
[out] Error module infomation, T.B.D.
Definition: audio_common_defs.h:685
bool is_end
[in] True: Last data of current session.
Definition: audio_common_defs.h:637
uint32_t reserved2
[out] reserved
Definition: audio_common_defs.h:693
Memory Handler Class for "Memory Manager Lite". This is only wrapper class for convert project-specif...
Definition: MemManager.h:98
#define ATTENTION_FILE_NAME_LEN
Definition: audio_common_defs.h:663
bool is_valid
[in] True: Valid PCM frame.
Definition: audio_common_defs.h:641
uint32_t reserved1
[out] reserved
Definition: audio_common_defs.h:669
MemMgrLite::MemHandle mh
[in] Memory handle for output PCM data
Definition: audio_common_defs.h:625
uint8_t cpu_id
[out] CPU ID (internal use only)
Definition: audio_common_defs.h:677
Definition: audio_common_defs.h:649
uint8_t sub_module_id
[out] for debug purpose
Definition: audio_common_defs.h:681
uint16_t line_number
[out] Line No (internal use only)
Definition: audio_common_defs.h:697
uint32_t size
[in] Size recognition result information.
Definition: audio_common_defs.h:657
Definition: audio_common_defs.h:665
uint32_t size
[in] Byte size of input data
Definition: audio_common_defs.h:633