Skip to content

Commit

Permalink
Merge branch 'feature/update_dueros_v3.2' into 'master'
Browse files Browse the repository at this point in the history
clouds: Update dueros to v3.2

See merge request adf/esp-adf-internal!1234
  • Loading branch information
jason-mao committed May 31, 2024
2 parents 707601d + 6ba2031 commit 37a49af
Show file tree
Hide file tree
Showing 120 changed files with 4,420 additions and 3,671 deletions.
3 changes: 3 additions & 0 deletions components/audio_board/esp32_s3_korvo2_v3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ esp_err_t audio_board_key_init(esp_periph_set_handle_t set)
adc_btn_tag.adc_level_step = btn_array;
adc_btn_cfg.arr = &adc_btn_tag;
adc_btn_cfg.arr_size = 1;
if (audio_mem_spiram_stack_is_enabled()) {
adc_btn_cfg.task_cfg.ext_stack = true;
}
esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg);
AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK);
return esp_periph_start(set, adc_btn_handle);
Expand Down
3 changes: 3 additions & 0 deletions components/audio_board/lyrat_mini_v1_1/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ esp_err_t audio_board_key_init(esp_periph_set_handle_t set)
adc_btn_tag.adc_level_step = btn_array;
adc_btn_cfg.arr = &adc_btn_tag;
adc_btn_cfg.arr_size = 1;
if (audio_mem_spiram_stack_is_enabled()) {
adc_btn_cfg.task_cfg.ext_stack = true;
}
esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg);
AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK);
ret = esp_periph_start(set, adc_btn_handle);
Expand Down
2 changes: 1 addition & 1 deletion components/audio_board/lyrat_mini_v1_1/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#define ES7243_MCLK_GPIO GPIO_NUM_0
#define HEADPHONE_DETECT GPIO_NUM_19
#define PA_ENABLE_GPIO GPIO_NUM_21
#define ES8311_MCLK_SOURCE 0 /* 0 From MCLK of esp32 1 From BCLK */
#define ES8311_MCLK_SOURCE 1 /* 0 From MCLK of esp32 1 From BCLK */
#define CODEC_ADC_I2S_PORT (1)
#define CODEC_ADC_BITS_PER_SAMPLE (16) /* 16bit */
#define CODEC_ADC_SAMPLE_RATE (16000)
Expand Down
2 changes: 1 addition & 1 deletion components/audio_board/lyrat_mini_v1_1/board_pins_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ esp_err_t get_i2s_pins(int port, board_i2s_pin_t *i2s_config)
{
AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL);
if (port == 0) {
i2s_config->mck_io_num = GPIO_NUM_0;
i2s_config->mck_io_num = -1;
i2s_config->bck_io_num = GPIO_NUM_5;
i2s_config->ws_io_num = GPIO_NUM_25;
i2s_config->data_out_num = GPIO_NUM_26;
Expand Down
2 changes: 1 addition & 1 deletion components/audio_stream/include/i2s_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ typedef struct {
.multi_out_num = 0, \
.uninstall_drv = true, \
.need_expand = false, \
.expand_src_bits = bits, \
.expand_src_bits = I2S_BITS_PER_SAMPLE_16BIT, \
.buffer_len = I2S_STREAM_BUF_SIZE, \
}

Expand Down
21 changes: 14 additions & 7 deletions components/clouds/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
if (DEFINED ENV{DUER_PATH})
include($ENV{DUER_PATH}/libduer.cmake)
return()
endif()

set(COMPONENT_ADD_INCLUDEDIRS ./dueros/lightduer/include)

# Edit following two lines to set component requirements (see docs)
set(COMPONENT_SRCS )


register_component()
IF ((CONFIG_IDF_TARGET STREQUAL "esp32c3") OR (CONFIG_IDF_TARGET STREQUAL "esp32c6"))
ELSE()
IF (IDF_VERSION_MAJOR GREATER 3)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/dueros/lightduer")

target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/dueros/lightduer/${CONFIG_IDF_TARGET}")

IF ((CONFIG_IDF_TARGET STREQUAL "esp32") OR (CONFIG_IDF_TARGET STREQUAL "esp32s3") OR (CONFIG_IDF_TARGET STREQUAL "esp32p4"))
IF (IDF_VERSION_MAJOR GREATER 4)
target_link_libraries(${COMPONENT_TARGET} INTERFACE duer-device-v5x)
ELSEIF (IDF_VERSION_MAJOR GREATER 3)
target_link_libraries(${COMPONENT_TARGET} INTERFACE duer-device-v4x)
ELSE ()
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/dueros/lightduer")
target_link_libraries(${COMPONENT_TARGET} INTERFACE duer-device)
ENDIF (IDF_VERSION_MAJOR GREATER 3)

ENDIF (IDF_VERSION_MAJOR GREATER 4)
ELSE()
ENDIF()
6 changes: 3 additions & 3 deletions components/clouds/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ COMPONENT_SRCDIRS :=

ifdef IDF_VERSION_MAJOR
ifneq ($(IDF_VERSION_MAJOR),3)
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/$(LIGHTDUER_PATH) -lduer-device-v4x
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/$(LIGHTDUER_PATH)/$(IDF_TARGET) -lduer-device-v4x
else
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/$(LIGHTDUER_PATH) -lduer-device
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/$(LIGHTDUER_PATH)/$(IDF_TARGET) -lduer-device
endif
else
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/$(LIGHTDUER_PATH) -lduer-device
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/$(LIGHTDUER_PATH)/$(IDF_TARGET) -lduer-device
endif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions components/clouds/dueros/lightduer/include/baidu_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ extern "C"

#define baidu_json_IsReference 256
#define baidu_json_StringIsConst 512
#define baidu_json_IsRoot 1024

#define JSON_PREBUFF_SIZE_128 128
#define JSON_PREBUFF_SIZE_256 256
#define JSON_PREBUFF_SIZE_512 512
#define JSON_PREBUFF_SIZE_1024 1024
#define JSON_PREBUFF_SIZE_2048 2048

/* The baidu_json structure: */
typedef struct baidu_json
Expand Down Expand Up @@ -146,6 +153,9 @@ extern void baidu_json_Minify(char *json);

extern void baidu_json_release(void *ptr);

/* dump all json objects alloc from prealloc memory, detail = 0 just print count, = 1 print all items */
extern int baidu_json_dump_prealloc_items(int detail);

/* Macros for creating things quickly. */
#define baidu_json_AddNullToObject(object,name) baidu_json_AddItemToObject(object, name, baidu_json_CreateNull())
#define baidu_json_AddTrueToObject(object,name) baidu_json_AddItemToObject(object, name, baidu_json_CreateTrue())
Expand Down
57 changes: 57 additions & 0 deletions components/clouds/dueros/lightduer/include/lightduer_base_coding.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (2017) Baidu Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Author: Su Hao ([email protected])
//
// Description: Encode & decode the int8 into base16/32/64.

#ifndef BAIDU_DUER_LIBDUER_DEVICE_MODULES_SONIC_CODEC_LIGHTDUER_BASE_CODING_H
#define BAIDU_DUER_LIBDUER_DEVICE_MODULES_SONIC_CODEC_LIGHTDUER_BASE_CODING_H

#include "lightduer_types.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* Coding the data base on the bits.
*
* @param dst The output data that will be encoded
* @param dlen The output data capacity
* @param dbits The bits of output data unit
* @param src The input data
* @param slen The input data size
* @param sbits The bits of input data unit
* @return if < 0, means coding failed;
* else, return the encoded data length.
*/
DUER_INT duer_status_t duer_base_coding(char *dst, duer_size_t dlen, duer_size_t dbits, const char *src, duer_size_t slen, duer_size_t sbits);

/**
* Obtain the encode string need length.
*
* @param dbits The bits of output data unit
* @param sbits The bits of input data unit
* @param slen The input data size
* @return the output data size
*/
DUER_INT duer_size_t duer_base_encoded_length(duer_size_t dbits, duer_size_t sbits, duer_size_t slen);

#ifdef __cplusplus
}
#endif

#endif // BAIDU_DUER_LIBDUER_DEVICE_MODULES_SONIC_CODEC_LIGHTDUER_BASE_CODING_H
84 changes: 84 additions & 0 deletions components/clouds/dueros/lightduer/include/lightduer_bitmap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Copyright (2017) Baidu Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Author: Zhang Leliang([email protected])
//
// Description: bitmap cache for fix-sized objects.

#ifndef BAIDU_DUER_LIBDUER_DEVICE_FRAMEWORK_UTILS_LIGHTDUER_BITMAP_H

#include "baidu_json.h"
#include "lightduer_mutex.h"

//#define BIT_MAP_TYPE unsigned char
typedef struct bitmap_objects_s {
int num_of_objs;
int num_of_bitmaps;
duer_mutex_t bitmap_lock;
unsigned char *bitmaps;
void *objects;
int element_size;
} bitmap_objects_t;

// int dump_bitmap(bitmap_objects_t *bop, const char *tag);

// int first_set_index(bitmap_objects_t *buffer);

/**
* init the bitmap structure
* @object_num, the number of elements which will be pre-allocated
* @bop, the address of the bitmap structure
* @element_size, the element size of the object, in Bytes
* @return, -1 fail, 0 ok
*/
int init_bitmap(int object_num, bitmap_objects_t *bop, int element_size);

/**
* release the resource abtained in the init_bitmap
* @bop, the address of the bitmap sructure
* @return, -1 fail, 0 ok
*/
int uninit_bitmap(bitmap_objects_t *bop);

/**
* allocate one element from the pre-allocated buffer in bop
* @bop, the address of the bitmap structure
* @return, NULL fail, the address of the element OK.
*/
void *alloc_obj(bitmap_objects_t *bop);

/**
* free the element got by alloc_obj
* @bop, the address of the bitmap structure
* @obj, the address of the element got from alloc_obj
* @return, 0 OK, -2 the address is not got from the buffer in bop,-1 fail,
*/
int free_obj(bitmap_objects_t *bop, void *obj);

/**
* lock the mutex of bitmap
* @bop, the address of the bitmap sructure
* @return, -1 fail, 0 ok
*/
int lock_bitmap(bitmap_objects_t *bop);

/**
* unlock the mutex of bitmap
* @bop, the address of the bitmap sructure
* @return, -1 fail, 0 ok
*/
int unlock_bitmap(bitmap_objects_t *bop);

#endif // BAIDU_DUER_LIBDUER_DEVICE_FRAMEWORK_UTILS_LIGHTDUER_BITMAP_H
24 changes: 24 additions & 0 deletions components/clouds/dueros/lightduer/include/lightduer_ca.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,30 @@ DUER_EXT duer_status_t baidu_ca_release(duer_handler hdlr);
*/
DUER_EXT const char *baidu_ca_get_uuid(duer_handler hdlr);

/*
* Obtain the client_id
*
* @Param hdlr, in, the handler will be operated
* @Return const char *, The client id string
*/
DUER_EXT const char *baidu_ca_get_client_id(duer_handler hdlr);

/*
* Obtain the bduss
*
* @Param hdlr, in, the handler will be operated
* @Return const char *, The bduss string
*/
DUER_EXT const char *baidu_ca_get_bduss(duer_handler hdlr);

/*
* Obtain the user_agent
*
* @Param hdlr, in, the handler will be operated
* @Return const char *, The urser agent string
*/
DUER_EXT const char *baidu_ca_get_user_agent(duer_handler hdlr);

/*
* Obtain the rsa cacrt
*
Expand Down
Loading

0 comments on commit 37a49af

Please sign in to comment.