Developer World
Spresense SDK Library v3.3.0-375c679
audio_frontend_api.h
Go to the documentation of this file.
1/****************************************************************************
2 * modules/include/audio/audio_frontend_api.h
3 *
4 * Copyright 2019 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_FRONTEND_API_H
37#define __MODULES_INCLUDE_AUDIO_AUDIO_FRONTEND_API_H
38
53/****************************************************************************
54 * Included Files
55 ****************************************************************************/
56
57#include <stdint.h>
58#include <stdbool.h>
59
63
64/****************************************************************************
65 * Pre-processor Definitions
66 ****************************************************************************/
67
68#define AS_FEATURE_FRONTEND_ENABLE
69
75#define LENGTH_INIT_MICFRONTEND 4
76
79#define LENGTH_INIT_PREPROCESS_DSP 4
80
83#define LENGTH_SET_PREPROCESS_DSP 4
84
89#define AS_PREPROCESS_FILE_PATH_LEN 22
90
91/****************************************************************************
92 * Public Types
93 ****************************************************************************/
94
97typedef enum
98{
102
106
110
114
118
122
126
130
132
133typedef enum
134{
135 AsMicFrontendDeviceMic = 0,
136 AsMicFrontendDeviceI2S,
137
138} AsMicFrontendInputDevice;
139
142typedef enum
143{
147
151
155
156 AsMicFrontendPreProcInvalid = 0xff,
157
159
160typedef enum
161{
165
169
173
175
178typedef struct
179{
186
188
189typedef bool (*MicFrontendCallback)(AsMicFrontendEvent evtype, uint32_t result, uint32_t sub_result);
190
191typedef struct
192{
194
195 MicFrontendCallback cb;
196
198
201typedef struct
202{
203 uint32_t reserve;
204
206
210
212{
214
215 CMN_SimpleFifoHandle *simple_fifo_handler;
216
218 {
219 uint8_t msgqid;
220 uint16_t msgtype;
221 } msg;
222};
223
224typedef struct
225{
230
234 uint8_t bit_length;
235
240
246 uint32_t out_fs;
247
254
259
265 uint8_t data_path;
266
273
275
278typedef struct
279{
280 uint32_t reserve;
281
283
286typedef struct
287{
288 uint32_t stop_mode;
289
291
294typedef struct
295{
298 uint8_t *packet_addr;
299
302 uint32_t packet_size;
303
305
308typedef struct
309{
319 int16_t mic_gain[AS_MIC_CHANNEL_MAX];
320
322
325typedef struct
326{
330
333 uint8_t reserved0;
334 uint8_t reserved1;
335 uint8_t reserved2;
336
338
341typedef struct
342{
346
349 union
350 {
356
362
368
374
380
386
392
398 };
399
401
404typedef struct
405{
408 uint8_t micfrontend;
409
412 uint8_t mng;
413
416 uint8_t dsp;
417
419
422typedef struct
423{
427
431
435
437
438typedef struct
439{
442 uint8_t input;
443
446 uint8_t output;
447
450 uint8_t dsp;
451
453
456typedef struct
457{
461
465
467
468typedef struct
469{
473
477
479
480/****************************************************************************
481 * Public Data
482 ****************************************************************************/
483
484/****************************************************************************
485 * Inline Functions
486 ****************************************************************************/
487
488/****************************************************************************
489 * Public Function Prototypes
490 ****************************************************************************/
491
503 AudioAttentionCb attcb);
504
506 AudioAttentionCb attcb);
507
518
529
540
551
560
569
578
587
596
605
606#endif /* __MODULES_INCLUDE_AUDIO_AUDIO_FRONTEND_API_H */
CXD5602 Sipmle Fifo API.
CXD5602 Audio Common Definitions.
CXD5602 Audio Object Layer API.
bool AS_StopMicFrontend(FAR AsStopMicFrontendParam *stopparam)
Stop mic frontend.
AsMicFrontendDataPath
Definition: audio_frontend_api.h:161
AsMicFrontendPreProcType
Definition: audio_frontend_api.h:143
bool AS_StartMicFrontend(FAR AsStartMicFrontendParam *startparam)
Start mic frontend.
bool AS_checkAvailabilityMicFrontend(void)
Check availability of MicFrontend.
bool AS_SetMicGainMicFrontend(FAR AsMicFrontendMicGainParam *micgain_param)
Set Mic gain.
AsMicFrontendEvent
Definition: audio_frontend_api.h:98
bool AS_DeleteMicFrontend(void)
Delete mic frontend.
bool AS_InitPreprocFrontend(FAR AsInitPreProcParam *param)
Init pre process.
bool AS_InitMicFrontend(FAR AsInitMicFrontendParam *initparam)
Init mic frontend.
bool AS_DeactivateMicFrontend(FAR AsDeactivateMicFrontendParam *deactparam)
Deactivate mic frontend.
void(* FrontendDoneCallback)(AsPcmDataParam param)
Definition: audio_frontend_api.h:209
bool AS_SetPreprocMicFrontend(FAR AsSetPreProcParam *param)
Set pre process.
#define AS_PREPROCESS_FILE_PATH_LEN
Length of Recognizer dsp file name and path.
Definition: audio_frontend_api.h:89
bool AS_CreateMicFrontend(FAR AsCreateMicFrontendParam_t *param, AudioAttentionCb attcb)
Create mic frontend.
bool AS_ActivateMicFrontend(FAR AsActivateMicFrontend *actparam)
Activate mic frontend.
@ AsDataPathMessage
PCM data is send by message.
Definition: audio_frontend_api.h:168
@ AsDataPathCallback
PCM data is send by callback.
Definition: audio_frontend_api.h:164
@ AsDataPathSimpleFIFO
PCM data is send by simple FIFO.
Definition: audio_frontend_api.h:172
@ AsMicFrontendPreProcUserCustom
Pre Process user customed.
Definition: audio_frontend_api.h:154
@ AsMicFrontendPreProcThrough
Pre Process through.
Definition: audio_frontend_api.h:146
@ AsMicFrontendPreProcSrc
Pre Process Sampling Rate Conveter.
Definition: audio_frontend_api.h:150
@ AsMicFrontendEventStop
Stop.
Definition: audio_frontend_api.h:117
@ AsMicFrontendEventStart
Start.
Definition: audio_frontend_api.h:113
@ AsMicFrontendEventInit
Init.
Definition: audio_frontend_api.h:109
@ AsMicFrontendEventSetMicGain
Set MicGain.
Definition: audio_frontend_api.h:129
@ AsMicFrontendEventInitPreProc
Init PreProc.
Definition: audio_frontend_api.h:121
@ AsMicFrontendEventSetPreProc
Set PreProc.
Definition: audio_frontend_api.h:125
@ AsMicFrontendEventAct
Activate.
Definition: audio_frontend_api.h:101
@ AsMicFrontendEventDeact
Deactivate.
Definition: audio_frontend_api.h:105
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:810
#define AS_MIC_CHANNEL_MAX
Definition: audio_common_defs.h:86
Definition: audio_frontend_api.h:179
uint8_t input_device
[in] Select Mic Frontend input device
Definition: audio_frontend_api.h:185
Definition: audio_frontend_api.h:192
Definition: audio_frontend_api.h:457
AsMicFrontendMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_frontend_api.h:460
AsMicFrontendPoolId_old_t pool_id
[in] ID of memory pool for processing data
Definition: audio_frontend_api.h:464
Definition: audio_frontend_api.h:469
AsMicFrontendMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_frontend_api.h:472
AsMicFrontendPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_frontend_api.h:476
Definition: audio_frontend_api.h:218
Definition: audio_frontend_api.h:202
Definition: audio_frontend_api.h:225
uint8_t preproc_type
[in] Select pre process enable
Definition: audio_frontend_api.h:253
uint32_t out_fs
[in] Output Fs
Definition: audio_frontend_api.h:246
uint16_t samples_per_frame
[in] Samples per a frame
Definition: audio_frontend_api.h:239
AsDataDest dest
[in] Data destination, callback or message
Definition: audio_frontend_api.h:272
uint8_t channel_number
[in] Select InitMicFrontend input channels
Definition: audio_frontend_api.h:229
uint8_t data_path
[in] Select Data path from MicFrontend
Definition: audio_frontend_api.h:265
uint8_t bit_length
[in] Select InitMicFrontend input bit length
Definition: audio_frontend_api.h:234
Definition: audio_frontend_api.h:295
uint32_t packet_size
[in] Command packet size
Definition: audio_frontend_api.h:302
uint8_t * packet_addr
[in] Command packet address
Definition: audio_frontend_api.h:298
Definition: audio_frontend_api.h:309
Definition: audio_frontend_api.h:405
uint8_t micfrontend
[in] Message queue id of micfrontend
Definition: audio_frontend_api.h:408
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_frontend_api.h:412
uint8_t dsp
[in] Message queue id of DSP
Definition: audio_frontend_api.h:416
Definition: audio_frontend_api.h:439
uint8_t input
[in] Memory pool id of input data
Definition: audio_frontend_api.h:442
uint8_t dsp
[in] Memory pool id of dsp command data
Definition: audio_frontend_api.h:450
uint8_t output
[in] Memory pool id of PreProc
Definition: audio_frontend_api.h:446
Definition: audio_frontend_api.h:423
MemMgrLite::PoolId dsp
[in] Memory pool id of dsp command data
Definition: audio_frontend_api.h:434
MemMgrLite::PoolId output
[in] Memory pool id of PreProc
Definition: audio_frontend_api.h:430
MemMgrLite::PoolId input
[in] Memory pool id of input data
Definition: audio_frontend_api.h:426
Definition: audio_common_defs.h:703
Definition: audio_frontend_api.h:279
Definition: audio_frontend_api.h:287
FIFO handle which holds data required to manipulate FIFO.
Definition: CMN_SimpleFifo.h:78
Definition: MemMgrTypes.h:88
Definition: audio_frontend_api.h:326
uint8_t reserved0
[in] reserved
Definition: audio_frontend_api.h:333
uint8_t command_code
[in] Command code
Definition: audio_frontend_api.h:329
Definition: audio_frontend_api.h:342
AsStartMicFrontendParam start_param
[in] for StartFrontend (Object Interface==AS_StartMicFrontend)
Definition: audio_frontend_api.h:373
AsSetPreProcParam setpreproc_param
[in] for SetPreProc (Object Interface==AS_SetPreProcFrontend)
Definition: audio_frontend_api.h:391
AsActivateMicFrontend act_param
[in] for ActivateFrontend (Object Interface==AS_ActivateFrontend)
Definition: audio_frontend_api.h:355
AsStopMicFrontendParam stop_param
[in] for StopFrontend (Object Interface==AS_StopMicFrontend)
Definition: audio_frontend_api.h:379
AsMicFrontendMicGainParam mic_gain_param
[in] for SetMicGain (Object Interface==AS_SetMicGainFrontend)
Definition: audio_frontend_api.h:397
AsInitPreProcParam initpreproc_param
[in] for InitPreProc (Object Interface==AS_InitPreProcFrontend)
Definition: audio_frontend_api.h:385
MicFrontendCommandHeader header
[in] Command Header
Definition: audio_frontend_api.h:345
AsDeactivateMicFrontendParam deact_param
[in] for DeactivateFrontend (Object Interface==AS_DeactivateFrontend)
Definition: audio_frontend_api.h:361
AsInitMicFrontendParam init_param
[in] for InitFrontend (Object Interface==AS_InitMicFrontend)
Definition: audio_frontend_api.h:367
Definition: audio_frontend_api.h:212