IDF release/v4.4 (#6994)

This commit is contained in:
Me No Dev 2022-08-08 15:46:30 +03:00 committed by GitHub
parent 60c4eea0d4
commit 860b104691
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
794 changed files with 8323 additions and 5095 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -60,8 +60,10 @@
#define CONFIG_ESP_RMAKER_OTA_AUTOFETCH 1
#define CONFIG_ESP_RMAKER_OTA_AUTOFETCH_PERIOD 0
#define CONFIG_ESP_RMAKER_OTA_HTTP_RX_BUFFER_SIZE 1024
#define CONFIG_ESP_RMAKER_OTA_ROLLBACK_WAIT_PERIOD 90
#define CONFIG_ESP_RMAKER_SCHEDULING_MAX_SCHEDULES 10
#define CONFIG_ESP_RMAKER_SCENES_MAX_SCENES 10
#define CONFIG_ESP_RMAKER_CMD_RESP_ENABLE 1
#define CONFIG_ENABLE_ARDUINO_DEPENDS 1
#define CONFIG_AUTOSTART_ARDUINO 1
#define CONFIG_ARDUINO_RUN_CORE1 1
@ -81,6 +83,8 @@
#define CONFIG_ARDUHAL_ESP_LOG 1
#define CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT 1
#define CONFIG_ARDUHAL_PARTITION_SCHEME "default"
#define CONFIG_USE_AFE 1
#define CONFIG_AFE_INTERFACE_V1 1
#define CONFIG_COMPILER_OPTIMIZATION_SIZE 1
#define CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE 1
#define CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL 2
@ -122,7 +126,7 @@
#define CONFIG_BTDM_SCAN_DUPL_TYPE 0
#define CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE 20
#define CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN 1
#define CONFIG_BTDM_MESH_DUPL_SCAN_CACHE_SIZE 200
#define CONFIG_BTDM_MESH_DUPL_SCAN_CACHE_SIZE 100
#define CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED 1
#define CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP 1
#define CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM 100
@ -592,7 +596,7 @@
#define CONFIG_ESP_RMAKER_MQTT_SEND_USERNAME 1
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_NAME "RMDev"
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_VERSION "1x0"
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_SKU "ES00"
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_SKU "EX00"
#define CONFIG_ESP_RMAKER_MQTT_USE_CERT_BUNDLE 1
#define CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK 4096
#define CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_PRIORITY 5
@ -600,6 +604,7 @@
#define CONFIG_ESP_RMAKER_FACTORY_NAMESPACE "rmaker_creds"
#define CONFIG_ESP_RMAKER_DEF_TIMEZONE "Asia/Shanghai"
#define CONFIG_ESP_RMAKER_SNTP_SERVER_NAME "pool.ntp.org"
#define CONFIG_ESP_RMAKER_MAX_COMMANDS 10
#define CONFIG_DSP_OPTIMIZATIONS_SUPPORTED 1
#define CONFIG_DSP_OPTIMIZED 1
#define CONFIG_DSP_OPTIMIZATION 1
@ -747,5 +752,5 @@
#define CONFIG_ULP_COPROC_ENABLED CONFIG_ESP32_ULP_COPROC_ENABLED
#define CONFIG_ULP_COPROC_RESERVE_MEM CONFIG_ESP32_ULP_COPROC_RESERVE_MEM
#define CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS
#define CONFIG_ARDUINO_IDF_COMMIT "c9140caf8c"
#define CONFIG_ARDUINO_IDF_COMMIT "ce1fde4b3b"
#define CONFIG_ARDUINO_IDF_BRANCH "release/v4.4"

View File

@ -60,8 +60,10 @@
#define CONFIG_ESP_RMAKER_OTA_AUTOFETCH 1
#define CONFIG_ESP_RMAKER_OTA_AUTOFETCH_PERIOD 0
#define CONFIG_ESP_RMAKER_OTA_HTTP_RX_BUFFER_SIZE 1024
#define CONFIG_ESP_RMAKER_OTA_ROLLBACK_WAIT_PERIOD 90
#define CONFIG_ESP_RMAKER_SCHEDULING_MAX_SCHEDULES 10
#define CONFIG_ESP_RMAKER_SCENES_MAX_SCENES 10
#define CONFIG_ESP_RMAKER_CMD_RESP_ENABLE 1
#define CONFIG_ENABLE_ARDUINO_DEPENDS 1
#define CONFIG_AUTOSTART_ARDUINO 1
#define CONFIG_ARDUINO_RUN_CORE1 1
@ -81,6 +83,8 @@
#define CONFIG_ARDUHAL_ESP_LOG 1
#define CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT 1
#define CONFIG_ARDUHAL_PARTITION_SCHEME "default"
#define CONFIG_USE_AFE 1
#define CONFIG_AFE_INTERFACE_V1 1
#define CONFIG_COMPILER_OPTIMIZATION_SIZE 1
#define CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE 1
#define CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL 2
@ -122,7 +126,7 @@
#define CONFIG_BTDM_SCAN_DUPL_TYPE 0
#define CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE 20
#define CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN 1
#define CONFIG_BTDM_MESH_DUPL_SCAN_CACHE_SIZE 200
#define CONFIG_BTDM_MESH_DUPL_SCAN_CACHE_SIZE 100
#define CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED 1
#define CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP 1
#define CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM 100
@ -592,7 +596,7 @@
#define CONFIG_ESP_RMAKER_MQTT_SEND_USERNAME 1
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_NAME "RMDev"
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_VERSION "1x0"
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_SKU "ES00"
#define CONFIG_ESP_RMAKER_MQTT_PRODUCT_SKU "EX00"
#define CONFIG_ESP_RMAKER_MQTT_USE_CERT_BUNDLE 1
#define CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK 4096
#define CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_PRIORITY 5
@ -600,6 +604,7 @@
#define CONFIG_ESP_RMAKER_FACTORY_NAMESPACE "rmaker_creds"
#define CONFIG_ESP_RMAKER_DEF_TIMEZONE "Asia/Shanghai"
#define CONFIG_ESP_RMAKER_SNTP_SERVER_NAME "pool.ntp.org"
#define CONFIG_ESP_RMAKER_MAX_COMMANDS 10
#define CONFIG_DSP_OPTIMIZATIONS_SUPPORTED 1
#define CONFIG_DSP_OPTIMIZED 1
#define CONFIG_DSP_OPTIMIZATION 1
@ -747,5 +752,5 @@
#define CONFIG_ULP_COPROC_ENABLED CONFIG_ESP32_ULP_COPROC_ENABLED
#define CONFIG_ULP_COPROC_RESERVE_MEM CONFIG_ESP32_ULP_COPROC_RESERVE_MEM
#define CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS
#define CONFIG_ARDUINO_IDF_COMMIT "c9140caf8c"
#define CONFIG_ARDUINO_IDF_COMMIT "ce1fde4b3b"
#define CONFIG_ARDUINO_IDF_BRANCH "release/v4.4"

View File

@ -327,9 +327,9 @@ typedef enum {
/**
* @brief Revokes the old signature digest. To be called in the application after the rollback logic.
*
* Relevant for Secure boot v2 on ESP32-S2 where upto 3 key digests can be stored (Key #N-1, Key #N, Key #N+1).
* When key #N-1 used to sign an app is invalidated, an OTA update is to be sent with an app signed with key #N-1 & Key #N.
* After successfully booting the OTA app should call this function to revoke Key #N-1.
* Relevant for Secure boot v2 on ESP32-S2, ESP32-S3, ESP32-C3 where upto 3 key digests can be stored (Key \#N-1, Key \#N, Key \#N+1).
* When key \#N-1 used to sign an app is invalidated, an OTA update is to be sent with an app signed with key \#N-1 & Key \#N.
* After successfully booting the OTA app should call this function to revoke Key \#N-1.
*
* @param index - The index of the signature block to be revoked
*

View File

@ -1455,7 +1455,7 @@ esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable);
*
*
* @param[in] icon - External appearance value, these values are defined by the Bluetooth SIG, please refer to
* https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml
* https://specificationrefs.bluetooth.com/assigned-values/Appearance%20Values.pdf
*
* @return
* - ESP_OK : success

View File

@ -354,6 +354,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg);
/**
* @brief De-initialize BT controller to free resource and delete task.
* You should stop advertising and scanning, as well as
* disconnect all existing connections before de-initializing BT controller.
*
* This function should be called only once, after any other BT functions are called.
* @return ESP_OK - success, other - failed

View File

@ -97,9 +97,9 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type);
/**
* @brief Enable GPIO module interrupt signal
*
* @note Please do not use the interrupt of GPIO36 and GPIO39 when using ADC or Wi-Fi and Bluetooth with sleep mode enabled.
* @note ESP32: Please do not use the interrupt of GPIO36 and GPIO39 when using ADC or Wi-Fi and Bluetooth with sleep mode enabled.
* Please refer to the comments of `adc1_get_raw`.
* Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue.
* Please refer to Section 3.11 of <a href="https://espressif.com/documentation/eco_and_workarounds_for_bugs_in_esp32_en.pdf">ESP32 ECO and Workarounds for Bugs</a> for the description of this issue.
* As a workaround, call adc_power_acquire() in the app. This will result in higher power consumption (by ~1mA),
* but will remove the glitches on GPIO36 and GPIO39.
*
@ -169,7 +169,7 @@ esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);
/**
* @brief Configure GPIO pull-up/pull-down resistors
*
* Only pins that support both input & output have integrated pull-up and pull-down resistors. Input-only GPIOs 34-39 do not.
* @note ESP32: Only pins that support both input & output have integrated pull-up and pull-down resistors. Input-only GPIOs 34-39 do not.
*
* @param gpio_num GPIO number. If you want to set pull up or down mode for e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
* @param pull GPIO pull up/down mode.
@ -484,7 +484,7 @@ esp_err_t gpio_sleep_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);
/**
* @brief Configure GPIO pull-up/pull-down resistors at sleep
*
* Only pins that support both input & output have integrated pull-up and pull-down resistors. Input-only GPIOs 34-39 do not.
* @note ESP32: Only pins that support both input & output have integrated pull-up and pull-down resistors. Input-only GPIOs 34-39 do not.
*
* @param gpio_num GPIO number. If you want to set pull up or down mode for e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16);
* @param pull GPIO pull up/down mode.

View File

@ -594,6 +594,18 @@ esp_err_t uart_flush_input(uart_port_t uart_num);
*/
esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t* size);
/**
* @brief UART get TX ring buffer free space size
*
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
* @param size Pointer of size_t to accept the free space size
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t uart_get_tx_buffer_free_size(uart_port_t uart_num, size_t *size);
/**
* @brief UART disable pattern detect function.
* Designed for applications like 'AT commands'.

View File

@ -57,10 +57,14 @@ int dsp_power_of_two(int x);
#endif
// esp_cpu_get_ccount function is implemented in IDF 4.1 and later
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#define dsp_get_cpu_cycle_count esp_cpu_get_cycle_count
#else
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
#define dsp_get_cpu_cycle_count esp_cpu_get_ccount
#else
#define dsp_get_cpu_cycle_count xthal_get_ccount
#endif
#endif // ESP_IDF_VERSION
#endif // _dsp_common_H_

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_customized_word_wn5;
extern const model_coeff_getter_t get_coeff_customized_word_wn5;

View File

@ -246,6 +246,28 @@ void dl_dilation_layerq8_mc_steps(dl_convq8_queue_t **in, dl_convq8_queue_t **ou
void dl_convq8_queue_mc_bzero(dl_convq8_queue_t **cqm, int nch);
dl_convq8_queue_t *dl_convq8_queue_alloc_from_psram(int n, int c);
qtp_t *dl_dilation_layerq16_8(dl_convq_queue_t *in, dl_convq8_queue_t *out, int rate, int size,
dl_matrix2dq_t* filter_kernel, dl_matrix2dq_t* filter_bias,
dl_matrix2dq_t* gate_kernel, dl_matrix2dq_t* gate_bias, int prenum);
qtp_t *dl_dilation_layerq8(dl_convq8_queue_t *in, dl_convq8_queue_t *out, int rate, int size,
dl_matrix2dq8_t* filter_kernel, dl_matrix2dq_t* filter_bias,
dl_matrix2dq8_t* gate_kernel, dl_matrix2dq_t* gate_bias, int prenum);
dl_matrix2dq8_t *dl_convq8_lstm_layer(const dl_convq8_queue_t *in, dl_convq8_queue_t *out, dl_matrix2dq8_t *state_c,
dl_matrix2dq8_t *state_h, const dl_matrix2dq8_t *in_weight, const dl_matrix2dq8_t *h_weight,
const dl_matrix2dq_t *bias, int prenum);
qtp_t *dl_atrous_conv1dq8_16_s3(dl_convq8_queue_t *in, dl_convq_queue_t *out, int rate, int size,
dl_matrix2dq8_t* kernel, dl_matrix2dq_t* bias, int prenum);
void print_convq8(dl_convq8_queue_t *cq, int offset);
void print_convq(dl_convq_queue_t *cq, int offset);
void lstmq8_free(void);
#endif

View File

@ -0,0 +1,101 @@
#pragma once
#include "stdint.h"
#include "esp_wn_iface.h"
#include "esp_wn_models.h"
#include "esp_vad.h"
//AFE: Audio Front-End
//SR: Speech Recognition
//afe_sr/AFE_SR: the audio front-end for speech recognition
//Set AFE_SR mode
typedef enum {
SR_MODE_LOW_COST = 0,
SR_MODE_HIGH_PERF = 1
} afe_sr_mode_t;
typedef enum {
AFE_MEMORY_ALLOC_MORE_INTERNAL = 1, // malloc with more internal ram
AFE_MEMORY_ALLOC_INTERNAL_PSRAM_BALANCE = 2, // malloc with internal ram and psram in balance
AFE_MEMORY_ALLOC_MORE_PSRAM = 3 // malloc with more psram
} afe_memory_alloc_mode_t;
typedef enum {
AFE_MN_PEAK_AGC_MODE_1 = -5, // The peak amplitude of audio fed to multinet is -5dB
AFE_MN_PEAK_AGC_MODE_2 = -4, // The peak amplitude of audio fed to multinet is -4dB
AFE_MN_PEAK_AGC_MODE_3 = -3, // The peak amplitude of audio fed to multinet is -3dB
AFE_MN_PEAK_NO_AGC = 0, // There is no agc gain
} afe_mn_peak_agc_mode_t;
typedef struct {
int total_ch_num; // total channel num. It must be: total_ch_num = mic_num + ref_num
int mic_num; // mic channel num
int ref_num; // reference channel num
} afe_pcm_config_t;
typedef struct {
bool aec_init;
bool se_init;
bool vad_init;
bool wakenet_init;
bool voice_communication_init;
bool voice_communication_agc_init; // AGC swich for voice communication
int voice_communication_agc_gain; // AGC gain(dB) for voice communication
vad_mode_t vad_mode; // The value can be: VAD_MODE_0, VAD_MODE_1, VAD_MODE_2, VAD_MODE_3, VAD_MODE_4
char *wakenet_model_name; // The model name of wakenet
det_mode_t wakenet_mode;
afe_sr_mode_t afe_mode;
int afe_perferred_core;
int afe_perferred_priority;
int afe_ringbuf_size;
afe_memory_alloc_mode_t memory_alloc_mode;
afe_mn_peak_agc_mode_t agc_mode; // The agc mode for ASR
afe_pcm_config_t pcm_config; // Config the channel num of original data which is fed to the afe feed function.
} afe_config_t;
#if CONFIG_IDF_TARGET_ESP32
#define AFE_CONFIG_DEFAULT() { \
.aec_init = true, \
.se_init = true, \
.vad_init = true, \
.wakenet_init = true, \
.voice_communication_init = false, \
.voice_communication_agc_init = false, \
.voice_communication_agc_gain = 15, \
.vad_mode = VAD_MODE_3, \
.wakenet_model_name = NULL, \
.wakenet_mode = DET_MODE_90, \
.afe_mode = SR_MODE_HIGH_PERF, \
.afe_perferred_core = 0, \
.afe_perferred_priority = 5, \
.afe_ringbuf_size = 50, \
.memory_alloc_mode = AFE_MEMORY_ALLOC_INTERNAL_PSRAM_BALANCE, \
.agc_mode = AFE_MN_PEAK_AGC_MODE_2, \
.pcm_config.total_ch_num = 2, \
.pcm_config.mic_num = 1, \
.pcm_config.ref_num = 1, \
}
#elif CONFIG_IDF_TARGET_ESP32S3
#define AFE_CONFIG_DEFAULT() { \
.aec_init = true, \
.se_init = true, \
.vad_init = true, \
.wakenet_init = true, \
.voice_communication_init = false, \
.voice_communication_agc_init = false, \
.voice_communication_agc_gain = 15, \
.vad_mode = VAD_MODE_3, \
.wakenet_model_name = NULL, \
.wakenet_mode = DET_MODE_2CH_90, \
.afe_mode = SR_MODE_LOW_COST, \
.afe_perferred_core = 0, \
.afe_perferred_priority = 5, \
.afe_ringbuf_size = 50, \
.memory_alloc_mode = AFE_MEMORY_ALLOC_MORE_PSRAM, \
.agc_mode = AFE_MN_PEAK_AGC_MODE_2, \
.pcm_config.total_ch_num = 3, \
.pcm_config.mic_num = 2, \
.pcm_config.ref_num = 1, \
}
#endif

View File

@ -1,7 +1,6 @@
#pragma once
#include "stdint.h"
#include "esp_wn_iface.h"
#include "esp_wn_models.h"
#include "esp_afe_config.h"
//AFE: Audio Front-End
//SR: Speech Recognition
@ -10,88 +9,30 @@
//Opaque AFE_SR data container
typedef struct esp_afe_sr_data_t esp_afe_sr_data_t;
//Set AFE_SR mode
typedef enum {
SR_MODE_LOW_COST = 0,
SR_MODE_HIGH_PERF = 1
} afe_sr_mode_t;
// the output state of fetch function
typedef enum {
AFE_FETCH_CHANNEL_VERIFIED = -2, // wwe state: output channel is verified
AFE_FETCH_NOISE = -1, // vad state: noise or silence
AFE_FETCH_SPEECH = 0, // vad state: speech
AFE_FETCH_WWE_DETECTED = 1 // wwe state: wake word is detected
} afe_fetch_mode_t;
typedef enum {
AFE_PSRAM_LOW_COST = 1,
AFE_PSRAM_MEDIA_COST = 2,
AFE_PSRAM_HIGH_COST = 3
} afe_use_psram_mode_t;
typedef struct {
bool aec_init;
bool se_init;
bool vad_init;
bool wakenet_init;
int vad_mode;
const esp_wn_iface_t *wakenet_model;
const model_coeff_getter_t *wakenet_coeff;
det_mode_t wakenet_mode;
afe_sr_mode_t afe_mode;
int afe_perferred_core;
int afe_perferred_priority;
int afe_ringbuf_size;
int alloc_from_psram;
int agc_mode;
} afe_config_t;
#if CONFIG_IDF_TARGET_ESP32
#define AFE_CONFIG_DEFAULT() { \
.aec_init = true, \
.se_init = true, \
.vad_init = true, \
.wakenet_init = true, \
.vad_mode = 3, \
.wakenet_model = &WAKENET_MODEL, \
.wakenet_coeff = &WAKENET_COEFF, \
.wakenet_mode = DET_MODE_90, \
.afe_mode = SR_MODE_HIGH_PERF, \
.afe_perferred_core = 0, \
.afe_perferred_priority = 5, \
.afe_ringbuf_size = 50, \
.alloc_from_psram = 1, \
.agc_mode = 2, \
}
#elif CONFIG_IDF_TARGET_ESP32S3
#define AFE_CONFIG_DEFAULT() { \
.aec_init = true, \
.se_init = true, \
.vad_init = true, \
.wakenet_init = true, \
.vad_mode = 3, \
.wakenet_model = &WAKENET_MODEL, \
.wakenet_coeff = &WAKENET_COEFF, \
.wakenet_mode = DET_MODE_2CH_90, \
.afe_mode = SR_MODE_LOW_COST, \
.afe_perferred_core = 0, \
.afe_perferred_priority = 5, \
.afe_ringbuf_size = 50, \
.alloc_from_psram = AFE_PSRAM_MEDIA_COST, \
.agc_mode = 2, \
}
#endif
/**
* @brief Function to initialze a AFE_SR instance with a specified mode
*
* @param mode The mode of AFE_SR
* @param perferred_core The perferred core to be pinned.
* If all task in AFE_SR can not run in real time by only one core, the another core would be used.
* @returns Handle to the AFE_SR data
* @brief The state of vad
*/
typedef esp_afe_sr_data_t* (*esp_afe_sr_iface_op_create_t)(afe_sr_mode_t mode, int perferred_cor);
typedef enum
{
AFE_VAD_SILENCE = 0, // noise or silence
AFE_VAD_SPEECH // speech
} afe_vad_state_t;
/**
* @brief The result of fetch function
*/
typedef struct afe_fetch_result_t
{
int16_t *data; // the data of audio.
int data_size; // the size of data. The unit is byte.
int wakeup_state; // the value is afe_wakeup_state_t
int wake_word_index; // if the wake word is detected. It will store the wake word index which start from 1.
int vad_state; // the value is afe_vad_state_t
int trigger_channel_id; // the channel index of output
int wake_word_length; // the length of wake word. It's unit is the number of samples.
int ret_value; // the return state of fetch function
void* reserved; // reserved for future use
} afe_fetch_result_t;
/**
* @brief Function to initialze a AFE_SR instance
@ -113,31 +54,39 @@ typedef esp_afe_sr_data_t* (*esp_afe_sr_iface_op_create_from_config_t)(afe_confi
typedef int (*esp_afe_sr_iface_op_get_samp_chunksize_t)(esp_afe_sr_data_t *afe);
/**
* @brief Get the channel number of samples that need to be passed to the fetch function
* @brief Get the total channel number which be config
*
* @param afe The AFE_SR object to query
* @return The amount of samples to feed the fetch function
* @param afe The AFE_SR object to query
* @return The amount of total channels
*/
typedef int (*esp_afe_sr_iface_op_get_total_channel_num_t)(esp_afe_sr_data_t *afe);
/**
* @brief Get the mic channel number which be config
*
* @param afe The AFE_SR object to query
* @return The amount of mic channels
*/
typedef int (*esp_afe_sr_iface_op_get_channel_num_t)(esp_afe_sr_data_t *afe);
/**
* @brief Get the sample rate of the samples to feed to the function
*
* @param afe The AFE_SR object to query
* @return The sample rate, in hz
* @param afe The AFE_SR object to query
* @return The sample rate, in hz
*/
typedef int (*esp_afe_sr_iface_op_get_samp_rate_t)(esp_afe_sr_data_t *afe);
/**
* @brief Feed samples of an audio stream to the AFE_SR
*
* @Warning The input data should be arranged in the format of [CH0_0, CH1_0, ..., CHN_0, CH0_1, CH1_1, ..., CHN_1, ...].
* The last channel is reference signal or far-end signal.
* @Warning The input data should be arranged in the format of channel interleaving.
* The last channel is reference signal if it has reference data.
*
* @param afe The AFE_SR object to queryq
* @param afe The AFE_SR object to query
*
* @param in The input microphone signal, only support signed 16-bit @ 16 KHZ. The frame size can be queried by the
* `get_samp_chunksize`. The channel number can be queried `get_channel_num`.
* `get_feed_chunksize`.
* @return The size of input
*/
typedef int (*esp_afe_sr_iface_op_feed_t)(esp_afe_sr_data_t *afe, const int16_t* in);
@ -148,23 +97,19 @@ typedef int (*esp_afe_sr_iface_op_feed_t)(esp_afe_sr_data_t *afe, const int16_t*
* @Warning The output is single channel data, no matter how many channels the input is.
*
* @param afe The AFE_SR object to query
* @param out The output enhanced signal. The frame size can be queried by the `get_samp_chunksize`.
* @return The state of output, please refer to the definition of `afe_fetch_mode_t`
* @return The result of output, please refer to the definition of `afe_fetch_result_t`. (The frame size of output audio can be queried by the `get_fetch_chunksize`.)
*/
typedef afe_fetch_mode_t (*esp_afe_sr_iface_op_fetch_t)(esp_afe_sr_data_t *afe, int16_t* out);
typedef afe_fetch_result_t* (*esp_afe_sr_iface_op_fetch_t)(esp_afe_sr_data_t *afe);
/**
* @brief Initial wakenet and wake words coefficient, or reset wakenet and wake words coefficient
* when wakenet has been initialized.
*
* @param afe The AFE_SR object to query
* @param wakenet The pointer of wakenet
* @param model_coeff The coefficient of wake word model
* @param afe The AFE_SR object to query
* @param wakenet_word The wakenet word, should be DEFAULT_WAKE_WORD or EXTRA_WAKE_WORD
* @return 0: fail, 1: success
*/
typedef int (*esp_afe_sr_iface_op_set_wakenet_t)(esp_afe_sr_data_t *afe,
esp_wn_iface_t *wakenet,
const model_coeff_getter_t *model_coeff);
typedef int (*esp_afe_sr_iface_op_set_wakenet_t)(esp_afe_sr_data_t *afe, char* model_name);
/**
* @brief Disable wakenet model.
@ -226,12 +171,12 @@ typedef void (*esp_afe_sr_iface_op_destroy_t)(esp_afe_sr_data_t *afe);
* This structure contains the functions used to do operations on a AFE_SR.
*/
typedef struct {
esp_afe_sr_iface_op_create_t create;
esp_afe_sr_iface_op_create_from_config_t create_from_config;
esp_afe_sr_iface_op_feed_t feed;
esp_afe_sr_iface_op_fetch_t fetch;
esp_afe_sr_iface_op_get_samp_chunksize_t get_feed_chunksize;
esp_afe_sr_iface_op_get_samp_chunksize_t get_fetch_chunksize;
esp_afe_sr_iface_op_get_total_channel_num_t get_total_channel_num;
esp_afe_sr_iface_op_get_channel_num_t get_channel_num;
esp_afe_sr_iface_op_get_samp_rate_t get_samp_rate;
esp_afe_sr_iface_op_set_wakenet_t set_wakenet;

View File

@ -1,6 +1,27 @@
#pragma once
#if defined CONFIG_USE_AFE
#include "esp_afe_sr_iface.h"
extern const esp_afe_sr_iface_t esp_afe_sr_2mic;
extern const esp_afe_sr_iface_t esp_afe_sr_1mic;
#if CONFIG_AFE_INTERFACE_V1
extern const esp_afe_sr_iface_t esp_afe_sr_v1;
extern const esp_afe_sr_iface_t esp_afe_vc_v1;
#define ESP_AFE_SR_HANDLE esp_afe_sr_v1
#define ESP_AFE_VC_HANDLE esp_afe_vc_v1
#else
#error No valid afe selected.
#endif
#else
#include "esp_afe_sr_iface.h"
extern const esp_afe_sr_iface_t esp_afe_sr_v1;
extern const esp_afe_sr_iface_t esp_afe_vc_v1;
#define ESP_AFE_SR_HANDLE esp_afe_sr_v1
#define ESP_AFE_VC_HANDLE esp_afe_vc_v1
#endif

View File

@ -14,10 +14,6 @@
#ifndef _ESP_AGC_H_
#define _ESP_AGC_H_
#ifdef __cplusplus
extern "C" {
#endif
////all positive value is valid, negective is error
typedef enum {
ESP_AGC_SUCCESS = 0, ////success
@ -32,8 +28,4 @@ void set_agc_config(void *agc_handle, int gain_dB, int limiter_enable, int targe
int esp_agc_process(void *agc_handle, short *in_pcm, short *out_pcm, int frame_size, int sample_rate);
void esp_agc_close(void *agc_handle);
#ifdef __cplusplus
}
#endif
#endif // _ESP_AGC_H_

View File

@ -1,90 +0,0 @@
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// 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
#ifndef _ESP_MAP_H_
#define _ESP_MAP_H_
#ifdef __cplusplus
extern "C" {
#endif
#define MAP_SAMPLE_RATE 16000 // Supports 16kHz only
#define MAP_FRAME_SIZE 16 // Supports 16ms only
#define MAP_MIC_DISTANCE 50 // According to physical design of mic-array
#define MAP_AEC_ON true
#define MAP_AEC_OFF false
#define MAP_AEC_FILTER_LENGTH 1200 // Number of samples of echo to cancel
/**
* @brief Sets mic-array type, currently 2-mic line array and 3-mic circular array
* are supported.
*/
typedef enum {
TWO_MIC_LINE = 0,
THREE_MIC_CIRCLE = 1
} map_mic_array_type_t;
typedef void* mic_array_processor_t;
/**
* @brief Creates an instance to the MAP structure.
*
* @param sample_rate The sampling frequency (Hz) must be 16000.
*
* @param frame_size The length of the audio processing must be 16ms.
*
* @param array_type '0' for 2-mic line array and '1' for 3-mic circular array.
*
* @param mic_distance The distance between neiboring microphones in mm.
*
* @param aec_on Decides whether to turn on AEC.
*
* @param filter_length Number of samples of echo to cancel, effective when AEC is on.
*
* @return
* - NULL: Create failed
* - Others: An instance of MAP
*/
mic_array_processor_t map_create(int fs, int frame_size, int array_type, float mic_distance, bool aec_on, int filter_length);
/**
* @brief Performs mic array processing for one frame.
*
* @param inst The instance of MAP.
*
* @param in An array of 16-bit signed audio samples from mic.
*
* @param far_end An array of 16-bit signed audio samples sent to the speaker, can be none when AEC is turned off.
*
* @param dsp_out Returns enhanced signal.
*
* @return None
*
*/
void map_process(mic_array_processor_t st, int16_t *in, int16_t *far_end, int16_t *dsp_out);
/**
* @brief Free the MAP instance
*
* @param inst The instance of MAP.
*
* @return None
*
*/
void map_destory(mic_array_processor_t st);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -12,13 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License
#ifndef _ESP_MASE_H_
#define _ESP_MASE_H_
#ifdef __cplusplus
extern "C" {
#endif
#define MASE_SAMPLE_RATE 16000 // Supports 16kHz only
#define MASE_FRAME_SIZE 16 // Supports 16ms only
#define MASE_MIC_DISTANCE 65 // According to physical design of mic-array
@ -85,10 +78,4 @@ void mase_process(mase_handle_t st, int16_t *in, int16_t *dsp_out);
* @return None
*
*/
void mase_destory(mase_handle_t st);
#ifdef __cplusplus
}
#endif
#endif
void mase_destory(mase_handle_t st);

View File

@ -1,21 +1,53 @@
#pragma once
#include "stdint.h"
// #include "esp_err.h"
#include "dl_lib_coefgetter_if.h"
#include "esp_wn_iface.h"
// //Opaque model data container
// typedef struct model_iface_data_t model_iface_data_t;
#define ESP_MN_RESULT_MAX_NUM 5
#define ESP_MN_MAX_PHRASE_NUM 200
#define ESP_MN_MAX_PHRASE_LEN 63
#define ESP_MN_MIN_PHRASE_LEN 2
typedef enum {
ESP_MN_STATE_DETECTING = 0, // detecting
ESP_MN_STATE_DETECTED = 1, // detected
ESP_MN_STATE_TIMEOUT = 2, // time out
} esp_mn_state_t;
// Return all possible recognition results
typedef struct{
esp_mn_state_t state;
int num; // The number of phrase in list, num<=5. When num=0, no phrase is recognized.
int command_id[ESP_MN_RESULT_MAX_NUM]; // The list of command id.
int phrase_id[ESP_MN_RESULT_MAX_NUM]; // The list of phrase id.
float prob[ESP_MN_RESULT_MAX_NUM]; // The list of probability.
} esp_mn_results_t;
typedef struct{
int16_t num; // The number of error phrases, which can not added into model
int16_t phrase_idx[ESP_MN_MAX_PHRASE_NUM]; // The error phrase index in singly linked list
} esp_mn_error_t;
typedef struct {
char phoneme_string[ESP_MN_MAX_PHRASE_LEN + 1]; // phoneme string
int16_t command_id; // the command id
float threshold; // trigger threshold, default: 0
int16_t *wave; // prompt wave data of the phrase
} esp_mn_phrase_t;
typedef struct _mn_node_ {
esp_mn_phrase_t *phrase;
struct _mn_node_ *next;
} esp_mn_node_t;
/**
* @brief Initialze a model instance with specified model coefficient.
* @brief Initialze a model instance with specified model name.
*
* @param model_name The wakenet model name.
* @param duration The duration (ms) to trigger the timeout
*
* @param coeff The wakenet model coefficient.
* @param coeff The wakenet model coefficient.
* @parm sample_length Audio length for speech recognition, in ms.
* @returns Handle to the model data.
*/
typedef model_iface_data_t* (*esp_mn_iface_op_create_t)(const model_coeff_getter_t *coeff, int sample_length);
typedef model_iface_data_t* (*esp_mn_iface_op_create_t)(const char *model_name, int duration);
/**
* @brief Callback function type to fetch the amount of samples that need to be passed to the detect function
@ -43,24 +75,6 @@ typedef int (*esp_mn_iface_op_get_samp_chunknum_t)(model_iface_data_t *model);
* @param det_treshold The threshold to trigger speech commands, the range of det_threshold is 0.0~0.9999
*/
typedef int (*esp_mn_iface_op_set_det_threshold_t)(model_iface_data_t *model, float det_threshold);
/**
* @brief Set the detection threshold to manually abjust the probability
*
* @param model The model object to query
* @param phrase_id The ID of speech command phrase
* @param det_treshold The threshold to trigger speech command phrases
*/
typedef void (*esp_mn_iface_op_set_command_det_threshold_t)(model_iface_data_t *model, int phrase_id, float det_threshold);
/**
* @brief Get the detection threshold by phrase ID
*
* @param model The model object to query
* @param phrase_id The ID of speech command phrase
*
* @return The threshold of speech command phrases
*/
typedef float (*esp_mn_iface_op_get_command_det_threshold_t)(model_iface_data_t *model, int phrase_id);
/**
* @brief Get the sample rate of the samples to feed to the detect function
@ -76,10 +90,9 @@ typedef int (*esp_mn_iface_op_get_samp_rate_t)(model_iface_data_t *model);
* @param model The model object to query.
* @param samples An array of 16-bit signed audio samples. The array size used can be queried by the
* get_samp_chunksize function.
* @return The command id, return 0 if no command word is detected,
* @return The state of multinet
*/
typedef int (*esp_mn_iface_op_detect_t)(model_iface_data_t *model, int16_t *samples);
typedef esp_mn_state_t (*esp_mn_iface_op_detect_t)(model_iface_data_t *model, int16_t *samples);
/**
* @brief Destroy a speech commands recognition model
@ -89,11 +102,30 @@ typedef int (*esp_mn_iface_op_detect_t)(model_iface_data_t *model, int16_t *samp
typedef void (*esp_mn_iface_op_destroy_t)(model_iface_data_t *model);
/**
* @brief Reset the speech commands recognition model
* @brief Get recognition results
*
* @param model The Model object to query
*
* @return The current results.
*/
typedef esp_mn_results_t* (*esp_mn_iface_op_get_results_t)(model_iface_data_t *model);
/**
* @brief Open the log print
*
* @param model_data The model object to query.
*
*/
typedef void (*esp_mn_iface_op_reset_t)(model_iface_data_t *model_data, char *command_str, char *err_phrase_id);
typedef void (*esp_mn_iface_op_open_log_t)(model_iface_data_t *model_data);
/**
* @brief Set the speech commands by mn_command_root
*
* @param model_data The model object to query.
* @param mn_command_root The speech commands link.
* @return The error phrase id info.
*/
typedef esp_mn_error_t* (*esp_wn_iface_op_set_speech_commands)(model_iface_data_t *model_data, esp_mn_node_t *mn_command_root);
typedef struct {
esp_mn_iface_op_create_t create;
@ -101,9 +133,9 @@ typedef struct {
esp_mn_iface_op_get_samp_chunksize_t get_samp_chunksize;
esp_mn_iface_op_get_samp_chunknum_t get_samp_chunknum;
esp_mn_iface_op_set_det_threshold_t set_det_threshold;
esp_mn_iface_op_set_command_det_threshold_t set_command_det_threshold;
esp_mn_iface_op_get_command_det_threshold_t get_command_det_threshold;
esp_mn_iface_op_detect_t detect;
esp_mn_iface_op_destroy_t destroy;
esp_mn_iface_op_reset_t reset;
esp_mn_iface_op_get_results_t get_results;
esp_mn_iface_op_open_log_t open_log;
esp_wn_iface_op_set_speech_commands set_speech_commands;
} esp_mn_iface_t;

View File

@ -3,55 +3,49 @@
//Contains declarations of all available speech recognion models. Pair this up with the right coefficients and you have a model that can recognize
//a specific phrase or word.
extern const esp_mn_iface_t esp_sr_multinet1_single_quantized_en;
extern const esp_mn_iface_t esp_sr_multinet3_single_quantized_en;
extern const esp_mn_iface_t esp_sr_multinet2_single_quantized_cn;
extern const esp_mn_iface_t esp_sr_multinet3_single_quantized_cn;
extern const esp_mn_iface_t esp_sr_multinet4_single_quantized_cn;
extern const esp_mn_iface_t esp_sr_multinet3_continuous_quantized_cn;
extern const esp_mn_iface_t esp_sr_multinet5_quantized;
extern const esp_mn_iface_t esp_sr_multinet5_quantized8;
#define ESP_MN_PREFIX "mn"
#define ESP_MN_ENGLISH "en"
#define ESP_MN_CHINESE "cn"
/**
* @brief Get the multinet handle from model name
*
* @param model_name The name of model
* @returns The handle of multinet
*/
esp_mn_iface_t *esp_mn_handle_from_name(char *model_name);
/**
* @brief Get the multinet language from model name
*
* @param model_name The name of model
* @returns The language of multinet
*/
char *esp_mn_language_from_name(char *model_name);
/*
Configure wake word to use based on what's selected in menuconfig.
*/
#if defined CONFIG_USE_MULTINET
#ifdef CONFIG_SR_MN_EN_MULTINET1_SINGLE_RECOGNITION
#include "multinet1_en.h"
#define MULTINET_MODEL esp_sr_multinet1_single_quantized_en
#define MULTINET_COEFF get_coeff_multinet1_en
#elif CONFIG_SR_MN_EN_MULTINET3_SINGLE_RECOGNITION
#include "multinet3_en.h"
#define MULTINET_MODEL esp_sr_multinet3_single_quantized_en
#define MULTINET_COEFF get_coeff_multinet3_en
#elif CONFIG_SR_MN_CN_MULTINET2_SINGLE_RECOGNITION
#include "multinet2_ch.h"
#define MULTINET_MODEL esp_sr_multinet2_single_quantized_cn
#define MULTINET_COEFF get_coeff_multinet2_ch
#elif CONFIG_SR_MN_CN_MULTINET2_CONTINUOUS_RECOGNITION
#elif CONFIG_SR_MN_CN_MULTINET3_SINGLE_RECOGNITION
#define MULTINET_MODEL esp_sr_multinet3_single_quantized_cn
#define MULTINET_COEFF "mn3cn"
#elif CONFIG_SR_MN_CN_MULTINET4_SINGLE_RECOGNITION
#define MULTINET_MODEL esp_sr_multinet4_single_quantized_cn
#define MULTINET_COEFF "mn4cn"
#elif CONFIG_SR_MN_CN_MULTINET3_CONTINUOUS_RECOGNITION
#define MULTINET_MODEL esp_sr_multinet3_continuous_quantized_cn
#define MULTINET_COEFF "mn3cn"
#elif CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION
#define MULTINET_MODEL esp_sr_multinet5_quantized
#define MULTINET_COEFF "mn5en"
#elif CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8
#define MULTINET_MODEL esp_sr_multinet5_quantized8
#define MULTINET_COEFF "mn5q8en"
#if CONFIG_SR_MN_CN_MULTINET2_SINGLE_RECOGNITION
#include "multinet2_ch.h"
#define MULTINET_COEFF get_coeff_multinet2_ch
#define MULTINET_MODEL_NAME "mn2_cn"
#else
#error No valid wake word selected.
#define MULTINET_COEFF "COEFF_NULL"
#define MULTINET_MODEL_NAME "NULL"
#endif
#else
#define MULTINET_MODEL "NULL"
#define MULTINET_COEFF "NULL"
#define MULTINET_COEFF "COEFF_NULL"
#define MULTINET_MODEL_NAME "NULL"
#endif
/* example
static const esp_mn_iface_t *multinet = &MULTINET_MODEL;

View File

@ -0,0 +1,158 @@
// Copyright 2015-2022 Espressif Systems (Shanghai) PTE LTD
//
// 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.
#pragma once
#include "esp_err.h"
#include "esp_mn_iface.h"
/*
esp_mn_node_t is a singly linked list which is used to manage speech commands.
It is easy to add one speech command into linked list and remove one speech command from linked list.
*/
/**
* @brief Initialze the speech commands singly linked list.
*
* @return
* - ESP_OK Success
* - ESP_ERR_NO_MEM No memory
* - ESP_ERR_INVALID_STATE The Speech Commands link has been initialized
*/
esp_err_t esp_mn_commands_alloc(void);
/**
* @brief Clear the speech commands linked list and free root node.
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_STATE The Speech Commands link has not been initialized
*/
esp_err_t esp_mn_commands_free(void);
/**
* @brief Add one speech commands with phoneme string and command ID
*
* @param command_id The command ID
* @param phoneme_string The phoneme string of the speech commands
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_STATE Fail
*/
esp_err_t esp_mn_commands_add(int command_id, char *phoneme_string);
/**
* @brief Modify one speech commands with new phoneme string
*
* @param old_phoneme_string The old phoneme string of the speech commands
* @param new_phoneme_string The new phoneme string of the speech commands
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_STATE Fail
*/
esp_err_t esp_mn_commands_modify(char *old_phoneme_string, char *new_phoneme_string);
/**
* @brief Remove one speech commands by phoneme string
*
* @param phoneme_string The phoneme string of the speech commands
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_STATE Fail
*/
esp_err_t esp_mn_commands_remove(char *phoneme_string);
/**
* @brief Clear all speech commands in linked list
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_STATE Fail
*/
esp_err_t esp_mn_commands_clear(void);
/**
* @brief Get phrase from index, which is the depth from the phrase node to root node
*
* @Warning: The first phrase index is 0, the second phrase index is 1, and so on.
*
* @return
* - esp_mn_phrase_t* Success
* - NULL Fail
*/
esp_mn_phrase_t *esp_mn_commands_get_from_index(int index);
/**
* @brief Get phrase from phoneme string
*
* @return
* - esp_mn_phrase_t* Success
* - NULL Fail
*/
esp_mn_phrase_t *esp_mn_commands_get_from_string(const char *phoneme_string);
/**
* @brief Update the speech commands of MultiNet
*
* @Warning: Must be used after [add/remove/modify/clear] function,
* otherwise the language model of multinet can not be updated.
*
* @param multinet The multinet handle
* @param model_data The model object to query
*
* @return
* - NULL Success
* - others The list of error phrase which can not be parsed by multinet.
*/
esp_mn_error_t *esp_mn_commands_update(const esp_mn_iface_t *multinet, const model_iface_data_t *model_data);
/**
* @brief Print the MultiNet Speech Commands.
*/
void esp_mn_print_commands(void);
/**
* @brief Initialze the esp_mn_phrase_t struct by command id and phoneme string .
*
* @return the pointer of esp_mn_phrase_t
*/
esp_mn_phrase_t *esp_mn_phrase_alloc(int command_id, char *phoneme_string);
/**
* @brief Free esp_mn_phrase_t pointer.
*
* @param phrase The esp_mn_phrase_t pointer
*/
void esp_mn_phrase_free(esp_mn_phrase_t *phrase);
/**
* @brief Initialze the esp_mn_node_t struct by esp_mn_phrase_t pointer.
*
* @return the pointer of esp_mn_node_t
*/
esp_mn_node_t *esp_mn_node_alloc(esp_mn_phrase_t *phrase);
/**
* @brief Free esp_mn_node_t pointer.
*
* @param node The esp_mn_node_free pointer
*/
void esp_mn_node_free(esp_mn_node_t *node);
/**
* @brief Print phrase linked list.
*/
void esp_mn_commands_print(void);

View File

@ -0,0 +1,23 @@
#pragma once
#include "esp_err.h"
#include "esp_mn_iface.h"
/**
* @brief Check chip config to ensure optimum performance
*/
void check_chip_config(void);
/**
* @brief Update the speech commands of MultiNet by menuconfig
*
* @param multinet The multinet handle
*
* @param model_data The model object to query
*
* @param langugae The language of MultiNet
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_STATE Fail
*/
esp_err_t esp_mn_commands_update_from_sdkconfig(esp_mn_iface_t *multinet, const model_iface_data_t *model_data);

View File

@ -47,15 +47,11 @@ typedef void* vad_handle_t;
*
* @param vad_mode Sets the VAD operating mode.
*
* @param sample_rate_hz The Sampling frequency (Hz) can be 32000, 16000, 8000, default: 16000.
*
* @param one_frame_ms The length of the audio processing can be 10ms, 20ms, 30ms, default: 30.
*
* @return
* - NULL: Create failed
* - Others: The instance of VAD
*/
vad_handle_t vad_create(vad_mode_t vad_mode, int sample_rate_hz, int one_frame_ms);
vad_handle_t vad_create(vad_mode_t vad_mode);
/**
* @brief Feed samples of an audio stream to the VAD and check if there is someone speaking.
@ -64,12 +60,16 @@ vad_handle_t vad_create(vad_mode_t vad_mode, int sample_rate_hz, int one_frame_m
*
* @param data An array of 16-bit signed audio samples.
*
* @param sample_rate_hz The Sampling frequency (Hz) can be 32000, 16000, 8000, default: 16000.
*
* @param one_frame_ms The length of the audio processing can be 10ms, 20ms, 30ms, default: 30.
*
* @return
* - VAD_SILENCE if no voice
* - VAD_SPEECH if voice is detected
*
*/
vad_state_t vad_process(vad_handle_t inst, int16_t *data);
vad_state_t vad_process(vad_handle_t inst, int16_t *data, int sample_rate_hz, int one_frame_ms);
/**
* @brief Free the VAD instance

View File

@ -1,10 +1,19 @@
#pragma once
#include "stdint.h"
#include "dl_lib_coefgetter_if.h"
//Opaque model data container
typedef struct model_iface_data_t model_iface_data_t;
/**
* @brief The state of wakeup
*/
typedef enum
{
WAKENET_NO_DETECT = 0, // wake word is not detected
WAKENET_CHANNEL_VERIFIED = -1, // output channel is verified
WAKENET_DETECTED = 1 // wake word is detected
} wakenet_state_t;
//Set wake words recognition operating mode
//The probability of being wake words is increased with increasing mode,
//As a consequence also the false alarm rate goes up
@ -25,14 +34,14 @@ typedef struct {
/**
* @brief Easy function type to initialze a model instance with a detection mode and specified wake word coefficient
*
* @param model_name The specified wake word model coefficient
* @param det_mode The wake words detection mode to trigger wake words, DET_MODE_90 or DET_MODE_95
* @param model_coeff The specified wake word model coefficient
* @returns Handle to the model data
*/
typedef model_iface_data_t* (*esp_wn_iface_op_create_t)(const model_coeff_getter_t *model_coeff, det_mode_t det_mode);
typedef model_iface_data_t* (*esp_wn_iface_op_create_t)(const void *model_name, det_mode_t det_mode);
/**
* @brief Callback function type to fetch the amount of samples that need to be passed to the detect function
* @brief Get the amount of samples that need to be passed to the detect function
*
* Every speech recognition model processes a certain number of samples at the same time. This function
* can be used to query that amount. Note that the returned amount is in 16-bit samples, not in bytes.
@ -43,7 +52,7 @@ typedef model_iface_data_t* (*esp_wn_iface_op_create_t)(const model_coeff_getter
typedef int (*esp_wn_iface_op_get_samp_chunksize_t)(model_iface_data_t *model);
/**
* @brief Callback function type to fetch the channel number of samples that need to be passed to the detect function
* @brief Get the channel number of samples that need to be passed to the detect function
*
* Every speech recognition model processes a certain number of samples at the same time. This function
* can be used to query that amount. Note that the returned amount is in 16-bit samples, not in bytes.
@ -53,6 +62,17 @@ typedef int (*esp_wn_iface_op_get_samp_chunksize_t)(model_iface_data_t *model);
*/
typedef int (*esp_wn_iface_op_get_channel_num_t)(model_iface_data_t *model);
/**
* @brief Get the start point of wake word when one wake word is detected.
*
* @Warning: This function should be called when the channel index is verified.
* The returned value is the number of samples from start point of wake word to detected point.
*
* @param model The model object to query
* @return The number of samples from start point to detected point (end point)
*/
typedef int (*esp_wn_iface_op_get_start_point_t)(model_iface_data_t *model);
/**
* @brief Get the sample rate of the samples to feed to the detect function
@ -110,7 +130,7 @@ typedef float (*esp_wn_iface_op_get_det_threshold_t)(model_iface_data_t *model,
* get_samp_chunksize function.
* @return The index of wake words, return 0 if no wake word is detected, else the index of the wake words.
*/
typedef int (*esp_wn_iface_op_detect_t)(model_iface_data_t *model, int16_t *samples);
typedef wakenet_state_t (*esp_wn_iface_op_detect_t)(model_iface_data_t *model, int16_t *samples);
/**
* @brief Get the volume gain
@ -149,6 +169,7 @@ typedef void (*esp_wn_iface_op_destroy_t)(model_iface_data_t *model);
*/
typedef struct {
esp_wn_iface_op_create_t create;
esp_wn_iface_op_get_start_point_t get_start_point;
esp_wn_iface_op_get_samp_chunksize_t get_samp_chunksize;
esp_wn_iface_op_get_channel_num_t get_channel_num;
esp_wn_iface_op_get_samp_rate_t get_samp_rate;

View File

@ -1,114 +1,109 @@
#pragma once
#include "esp_wn_iface.h"
//Contains declarations of all available speech recognion models. Pair this up with the right coefficients and you have a model that can recognize
//a specific phrase or word.
extern const esp_wn_iface_t esp_sr_wakenet5_quantized;
extern const esp_wn_iface_t esp_sr_wakenet7_quantized;
extern const esp_wn_iface_t esp_sr_wakenet7_quantized8;
extern const esp_wn_iface_t esp_sr_wakenet8_quantized;
extern const esp_wn_iface_t esp_sr_wakenet8_quantized8;
/*
Configure network to use based on what's selected in menuconfig.
*/
// The prefix of wakenet model name is used to filter all wakenet from availabel models.
#define ESP_WN_PREFIX "wn"
/**
* @brief Get the wakenet handle from model name
*
* @param model_name The name of model
* @returns The handle of wakenet
*/
const esp_wn_iface_t *esp_wn_handle_from_name(const char *model_name);
/**
* @brief Get the wake word name from model name
*
* @param model_name The name of model
* @returns The wake word name, like "alexa","hilexin","xiaoaitongxue"
*/
char* esp_wn_wakeword_from_name(const char *model_name);
// /**
// * @brief Get the model coeff from model name
// *
// * @Warning: retuen model_coeff_getter_t, when chip is ESP32,
// * return string for other chips
// *
// * @param model_name The name of model
// * @returns The handle of wakenet
// */
// void *esp_wn_coeff_from_name(char *model_name);
#if defined CONFIG_USE_WAKENET
#if CONFIG_SR_WN_MODEL_WN5_QUANT
#define WAKENET_MODEL esp_sr_wakenet5_quantized
#elif CONFIG_SR_WN_MODEL_WN7_QUANT
#define WAKENET_MODEL esp_sr_wakenet7_quantized
#elif CONFIG_SR_WN_MODEL_WN7_QUANT8
#define WAKENET_MODEL esp_sr_wakenet7_quantized8
#elif CONFIG_SR_WN_MODEL_WN8_QUANT
#define WAKENET_MODEL esp_sr_wakenet8_quantized
#elif CONFIG_SR_WN_MODEL_WN8_QUANT8
#define WAKENET_MODEL esp_sr_wakenet8_quantized8
#else
#error No valid neural network model selected.
#endif
/*
Configure wake word to use based on what's selected in menuconfig.
*/
#if CONFIG_SR_WN_WN5_HILEXIN & CONFIG_SR_WN_MODEL_WN5_QUANT
#if CONFIG_SR_WN_WN5_HILEXIN
#include "hilexin_wn5.h"
#define WAKENET_MODEL_NAME "wn5_hilexin"
#define WAKENET_COEFF get_coeff_hilexin_wn5
#elif CONFIG_SR_WN_WN5X2_HILEXIN & CONFIG_SR_WN_MODEL_WN5_QUANT
#elif CONFIG_SR_WN_WN5X2_HILEXIN
#include "hilexin_wn5X2.h"
#define WAKENET_MODEL_NAME "wn5_hilexinX2"
#define WAKENET_COEFF get_coeff_hilexin_wn5X2
#elif CONFIG_SR_WN_WN5X3_HILEXIN & CONFIG_SR_WN_MODEL_WN5_QUANT
#elif CONFIG_SR_WN_WN5X3_HILEXIN
#include "hilexin_wn5X3.h"
#define WAKENET_MODEL_NAME "wn5_hilexinX3"
#define WAKENET_COEFF get_coeff_hilexin_wn5X3
#elif CONFIG_SR_WN_WN5_NIHAOXIAOZHI & CONFIG_SR_WN_MODEL_WN5_QUANT
#elif CONFIG_SR_WN_WN5_NIHAOXIAOZHI
#include "nihaoxiaozhi_wn5.h"
#define WAKENET_MODEL_NAME "wn5_nihaoxiaozhi"
#define WAKENET_COEFF get_coeff_nihaoxiaozhi_wn5
#elif CONFIG_SR_WN_WN5X2_NIHAOXIAOZHI & CONFIG_SR_WN_MODEL_WN5_QUANT
#elif CONFIG_SR_WN_WN5X2_NIHAOXIAOZHI
#include "nihaoxiaozhi_wn5X2.h"
#define WAKENET_MODEL_NAME "wn5_nihaoxiaozhiX2"
#define WAKENET_COEFF get_coeff_nihaoxiaozhi_wn5X2
#elif CONFIG_SR_WN_WN5X3_NIHAOXIAOZHI & CONFIG_SR_WN_MODEL_WN5_QUANT
#elif CONFIG_SR_WN_WN5X3_NIHAOXIAOZHI
#include "nihaoxiaozhi_wn5X3.h"
#define WAKENET_MODEL_NAME "wn5_nihaoxiaozhiX3"
#define WAKENET_COEFF get_coeff_nihaoxiaozhi_wn5X3
#elif CONFIG_SR_WN_WN5X3_NIHAOXIAOXIN & CONFIG_SR_WN_MODEL_WN5_QUANT
#elif CONFIG_SR_WN_WN5X3_NIHAOXIAOXIN
#include "nihaoxiaoxin_wn5X3.h"
#define WAKENET_MODEL_NAME "wn5_nihaoxiaoxinX3"
#define WAKENET_COEFF get_coeff_nihaoxiaoxin_wn5X3
#elif CONFIG_SR_WN_WN5X3_HIJESON & CONFIG_SR_WN_MODEL_WN5_QUANT
#elif CONFIG_SR_WN_WN5X3_HIJESON
#include "hijeson_wn5X3.h"
#define WAKENET_MODEL_NAME "wn5_hijesonX3"
#define WAKENET_COEFF get_coeff_hijeson_wn5X3
#elif CONFIG_SR_WN_WN5_CUSTOMIZED_WORD
#include "customized_word_wn5.h"
#define WAKENET_COEFF get_coeff_customized_word_wn5
#elif CONFIG_SR_WN_WN7_CUSTOMIZED_WORD
#define WAKENET_COEFF "custom7"
#elif CONFIG_SR_WN_WN7_XIAOAITONGXUE & CONFIG_SR_WN_MODEL_WN7_QUANT
#define WAKENET_COEFF "xiaoaitongxue7"
#elif CONFIG_SR_WN_WN7_XIAOAITONGXUE & CONFIG_SR_WN_MODEL_WN7_QUANT8
#define WAKENET_COEFF "xiaoaitongxue7q8"
#elif CONFIG_SR_WN_WN7_HILEXIN & CONFIG_SR_WN_MODEL_WN7_QUANT
#define WAKENET_COEFF "hilexin7"
#elif CONFIG_SR_WN_WN7_HILEXIN & CONFIG_SR_WN_MODEL_WN7_QUANT8
#define WAKENET_COEFF "hilexin7q8"
#elif CONFIG_SR_WN_WN7_ALEXA & CONFIG_SR_WN_MODEL_WN7_QUANT
#define WAKENET_COEFF "alexa7"
#elif CONFIG_SR_WN_WN8_ALEXA & CONFIG_SR_WN_MODEL_WN8_QUANT
#define WAKENET_COEFF "alexa8"
#elif CONFIG_SR_WN_WN7_ALEXA & CONFIG_SR_WN_MODEL_WN7_QUANT8
#define WAKENET_COEFF "alexa7q8"
#elif CONFIG_SR_WN_WN8_HIESP & CONFIG_SR_WN_MODEL_WN8_QUANT
#define WAKENET_COEFF "hiesp8"
#elif CONFIG_SR_WN_WN8_HIESP & CONFIG_SR_WN_MODEL_WN8_QUANT8
#define WAKENET_COEFF "hiesp8q8"
#define WAKENET_MODEL_NAME "wn5_customizedword"
#define WAKENET_COEFF get_coeff_customizedword_wn5
#else
#error No valid wake word selected.
#define WAKENET_MODEL_NAME "NULL"
#define WAKENET_COEFF "COEFF_NULL"
#endif
#else
#define WAKENET_MODEL "NULL"
#define WAKENET_COEFF "NULL"
#endif
/* example
static const sr_model_iface_t *model = &WAKENET_MODEL;
#else
#define WAKENET_MODEL_NAME "NULL"
#define WAKENET_COEFF "COEFF_NULL"
#endif
/*
static const sr_model_iface_t *model = esp_wn_handle_from_name(model_name);
//Initialize wakeNet model data
static model_iface_data_t *model_data=model->create(DET_MODE_90);
static model_iface_data_t *model_data=model->create(model_name, DET_MODE_90);
//Set parameters of buffer
int audio_chunksize=model->get_samp_chunksize(model_data);

View File

@ -1,8 +0,0 @@
//Generated by mkmodel
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
extern const model_coeff_getter_t get_coeff_hijeson_wn5X3;

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_hilexin_wn5;
extern const model_coeff_getter_t get_coeff_hilexin_wn5;

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_hilexin_wn5X2;
extern const model_coeff_getter_t get_coeff_hilexin_wn5X2;

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_hilexin_wn5X3;
extern const model_coeff_getter_t get_coeff_hilexin_wn5X3;

View File

@ -1,408 +0,0 @@
#pragma once
#include "esp_mn_iface.h"
#define SPEECH_COMMANDS_NUM 99
#if CONFIG_SR_MN_CHINESE
#define MN_SPEECH_COMMAND_ID0 CONFIG_CN_SPEECH_COMMAND_ID0
#define MN_SPEECH_COMMAND_ID1 CONFIG_CN_SPEECH_COMMAND_ID1
#define MN_SPEECH_COMMAND_ID2 CONFIG_CN_SPEECH_COMMAND_ID2
#define MN_SPEECH_COMMAND_ID3 CONFIG_CN_SPEECH_COMMAND_ID3
#define MN_SPEECH_COMMAND_ID4 CONFIG_CN_SPEECH_COMMAND_ID4
#define MN_SPEECH_COMMAND_ID5 CONFIG_CN_SPEECH_COMMAND_ID5
#define MN_SPEECH_COMMAND_ID6 CONFIG_CN_SPEECH_COMMAND_ID6
#define MN_SPEECH_COMMAND_ID7 CONFIG_CN_SPEECH_COMMAND_ID7
#define MN_SPEECH_COMMAND_ID8 CONFIG_CN_SPEECH_COMMAND_ID8
#define MN_SPEECH_COMMAND_ID9 CONFIG_CN_SPEECH_COMMAND_ID9
#define MN_SPEECH_COMMAND_ID10 CONFIG_CN_SPEECH_COMMAND_ID10
#define MN_SPEECH_COMMAND_ID11 CONFIG_CN_SPEECH_COMMAND_ID11
#define MN_SPEECH_COMMAND_ID12 CONFIG_CN_SPEECH_COMMAND_ID12
#define MN_SPEECH_COMMAND_ID13 CONFIG_CN_SPEECH_COMMAND_ID13
#define MN_SPEECH_COMMAND_ID14 CONFIG_CN_SPEECH_COMMAND_ID14
#define MN_SPEECH_COMMAND_ID15 CONFIG_CN_SPEECH_COMMAND_ID15
#define MN_SPEECH_COMMAND_ID16 CONFIG_CN_SPEECH_COMMAND_ID16
#define MN_SPEECH_COMMAND_ID17 CONFIG_CN_SPEECH_COMMAND_ID17
#define MN_SPEECH_COMMAND_ID18 CONFIG_CN_SPEECH_COMMAND_ID18
#define MN_SPEECH_COMMAND_ID19 CONFIG_CN_SPEECH_COMMAND_ID19
#define MN_SPEECH_COMMAND_ID20 CONFIG_CN_SPEECH_COMMAND_ID20
#define MN_SPEECH_COMMAND_ID21 CONFIG_CN_SPEECH_COMMAND_ID21
#define MN_SPEECH_COMMAND_ID22 CONFIG_CN_SPEECH_COMMAND_ID22
#define MN_SPEECH_COMMAND_ID23 CONFIG_CN_SPEECH_COMMAND_ID23
#define MN_SPEECH_COMMAND_ID24 CONFIG_CN_SPEECH_COMMAND_ID24
#define MN_SPEECH_COMMAND_ID25 CONFIG_CN_SPEECH_COMMAND_ID25
#define MN_SPEECH_COMMAND_ID26 CONFIG_CN_SPEECH_COMMAND_ID26
#define MN_SPEECH_COMMAND_ID27 CONFIG_CN_SPEECH_COMMAND_ID27
#define MN_SPEECH_COMMAND_ID28 CONFIG_CN_SPEECH_COMMAND_ID28
#define MN_SPEECH_COMMAND_ID29 CONFIG_CN_SPEECH_COMMAND_ID29
#define MN_SPEECH_COMMAND_ID30 CONFIG_CN_SPEECH_COMMAND_ID30
#define MN_SPEECH_COMMAND_ID31 CONFIG_CN_SPEECH_COMMAND_ID31
#define MN_SPEECH_COMMAND_ID32 CONFIG_CN_SPEECH_COMMAND_ID32
#define MN_SPEECH_COMMAND_ID33 CONFIG_CN_SPEECH_COMMAND_ID33
#define MN_SPEECH_COMMAND_ID34 CONFIG_CN_SPEECH_COMMAND_ID34
#define MN_SPEECH_COMMAND_ID35 CONFIG_CN_SPEECH_COMMAND_ID35
#define MN_SPEECH_COMMAND_ID36 CONFIG_CN_SPEECH_COMMAND_ID36
#define MN_SPEECH_COMMAND_ID37 CONFIG_CN_SPEECH_COMMAND_ID37
#define MN_SPEECH_COMMAND_ID38 CONFIG_CN_SPEECH_COMMAND_ID38
#define MN_SPEECH_COMMAND_ID39 CONFIG_CN_SPEECH_COMMAND_ID39
#define MN_SPEECH_COMMAND_ID40 CONFIG_CN_SPEECH_COMMAND_ID40
#define MN_SPEECH_COMMAND_ID41 CONFIG_CN_SPEECH_COMMAND_ID41
#define MN_SPEECH_COMMAND_ID42 CONFIG_CN_SPEECH_COMMAND_ID42
#define MN_SPEECH_COMMAND_ID43 CONFIG_CN_SPEECH_COMMAND_ID43
#define MN_SPEECH_COMMAND_ID44 CONFIG_CN_SPEECH_COMMAND_ID44
#define MN_SPEECH_COMMAND_ID45 CONFIG_CN_SPEECH_COMMAND_ID45
#define MN_SPEECH_COMMAND_ID46 CONFIG_CN_SPEECH_COMMAND_ID46
#define MN_SPEECH_COMMAND_ID47 CONFIG_CN_SPEECH_COMMAND_ID47
#define MN_SPEECH_COMMAND_ID48 CONFIG_CN_SPEECH_COMMAND_ID48
#define MN_SPEECH_COMMAND_ID49 CONFIG_CN_SPEECH_COMMAND_ID49
#define MN_SPEECH_COMMAND_ID50 CONFIG_CN_SPEECH_COMMAND_ID50
#define MN_SPEECH_COMMAND_ID51 CONFIG_CN_SPEECH_COMMAND_ID51
#define MN_SPEECH_COMMAND_ID52 CONFIG_CN_SPEECH_COMMAND_ID52
#define MN_SPEECH_COMMAND_ID53 CONFIG_CN_SPEECH_COMMAND_ID53
#define MN_SPEECH_COMMAND_ID54 CONFIG_CN_SPEECH_COMMAND_ID54
#define MN_SPEECH_COMMAND_ID55 CONFIG_CN_SPEECH_COMMAND_ID55
#define MN_SPEECH_COMMAND_ID56 CONFIG_CN_SPEECH_COMMAND_ID56
#define MN_SPEECH_COMMAND_ID57 CONFIG_CN_SPEECH_COMMAND_ID57
#define MN_SPEECH_COMMAND_ID58 CONFIG_CN_SPEECH_COMMAND_ID58
#define MN_SPEECH_COMMAND_ID59 CONFIG_CN_SPEECH_COMMAND_ID59
#define MN_SPEECH_COMMAND_ID60 CONFIG_CN_SPEECH_COMMAND_ID60
#define MN_SPEECH_COMMAND_ID61 CONFIG_CN_SPEECH_COMMAND_ID61
#define MN_SPEECH_COMMAND_ID62 CONFIG_CN_SPEECH_COMMAND_ID62
#define MN_SPEECH_COMMAND_ID63 CONFIG_CN_SPEECH_COMMAND_ID63
#define MN_SPEECH_COMMAND_ID64 CONFIG_CN_SPEECH_COMMAND_ID64
#define MN_SPEECH_COMMAND_ID65 CONFIG_CN_SPEECH_COMMAND_ID65
#define MN_SPEECH_COMMAND_ID66 CONFIG_CN_SPEECH_COMMAND_ID66
#define MN_SPEECH_COMMAND_ID67 CONFIG_CN_SPEECH_COMMAND_ID67
#define MN_SPEECH_COMMAND_ID68 CONFIG_CN_SPEECH_COMMAND_ID68
#define MN_SPEECH_COMMAND_ID69 CONFIG_CN_SPEECH_COMMAND_ID69
#define MN_SPEECH_COMMAND_ID70 CONFIG_CN_SPEECH_COMMAND_ID70
#define MN_SPEECH_COMMAND_ID71 CONFIG_CN_SPEECH_COMMAND_ID71
#define MN_SPEECH_COMMAND_ID72 CONFIG_CN_SPEECH_COMMAND_ID72
#define MN_SPEECH_COMMAND_ID73 CONFIG_CN_SPEECH_COMMAND_ID73
#define MN_SPEECH_COMMAND_ID74 CONFIG_CN_SPEECH_COMMAND_ID74
#define MN_SPEECH_COMMAND_ID75 CONFIG_CN_SPEECH_COMMAND_ID75
#define MN_SPEECH_COMMAND_ID76 CONFIG_CN_SPEECH_COMMAND_ID76
#define MN_SPEECH_COMMAND_ID77 CONFIG_CN_SPEECH_COMMAND_ID77
#define MN_SPEECH_COMMAND_ID78 CONFIG_CN_SPEECH_COMMAND_ID78
#define MN_SPEECH_COMMAND_ID79 CONFIG_CN_SPEECH_COMMAND_ID79
#define MN_SPEECH_COMMAND_ID80 CONFIG_CN_SPEECH_COMMAND_ID80
#define MN_SPEECH_COMMAND_ID81 CONFIG_CN_SPEECH_COMMAND_ID81
#define MN_SPEECH_COMMAND_ID82 CONFIG_CN_SPEECH_COMMAND_ID82
#define MN_SPEECH_COMMAND_ID83 CONFIG_CN_SPEECH_COMMAND_ID83
#define MN_SPEECH_COMMAND_ID84 CONFIG_CN_SPEECH_COMMAND_ID84
#define MN_SPEECH_COMMAND_ID85 CONFIG_CN_SPEECH_COMMAND_ID85
#define MN_SPEECH_COMMAND_ID86 CONFIG_CN_SPEECH_COMMAND_ID86
#define MN_SPEECH_COMMAND_ID87 CONFIG_CN_SPEECH_COMMAND_ID87
#define MN_SPEECH_COMMAND_ID88 CONFIG_CN_SPEECH_COMMAND_ID88
#define MN_SPEECH_COMMAND_ID89 CONFIG_CN_SPEECH_COMMAND_ID89
#define MN_SPEECH_COMMAND_ID90 CONFIG_CN_SPEECH_COMMAND_ID90
#define MN_SPEECH_COMMAND_ID91 CONFIG_CN_SPEECH_COMMAND_ID91
#define MN_SPEECH_COMMAND_ID92 CONFIG_CN_SPEECH_COMMAND_ID92
#define MN_SPEECH_COMMAND_ID93 CONFIG_CN_SPEECH_COMMAND_ID93
#define MN_SPEECH_COMMAND_ID94 CONFIG_CN_SPEECH_COMMAND_ID94
#define MN_SPEECH_COMMAND_ID95 CONFIG_CN_SPEECH_COMMAND_ID95
#define MN_SPEECH_COMMAND_ID96 CONFIG_CN_SPEECH_COMMAND_ID96
#define MN_SPEECH_COMMAND_ID97 CONFIG_CN_SPEECH_COMMAND_ID97
#define MN_SPEECH_COMMAND_ID98 CONFIG_CN_SPEECH_COMMAND_ID98
#define MN_SPEECH_COMMAND_ID99 CONFIG_CN_SPEECH_COMMAND_ID99
#define MN_SPEECH_COMMAND_ID100 CONFIG_CN_SPEECH_COMMAND_ID100
#define MN_SPEECH_COMMAND_ID101 CONFIG_CN_SPEECH_COMMAND_ID101
#define MN_SPEECH_COMMAND_ID102 CONFIG_CN_SPEECH_COMMAND_ID102
#define MN_SPEECH_COMMAND_ID103 CONFIG_CN_SPEECH_COMMAND_ID103
#define MN_SPEECH_COMMAND_ID104 CONFIG_CN_SPEECH_COMMAND_ID104
#define MN_SPEECH_COMMAND_ID105 CONFIG_CN_SPEECH_COMMAND_ID105
#define MN_SPEECH_COMMAND_ID106 CONFIG_CN_SPEECH_COMMAND_ID106
#define MN_SPEECH_COMMAND_ID107 CONFIG_CN_SPEECH_COMMAND_ID107
#define MN_SPEECH_COMMAND_ID108 CONFIG_CN_SPEECH_COMMAND_ID108
#define MN_SPEECH_COMMAND_ID109 CONFIG_CN_SPEECH_COMMAND_ID109
#define MN_SPEECH_COMMAND_ID110 CONFIG_CN_SPEECH_COMMAND_ID110
#define MN_SPEECH_COMMAND_ID111 CONFIG_CN_SPEECH_COMMAND_ID111
#define MN_SPEECH_COMMAND_ID112 CONFIG_CN_SPEECH_COMMAND_ID112
#define MN_SPEECH_COMMAND_ID113 CONFIG_CN_SPEECH_COMMAND_ID113
#define MN_SPEECH_COMMAND_ID114 CONFIG_CN_SPEECH_COMMAND_ID114
#define MN_SPEECH_COMMAND_ID115 CONFIG_CN_SPEECH_COMMAND_ID115
#define MN_SPEECH_COMMAND_ID116 CONFIG_CN_SPEECH_COMMAND_ID116
#define MN_SPEECH_COMMAND_ID117 CONFIG_CN_SPEECH_COMMAND_ID117
#define MN_SPEECH_COMMAND_ID118 CONFIG_CN_SPEECH_COMMAND_ID118
#define MN_SPEECH_COMMAND_ID119 CONFIG_CN_SPEECH_COMMAND_ID119
#define MN_SPEECH_COMMAND_ID120 CONFIG_CN_SPEECH_COMMAND_ID120
#define MN_SPEECH_COMMAND_ID121 CONFIG_CN_SPEECH_COMMAND_ID121
#define MN_SPEECH_COMMAND_ID122 CONFIG_CN_SPEECH_COMMAND_ID122
#define MN_SPEECH_COMMAND_ID123 CONFIG_CN_SPEECH_COMMAND_ID123
#define MN_SPEECH_COMMAND_ID124 CONFIG_CN_SPEECH_COMMAND_ID124
#define MN_SPEECH_COMMAND_ID125 CONFIG_CN_SPEECH_COMMAND_ID125
#define MN_SPEECH_COMMAND_ID126 CONFIG_CN_SPEECH_COMMAND_ID126
#define MN_SPEECH_COMMAND_ID127 CONFIG_CN_SPEECH_COMMAND_ID127
#define MN_SPEECH_COMMAND_ID128 CONFIG_CN_SPEECH_COMMAND_ID128
#define MN_SPEECH_COMMAND_ID129 CONFIG_CN_SPEECH_COMMAND_ID129
#define MN_SPEECH_COMMAND_ID130 CONFIG_CN_SPEECH_COMMAND_ID130
#define MN_SPEECH_COMMAND_ID131 CONFIG_CN_SPEECH_COMMAND_ID131
#define MN_SPEECH_COMMAND_ID132 CONFIG_CN_SPEECH_COMMAND_ID132
#define MN_SPEECH_COMMAND_ID133 CONFIG_CN_SPEECH_COMMAND_ID133
#define MN_SPEECH_COMMAND_ID134 CONFIG_CN_SPEECH_COMMAND_ID134
#define MN_SPEECH_COMMAND_ID135 CONFIG_CN_SPEECH_COMMAND_ID135
#define MN_SPEECH_COMMAND_ID136 CONFIG_CN_SPEECH_COMMAND_ID136
#define MN_SPEECH_COMMAND_ID137 CONFIG_CN_SPEECH_COMMAND_ID137
#define MN_SPEECH_COMMAND_ID138 CONFIG_CN_SPEECH_COMMAND_ID138
#define MN_SPEECH_COMMAND_ID139 CONFIG_CN_SPEECH_COMMAND_ID139
#define MN_SPEECH_COMMAND_ID140 CONFIG_CN_SPEECH_COMMAND_ID140
#define MN_SPEECH_COMMAND_ID141 CONFIG_CN_SPEECH_COMMAND_ID141
#define MN_SPEECH_COMMAND_ID142 CONFIG_CN_SPEECH_COMMAND_ID142
#define MN_SPEECH_COMMAND_ID143 CONFIG_CN_SPEECH_COMMAND_ID143
#define MN_SPEECH_COMMAND_ID144 CONFIG_CN_SPEECH_COMMAND_ID144
#define MN_SPEECH_COMMAND_ID145 CONFIG_CN_SPEECH_COMMAND_ID145
#define MN_SPEECH_COMMAND_ID146 CONFIG_CN_SPEECH_COMMAND_ID146
#define MN_SPEECH_COMMAND_ID147 CONFIG_CN_SPEECH_COMMAND_ID147
#define MN_SPEECH_COMMAND_ID148 CONFIG_CN_SPEECH_COMMAND_ID148
#define MN_SPEECH_COMMAND_ID149 CONFIG_CN_SPEECH_COMMAND_ID149
#define MN_SPEECH_COMMAND_ID150 CONFIG_CN_SPEECH_COMMAND_ID150
#define MN_SPEECH_COMMAND_ID151 CONFIG_CN_SPEECH_COMMAND_ID151
#define MN_SPEECH_COMMAND_ID152 CONFIG_CN_SPEECH_COMMAND_ID152
#define MN_SPEECH_COMMAND_ID153 CONFIG_CN_SPEECH_COMMAND_ID153
#define MN_SPEECH_COMMAND_ID154 CONFIG_CN_SPEECH_COMMAND_ID154
#define MN_SPEECH_COMMAND_ID155 CONFIG_CN_SPEECH_COMMAND_ID155
#define MN_SPEECH_COMMAND_ID156 CONFIG_CN_SPEECH_COMMAND_ID156
#define MN_SPEECH_COMMAND_ID157 CONFIG_CN_SPEECH_COMMAND_ID157
#define MN_SPEECH_COMMAND_ID158 CONFIG_CN_SPEECH_COMMAND_ID158
#define MN_SPEECH_COMMAND_ID159 CONFIG_CN_SPEECH_COMMAND_ID159
#define MN_SPEECH_COMMAND_ID160 CONFIG_CN_SPEECH_COMMAND_ID160
#define MN_SPEECH_COMMAND_ID161 CONFIG_CN_SPEECH_COMMAND_ID161
#define MN_SPEECH_COMMAND_ID162 CONFIG_CN_SPEECH_COMMAND_ID162
#define MN_SPEECH_COMMAND_ID163 CONFIG_CN_SPEECH_COMMAND_ID163
#define MN_SPEECH_COMMAND_ID164 CONFIG_CN_SPEECH_COMMAND_ID164
#define MN_SPEECH_COMMAND_ID165 CONFIG_CN_SPEECH_COMMAND_ID165
#define MN_SPEECH_COMMAND_ID166 CONFIG_CN_SPEECH_COMMAND_ID166
#define MN_SPEECH_COMMAND_ID167 CONFIG_CN_SPEECH_COMMAND_ID167
#define MN_SPEECH_COMMAND_ID168 CONFIG_CN_SPEECH_COMMAND_ID168
#define MN_SPEECH_COMMAND_ID169 CONFIG_CN_SPEECH_COMMAND_ID169
#define MN_SPEECH_COMMAND_ID170 CONFIG_CN_SPEECH_COMMAND_ID170
#define MN_SPEECH_COMMAND_ID171 CONFIG_CN_SPEECH_COMMAND_ID171
#define MN_SPEECH_COMMAND_ID172 CONFIG_CN_SPEECH_COMMAND_ID172
#define MN_SPEECH_COMMAND_ID173 CONFIG_CN_SPEECH_COMMAND_ID173
#define MN_SPEECH_COMMAND_ID174 CONFIG_CN_SPEECH_COMMAND_ID174
#define MN_SPEECH_COMMAND_ID175 CONFIG_CN_SPEECH_COMMAND_ID175
#define MN_SPEECH_COMMAND_ID176 CONFIG_CN_SPEECH_COMMAND_ID176
#define MN_SPEECH_COMMAND_ID177 CONFIG_CN_SPEECH_COMMAND_ID177
#define MN_SPEECH_COMMAND_ID178 CONFIG_CN_SPEECH_COMMAND_ID178
#define MN_SPEECH_COMMAND_ID179 CONFIG_CN_SPEECH_COMMAND_ID179
#define MN_SPEECH_COMMAND_ID180 CONFIG_CN_SPEECH_COMMAND_ID180
#define MN_SPEECH_COMMAND_ID181 CONFIG_CN_SPEECH_COMMAND_ID181
#define MN_SPEECH_COMMAND_ID182 CONFIG_CN_SPEECH_COMMAND_ID182
#define MN_SPEECH_COMMAND_ID183 CONFIG_CN_SPEECH_COMMAND_ID183
#define MN_SPEECH_COMMAND_ID184 CONFIG_CN_SPEECH_COMMAND_ID184
#define MN_SPEECH_COMMAND_ID185 CONFIG_CN_SPEECH_COMMAND_ID185
#define MN_SPEECH_COMMAND_ID186 CONFIG_CN_SPEECH_COMMAND_ID186
#define MN_SPEECH_COMMAND_ID187 CONFIG_CN_SPEECH_COMMAND_ID187
#define MN_SPEECH_COMMAND_ID188 CONFIG_CN_SPEECH_COMMAND_ID188
#define MN_SPEECH_COMMAND_ID189 CONFIG_CN_SPEECH_COMMAND_ID189
#define MN_SPEECH_COMMAND_ID190 CONFIG_CN_SPEECH_COMMAND_ID190
#define MN_SPEECH_COMMAND_ID191 CONFIG_CN_SPEECH_COMMAND_ID191
#define MN_SPEECH_COMMAND_ID192 CONFIG_CN_SPEECH_COMMAND_ID192
#define MN_SPEECH_COMMAND_ID193 CONFIG_CN_SPEECH_COMMAND_ID193
#define MN_SPEECH_COMMAND_ID194 CONFIG_CN_SPEECH_COMMAND_ID194
#define MN_SPEECH_COMMAND_ID195 CONFIG_CN_SPEECH_COMMAND_ID195
#define MN_SPEECH_COMMAND_ID196 CONFIG_CN_SPEECH_COMMAND_ID196
#define MN_SPEECH_COMMAND_ID197 CONFIG_CN_SPEECH_COMMAND_ID197
#define MN_SPEECH_COMMAND_ID198 CONFIG_CN_SPEECH_COMMAND_ID198
#define MN_SPEECH_COMMAND_ID199 CONFIG_CN_SPEECH_COMMAND_ID199
#elif CONFIG_SR_MN_ENGLISH
#define MN_SPEECH_COMMAND_ID0 CONFIG_EN_SPEECH_COMMAND_ID0
#define MN_SPEECH_COMMAND_ID1 CONFIG_EN_SPEECH_COMMAND_ID1
#define MN_SPEECH_COMMAND_ID2 CONFIG_EN_SPEECH_COMMAND_ID2
#define MN_SPEECH_COMMAND_ID3 CONFIG_EN_SPEECH_COMMAND_ID3
#define MN_SPEECH_COMMAND_ID4 CONFIG_EN_SPEECH_COMMAND_ID4
#define MN_SPEECH_COMMAND_ID5 CONFIG_EN_SPEECH_COMMAND_ID5
#define MN_SPEECH_COMMAND_ID6 CONFIG_EN_SPEECH_COMMAND_ID6
#define MN_SPEECH_COMMAND_ID7 CONFIG_EN_SPEECH_COMMAND_ID7
#define MN_SPEECH_COMMAND_ID8 CONFIG_EN_SPEECH_COMMAND_ID8
#define MN_SPEECH_COMMAND_ID9 CONFIG_EN_SPEECH_COMMAND_ID9
#define MN_SPEECH_COMMAND_ID10 CONFIG_EN_SPEECH_COMMAND_ID10
#define MN_SPEECH_COMMAND_ID11 CONFIG_EN_SPEECH_COMMAND_ID11
#define MN_SPEECH_COMMAND_ID12 CONFIG_EN_SPEECH_COMMAND_ID12
#define MN_SPEECH_COMMAND_ID13 CONFIG_EN_SPEECH_COMMAND_ID13
#define MN_SPEECH_COMMAND_ID14 CONFIG_EN_SPEECH_COMMAND_ID14
#define MN_SPEECH_COMMAND_ID15 CONFIG_EN_SPEECH_COMMAND_ID15
#define MN_SPEECH_COMMAND_ID16 CONFIG_EN_SPEECH_COMMAND_ID16
#define MN_SPEECH_COMMAND_ID17 CONFIG_EN_SPEECH_COMMAND_ID17
#define MN_SPEECH_COMMAND_ID18 CONFIG_EN_SPEECH_COMMAND_ID18
#define MN_SPEECH_COMMAND_ID19 CONFIG_EN_SPEECH_COMMAND_ID19
#define MN_SPEECH_COMMAND_ID20 CONFIG_EN_SPEECH_COMMAND_ID20
#define MN_SPEECH_COMMAND_ID21 CONFIG_EN_SPEECH_COMMAND_ID21
#define MN_SPEECH_COMMAND_ID22 CONFIG_EN_SPEECH_COMMAND_ID22
#define MN_SPEECH_COMMAND_ID23 CONFIG_EN_SPEECH_COMMAND_ID23
#define MN_SPEECH_COMMAND_ID24 CONFIG_EN_SPEECH_COMMAND_ID24
#define MN_SPEECH_COMMAND_ID25 CONFIG_EN_SPEECH_COMMAND_ID25
#define MN_SPEECH_COMMAND_ID26 CONFIG_EN_SPEECH_COMMAND_ID26
#define MN_SPEECH_COMMAND_ID27 CONFIG_EN_SPEECH_COMMAND_ID27
#define MN_SPEECH_COMMAND_ID28 CONFIG_EN_SPEECH_COMMAND_ID28
#define MN_SPEECH_COMMAND_ID29 CONFIG_EN_SPEECH_COMMAND_ID29
#define MN_SPEECH_COMMAND_ID30 CONFIG_EN_SPEECH_COMMAND_ID30
#define MN_SPEECH_COMMAND_ID31 CONFIG_EN_SPEECH_COMMAND_ID31
#define MN_SPEECH_COMMAND_ID32 CONFIG_EN_SPEECH_COMMAND_ID32
#define MN_SPEECH_COMMAND_ID33 CONFIG_EN_SPEECH_COMMAND_ID33
#define MN_SPEECH_COMMAND_ID34 CONFIG_EN_SPEECH_COMMAND_ID34
#define MN_SPEECH_COMMAND_ID35 CONFIG_EN_SPEECH_COMMAND_ID35
#define MN_SPEECH_COMMAND_ID36 CONFIG_EN_SPEECH_COMMAND_ID36
#define MN_SPEECH_COMMAND_ID37 CONFIG_EN_SPEECH_COMMAND_ID37
#define MN_SPEECH_COMMAND_ID38 CONFIG_EN_SPEECH_COMMAND_ID38
#define MN_SPEECH_COMMAND_ID39 CONFIG_EN_SPEECH_COMMAND_ID39
#define MN_SPEECH_COMMAND_ID40 CONFIG_EN_SPEECH_COMMAND_ID40
#define MN_SPEECH_COMMAND_ID41 CONFIG_EN_SPEECH_COMMAND_ID41
#define MN_SPEECH_COMMAND_ID42 CONFIG_EN_SPEECH_COMMAND_ID42
#define MN_SPEECH_COMMAND_ID43 CONFIG_EN_SPEECH_COMMAND_ID43
#define MN_SPEECH_COMMAND_ID44 CONFIG_EN_SPEECH_COMMAND_ID44
#define MN_SPEECH_COMMAND_ID45 CONFIG_EN_SPEECH_COMMAND_ID45
#define MN_SPEECH_COMMAND_ID46 CONFIG_EN_SPEECH_COMMAND_ID46
#define MN_SPEECH_COMMAND_ID47 CONFIG_EN_SPEECH_COMMAND_ID47
#define MN_SPEECH_COMMAND_ID48 CONFIG_EN_SPEECH_COMMAND_ID48
#define MN_SPEECH_COMMAND_ID49 CONFIG_EN_SPEECH_COMMAND_ID49
#define MN_SPEECH_COMMAND_ID50 CONFIG_EN_SPEECH_COMMAND_ID50
#define MN_SPEECH_COMMAND_ID51 CONFIG_EN_SPEECH_COMMAND_ID51
#define MN_SPEECH_COMMAND_ID52 CONFIG_EN_SPEECH_COMMAND_ID52
#define MN_SPEECH_COMMAND_ID53 CONFIG_EN_SPEECH_COMMAND_ID53
#define MN_SPEECH_COMMAND_ID54 CONFIG_EN_SPEECH_COMMAND_ID54
#define MN_SPEECH_COMMAND_ID55 CONFIG_EN_SPEECH_COMMAND_ID55
#define MN_SPEECH_COMMAND_ID56 CONFIG_EN_SPEECH_COMMAND_ID56
#define MN_SPEECH_COMMAND_ID57 CONFIG_EN_SPEECH_COMMAND_ID57
#define MN_SPEECH_COMMAND_ID58 CONFIG_EN_SPEECH_COMMAND_ID58
#define MN_SPEECH_COMMAND_ID59 CONFIG_EN_SPEECH_COMMAND_ID59
#define MN_SPEECH_COMMAND_ID60 CONFIG_EN_SPEECH_COMMAND_ID60
#define MN_SPEECH_COMMAND_ID61 CONFIG_EN_SPEECH_COMMAND_ID61
#define MN_SPEECH_COMMAND_ID62 CONFIG_EN_SPEECH_COMMAND_ID62
#define MN_SPEECH_COMMAND_ID63 CONFIG_EN_SPEECH_COMMAND_ID63
#define MN_SPEECH_COMMAND_ID64 CONFIG_EN_SPEECH_COMMAND_ID64
#define MN_SPEECH_COMMAND_ID65 CONFIG_EN_SPEECH_COMMAND_ID65
#define MN_SPEECH_COMMAND_ID66 CONFIG_EN_SPEECH_COMMAND_ID66
#define MN_SPEECH_COMMAND_ID67 CONFIG_EN_SPEECH_COMMAND_ID67
#define MN_SPEECH_COMMAND_ID68 CONFIG_EN_SPEECH_COMMAND_ID68
#define MN_SPEECH_COMMAND_ID69 CONFIG_EN_SPEECH_COMMAND_ID69
#define MN_SPEECH_COMMAND_ID70 CONFIG_EN_SPEECH_COMMAND_ID70
#define MN_SPEECH_COMMAND_ID71 CONFIG_EN_SPEECH_COMMAND_ID71
#define MN_SPEECH_COMMAND_ID72 CONFIG_EN_SPEECH_COMMAND_ID72
#define MN_SPEECH_COMMAND_ID73 CONFIG_EN_SPEECH_COMMAND_ID73
#define MN_SPEECH_COMMAND_ID74 CONFIG_EN_SPEECH_COMMAND_ID74
#define MN_SPEECH_COMMAND_ID75 CONFIG_EN_SPEECH_COMMAND_ID75
#define MN_SPEECH_COMMAND_ID76 CONFIG_EN_SPEECH_COMMAND_ID76
#define MN_SPEECH_COMMAND_ID77 CONFIG_EN_SPEECH_COMMAND_ID77
#define MN_SPEECH_COMMAND_ID78 CONFIG_EN_SPEECH_COMMAND_ID78
#define MN_SPEECH_COMMAND_ID79 CONFIG_EN_SPEECH_COMMAND_ID79
#define MN_SPEECH_COMMAND_ID80 CONFIG_EN_SPEECH_COMMAND_ID80
#define MN_SPEECH_COMMAND_ID81 CONFIG_EN_SPEECH_COMMAND_ID81
#define MN_SPEECH_COMMAND_ID82 CONFIG_EN_SPEECH_COMMAND_ID82
#define MN_SPEECH_COMMAND_ID83 CONFIG_EN_SPEECH_COMMAND_ID83
#define MN_SPEECH_COMMAND_ID84 CONFIG_EN_SPEECH_COMMAND_ID84
#define MN_SPEECH_COMMAND_ID85 CONFIG_EN_SPEECH_COMMAND_ID85
#define MN_SPEECH_COMMAND_ID86 CONFIG_EN_SPEECH_COMMAND_ID86
#define MN_SPEECH_COMMAND_ID87 CONFIG_EN_SPEECH_COMMAND_ID87
#define MN_SPEECH_COMMAND_ID88 CONFIG_EN_SPEECH_COMMAND_ID88
#define MN_SPEECH_COMMAND_ID89 CONFIG_EN_SPEECH_COMMAND_ID89
#define MN_SPEECH_COMMAND_ID90 CONFIG_EN_SPEECH_COMMAND_ID90
#define MN_SPEECH_COMMAND_ID91 CONFIG_EN_SPEECH_COMMAND_ID91
#define MN_SPEECH_COMMAND_ID92 CONFIG_EN_SPEECH_COMMAND_ID92
#define MN_SPEECH_COMMAND_ID93 CONFIG_EN_SPEECH_COMMAND_ID93
#define MN_SPEECH_COMMAND_ID94 CONFIG_EN_SPEECH_COMMAND_ID94
#define MN_SPEECH_COMMAND_ID95 CONFIG_EN_SPEECH_COMMAND_ID95
#define MN_SPEECH_COMMAND_ID96 CONFIG_EN_SPEECH_COMMAND_ID96
#define MN_SPEECH_COMMAND_ID97 CONFIG_EN_SPEECH_COMMAND_ID97
#define MN_SPEECH_COMMAND_ID98 CONFIG_EN_SPEECH_COMMAND_ID98
#define MN_SPEECH_COMMAND_ID99 CONFIG_EN_SPEECH_COMMAND_ID99
#define MN_SPEECH_COMMAND_ID100 CONFIG_EN_SPEECH_COMMAND_ID100
#define MN_SPEECH_COMMAND_ID101 CONFIG_EN_SPEECH_COMMAND_ID101
#define MN_SPEECH_COMMAND_ID102 CONFIG_EN_SPEECH_COMMAND_ID102
#define MN_SPEECH_COMMAND_ID103 CONFIG_EN_SPEECH_COMMAND_ID103
#define MN_SPEECH_COMMAND_ID104 CONFIG_EN_SPEECH_COMMAND_ID104
#define MN_SPEECH_COMMAND_ID105 CONFIG_EN_SPEECH_COMMAND_ID105
#define MN_SPEECH_COMMAND_ID106 CONFIG_EN_SPEECH_COMMAND_ID106
#define MN_SPEECH_COMMAND_ID107 CONFIG_EN_SPEECH_COMMAND_ID107
#define MN_SPEECH_COMMAND_ID108 CONFIG_EN_SPEECH_COMMAND_ID108
#define MN_SPEECH_COMMAND_ID109 CONFIG_EN_SPEECH_COMMAND_ID109
#define MN_SPEECH_COMMAND_ID110 CONFIG_EN_SPEECH_COMMAND_ID110
#define MN_SPEECH_COMMAND_ID111 CONFIG_EN_SPEECH_COMMAND_ID111
#define MN_SPEECH_COMMAND_ID112 CONFIG_EN_SPEECH_COMMAND_ID112
#define MN_SPEECH_COMMAND_ID113 CONFIG_EN_SPEECH_COMMAND_ID113
#define MN_SPEECH_COMMAND_ID114 CONFIG_EN_SPEECH_COMMAND_ID114
#define MN_SPEECH_COMMAND_ID115 CONFIG_EN_SPEECH_COMMAND_ID115
#define MN_SPEECH_COMMAND_ID116 CONFIG_EN_SPEECH_COMMAND_ID116
#define MN_SPEECH_COMMAND_ID117 CONFIG_EN_SPEECH_COMMAND_ID117
#define MN_SPEECH_COMMAND_ID118 CONFIG_EN_SPEECH_COMMAND_ID118
#define MN_SPEECH_COMMAND_ID119 CONFIG_EN_SPEECH_COMMAND_ID119
#define MN_SPEECH_COMMAND_ID120 CONFIG_EN_SPEECH_COMMAND_ID120
#define MN_SPEECH_COMMAND_ID121 CONFIG_EN_SPEECH_COMMAND_ID121
#define MN_SPEECH_COMMAND_ID122 CONFIG_EN_SPEECH_COMMAND_ID122
#define MN_SPEECH_COMMAND_ID123 CONFIG_EN_SPEECH_COMMAND_ID123
#define MN_SPEECH_COMMAND_ID124 CONFIG_EN_SPEECH_COMMAND_ID124
#define MN_SPEECH_COMMAND_ID125 CONFIG_EN_SPEECH_COMMAND_ID125
#define MN_SPEECH_COMMAND_ID126 CONFIG_EN_SPEECH_COMMAND_ID126
#define MN_SPEECH_COMMAND_ID127 CONFIG_EN_SPEECH_COMMAND_ID127
#define MN_SPEECH_COMMAND_ID128 CONFIG_EN_SPEECH_COMMAND_ID128
#define MN_SPEECH_COMMAND_ID129 CONFIG_EN_SPEECH_COMMAND_ID129
#define MN_SPEECH_COMMAND_ID130 CONFIG_EN_SPEECH_COMMAND_ID130
#define MN_SPEECH_COMMAND_ID131 CONFIG_EN_SPEECH_COMMAND_ID131
#define MN_SPEECH_COMMAND_ID132 CONFIG_EN_SPEECH_COMMAND_ID132
#define MN_SPEECH_COMMAND_ID133 CONFIG_EN_SPEECH_COMMAND_ID133
#define MN_SPEECH_COMMAND_ID134 CONFIG_EN_SPEECH_COMMAND_ID134
#define MN_SPEECH_COMMAND_ID135 CONFIG_EN_SPEECH_COMMAND_ID135
#define MN_SPEECH_COMMAND_ID136 CONFIG_EN_SPEECH_COMMAND_ID136
#define MN_SPEECH_COMMAND_ID137 CONFIG_EN_SPEECH_COMMAND_ID137
#define MN_SPEECH_COMMAND_ID138 CONFIG_EN_SPEECH_COMMAND_ID138
#define MN_SPEECH_COMMAND_ID139 CONFIG_EN_SPEECH_COMMAND_ID139
#define MN_SPEECH_COMMAND_ID140 CONFIG_EN_SPEECH_COMMAND_ID140
#define MN_SPEECH_COMMAND_ID141 CONFIG_EN_SPEECH_COMMAND_ID141
#define MN_SPEECH_COMMAND_ID142 CONFIG_EN_SPEECH_COMMAND_ID142
#define MN_SPEECH_COMMAND_ID143 CONFIG_EN_SPEECH_COMMAND_ID143
#define MN_SPEECH_COMMAND_ID144 CONFIG_EN_SPEECH_COMMAND_ID144
#define MN_SPEECH_COMMAND_ID145 CONFIG_EN_SPEECH_COMMAND_ID145
#define MN_SPEECH_COMMAND_ID146 CONFIG_EN_SPEECH_COMMAND_ID146
#define MN_SPEECH_COMMAND_ID147 CONFIG_EN_SPEECH_COMMAND_ID147
#define MN_SPEECH_COMMAND_ID148 CONFIG_EN_SPEECH_COMMAND_ID148
#define MN_SPEECH_COMMAND_ID149 CONFIG_EN_SPEECH_COMMAND_ID149
#define MN_SPEECH_COMMAND_ID150 CONFIG_EN_SPEECH_COMMAND_ID150
#define MN_SPEECH_COMMAND_ID151 CONFIG_EN_SPEECH_COMMAND_ID151
#define MN_SPEECH_COMMAND_ID152 CONFIG_EN_SPEECH_COMMAND_ID152
#define MN_SPEECH_COMMAND_ID153 CONFIG_EN_SPEECH_COMMAND_ID153
#define MN_SPEECH_COMMAND_ID154 CONFIG_EN_SPEECH_COMMAND_ID154
#define MN_SPEECH_COMMAND_ID155 CONFIG_EN_SPEECH_COMMAND_ID155
#define MN_SPEECH_COMMAND_ID156 CONFIG_EN_SPEECH_COMMAND_ID156
#define MN_SPEECH_COMMAND_ID157 CONFIG_EN_SPEECH_COMMAND_ID157
#define MN_SPEECH_COMMAND_ID158 CONFIG_EN_SPEECH_COMMAND_ID158
#define MN_SPEECH_COMMAND_ID159 CONFIG_EN_SPEECH_COMMAND_ID159
#define MN_SPEECH_COMMAND_ID160 CONFIG_EN_SPEECH_COMMAND_ID160
#define MN_SPEECH_COMMAND_ID161 CONFIG_EN_SPEECH_COMMAND_ID161
#define MN_SPEECH_COMMAND_ID162 CONFIG_EN_SPEECH_COMMAND_ID162
#define MN_SPEECH_COMMAND_ID163 CONFIG_EN_SPEECH_COMMAND_ID163
#define MN_SPEECH_COMMAND_ID164 CONFIG_EN_SPEECH_COMMAND_ID164
#define MN_SPEECH_COMMAND_ID165 CONFIG_EN_SPEECH_COMMAND_ID165
#define MN_SPEECH_COMMAND_ID166 CONFIG_EN_SPEECH_COMMAND_ID166
#define MN_SPEECH_COMMAND_ID167 CONFIG_EN_SPEECH_COMMAND_ID167
#define MN_SPEECH_COMMAND_ID168 CONFIG_EN_SPEECH_COMMAND_ID168
#define MN_SPEECH_COMMAND_ID169 CONFIG_EN_SPEECH_COMMAND_ID169
#define MN_SPEECH_COMMAND_ID170 CONFIG_EN_SPEECH_COMMAND_ID170
#define MN_SPEECH_COMMAND_ID171 CONFIG_EN_SPEECH_COMMAND_ID171
#define MN_SPEECH_COMMAND_ID172 CONFIG_EN_SPEECH_COMMAND_ID172
#define MN_SPEECH_COMMAND_ID173 CONFIG_EN_SPEECH_COMMAND_ID173
#define MN_SPEECH_COMMAND_ID174 CONFIG_EN_SPEECH_COMMAND_ID174
#define MN_SPEECH_COMMAND_ID175 CONFIG_EN_SPEECH_COMMAND_ID175
#define MN_SPEECH_COMMAND_ID176 CONFIG_EN_SPEECH_COMMAND_ID176
#define MN_SPEECH_COMMAND_ID177 CONFIG_EN_SPEECH_COMMAND_ID177
#define MN_SPEECH_COMMAND_ID178 CONFIG_EN_SPEECH_COMMAND_ID178
#define MN_SPEECH_COMMAND_ID179 CONFIG_EN_SPEECH_COMMAND_ID179
#define MN_SPEECH_COMMAND_ID180 CONFIG_EN_SPEECH_COMMAND_ID180
#define MN_SPEECH_COMMAND_ID181 CONFIG_EN_SPEECH_COMMAND_ID181
#define MN_SPEECH_COMMAND_ID182 CONFIG_EN_SPEECH_COMMAND_ID182
#define MN_SPEECH_COMMAND_ID183 CONFIG_EN_SPEECH_COMMAND_ID183
#define MN_SPEECH_COMMAND_ID184 CONFIG_EN_SPEECH_COMMAND_ID184
#define MN_SPEECH_COMMAND_ID185 CONFIG_EN_SPEECH_COMMAND_ID185
#define MN_SPEECH_COMMAND_ID186 CONFIG_EN_SPEECH_COMMAND_ID186
#define MN_SPEECH_COMMAND_ID187 CONFIG_EN_SPEECH_COMMAND_ID187
#define MN_SPEECH_COMMAND_ID188 CONFIG_EN_SPEECH_COMMAND_ID188
#define MN_SPEECH_COMMAND_ID189 CONFIG_EN_SPEECH_COMMAND_ID189
#define MN_SPEECH_COMMAND_ID190 CONFIG_EN_SPEECH_COMMAND_ID190
#define MN_SPEECH_COMMAND_ID191 CONFIG_EN_SPEECH_COMMAND_ID191
#define MN_SPEECH_COMMAND_ID192 CONFIG_EN_SPEECH_COMMAND_ID192
#define MN_SPEECH_COMMAND_ID193 CONFIG_EN_SPEECH_COMMAND_ID193
#define MN_SPEECH_COMMAND_ID194 CONFIG_EN_SPEECH_COMMAND_ID194
#define MN_SPEECH_COMMAND_ID195 CONFIG_EN_SPEECH_COMMAND_ID195
#define MN_SPEECH_COMMAND_ID196 CONFIG_EN_SPEECH_COMMAND_ID196
#define MN_SPEECH_COMMAND_ID197 CONFIG_EN_SPEECH_COMMAND_ID197
#define MN_SPEECH_COMMAND_ID198 CONFIG_EN_SPEECH_COMMAND_ID198
#define MN_SPEECH_COMMAND_ID199 CONFIG_EN_SPEECH_COMMAND_ID199
#endif
char *get_id_name(int i);
void reset_speech_commands(model_iface_data_t *model_data, char* command_str, char *err_phrase_id);

View File

@ -1,3 +1,79 @@
#pragma once
char *get_model_base_path(void);
void srmodel_spiffs_init(void);
typedef struct
{
char **model_name; // the name of models, like "wn9_hilexin"(wakenet9, hilexin), "mn5_en"(multinet5, english)
char *partition_label; // partition label used to save the files of model
int num; // the number of models
} srmodel_list_t;
#define MODEL_NAME_MAX_LENGTH 64
/**
* @brief Return all avaliable models in spiffs or selected in Kconfig.
*
* @param partition_label The spiffs label defined in your partition file used to save models.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
srmodel_list_t* esp_srmodel_init(const char* partition_label);
/**
* @brief Free srmodel_list_t and unregister SPIFFS filesystem if open SPIFFS filesystem.
*
* @param models The srmodel_list_t point allocated by esp_srmodel_init function.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
void esp_srmodel_deinit(srmodel_list_t *models);
/**
* @brief Return the first model name containing the specified keywords
* If keyword is NULL, we will ignore the keyword.
*
* @param models The srmodel_list_t point allocated by esp_srmodel_init function.
* @param keyword1 The specified keyword1 , like ESP_WN_PREDIX(the prefix of wakenet),
* ESP_MN_PREFIX(the prefix of multinet),
*
* @param keyword2 The specified keyword2, like ESP_MN_ENGLISH(the english multinet)
* ESP_MN_CHINESE(the chinese multinet)
* "alexa" (the "alexa" wakenet)
* @return return model name if can find one model name containing the keywords otherwise return NULL.
*/
char *esp_srmodel_filter(srmodel_list_t *models, const char *keyword1, const char *keyword2);
/**
* @brief Check whether the specified model name exists or not.
*
* @param models The srmodel_list_t point allocated by esp_srmodel_init function.
* @param model_name The specified model name
* @return return index in models if model name exists otherwise return -1
*/
int esp_srmodel_exists(srmodel_list_t *models, char *model_name);
/**
* @brief Initialize and mount SPIFFS filesystem, return all avaliable models in spiffs.
*
* @param partition_label The spiffs label defined in your partition file used to save models.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
srmodel_list_t *srmodel_spiffs_init(const char* partition_label);
/**
* @brief unregister SPIFFS filesystem and free srmodel_list_t.
*
* @param models The srmodel_list_t point allocated by srmodel_spiffs_init function.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
void srmodel_spiffs_deinit(srmodel_list_t *models);
/**
* @brief Return base path of srmodel spiffs
*
* @return the base path od srmodel spiffs
*/
char *get_model_base_path(void);

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_nihaoxiaoxin_wn5X3;
extern const model_coeff_getter_t get_coeff_nihaoxiaoxin_wn5X3;

View File

@ -1,8 +0,0 @@
//Generated by mkmodel
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
extern const model_coeff_getter_t get_coeff_nihaoxiaoxin_wn6;

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_nihaoxiaozhi_wn5;
extern const model_coeff_getter_t get_coeff_nihaoxiaozhi_wn5;

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_nihaoxiaozhi_wn5X2;
extern const model_coeff_getter_t get_coeff_nihaoxiaozhi_wn5X2;

View File

@ -1,8 +1,9 @@
//Generated by mkmodel
//Generated by mkmodel_py
#pragma once
#include <string.h>
#include "dl_lib_coefgetter_if.h"
#include "dl_lib_matrix.h"
#include "dl_lib_matrixq.h"
#include "dl_lib_matrixq8.h"
extern const model_coeff_getter_t get_coeff_nihaoxiaozhi_wn5X3;
extern const model_coeff_getter_t get_coeff_nihaoxiaozhi_wn5X3;

View File

@ -1,12 +0,0 @@
#pragma once
#define SR_FLASH_TYPE 32
#define SR_FLASH_SUBTYPE 32
#define SR_FLASH_PARTITION_NAME "fr"
#define SR_FLASH_INFO_FLAG 12138
int8_t speech_command_flash_init(void);
int8_t enroll_speech_command_to_flash_with_id(char *phrase, int mn_command_id);
int get_use_flag_from_flash();
int get_enroll_num_from_flash();
char *read_speech_command_from_flash(int i);

View File

@ -70,6 +70,7 @@
#include "driver/ledc.h"
#include "sensor.h"
#include "sys/time.h"
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
@ -91,6 +92,19 @@ typedef enum {
CAMERA_FB_IN_DRAM /*!< Frame buffer is placed in internal DRAM */
} camera_fb_location_t;
#if CONFIG_CAMERA_CONVERTER_ENABLED
/**
* @brief Camera RGB\YUV conversion mode
*/
typedef enum {
CONV_DISABLE,
RGB565_TO_YUV422,
YUV422_TO_RGB565,
YUV422_TO_YUV420
} camera_conv_mode_t;
#endif
/**
* @brief Configuration structure for camera initialization
*/
@ -124,6 +138,9 @@ typedef struct {
size_t fb_count; /*!< Number of frame buffers to be allocated. If more than one, then each frame will be acquired (double speed) */
camera_fb_location_t fb_location; /*!< The location where the frame buffer will be allocated */
camera_grab_mode_t grab_mode; /*!< When buffers should be filled */
#if CONFIG_CAMERA_CONVERTER_ENABLED
camera_conv_mode_t conv_mode; /*!< RGB<->YUV Conversion mode */
#endif
} camera_config_t;
/**

View File

@ -69,6 +69,7 @@ typedef enum {
typedef enum {
PIXFORMAT_RGB565, // 2BPP/RGB565
PIXFORMAT_YUV422, // 2BPP/YUV422
PIXFORMAT_YUV420, // 1.5BPP/YUV420
PIXFORMAT_GRAYSCALE, // 1BPP/GRAYSCALE
PIXFORMAT_JPEG, // JPEG/COMPRESSED
PIXFORMAT_RGB888, // 3BPP/RGB888

View File

@ -23,7 +23,7 @@ extern "C" {
/** Minor version number (x.X.x) */
#define ESP_IDF_VERSION_MINOR 4
/** Patch version number (x.x.X) */
#define ESP_IDF_VERSION_PATCH 1
#define ESP_IDF_VERSION_PATCH 2
/**
* Macro to convert IDF version number into an integer

View File

@ -411,7 +411,7 @@ typedef struct {
/**
* @brief Create ESP32 Ethernet MAC instance
*
* @param config: Ethernet MAC configuration
* @param config: Ethernet MAC configuration
*
* @return
* - instance: create MAC instance successfully

View File

@ -25,7 +25,7 @@ typedef enum {
* @brief Callback data struct, contains the ESP-TLS connection handle
*/
typedef struct esp_https_server_user_cb_arg {
const esp_tls_t *tls;
const esp_tls_t *tls; /*!< ESP-TLS connection handle */
} esp_https_server_user_cb_arg_t;
/**

View File

@ -139,7 +139,7 @@ esp_err_t esp_read_mac(uint8_t *mac, esp_mac_type_t type);
* address, then the first octet is XORed with 0x4 in order to create a different
* locally administered MAC address.
*
* @param mac base MAC address, length: 6 bytes/8 bytes.
* @param local_mac base MAC address, length: 6 bytes/8 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for IEEE 802.15.4)
* @param universal_mac Source universal MAC address, length: 6 bytes.

View File

@ -134,6 +134,10 @@ typedef struct {
*/
esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_panel_io_spi_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io);
/**
* @brief Panel IO configuration structure, for I2C interface
*
*/
typedef struct {
uint32_t dev_addr; /*!< I2C device address */
esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */
@ -145,7 +149,7 @@ typedef struct {
struct {
unsigned int dc_low_on_data: 1; /*!< If this flag is enabled, DC line = 0 means transfer data, DC line = 1 means transfer command; vice versa */
unsigned int disable_control_phase: 1; /*!< If this flag is enabled, the control phase isn't used */
} flags;
} flags; /*!< Extra flags to fine-tune the I2C device */
} esp_lcd_panel_io_i2c_config_t;
/**
@ -223,7 +227,7 @@ typedef struct {
unsigned int swap_color_bytes: 1; /*!< Swap adjacent two color bytes */
unsigned int pclk_active_neg: 1; /*!< The display will write data lines when there's a falling edge on WR signal (a.k.a the PCLK) */
unsigned int pclk_idle_low: 1; /*!< The WR signal (a.k.a the PCLK) stays at low level in IDLE phase */
} flags;
} flags; /*!< Panel IO config flags */
} esp_lcd_panel_io_i80_config_t;
/**

View File

@ -66,7 +66,7 @@ typedef struct {
unsigned int de_idle_high: 1; /*!< The de signal is high in IDLE state */
unsigned int pclk_active_neg: 1; /*!< Whether the display data is clocked out at the falling edge of PCLK */
unsigned int pclk_idle_high: 1; /*!< The PCLK stays at high level in IDLE phase */
} flags;
} flags; /*!< LCD RGB timing flags */
} esp_lcd_rgb_timing_t;
/**
@ -106,7 +106,7 @@ typedef struct {
unsigned int disp_active_low: 1; /*!< If this flag is enabled, a low level of display control signal can turn the screen on; vice versa */
unsigned int relax_on_idle: 1; /*!< If this flag is enabled, the host won't refresh the LCD if nothing changed in host's frame buffer (this is usefull for LCD with built-in GRAM) */
unsigned int fb_in_psram: 1; /*!< If this flag is enabled, the frame buffer will be allocated from PSRAM preferentially */
} flags;
} flags; /*!< LCD RGB panel configuration flags */
} esp_lcd_rgb_panel_config_t;
/**

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -22,8 +22,8 @@ typedef struct {
unsigned int bits_per_pixel; /*!< Color depth, in bpp */
struct {
unsigned int reset_active_high: 1; /*!< Setting this if the panel reset is high level active */
} flags;
void *vendor_config; /* vendor specific configuration, optional, left as NULL if not used */
} flags; /*!< LCD panel config flags */
void *vendor_config; /*!< vendor specific configuration, optional, left as NULL if not used */
} esp_lcd_panel_dev_config_t;
/**

View File

@ -1,6 +1,7 @@
/*
* Block device emulated in a file
*
* Copyright (c) 2022, The littlefs authors.
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/

View File

@ -1,6 +1,7 @@
/*
* Block device emulated in RAM
*
* Copyright (c) 2022, The littlefs authors.
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/

View File

@ -2,6 +2,7 @@
* Testing block device, wraps filebd and rambd while providing a bunch
* of hooks for testing littlefs in various conditions.
*
* Copyright (c) 2022, The littlefs authors.
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/

View File

@ -1,6 +1,7 @@
/*
* The little filesystem
*
* Copyright (c) 2022, The littlefs authors.
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -22,7 +23,7 @@ extern "C"
// Software library version
// Major (top-nibble), incremented on backwards incompatible changes
// Minor (bottom-nibble), incremented on feature additions
#define LFS_VERSION 0x00020004
#define LFS_VERSION 0x00020005
#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
@ -159,49 +160,49 @@ struct lfs_config {
// information to the block device operations
void *context;
// Read a region in a block. Negative error codes are propogated
// Read a region in a block. Negative error codes are propagated
// to the user.
int (*read)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size);
// Program a region in a block. The block must have previously
// been erased. Negative error codes are propogated to the user.
// been erased. Negative error codes are propagated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*prog)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block. A block must be erased before being programmed.
// The state of an erased block is undefined. Negative error codes
// are propogated to the user.
// are propagated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*erase)(const struct lfs_config *c, lfs_block_t block);
// Sync the state of the underlying block device. Negative error codes
// are propogated to the user.
// are propagated to the user.
int (*sync)(const struct lfs_config *c);
#ifdef LFS_THREADSAFE
// Lock the underlying block device. Negative error codes
// are propogated to the user.
// are propagated to the user.
int (*lock)(const struct lfs_config *c);
// Unlock the underlying block device. Negative error codes
// are propogated to the user.
// are propagated to the user.
int (*unlock)(const struct lfs_config *c);
#endif
// Minimum size of a block read. All read operations will be a
// Minimum size of a block read in bytes. All read operations will be a
// multiple of this value.
lfs_size_t read_size;
// Minimum size of a block program. All program operations will be a
// multiple of this value.
// Minimum size of a block program in bytes. All program operations will be
// a multiple of this value.
lfs_size_t prog_size;
// Size of an erasable block. This does not impact ram consumption and
// may be larger than the physical erase size. However, non-inlined files
// take up at minimum one block. Must be a multiple of the read
// and program sizes.
// Size of an erasable block in bytes. This does not impact ram consumption
// and may be larger than the physical erase size. However, non-inlined
// files take up at minimum one block. Must be a multiple of the read and
// program sizes.
lfs_size_t block_size;
// Number of erasable blocks on the device.
@ -215,11 +216,11 @@ struct lfs_config {
// Set to -1 to disable block-level wear-leveling.
int32_t block_cycles;
// Size of block caches. Each cache buffers a portion of a block in RAM.
// The littlefs needs a read cache, a program cache, and one additional
// Size of block caches in bytes. Each cache buffers a portion of a block in
// RAM. The littlefs needs a read cache, a program cache, and one additional
// cache per file. Larger caches can improve performance by storing more
// data and reducing the number of disk accesses. Must be a multiple of
// the read and program sizes, and a factor of the block size.
// data and reducing the number of disk accesses. Must be a multiple of the
// read and program sizes, and a factor of the block size.
lfs_size_t cache_size;
// Size of the lookahead buffer in bytes. A larger lookahead buffer
@ -485,7 +486,7 @@ int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info);
// Returns the size of the attribute, or a negative error code on failure.
// Note, the returned size is the size of the attribute on disk, irrespective
// of the size of the buffer. This can be used to dynamically allocate a buffer
// or check for existance.
// or check for existence.
lfs_ssize_t lfs_getattr(lfs_t *lfs, const char *path,
uint8_t type, void *buffer, lfs_size_t size);
@ -513,6 +514,7 @@ int lfs_removeattr(lfs_t *lfs, const char *path, uint8_t type);
/// File operations ///
#ifndef LFS_NO_MALLOC
// Open a file
//
// The mode that the file is opened in is determined by the flags, which
@ -522,6 +524,10 @@ int lfs_removeattr(lfs_t *lfs, const char *path, uint8_t type);
int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags);
// if LFS_NO_MALLOC is defined, lfs_file_open() will fail with LFS_ERR_NOMEM
// thus use lfs_file_opencfg() with config.buffer set.
#endif
// Open a file with extra configuration
//
// The mode that the file is opened in is determined by the flags, which

View File

@ -1,6 +1,7 @@
/*
* lfs utility functions
*
* Copyright (c) 2022, The littlefs authors.
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/

View File

@ -619,9 +619,10 @@ esp_err_t esp_netif_dhcps_stop(esp_netif_t *esp_netif);
*
* If DHCP server is enabled, the Main DNS Server setting is used by the DHCP server to provide a DNS Server option
* to DHCP clients (Wi-Fi stations).
* - The default Main DNS server is typically the IP of the Wi-Fi AP interface itself.
* - The default Main DNS server is typically the IP of the DHCP server itself.
* - This function can override it by setting server type ESP_NETIF_DNS_MAIN.
* - Other DNS Server types are not supported for the Wi-Fi AP interface.
* - Other DNS Server types are not supported for the DHCP server.
* - To propagate the DNS info to client, please stop the DHCP server before using this API.
*
* @param[in] esp_netif Handle to esp-netif instance
* @param[in] type Type of DNS Server to set: ESP_NETIF_DNS_MAIN, ESP_NETIF_DNS_BACKUP, ESP_NETIF_DNS_FALLBACK

View File

@ -81,25 +81,37 @@ extern "C" {
#define ESP_IP4ADDR_INIT(a, b, c, d) { .type = ESP_IPADDR_TYPE_V4, .u_addr = { .ip4 = { .addr = ESP_IP4TOADDR(a, b, c, d) }}};
#define ESP_IP6ADDR_INIT(a, b, c, d) { .type = ESP_IPADDR_TYPE_V6, .u_addr = { .ip6 = { .addr = { a, b, c, d }, .zone = 0 }}};
/**
* @brief IPv6 address
*
*/
struct esp_ip6_addr {
uint32_t addr[4];
uint8_t zone;
uint32_t addr[4]; /*!< IPv6 address */
uint8_t zone; /*!< zone ID */
};
/**
* @brief IPv4 address
*
*/
struct esp_ip4_addr {
uint32_t addr;
uint32_t addr; /*!< IPv4 address */
};
typedef struct esp_ip4_addr esp_ip4_addr_t;
typedef struct esp_ip6_addr esp_ip6_addr_t;
/**
* @brief IP address
*
*/
typedef struct _ip_addr {
union {
esp_ip6_addr_t ip6;
esp_ip4_addr_t ip4;
} u_addr;
uint8_t type;
esp_ip6_addr_t ip6; /*!< IPv6 address type */
esp_ip4_addr_t ip4; /*!< IPv4 address type */
} u_addr; /*!< IP address union */
uint8_t type; /*!< ipaddress type */
} esp_ip_addr_t;
typedef enum {

View File

@ -112,6 +112,11 @@ typedef struct {
esp_ip6_addr_t ip; /**< Interface IPV6 address */
} esp_netif_ip6_info_t;
/**
* @brief Event structure for IP_EVENT_GOT_IP event
*
*/
typedef struct {
int if_index; /*!< Interface index for which the event is received (left for legacy compilation) */
esp_netif_t *esp_netif; /*!< Pointer to corresponding esp-netif object */
@ -164,6 +169,10 @@ typedef enum esp_netif_ip_event_type {
// 3) network stack specific config (esp_netif_net_stack_ifconfig_t) -- no publicly available
//
/**
* @brief ESP-netif inherent config parameters
*
*/
typedef struct esp_netif_inherent_config {
esp_netif_flags_t flags; /*!< flags that define esp-netif behavior */
uint8_t mac[6]; /*!< initial mac address for this interface */
@ -185,19 +194,23 @@ typedef struct esp_netif_config esp_netif_config_t;
*/
typedef void * esp_netif_iodriver_handle;
/**
* @brief ESP-netif driver base handle
*
*/
typedef struct esp_netif_driver_base_s {
esp_err_t (*post_attach)(esp_netif_t *netif, esp_netif_iodriver_handle h);
esp_netif_t *netif;
esp_err_t (*post_attach)(esp_netif_t *netif, esp_netif_iodriver_handle h); /*!< post attach function pointer */
esp_netif_t *netif; /*!< netif handle */
} esp_netif_driver_base_t;
/**
* @brief Specific IO driver configuration
*/
struct esp_netif_driver_ifconfig {
esp_netif_iodriver_handle handle;
esp_err_t (*transmit)(void *h, void *buffer, size_t len);
esp_err_t (*transmit_wrap)(void *h, void *buffer, size_t len, void *netstack_buffer);
void (*driver_free_rx_buffer)(void *h, void* buffer);
esp_netif_iodriver_handle handle; /*!< io-driver handle */
esp_err_t (*transmit)(void *h, void *buffer, size_t len); /*!< transmit function pointer */
esp_err_t (*transmit_wrap)(void *h, void *buffer, size_t len, void *netstack_buffer); /*!< transmit wrap function pointer */
void (*driver_free_rx_buffer)(void *h, void* buffer); /*!< free rx buffer function pointer */
};
typedef struct esp_netif_driver_ifconfig esp_netif_driver_ifconfig_t;
@ -212,9 +225,9 @@ typedef struct esp_netif_netstack_config esp_netif_netstack_config_t;
* @brief Generic esp_netif configuration
*/
struct esp_netif_config {
const esp_netif_inherent_config_t *base;
const esp_netif_driver_ifconfig_t *driver;
const esp_netif_netstack_config_t *stack;
const esp_netif_inherent_config_t *base; /*!< base config */
const esp_netif_driver_ifconfig_t *driver; /*!< driver config */
const esp_netif_netstack_config_t *stack; /*!< stack config */
};
/**

View File

@ -14,7 +14,8 @@ extern "C" {
#endif
/**
* @file PHY init parameters and API
* @file
* init parameters and API
*/
@ -34,6 +35,10 @@ typedef struct {
uint8_t opaque[1894]; /*!< calibration data */
} esp_phy_calibration_data_t;
/**
* @brief PHY calibration mode
*
*/
typedef enum {
PHY_RF_CAL_PARTIAL = 0x00000000, /*!< Do part of RF calibration. This should be used after power-on reset. */
PHY_RF_CAL_NONE = 0x00000001, /*!< Don't do any RF calibration. This mode is only suggested to be used after deep sleep reset. */
@ -223,6 +228,10 @@ int64_t esp_phy_rf_get_on_ts(void);
/**
* @brief Update the corresponding PHY init type according to the country code of Wi-Fi.
*
* @param country country code
* @return ESP_OK on success.
* @return esp_err_t code describing the error on fail
*/
esp_err_t esp_phy_update_country_info(const char *country);

View File

@ -931,6 +931,20 @@ bool esp_rmaker_local_ctrl_service_started(void);
* @return error on failure
*/
esp_err_t esp_rmaker_ota_enable_default(void);
/*
* Send a command to self (TESTING only)
*
* This is to be passed as an argument to esp_rmaker_cmd_resp_test_send().
*
* @param[in] cmd The TLV encoded command data.
* @param[in] cmd_len Length of the command data.
* @param[in] priv_data Private data passed to esp_rmaker_cmd_resp_test_send().
*
* @return ESP_OK on success
* @return error on failure
*/
esp_err_t esp_rmaker_test_cmd_resp(const void *cmd, size_t cmd_len, void *priv_data);
#ifdef __cplusplus
}
#endif

View File

@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// 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.
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_NOW_H__
#define __ESP_NOW_H__
@ -190,7 +182,7 @@ esp_err_t esp_now_unregister_send_cb(void);
* - ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized
* - ESP_ERR_ESPNOW_ARG : invalid argument
* - ESP_ERR_ESPNOW_INTERNAL : internal error
* - ESP_ERR_ESPNOW_NO_MEM : out of memory
* - ESP_ERR_ESPNOW_NO_MEM : out of memory, when this happens, you can delay a while before sending the next data
* - ESP_ERR_ESPNOW_NOT_FOUND : peer is not found
* - ESP_ERR_ESPNOW_IF : current WiFi interface doesn't match that of peer
*/
@ -237,6 +229,20 @@ esp_err_t esp_now_del_peer(const uint8_t *peer_addr);
*/
esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer);
/**
* @brief Config ESPNOW rate of specified interface
*
* @attention 1. This API should be called after esp_wifi_start().
*
* @param ifx Interface to be configured.
* @param rate Phy rate to be configured.
*
* @return
* - ESP_OK: succeed
* - others: failed
*/
esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate);
/**
* @brief Get a peer whose MAC address matches peer_addr from peer list
*

View File

@ -251,6 +251,7 @@ esp_err_t esp_wifi_internal_set_sta_ip(void);
*
* @attention 1. If fixed rate is enabled, both management and data frame are transmitted with fixed rate
* @attention 2. Make sure that the receiver is able to receive the frame with the fixed rate if you want the frame to be received
* @attention 3. Not support to set fix rate for espnow and 80211_tx
*
* @param ifx : wifi interface
* @param en : false - disable, true - enable

View File

@ -498,7 +498,7 @@ esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
* @brief Set protocol type of specified interface
* The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N)
*
* @attention Currently we only support 802.11b or 802.11bg or 802.11bgn mode
* @attention Support 802.11b or 802.11bg or 802.11bgn or LR mode
*
* @param ifx interfaces
* @param protocol_bitmap WiFi protocol bitmap
@ -1210,20 +1210,6 @@ esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm);
*/
esp_err_t esp_wifi_config_11b_rate(wifi_interface_t ifx, bool disable);
/**
* @brief Config ESPNOW rate of specified interface
*
* @attention 1. This API should be called after esp_wifi_init() and before esp_wifi_start().
*
* @param ifx Interface to be configured.
* @param rate Phy rate to be configured.
*
* @return
* - ESP_OK: succeed
* - others: failed
*/
esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate);
/**
* @brief Set interval for station to wake up periodically at disconnected.
*

View File

@ -343,7 +343,7 @@ typedef struct {
unsigned fec_coding:1; /**< Flag is set for 11n packets which are LDPC */
unsigned sgi:1; /**< Short Guide Interval(SGI). 0: Long GI; 1: Short GI */
#if CONFIG_IDF_TARGET_ESP32
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: 0.25dBm*/
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
unsigned :8; /**< reserved */
#endif
@ -356,14 +356,14 @@ typedef struct {
#if CONFIG_IDF_TARGET_ESP32S2
unsigned :32; /**< reserved */
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: 0.25dBm*/
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
unsigned :24; /**< reserved */
unsigned :32; /**< reserved */
#endif
unsigned :31; /**< reserved */
unsigned ant:1; /**< antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1 */
#if CONFIG_IDF_TARGET_ESP32S2
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: 0.25dBm*/
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
unsigned :24; /**< reserved */
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
unsigned :32; /**< reserved */

View File

@ -1398,9 +1398,6 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;
BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
/**@}*/
/** @endcond */
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* queue. h

View File

@ -392,7 +392,7 @@ typedef enum
* example, to create a privileged task at priority 2 the uxPriority parameter
* should be set to ( 2 | portPRIVILEGE_BIT ).
*
* @param pvCreatedTask Used to pass back a handle by which the created task
* @param pxCreatedTask Used to pass back a handle by which the created task
* can be referenced.
*
* @return pdPASS if the task was successfully created and added to a ready
@ -538,7 +538,7 @@ typedef enum
*
* @param uxPriority The priority at which the task will run.
*
* @param pxStackBuffer Must point to a StackType_t array that has at least
* @param puxStackBuffer Must point to a StackType_t array that has at least
* ulStackDepth indexes - the array will then be used as the task's stack,
* removing the need for the stack to be allocated dynamically.
*
@ -2368,7 +2368,7 @@ uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION;
* notification value at that index being updated. ulValue is not used and
* xTaskNotifyIndexed() always returns pdPASS in this case.
*
* pulPreviousNotificationValue -
* @param pulPreviousNotificationValue -
* Can be used to pass out the subject task's notification value before any
* bits are modified by the notify function.
*
@ -2532,6 +2532,10 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify,
* requested from an ISR is dependent on the port - see the documentation page
* for the port in use.
*
* @param pulPreviousNotificationValue -
* Can be used to pass out the subject task's notification value before any
* bits are modified by the notify function.
*
* @return Dependent on the value of eAction. See the description of the
* eAction parameter.
*
@ -2778,11 +2782,10 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn,
* @endcond
* \ingroup TaskNotifications
*/
#define xTaskNotifyGive( xTaskToNotify ) \
xTaskGenericNotify( ( xTaskToNotify ), ( tskDEFAULT_INDEX_TO_NOTIFY ), ( 0 ), eIncrement, NULL )
#define xTaskNotifyGiveIndexed( xTaskToNotify, uxIndexToNotify ) \
xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( 0 ), eIncrement, NULL )
#define xTaskNotifyGive( xTaskToNotify ) \
xTaskGenericNotify( ( xTaskToNotify ), ( tskDEFAULT_INDEX_TO_NOTIFY ), ( 0 ), eIncrement, NULL )
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task. h

View File

@ -121,7 +121,7 @@ typedef struct {
struct {
uint16_t data: 12; /*!<ADC real output data info. Resolution: 12 bit. */
uint16_t channel: 4; /*!<ADC channel index info. */
} type1;
} type1; /*!<ADC type1 */
struct {
uint16_t data: 11; /*!<ADC real output data info. Resolution: 11 bit. */
uint16_t channel: 4; /*!<ADC channel index info. For ESP32-S2:

View File

@ -67,7 +67,8 @@ typedef struct {
uint32_t interval_ms; /*!< Milliseconds between each ping procedure */
uint32_t timeout_ms; /*!< Timeout value (in milliseconds) of each ping procedure */
uint32_t data_size; /*!< Size of the data next to ICMP packet header */
uint8_t tos; /*!< Type of Service, a field specified in the IP header */
int tos; /*!< Type of Service, a field specified in the IP header */
int ttl; /*!< Time to Live,a field specified in the IP header */
ip_addr_t target_addr; /*!< Target IP address, either IPv4 or IPv6 */
uint32_t task_stack_size; /*!< Stack size of internal ping task */
uint32_t task_prio; /*!< Priority of internal ping task */
@ -85,6 +86,7 @@ typedef struct {
.timeout_ms = 1000, \
.data_size = 64, \
.tos = 0, \
.ttl = IP_DEFAULT_TTL, \
.target_addr = *(IP_ANY_TYPE), \
.task_stack_size = 2048, \
.task_prio = 2, \
@ -99,6 +101,7 @@ typedef struct {
*/
typedef enum {
ESP_PING_PROF_SEQNO, /*!< Sequence number of a ping procedure */
ESP_PING_PROF_TOS, /*!< Type of service of a ping procedure */
ESP_PING_PROF_TTL, /*!< Time to live of a ping procedure */
ESP_PING_PROF_REQUEST, /*!< Number of request packets sent out */
ESP_PING_PROF_REPLY, /*!< Number of reply packets received */

View File

@ -79,7 +79,15 @@ typedef int sys_prot_t;
#include <stdio.h>
#ifdef CONFIG_LWIP_DEBUG_ESP_LOG
// lwip debugs routed to ESP_LOGD
#include "esp_log.h"
#define LWIP_ESP_LOG_FUNC(format, ...) ESP_LOG_LEVEL(ESP_LOG_DEBUG, "lwip", format, ##__VA_ARGS__)
#define LWIP_PLATFORM_DIAG(x) LWIP_ESP_LOG_FUNC x
#else
// lwip debugs routed to printf
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
#endif
#ifdef NDEBUG

View File

@ -564,7 +564,7 @@ int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
* for example, with 96-bit random nonces, you should not encrypt
* more than 2**32 messages with the same key.
*
* Note that for both stategies, sizes are measured in blocks and
* Note that for both strategies, sizes are measured in blocks and
* that an AES block is 16 bytes.
*
* \warning Upon return, \p stream_block contains sensitive data. Its

View File

@ -44,7 +44,7 @@
#define MBEDTLS_ARIA_DECRYPT 0 /**< ARIA decryption. */
#define MBEDTLS_ARIA_BLOCKSIZE 16 /**< ARIA block size in bytes. */
#define MBEDTLS_ARIA_MAX_ROUNDS 16 /**< Maxiumum number of rounds in ARIA. */
#define MBEDTLS_ARIA_MAX_ROUNDS 16 /**< Maximum number of rounds in ARIA. */
#define MBEDTLS_ARIA_MAX_KEYSIZE 32 /**< Maximum size of an ARIA key in bytes. */
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
@ -321,7 +321,7 @@ int mbedtls_aria_crypt_cfb128( mbedtls_aria_context *ctx,
* for example, with 96-bit random nonces, you should not encrypt
* more than 2**32 messages with the same key.
*
* Note that for both stategies, sizes are measured in blocks and
* Note that for both strategies, sizes are measured in blocks and
* that an ARIA block is 16 bytes.
*
* \warning Upon return, \p stream_block contains sensitive data. Its

View File

@ -61,7 +61,7 @@
/** Buffer too small when writing ASN.1 data structure. */
#define MBEDTLS_ERR_ASN1_BUF_TOO_SMALL -0x006C
/* \} name */
/** \} name ASN1 Error codes */
/**
* \name DER constants
@ -121,8 +121,7 @@
#define MBEDTLS_ASN1_TAG_PC_MASK 0x20
#define MBEDTLS_ASN1_TAG_VALUE_MASK 0x1F
/* \} name */
/* \} addtogroup asn1_module */
/** \} name DER constants */
/** Returns the size of the binary string, without the trailing \\0 */
#define MBEDTLS_OID_SIZE(x) (sizeof(x) - 1)
@ -210,7 +209,7 @@ mbedtls_asn1_named_data;
* \return 0 if successful.
* \return #MBEDTLS_ERR_ASN1_OUT_OF_DATA if the ASN.1 element
* would end beyond \p end.
* \return #MBEDTLS_ERR_ASN1_INVALID_LENGTH if the length is unparseable.
* \return #MBEDTLS_ERR_ASN1_INVALID_LENGTH if the length is unparsable.
*/
int mbedtls_asn1_get_len( unsigned char **p,
const unsigned char *end,
@ -235,7 +234,7 @@ int mbedtls_asn1_get_len( unsigned char **p,
* with the requested tag.
* \return #MBEDTLS_ERR_ASN1_OUT_OF_DATA if the ASN.1 element
* would end beyond \p end.
* \return #MBEDTLS_ERR_ASN1_INVALID_LENGTH if the length is unparseable.
* \return #MBEDTLS_ERR_ASN1_INVALID_LENGTH if the length is unparsable.
*/
int mbedtls_asn1_get_tag( unsigned char **p,
const unsigned char *end,
@ -607,6 +606,9 @@ void mbedtls_asn1_free_named_data( mbedtls_asn1_named_data *entry );
*/
void mbedtls_asn1_free_named_data_list( mbedtls_asn1_named_data **head );
/** \} name Functions to parse ASN.1 data structures */
/** \} addtogroup asn1_module */
#ifdef __cplusplus
}
#endif

View File

@ -991,7 +991,7 @@ MBEDTLS_DEPRECATED int mbedtls_mpi_is_prime( const mbedtls_mpi *X,
* generate yourself and that are supposed to be prime, then
* \p rounds should be at least the half of the security
* strength of the cryptographic algorithm. On the other hand,
* if \p X is chosen uniformly or non-adversially (as is the
* if \p X is chosen uniformly or non-adversarially (as is the
* case when mbedtls_mpi_gen_prime calls this function), then
* \p rounds can be much lower.
*

View File

@ -185,7 +185,7 @@ int mbedtls_blowfish_crypt_cbc( mbedtls_blowfish_context *ctx,
* #MBEDTLS_BLOWFISH_ENCRYPT for encryption, or
* #MBEDTLS_BLOWFISH_DECRYPT for decryption.
* \param length The length of the input data in Bytes.
* \param iv_off The offset in the initialiation vector.
* \param iv_off The offset in the initialization vector.
* The value pointed to must be smaller than \c 8 Bytes.
* It is updated by this function to support the aforementioned
* streaming usage.
@ -246,7 +246,7 @@ int mbedtls_blowfish_crypt_cfb64( mbedtls_blowfish_context *ctx,
* The recommended way to ensure uniqueness is to use a message
* counter.
*
* Note that for both stategies, sizes are measured in blocks and
* Note that for both strategies, sizes are measured in blocks and
* that a Blowfish block is 8 bytes.
*
* \warning Upon return, \p stream_block contains sensitive data. Its

View File

@ -273,7 +273,7 @@ int mbedtls_camellia_crypt_cfb128( mbedtls_camellia_context *ctx,
* encrypted: for example, with 96-bit random nonces, you should
* not encrypt more than 2**32 messages with the same key.
*
* Note that for both stategies, sizes are measured in blocks and
* Note that for both strategies, sizes are measured in blocks and
* that a CAMELLIA block is \c 16 Bytes.
*
* \warning Upon return, \p stream_block contains sensitive data. Its

View File

@ -161,7 +161,7 @@ int mbedtls_chachapoly_setkey( mbedtls_chachapoly_context *ctx,
* \param ctx The ChaCha20-Poly1305 context. This must be initialized
* and bound to a key.
* \param nonce The nonce/IV to use for the message.
* This must be a redable buffer of length \c 12 Bytes.
* This must be a readable buffer of length \c 12 Bytes.
* \param mode The operation to perform: #MBEDTLS_CHACHAPOLY_ENCRYPT or
* #MBEDTLS_CHACHAPOLY_DECRYPT (discouraged, see warning).
*

View File

@ -173,7 +173,11 @@
#endif
#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_ASN1_PARSE_C)
#error "MBEDTLS_PK_PARSE_C defined, but not all prerequesites"
#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_PKCS5_C) && !defined(MBEDTLS_MD_C)
#error "MBEDTLS_PKCS5_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) && \
@ -214,11 +218,32 @@
#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
#endif
#if defined(MBEDTLS_CCM_C) && ( \
!defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
#error "MBEDTLS_CCM_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_CCM_C) && !defined(MBEDTLS_CIPHER_C)
#error "MBEDTLS_CCM_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_GCM_C) && ( \
!defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
!defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) && !defined(MBEDTLS_ARIA_C) )
#error "MBEDTLS_GCM_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_GCM_C) && !defined(MBEDTLS_CIPHER_C)
#error "MBEDTLS_GCM_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_CHACHA20_C)
#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_CHACHAPOLY_C) && !defined(MBEDTLS_POLY1305_C)
#error "MBEDTLS_CHACHAPOLY_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
#error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
#endif
@ -338,11 +363,11 @@
#endif
#if defined(MBEDTLS_MEMORY_BACKTRACE) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequesites"
#error "MBEDTLS_MEMORY_BACKTRACE defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_MEMORY_DEBUG) && !defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequesites"
#error "MBEDTLS_MEMORY_DEBUG defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
@ -619,6 +644,18 @@
#error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
#endif
#if defined(MBEDTLS_PK_C) && defined(MBEDTLS_USE_PSA_CRYPTO) && \
!defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_ECDSA_C)
#error "MBEDTLS_PK_C in configuration with MBEDTLS_USE_PSA_CRYPTO and \
MBEDTLS_ECDSA_C requires MBEDTLS_PK_WRITE_C to be defined."
#endif
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PKCS1_V15) && \
!defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_PSA_CRYPTO_C)
#error "MBEDTLS_PSA_CRYPTO_C, MBEDTLS_RSA_C and MBEDTLS_PKCS1_V15 defined, \
but not all prerequisites"
#endif
#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
!defined(MBEDTLS_OID_C) )
#error "MBEDTLS_RSA_C defined, but not all prerequisites"
@ -761,14 +798,14 @@
!defined(MBEDTLS_SSL_PROTO_TLS1) && \
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
!defined(MBEDTLS_SSL_PROTO_TLS1_2)
#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
!defined(MBEDTLS_SSL_PROTO_TLS1) && \
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
!defined(MBEDTLS_SSL_PROTO_TLS1_2)
#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)

View File

@ -128,7 +128,12 @@
* MBEDTLS_PLATFORM_TIME_MACRO, MBEDTLS_PLATFORM_TIME_TYPE_MACRO and
* MBEDTLS_PLATFORM_STD_TIME.
*
* Comment if your system does not support time functions
* Comment if your system does not support time functions.
*
* \note If MBEDTLS_TIMING_C is set - to enable the semi-portable timing
* interface - timing.c will include time.h on suitable platforms
* regardless of the setting of MBEDTLS_HAVE_TIME, unless
* MBEDTLS_TIMING_ALT is used. See timing.c for more information.
*/
#define MBEDTLS_HAVE_TIME
@ -321,7 +326,7 @@
*/
//#define MBEDTLS_CHECK_PARAMS_ASSERT
/* \} name SECTION: System support */
/** \} name SECTION: System support */
/**
* \name SECTION: mbed TLS feature support
@ -395,7 +400,7 @@
//#define MBEDTLS_XTEA_ALT
/*
* When replacing the elliptic curve module, pleace consider, that it is
* When replacing the elliptic curve module, please consider, that it is
* implemented with two .c files:
* - ecp.c
* - ecp_curves.c
@ -1493,7 +1498,7 @@
* Enable an implementation of SHA-256 that has lower ROM footprint but also
* lower performance.
*
* The default implementation is meant to be a reasonnable compromise between
* The default implementation is meant to be a reasonable compromise between
* performance and size. This version optimizes more aggressively for size at
* the expense of performance. Eg on Cortex-M4 it reduces the size of
* mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about
@ -1658,7 +1663,7 @@
* Enable support for RFC 7627: Session Hash and Extended Master Secret
* Extension.
*
* This was introduced as "the proper fix" to the Triple Handshake familiy of
* This was introduced as "the proper fix" to the Triple Handshake family of
* attacks, but it is recommended to always use it (even if you disable
* renegotiation), since it actually fixes a more fundamental issue in the
* original SSL/TLS design, and has implications beyond Triple Handshake.
@ -1704,7 +1709,7 @@
* \note This option has no influence on the protection against the
* triple handshake attack. Even if it is disabled, Mbed TLS will
* still ensure that certificates do not change during renegotiation,
* for exaple by keeping a hash of the peer's certificate.
* for example by keeping a hash of the peer's certificate.
*
* Comment this macro to disable storing the peer's certificate
* after the handshake.
@ -1909,7 +1914,7 @@
* unless you know for sure amplification cannot be a problem in the
* environment in which your server operates.
*
* \warning Disabling this can ba a security risk! (see above)
* \warning Disabling this can be a security risk! (see above)
*
* Requires: MBEDTLS_SSL_PROTO_DTLS
*
@ -2162,8 +2167,19 @@
* This setting allows support for cryptographic mechanisms through the PSA
* API to be configured separately from support through the mbedtls API.
*
* Uncomment this to enable use of PSA Crypto configuration settings which
* can be found in include/psa/crypto_config.h.
* When this option is disabled, the PSA API exposes the cryptographic
* mechanisms that can be implemented on top of the `mbedtls_xxx` API
* configured with `MBEDTLS_XXX` symbols.
*
* When this option is enabled, the PSA API exposes the cryptographic
* mechanisms requested by the `PSA_WANT_XXX` symbols defined in
* include/psa/crypto_config.h. The corresponding `MBEDTLS_XXX` settings are
* automatically enabled if required (i.e. if no PSA driver provides the
* mechanism). You may still freely enable additional `MBEDTLS_XXX` symbols
* in config.h.
*
* If the symbol #MBEDTLS_PSA_CRYPTO_CONFIG_FILE is defined, it specifies
* an alternative header to include instead of include/psa/crypto_config.h.
*
* If you enable this option and write your own configuration file, you must
* include mbedtls/config_psa.h in your configuration file. The default
@ -2289,7 +2305,7 @@
* Uncomment to enable use of ZLIB
*/
//#define MBEDTLS_ZLIB_SUPPORT
/* \} name SECTION: mbed TLS feature support */
/** \} name SECTION: mbed TLS feature support */
/**
* \name SECTION: mbed TLS modules
@ -2902,7 +2918,7 @@
*
* Requires: MBEDTLS_MD_C
*
* Uncomment to enable the HMAC_DRBG random number geerator.
* Uncomment to enable the HMAC_DRBG random number generator.
*/
#define MBEDTLS_HMAC_DRBG_C
@ -3096,7 +3112,7 @@
/**
* \def MBEDTLS_PK_C
*
* Enable the generic public (asymetric) key layer.
* Enable the generic public (asymmetric) key layer.
*
* Module: library/pk.c
* Caller: library/ssl_tls.c
@ -3112,7 +3128,7 @@
/**
* \def MBEDTLS_PK_PARSE_C
*
* Enable the generic public (asymetric) key parser.
* Enable the generic public (asymmetric) key parser.
*
* Module: library/pkparse.c
* Caller: library/x509_crt.c
@ -3127,7 +3143,7 @@
/**
* \def MBEDTLS_PK_WRITE_C
*
* Enable the generic public (asymetric) key writer.
* Enable the generic public (asymmetric) key writer.
*
* Module: library/pkwrite.c
* Caller: library/x509write.c
@ -3466,6 +3482,10 @@
* your own implementation of the whole module by setting
* \c MBEDTLS_TIMING_ALT in the current file.
*
* \note The timing module will include time.h on suitable platforms
* regardless of the setting of MBEDTLS_HAVE_TIME, unless
* MBEDTLS_TIMING_ALT is used. See timing.c for more information.
*
* \note See also our Knowledge Base article about porting to a new
* environment:
* https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
@ -3598,7 +3618,88 @@
*/
#define MBEDTLS_XTEA_C
/* \} name SECTION: mbed TLS modules */
/** \} name SECTION: mbed TLS modules */
/**
* \name SECTION: General configuration options
*
* This section contains Mbed TLS build settings that are not associated
* with a particular module.
*
* \{
*/
/**
* \def MBEDTLS_CONFIG_FILE
*
* If defined, this is a header which will be included instead of
* `"mbedtls/config.h"`.
* This header file specifies the compile-time configuration of Mbed TLS.
* Unlike other configuration options, this one must be defined on the
* compiler command line: a definition in `config.h` would have no effect.
*
* This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
* non-standard feature of the C language, so this feature is only available
* with compilers that perform macro expansion on an <tt>\#include</tt> line.
*
* The value of this symbol is typically a path in double quotes, either
* absolute or relative to a directory on the include search path.
*/
//#define MBEDTLS_CONFIG_FILE "mbedtls/config.h"
/**
* \def MBEDTLS_USER_CONFIG_FILE
*
* If defined, this is a header which will be included after
* `"mbedtls/config.h"` or #MBEDTLS_CONFIG_FILE.
* This allows you to modify the default configuration, including the ability
* to undefine options that are enabled by default.
*
* This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
* non-standard feature of the C language, so this feature is only available
* with compilers that perform macro expansion on an <tt>\#include</tt> line.
*
* The value of this symbol is typically a path in double quotes, either
* absolute or relative to a directory on the include search path.
*/
//#define MBEDTLS_USER_CONFIG_FILE "/dev/null"
/**
* \def MBEDTLS_PSA_CRYPTO_CONFIG_FILE
*
* If defined, this is a header which will be included instead of
* `"psa/crypto_config.h"`.
* This header file specifies which cryptographic mechanisms are available
* through the PSA API when #MBEDTLS_PSA_CRYPTO_CONFIG is enabled, and
* is not used when #MBEDTLS_PSA_CRYPTO_CONFIG is disabled.
*
* This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
* non-standard feature of the C language, so this feature is only available
* with compilers that perform macro expansion on an <tt>\#include</tt> line.
*
* The value of this symbol is typically a path in double quotes, either
* absolute or relative to a directory on the include search path.
*/
//#define MBEDTLS_PSA_CRYPTO_CONFIG_FILE "psa/crypto_config.h"
/**
* \def MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE
*
* If defined, this is a header which will be included after
* `"psa/crypto_config.h"` or #MBEDTLS_PSA_CRYPTO_CONFIG_FILE.
* This allows you to modify the default configuration, including the ability
* to undefine options that are enabled by default.
*
* This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
* non-standard feature of the C language, so this feature is only available
* with compilers that perform macro expansion on an <tt>\#include</tt> line.
*
* The value of this symbol is typically a path in double quotes, either
* absolute or relative to a directory on the include search path.
*/
//#define MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE "/dev/null"
/** \} name SECTION: General configuration options */
/**
* \name SECTION: Module configuration options
@ -3609,11 +3710,15 @@
*
* Our advice is to enable options and change their values here
* only if you have a good reason and know the consequences.
*
* Please check the respective header file for documentation on these
* parameters (to prevent duplicate documentation).
* \{
*/
/* The Doxygen documentation here is used when a user comments out a
* setting and runs doxygen themselves. On the other hand, when we typeset
* the full documentation including disabled settings, the documentation
* in specific modules' header files is used if present. When editing this
* file, make sure that each option is documented in exactly one place,
* plus optionally a same-line Doxygen comment here if there is a Doxygen
* comment in the specific module. */
/* MPI / BIGNUM options */
//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum window size used. */
@ -4002,7 +4107,7 @@
*/
//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
/* \} name SECTION: Customisation configuration options */
/** \} name SECTION: Module configuration options */
/* Target and application specific configurations
*

View File

@ -31,9 +31,17 @@
#define MBEDTLS_CONFIG_PSA_H
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG_FILE)
#include MBEDTLS_PSA_CRYPTO_CONFIG_FILE
#else
#include "psa/crypto_config.h"
#endif
#endif /* defined(MBEDTLS_PSA_CRYPTO_CONFIG) */
#if defined(MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE)
#include MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -264,7 +272,6 @@ extern "C" {
#if (defined(PSA_WANT_ALG_CTR) && !defined(MBEDTLS_PSA_ACCEL_ALG_CTR)) || \
(defined(PSA_WANT_ALG_CFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_CFB)) || \
(defined(PSA_WANT_ALG_OFB) && !defined(MBEDTLS_PSA_ACCEL_ALG_OFB)) || \
(defined(PSA_WANT_ALG_XTS) && !defined(MBEDTLS_PSA_ACCEL_ALG_XTS)) || \
defined(PSA_WANT_ALG_ECB_NO_PADDING) || \
(defined(PSA_WANT_ALG_CBC_NO_PADDING) && \
!defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)) || \
@ -393,15 +400,8 @@ extern "C" {
#endif
#endif /* PSA_WANT_ALG_OFB */
#if defined(PSA_WANT_ALG_XTS)
#if !defined(MBEDTLS_PSA_ACCEL_ALG_XTS) || \
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
#define MBEDTLS_PSA_BUILTIN_ALG_XTS 1
#define MBEDTLS_CIPHER_MODE_XTS
#endif
#endif /* PSA_WANT_ALG_XTS */
#if defined(PSA_WANT_ALG_ECB_NO_PADDING)
#if defined(PSA_WANT_ALG_ECB_NO_PADDING) && \
!defined(MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING)
#define MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING 1
#endif
@ -483,7 +483,7 @@ extern "C" {
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448)
/*
* Curve448 is not yet supported via the PSA API in Mbed TLS
* (https://github.com/ARMmbed/mbedtls/issues/4249).
* (https://github.com/Mbed-TLS/mbedtls/issues/4249).
*/
#error "Curve448 is not yet supported via the PSA API in Mbed TLS."
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
@ -537,7 +537,7 @@ extern "C" {
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224)
/*
* SECP224K1 is buggy via the PSA API in Mbed TLS
* (https://github.com/ARMmbed/mbedtls/issues/3541).
* (https://github.com/Mbed-TLS/mbedtls/issues/3541).
*/
#error "SECP224K1 is buggy via the PSA API in Mbed TLS."
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
@ -751,11 +751,6 @@ extern "C" {
#define PSA_WANT_ALG_OFB 1
#endif
#if defined(MBEDTLS_CIPHER_MODE_XTS)
#define MBEDTLS_PSA_BUILTIN_ALG_XTS 1
#define PSA_WANT_ALG_XTS 1
#endif
#if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
#define PSA_WANT_ECC_BRAINPOOL_P_R1_256
@ -776,7 +771,7 @@ extern "C" {
#define PSA_WANT_ECC_MONTGOMERY_255
#endif
/* Curve448 is not yet supported via the PSA API (https://github.com/ARMmbed/mbedtls/issues/4249) */
/* Curve448 is not yet supported via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/4249) */
#if 0 && defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
#define PSA_WANT_ECC_MONTGOMERY_448
@ -812,7 +807,7 @@ extern "C" {
#define PSA_WANT_ECC_SECP_K1_192
#endif
/* SECP224K1 is buggy via the PSA API (https://github.com/ARMmbed/mbedtls/issues/3541) */
/* SECP224K1 is buggy via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/3541) */
#if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
#define PSA_WANT_ECC_SECP_K1_224

View File

@ -138,7 +138,7 @@
/**< The maximum size of seed or reseed buffer in bytes. */
#endif
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
#define MBEDTLS_CTR_DRBG_PR_OFF 0
/**< Prediction resistance is disabled. */

View File

@ -139,7 +139,7 @@ extern "C" {
* discarded.
* (Default value: 0 = No debug )
*
* \param threshold theshold level of messages to filter on. Messages at a
* \param threshold threshold level of messages to filter on. Messages at a
* higher level will be discarded.
* - Debug levels
* - 0 No debug

View File

@ -68,7 +68,7 @@ typedef enum {
* (KeyExchange) as defined by the Thread spec.
*
* In order to benefit from this symmetry, we choose a different naming
* convetion from the Thread v1.0 spec. Correspondance is indicated in the
* convention from the Thread v1.0 spec. Correspondence is indicated in the
* description as a pair C: client name, S: server name
*/
typedef struct mbedtls_ecjpake_context

View File

@ -315,7 +315,7 @@ mbedtls_ecp_group;
#if !defined(MBEDTLS_ECP_WINDOW_SIZE)
/*
* Maximum "window" size used for point multiplication.
* Default: a point where higher memory usage yields disminishing performance
* Default: a point where higher memory usage yields diminishing performance
* returns.
* Minimum value: 2. Maximum value: 7.
*
@ -351,7 +351,7 @@ mbedtls_ecp_group;
#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up. */
#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
#else /* MBEDTLS_ECP_ALT */
#include "ecp_alt.h"

View File

@ -75,7 +75,7 @@
#define MBEDTLS_ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */
#endif
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
#if defined(MBEDTLS_ENTROPY_SHA512_ACCUMULATOR)
#define MBEDTLS_ENTROPY_BLOCK_SIZE 64 /**< Block size of entropy accumulator (SHA-512) */

View File

@ -39,7 +39,7 @@
*/
/** Bad input parameters to function. */
#define MBEDTLS_ERR_HKDF_BAD_INPUT_DATA -0x5F80
/* \} name */
/** \} name */
#ifdef __cplusplus
extern "C" {

View File

@ -74,7 +74,7 @@
#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */
#endif
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
#define MBEDTLS_HMAC_DRBG_PR_OFF 0 /**< No prediction resistance */
#define MBEDTLS_HMAC_DRBG_PR_ON 1 /**< Prediction resistance enabled */
@ -207,7 +207,7 @@ int mbedtls_hmac_drbg_seed( mbedtls_hmac_drbg_context *ctx,
size_t len );
/**
* \brief Initilisation of simpified HMAC_DRBG (never reseeds).
* \brief Initialisation of simplified HMAC_DRBG (never reseeds).
*
* This function is meant for use in algorithms that need a pseudorandom
* input such as deterministic ECDSA.

View File

@ -42,7 +42,7 @@
#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4 /**< Align on multiples of this value */
#endif
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
#define MBEDTLS_MEMORY_VERIFY_NONE 0
#define MBEDTLS_MEMORY_VERIFY_ALLOC (1 << 0)

View File

@ -143,7 +143,7 @@
#define MBEDTLS_OID_AT_GIVEN_NAME MBEDTLS_OID_AT "\x2A" /**< id-at-givenName AttributeType:= {id-at 42} */
#define MBEDTLS_OID_AT_INITIALS MBEDTLS_OID_AT "\x2B" /**< id-at-initials AttributeType:= {id-at 43} */
#define MBEDTLS_OID_AT_GENERATION_QUALIFIER MBEDTLS_OID_AT "\x2C" /**< id-at-generationQualifier AttributeType:= {id-at 44} */
#define MBEDTLS_OID_AT_UNIQUE_IDENTIFIER MBEDTLS_OID_AT "\x2D" /**< id-at-uniqueIdentifier AttributType:= {id-at 45} */
#define MBEDTLS_OID_AT_UNIQUE_IDENTIFIER MBEDTLS_OID_AT "\x2D" /**< id-at-uniqueIdentifier AttributeType:= {id-at 45} */
#define MBEDTLS_OID_AT_DN_QUALIFIER MBEDTLS_OID_AT "\x2E" /**< id-at-dnQualifier AttributeType:= {id-at 46} */
#define MBEDTLS_OID_AT_PSEUDONYM MBEDTLS_OID_AT "\x41" /**< id-at-pseudonym AttributeType:= {id-at 65} */

View File

@ -54,7 +54,7 @@
#define MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE -0x1400
/** Bad input parameters to function. */
#define MBEDTLS_ERR_PEM_BAD_INPUT_DATA -0x1480
/* \} name */
/** \} name PEM Error codes */
#ifdef __cplusplus
extern "C" {

View File

@ -217,32 +217,6 @@ typedef struct
typedef void mbedtls_pk_restart_ctx;
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
#if defined(MBEDTLS_RSA_C)
/**
* Quick access to an RSA context inside a PK context.
*
* \warning You must make sure the PK context actually holds an RSA context
* before using this function!
*/
static inline mbedtls_rsa_context *mbedtls_pk_rsa( const mbedtls_pk_context pk )
{
return( (mbedtls_rsa_context *) (pk).pk_ctx );
}
#endif /* MBEDTLS_RSA_C */
#if defined(MBEDTLS_ECP_C)
/**
* Quick access to an EC context inside a PK context.
*
* \warning You must make sure the PK context actually holds an EC context
* before using this function!
*/
static inline mbedtls_ecp_keypair *mbedtls_pk_ec( const mbedtls_pk_context pk )
{
return( (mbedtls_ecp_keypair *) (pk).pk_ctx );
}
#endif /* MBEDTLS_ECP_C */
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/**
* \brief Types for RSA-alt abstraction
@ -656,6 +630,55 @@ const char * mbedtls_pk_get_name( const mbedtls_pk_context *ctx );
*/
mbedtls_pk_type_t mbedtls_pk_get_type( const mbedtls_pk_context *ctx );
#if defined(MBEDTLS_RSA_C)
/**
* Quick access to an RSA context inside a PK context.
*
* \warning This function can only be used when the type of the context, as
* returned by mbedtls_pk_get_type(), is #MBEDTLS_PK_RSA.
* Ensuring that is the caller's responsibility.
* Alternatively, you can check whether this function returns NULL.
*
* \return The internal RSA context held by the PK context, or NULL.
*/
static inline mbedtls_rsa_context *mbedtls_pk_rsa( const mbedtls_pk_context pk )
{
switch( mbedtls_pk_get_type( &pk ) )
{
case MBEDTLS_PK_RSA:
return( (mbedtls_rsa_context *) (pk).pk_ctx );
default:
return( NULL );
}
}
#endif /* MBEDTLS_RSA_C */
#if defined(MBEDTLS_ECP_C)
/**
* Quick access to an EC context inside a PK context.
*
* \warning This function can only be used when the type of the context, as
* returned by mbedtls_pk_get_type(), is #MBEDTLS_PK_ECKEY,
* #MBEDTLS_PK_ECKEY_DH, or #MBEDTLS_PK_ECDSA.
* Ensuring that is the caller's responsibility.
* Alternatively, you can check whether this function returns NULL.
*
* \return The internal EC context held by the PK context, or NULL.
*/
static inline mbedtls_ecp_keypair *mbedtls_pk_ec( const mbedtls_pk_context pk )
{
switch( mbedtls_pk_get_type( &pk ) )
{
case MBEDTLS_PK_ECKEY:
case MBEDTLS_PK_ECKEY_DH:
case MBEDTLS_PK_ECDSA:
return( (mbedtls_ecp_keypair *) (pk).pk_ctx );
default:
return( NULL );
}
}
#endif /* MBEDTLS_ECP_C */
#if defined(MBEDTLS_PK_PARSE_C)
/** \ingroup pk_module */
/**

View File

@ -70,7 +70,9 @@ extern "C" {
#if !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
#include <stdio.h>
#include <stdlib.h>
#if defined(MBEDTLS_HAVE_TIME)
#include <time.h>
#endif
#if !defined(MBEDTLS_PLATFORM_STD_SNPRINTF)
#if defined(MBEDTLS_PLATFORM_HAS_NON_CONFORMING_SNPRINTF)
#define MBEDTLS_PLATFORM_STD_SNPRINTF mbedtls_platform_win32_snprintf /**< The default \c snprintf function to use. */
@ -127,7 +129,7 @@ extern "C" {
#endif /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
/*
* The function pointers for calloc and free.

View File

@ -32,14 +32,6 @@
extern "C" {
#endif
/**
* \name SECTION: Module settings
*
* The configuration options you can set for this module are in this section.
* Either change them in config.h or define them on the compiler command line.
* \{
*/
/*
* The time_t datatype
*/

View File

@ -67,7 +67,7 @@ extern "C" {
* \brief User supplied callback function for parameter validation failure.
* See #MBEDTLS_CHECK_PARAMS for context.
*
* This function will be called unless an alternative treatement
* This function will be called unless an alternative treatment
* is defined through the #MBEDTLS_PARAM_FAILED macro.
*
* This function can return, and the operation will be aborted, or
@ -198,7 +198,7 @@ MBEDTLS_DEPRECATED typedef int mbedtls_deprecated_numeric_constant_t;
*
* This macro has an empty expansion. It exists for documentation purposes:
* a #MBEDTLS_CHECK_RETURN_OPTIONAL annotation indicates that the function
* has been analyzed for return-check usefuless, whereas the lack of
* has been analyzed for return-check usefulness, whereas the lack of
* an annotation indicates that the function has not been analyzed and its
* return-check usefulness is unknown.
*/

View File

@ -88,7 +88,7 @@
/*
* The above constants may be used even if the RSA module is compile out,
* eg for alternative (PKCS#11) RSA implemenations in the PK layers.
* eg for alternative (PKCS#11) RSA implementations in the PK layers.
*/
#ifdef __cplusplus
@ -552,7 +552,7 @@ int mbedtls_rsa_public( mbedtls_rsa_context *ctx,
*
* \note Blinding is used if and only if a PRNG is provided.
*
* \note If blinding is used, both the base of exponentation
* \note If blinding is used, both the base of exponentiation
* and the exponent are blinded, providing protection
* against some side-channel attacks.
*
@ -687,7 +687,7 @@ int mbedtls_rsa_rsaes_pkcs1_v15_encrypt( mbedtls_rsa_context *ctx,
* mode being set to #MBEDTLS_RSA_PRIVATE and might instead
* return #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED.
*
* \param ctx The initnialized RSA context to use.
* \param ctx The initialized RSA context to use.
* \param f_rng The RNG function to use. This is needed for padding
* generation and must be provided.
* \param p_rng The RNG context to be passed to \p f_rng. This may

View File

@ -349,7 +349,7 @@
#define MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY 1
#endif
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
/*
* Length of the verify data for secure renegotiation
@ -1152,7 +1152,7 @@ struct mbedtls_ssl_config
#endif
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && defined(MBEDTLS_SSL_SRV_C)
/** Callback to create & write a cookie for ClientHello veirifcation */
/** Callback to create & write a cookie for ClientHello verification */
int (*f_cookie_write)( void *, unsigned char **, unsigned char *,
const unsigned char *, size_t );
/** Callback to verify validity of a ClientHello cookie */
@ -1405,7 +1405,7 @@ struct mbedtls_ssl_context
unsigned char *compress_buf; /*!< zlib data buffer */
#endif /* MBEDTLS_ZLIB_SUPPORT */
#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
signed char split_done; /*!< current record already splitted? */
signed char split_done; /*!< current record already split? */
#endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
/*
@ -1688,7 +1688,7 @@ void mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf,
*
* \note The two most common use cases are:
* - non-blocking I/O, f_recv != NULL, f_recv_timeout == NULL
* - blocking I/O, f_recv == NULL, f_recv_timout != NULL
* - blocking I/O, f_recv == NULL, f_recv_timeout != NULL
*
* \note For DTLS, you need to provide either a non-NULL
* f_recv_timeout callback, or a f_recv that doesn't block.
@ -1846,7 +1846,7 @@ int mbedtls_ssl_get_peer_cid( mbedtls_ssl_context *ssl,
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
/**
* \brief Set the Maximum Tranport Unit (MTU).
* \brief Set the Maximum Transport Unit (MTU).
* Special value: 0 means unset (no limit).
* This represents the maximum size of a datagram payload
* handled by the transport layer (usually UDP) as determined
@ -2387,7 +2387,7 @@ void mbedtls_ssl_conf_dtls_anti_replay( mbedtls_ssl_config *conf, char mode );
* ones going through the authentication-decryption phase.
*
* \note This is a security trade-off related to the fact that it's
* often relatively easy for an active attacker ot inject UDP
* often relatively easy for an active attacker to inject UDP
* datagrams. On one hand, setting a low limit here makes it
* easier for such an attacker to forcibly terminated a
* connection. On the other hand, a high limit or no limit
@ -2498,7 +2498,7 @@ void mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *conf, uint32_t min,
* successfully cached, return 1 otherwise.
*
* \param conf SSL configuration
* \param p_cache parmater (context) for both callbacks
* \param p_cache parameter (context) for both callbacks
* \param f_get_cache session get callback
* \param f_set_cache session set callback
*/
@ -2529,7 +2529,7 @@ int mbedtls_ssl_set_session( mbedtls_ssl_context *ssl, const mbedtls_ssl_session
/**
* \brief Load serialized session data into a session structure.
* On client, this can be used for loading saved sessions
* before resuming them with mbedstls_ssl_set_session().
* before resuming them with mbedtls_ssl_set_session().
* On server, this can be used for alternative implementations
* of session cache or session tickets.
*
@ -2793,7 +2793,7 @@ void mbedtls_ssl_conf_ca_cb( mbedtls_ssl_config *conf,
*
* \note On client, only the first call has any effect. That is,
* only one client certificate can be provisioned. The
* server's preferences in its CertficateRequest message will
* server's preferences in its CertificateRequest message will
* be ignored and our only cert will be sent regardless of
* whether it matches those preferences - the server can then
* decide what it wants to do with it.
@ -3241,7 +3241,7 @@ int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,
* \param protos Pointer to a NULL-terminated list of supported protocols,
* in decreasing preference order. The pointer to the list is
* recorded by the library for later reference as required, so
* the lifetime of the table must be atleast as long as the
* the lifetime of the table must be at least as long as the
* lifetime of the SSL configuration structure.
*
* \return 0 on success, or MBEDTLS_ERR_SSL_BAD_INPUT_DATA.
@ -3255,7 +3255,7 @@ int mbedtls_ssl_conf_alpn_protocols( mbedtls_ssl_config *conf, const char **prot
*
* \param ssl SSL context
*
* \return Protcol name, or NULL if no protocol was negotiated.
* \return Protocol name, or NULL if no protocol was negotiated.
*/
const char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl );
#endif /* MBEDTLS_SSL_ALPN */
@ -3338,7 +3338,7 @@ int mbedtls_ssl_dtls_srtp_set_mki_value( mbedtls_ssl_context *ssl,
unsigned char *mki_value,
uint16_t mki_len );
/**
* \brief Get the negotiated DTLS-SRTP informations:
* \brief Get the negotiated DTLS-SRTP information:
* Protection profile and MKI value.
*
* \warning This function must be called after the handshake is
@ -3346,7 +3346,7 @@ int mbedtls_ssl_dtls_srtp_set_mki_value( mbedtls_ssl_context *ssl,
* not be trusted or acted upon before the handshake completes.
*
* \param ssl The SSL context to query.
* \param dtls_srtp_info The negotiated DTLS-SRTP informations:
* \param dtls_srtp_info The negotiated DTLS-SRTP information:
* - Protection profile in use.
* A direct mapping of the iana defined value for protection
* profile on an uint16_t.
@ -3508,7 +3508,7 @@ void mbedtls_ssl_conf_cert_req_ca_list( mbedtls_ssl_config *conf,
* \c mbedtls_ssl_get_record_expansion().
*
* \note For DTLS, it is also possible to set a limit for the total
* size of daragrams passed to the transport layer, including
* size of datagrams passed to the transport layer, including
* record overhead, see \c mbedtls_ssl_set_mtu().
*
* \param conf SSL configuration
@ -3568,7 +3568,7 @@ void mbedtls_ssl_conf_session_tickets( mbedtls_ssl_config *conf, int use_tickets
* initiated by peer
* (Default: MBEDTLS_SSL_RENEGOTIATION_DISABLED)
*
* \warning It is recommended to always disable renegotation unless you
* \warning It is recommended to always disable renegotiation unless you
* know you need it and you know what you're doing. In the
* past, there have been several issues associated with
* renegotiation or a poor understanding of its properties.
@ -3631,7 +3631,7 @@ void mbedtls_ssl_conf_legacy_renegotiation( mbedtls_ssl_config *conf, int allow_
* scenario.
*
* \note With DTLS and server-initiated renegotiation, the
* HelloRequest is retransmited every time mbedtls_ssl_read() times
* HelloRequest is retransmitted every time mbedtls_ssl_read() times
* out or receives Application Data, until:
* - max_records records have beens seen, if it is >= 0, or
* - the number of retransmits that would happen during an
@ -4263,7 +4263,7 @@ void mbedtls_ssl_free( mbedtls_ssl_context *ssl );
* \return \c 0 if successful.
* \return #MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL if \p buf is too small.
* \return #MBEDTLS_ERR_SSL_ALLOC_FAILED if memory allocation failed
* while reseting the context.
* while resetting the context.
* \return #MBEDTLS_ERR_SSL_BAD_INPUT_DATA if a handshake is in
* progress, or there is pending data for reading or sending,
* or the connection does not use DTLS 1.2 with an AEAD
@ -4357,7 +4357,7 @@ int mbedtls_ssl_context_load( mbedtls_ssl_context *ssl,
void mbedtls_ssl_config_init( mbedtls_ssl_config *conf );
/**
* \brief Load reasonnable default SSL configuration values.
* \brief Load reasonable default SSL configuration values.
* (You need to call mbedtls_ssl_config_init() first.)
*
* \param conf SSL configuration context

View File

@ -50,7 +50,7 @@
#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /*!< Maximum entries in cache */
#endif
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
#ifdef __cplusplus
extern "C" {

View File

@ -45,7 +45,7 @@
#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */
#endif
/* \} name SECTION: Module settings */
/** \} name SECTION: Module settings */
#ifdef __cplusplus
extern "C" {
@ -84,7 +84,7 @@ int mbedtls_ssl_cookie_setup( mbedtls_ssl_cookie_ctx *ctx,
* \brief Set expiration delay for cookies
* (Default MBEDTLS_SSL_COOKIE_TIMEOUT)
*
* \param ctx Cookie contex
* \param ctx Cookie context
* \param delay Delay, in seconds if HAVE_TIME, or in number of cookies
* issued in the meantime.
* 0 to disable expiration (NOT recommended)

View File

@ -934,16 +934,22 @@ void mbedtls_ssl_transform_free( mbedtls_ssl_transform *transform );
*/
void mbedtls_ssl_handshake_free( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl );
void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_send_fatal_handshake_failure( mbedtls_ssl_context *ssl );
void mbedtls_ssl_reset_checksum( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_handle_message_type( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_prepare_handshake_record( mbedtls_ssl_context *ssl );
void mbedtls_ssl_update_handshake_status( mbedtls_ssl_context *ssl );
@ -1023,27 +1029,39 @@ void mbedtls_ssl_update_handshake_status( mbedtls_ssl_context *ssl );
* following the above definition.
*
*/
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_read_record( mbedtls_ssl_context *ssl,
unsigned update_hs_digest );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_write_handshake_msg( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_write_record( mbedtls_ssl_context *ssl, uint8_t force_flush );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_parse_change_cipher_spec( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_write_change_cipher_spec( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_write_finished( mbedtls_ssl_context *ssl );
void mbedtls_ssl_optimize_checksum( mbedtls_ssl_context *ssl,
const mbedtls_ssl_ciphersuite_t *ciphersuite_info );
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_psk_derive_premaster( mbedtls_ssl_context *ssl, mbedtls_key_exchange_type_t key_ex );
/**
@ -1108,13 +1126,18 @@ mbedtls_pk_type_t mbedtls_ssl_pk_alg_from_sig( unsigned char sig );
mbedtls_md_type_t mbedtls_ssl_md_alg_from_hash( unsigned char hash );
unsigned char mbedtls_ssl_hash_from_md_alg( int md );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_set_calc_verify_md( mbedtls_ssl_context *ssl, int md );
#if defined(MBEDTLS_ECP_C)
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_check_curve( const mbedtls_ssl_context *ssl, mbedtls_ecp_group_id grp_id );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_check_curve_tls_id( const mbedtls_ssl_context *ssl, uint16_t tls_id );
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_check_sig_hash( const mbedtls_ssl_context *ssl,
mbedtls_md_type_t md );
#endif
@ -1170,6 +1193,7 @@ static inline mbedtls_x509_crt *mbedtls_ssl_own_cert( mbedtls_ssl_context *ssl )
*
* Return 0 if everything is OK, -1 if not.
*/
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_check_cert_usage( const mbedtls_x509_crt *cert,
const mbedtls_ssl_ciphersuite_t *ciphersuite,
int cert_endpoint,
@ -1218,21 +1242,26 @@ static inline size_t mbedtls_ssl_hs_hdr_len( const mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_PROTO_DTLS)
void mbedtls_ssl_send_flight_completed( mbedtls_ssl_context *ssl );
void mbedtls_ssl_recv_flight_completed( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_resend( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl );
#endif
/* Visible for testing purposes only */
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_dtls_replay_check( mbedtls_ssl_context const *ssl );
void mbedtls_ssl_dtls_replay_update( mbedtls_ssl_context *ssl );
#endif
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_session_copy( mbedtls_ssl_session *dst,
const mbedtls_ssl_session *src );
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_1)
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_get_key_exchange_md_ssl_tls( mbedtls_ssl_context *ssl,
unsigned char *output,
unsigned char *data, size_t data_len );
@ -1242,6 +1271,7 @@ int mbedtls_ssl_get_key_exchange_md_ssl_tls( mbedtls_ssl_context *ssl,
#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_2)
/* The hash buffer must have at least MBEDTLS_MD_MAX_SIZE bytes of length. */
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_get_key_exchange_md_tls1_2( mbedtls_ssl_context *ssl,
unsigned char *hash, size_t *hashlen,
unsigned char *data, size_t data_len,
@ -1254,11 +1284,13 @@ int mbedtls_ssl_get_key_exchange_md_tls1_2( mbedtls_ssl_context *ssl,
#endif
void mbedtls_ssl_transform_init( mbedtls_ssl_transform *transform );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
mbedtls_ssl_transform *transform,
mbedtls_record *rec,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
mbedtls_ssl_transform *transform,
mbedtls_record *rec );
@ -1276,10 +1308,12 @@ static inline size_t mbedtls_ssl_ep_len( const mbedtls_ssl_context *ssl )
}
#if defined(MBEDTLS_SSL_PROTO_DTLS)
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_resend_hello_request( mbedtls_ssl_context *ssl );
#endif /* MBEDTLS_SSL_PROTO_DTLS */
void mbedtls_ssl_set_timer( mbedtls_ssl_context *ssl, uint32_t millisecs );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_check_timer( mbedtls_ssl_context *ssl );
void mbedtls_ssl_reset_in_out_pointers( mbedtls_ssl_context *ssl );
@ -1287,6 +1321,7 @@ void mbedtls_ssl_update_out_pointers( mbedtls_ssl_context *ssl,
mbedtls_ssl_transform *transform );
void mbedtls_ssl_update_in_pointers( mbedtls_ssl_context *ssl );
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_session_reset_int( mbedtls_ssl_context *ssl, int partial );
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
@ -1296,6 +1331,7 @@ void mbedtls_ssl_dtls_replay_reset( mbedtls_ssl_context *ssl );
void mbedtls_ssl_handshake_wrapup_free_hs_transform( mbedtls_ssl_context *ssl );
#if defined(MBEDTLS_SSL_RENEGOTIATION)
MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_start_renegotiation( mbedtls_ssl_context *ssl );
#endif /* MBEDTLS_SSL_RENEGOTIATION */
@ -1305,4 +1341,12 @@ void mbedtls_ssl_buffering_free( mbedtls_ssl_context *ssl );
void mbedtls_ssl_flight_free( mbedtls_ssl_flight_item *flight );
#endif /* MBEDTLS_SSL_PROTO_DTLS */
#if defined(MBEDTLS_TEST_HOOKS)
int mbedtls_ssl_check_dtls_clihlo_cookie(
mbedtls_ssl_context *ssl,
const unsigned char *cli_id, size_t cli_id_len,
const unsigned char *in, size_t in_len,
unsigned char *obuf, size_t buf_len, size_t *olen );
#endif
#endif /* ssl_internal.h */

Some files were not shown because too many files have changed in this diff Show More