1 /***************************************************************************
2  *
3  * Copyright 2019-2025 BES.
4  * All rights reserved. All unpublished rights reserved.
5  *
6  * No part of this work may be used or reproduced in any form or by any
7  * means, or stored in a database or retrieval system, without prior written
8  * permission of BES.
9  *
10  * Use of this work is governed by a license granted by BES.
11  * This work contains confidential and proprietary information of
12  * BES. which is protected by copyright, trade secret,
13  * trademark and other intellectual property rights.
14  *
15  ****************************************************************************/
16 #ifndef _AUD_DUMP_H_
17 #define _AUD_DUMP_H_
18 
19 #include <stdint.h>
20 #include "a7_cmd.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define AUD_DUMP_IDLE 0
27 #define AUD_DUMP_INIT 0x12344321
28 #define AUD_DUMP_READY 0x43211234
29 #define AUD_DUMP_START 0x12121212
30 #define AUD_DUMP_MIC12 3 // 011, no ref
31 
32 #define _AUDIO_DUMP_TAG_ "/audiodump/"
33 #define _AUDIO_DUMP_SRC_BEFORE_ALG_ "before-alg"
34 #define _AUDIO_DUMP_SRC_INTER_ALG_ "inter-alg"
35 #define _AUDIO_DUMP_SRC_AFTER_ALG_ "after-alg"
36 
37 typedef void (*aud_dump_cb_t)(unsigned char *data, unsigned int len, void *param);
38 
39 typedef struct
40 {
41     int handle;
42     aud_dump_cb_t func;
43     void *param;
44 } multi_audio_dump_t;
45 
46 void ai_record(unsigned int dump_src, unsigned char *data, unsigned int len);
47 void aud_dump_cb_register(aud_dump_cb_t cbf, void *param);
48 void aud_dump_cb_unregister(aud_dump_cb_t cbf, void *param);
49 int aud_dump_set(AUD_DUMP_SRC_T dump_src, int onoff);
50 int aud_dump_set_channel(AUD_DUMP_SRC_T dump_src, int ch_map);
51 int aud_dump_send(void);
52 void aud_dump_init(void);
53 uint32_t mic_resample_48_to_16(uint8_t *src, uint8_t *dst, uint32_t len);
54 void mic_set_samplerate(int mic_samplerate);
55 int mic_get_samplerate();
56 int mic_get_handshake_done();
57 void mic_reset_handshake();
58 void mic_set_period(int mic_period_ms);
59 int mic_get_period();
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif /* _AUD_DUMP_H_ */
66