forked from espressif/arduino-esp32
IDF release/v3.2 d3e562907 (#3292)
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,6 +14,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "esp_flash_data_types.h"
|
||||
#include "esp_image_format.h"
|
||||
|
||||
/// Type of hold a GPIO in low state
|
||||
typedef enum {
|
||||
@ -92,6 +93,17 @@ bool bootloader_common_label_search(const char *list, char *label);
|
||||
*/
|
||||
esp_err_t bootloader_common_get_sha256_of_partition(uint32_t address, uint32_t size, int type, uint8_t *out_sha_256);
|
||||
|
||||
/**
|
||||
* @brief Check if the image (bootloader and application) has valid chip ID and revision
|
||||
*
|
||||
* @param img_hdr: image header
|
||||
* @return
|
||||
* - ESP_OK: image and chip are matched well
|
||||
* - ESP_FAIL: image doesn't match to the chip
|
||||
*/
|
||||
esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Configure VDDSDIO, call this API to rise VDDSDIO to 1.9V when VDDSDIO regulator is enabled as 1.8V mode.
|
||||
*/
|
||||
|
@ -91,6 +91,13 @@ esp_err_t esp_efuse_apply_34_encoding(const uint8_t *in_bytes, uint32_t *out_wor
|
||||
*/
|
||||
void esp_efuse_write_random_key(uint32_t blk_wdata0_reg);
|
||||
|
||||
/**
|
||||
* @brief Returns chip version from efuse
|
||||
*
|
||||
* @return chip version
|
||||
*/
|
||||
uint8_t esp_efuse_get_chip_ver(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -55,6 +55,19 @@ typedef enum {
|
||||
|
||||
#define ESP_IMAGE_HEADER_MAGIC 0xE9
|
||||
|
||||
/**
|
||||
* @brief ESP chip ID
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_CHIP_ID_ESP32 = 0x0000, /*!< chip ID: ESP32 */
|
||||
ESP_CHIP_ID_INVALID = 0xFFFF /*!< Invalid chip ID (we defined it to make sure the esp_chip_id_t is 2 bytes size) */
|
||||
} __attribute__((packed)) esp_chip_id_t;
|
||||
|
||||
/** @cond */
|
||||
_Static_assert(sizeof(esp_chip_id_t) == 2, "esp_chip_id_t should be 16 bit");
|
||||
|
||||
|
||||
/* Main header of binary image */
|
||||
typedef struct {
|
||||
uint8_t magic;
|
||||
@ -71,8 +84,12 @@ typedef struct {
|
||||
uint8_t wp_pin;
|
||||
/* Drive settings for the SPI flash pins (read by ROM bootloader) */
|
||||
uint8_t spi_pin_drv[3];
|
||||
/* Reserved bytes in ESP32 additional header space, currently unused */
|
||||
uint8_t reserved[11];
|
||||
/*!< Chip identification number */
|
||||
esp_chip_id_t chip_id;
|
||||
/*!< Minimum chip revision supported by image */
|
||||
uint8_t min_chip_rev;
|
||||
/*!< Reserved bytes in additional header space, currently unused */
|
||||
uint8_t reserved[8];
|
||||
/* If 1, a SHA256 digest "simple hash" (of the entire image) is appended after the checksum. Included in image length. This digest
|
||||
* is separate to secure boot and only used for detecting corruption. For secure boot signed images, the signature
|
||||
* is appended after this (and the simple hash is included in the signed data). */
|
||||
|
@ -75,6 +75,7 @@
|
||||
#define CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED 1
|
||||
#define CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED 1
|
||||
#define CONFIG_CAMERA_CORE1 1
|
||||
#define CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL 5
|
||||
#define CONFIG_MB_SERIAL_BUF_SIZE 256
|
||||
#define CONFIG_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_SPIRAM_SUPPORT 1
|
||||
@ -153,8 +154,10 @@
|
||||
#define CONFIG_ADC2_DISABLE_DAC 1
|
||||
#define CONFIG_HFP_ENABLE 1
|
||||
#define CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM 100
|
||||
#define CONFIG_ESP32_REV_MIN_0 1
|
||||
#define CONFIG_LOG_DEFAULT_LEVEL 1
|
||||
#define CONFIG_TIMER_QUEUE_LENGTH 10
|
||||
#define CONFIG_ESP32_REV_MIN 0
|
||||
#define CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT 1
|
||||
#define CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE 0
|
||||
#define CONFIG_MAKE_WARN_UNDEFINED_VARIABLES 1
|
||||
@ -295,6 +298,7 @@
|
||||
#define CONFIG_REDUCE_PHY_TX_POWER 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_FREERTOS_CORETIMER_0 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0000
|
||||
#define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv"
|
||||
#define CONFIG_MBEDTLS_HAVE_TIME 1
|
||||
#define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY 1
|
||||
@ -336,6 +340,7 @@
|
||||
#define CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE 1
|
||||
#define CONFIG_SPIFFS_PAGE_SIZE 256
|
||||
#define CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED 1
|
||||
#define CONFIG_ESP32_DPORT_WORKAROUND 1
|
||||
#define CONFIG_PPP_MSCHAP_SUPPORT 1
|
||||
#define CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 1
|
||||
#define CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT 2048
|
||||
@ -355,3 +360,5 @@
|
||||
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR 1
|
||||
#define CONFIG_ESP32_WIFI_IRAM_OPT 1
|
||||
#define CONFIG_FATFS_API_ENCODING_ANSI_OEM 1
|
||||
#define CONFIG_ARDUINO_IDF_COMMIT "d3e562907"
|
||||
#define CONFIG_ARDUINO_IDF_BRANCH "release/v3.2"
|
||||
|
@ -27,24 +27,22 @@ typedef enum
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/******* fix start *******/
|
||||
int w; // Width
|
||||
int h; // Height
|
||||
int c; // Channel
|
||||
int n; // Number, to record filter's out_channels. input and output must be 1
|
||||
int stride;
|
||||
fptp_t *item;
|
||||
/******* fix end *******/
|
||||
int w; /*!< Width */
|
||||
int h; /*!< Height */
|
||||
int c; /*!< Channel */
|
||||
int n; /*!< Number of filter, input and output must be 1 */
|
||||
int stride; /*!< Step between lines */
|
||||
fptp_t *item; /*!< Data */
|
||||
} dl_matrix3d_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int w; // Width
|
||||
int h; // Height
|
||||
int c; // Channel
|
||||
int n; // Number, to record filter's out_channels. input and output must be 1
|
||||
int stride;
|
||||
uc_t *item;
|
||||
int w; /*!< Width */
|
||||
int h; /*!< Height */
|
||||
int c; /*!< Channel */
|
||||
int n; /*!< Number of filter, input and output must be 1 */
|
||||
int stride; /*!< Step between lines */
|
||||
uc_t *item; /*!< Data */
|
||||
} dl_matrix3du_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -3,20 +3,21 @@
|
||||
|
||||
typedef int16_t qtp_t;
|
||||
|
||||
/*
|
||||
* Matrix for 3d
|
||||
* @Warning: the sequence of variables is fixed, cannot be modified, otherwise there will be errors in esp_dsp_dot_float
|
||||
/**
|
||||
* Matrix for input, filter, and output
|
||||
* @Warning: the sequence of variables is fixed, cannot be modified, otherwise there will be errors in
|
||||
* some handwrite xtensa instruction functions
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/******* fix start *******/
|
||||
int w; // Width
|
||||
int h; // Height
|
||||
int c; // Channel
|
||||
int n; // Number, to record filter's out_channels. input and output must be 1
|
||||
int stride;
|
||||
int exponent;
|
||||
qtp_t *item;
|
||||
int w; /*!< Width */
|
||||
int h; /*!< Height */
|
||||
int c; /*!< Channel */
|
||||
int n; /*!< Number of filter, input and output must be 1 */
|
||||
int stride; /*!< Step between lines */
|
||||
int exponent; /*!< Exponent for quantization */
|
||||
qtp_t *item; /*!< Data */
|
||||
/******* fix end *******/
|
||||
} dl_matrix3dq_t;
|
||||
|
||||
@ -32,21 +33,28 @@ typedef struct
|
||||
#define DL_SHIFT_AUTO 32
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Implementation of matrix relative operations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DL_C_IMPL = 0,
|
||||
DL_XTENSA_IMPL = 1
|
||||
DL_C_IMPL = 0, /*!< ANSI C */
|
||||
DL_XTENSA_IMPL = 1 /*!< Handwrite xtensa instruction */
|
||||
} dl_conv_mode;
|
||||
|
||||
|
||||
/**
|
||||
* Configuration of mobilenet operation
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int stride_x;
|
||||
int stride_y;
|
||||
dl_padding_type padding;
|
||||
dl_conv_mode mode;
|
||||
int dilate_exponent;
|
||||
int depthwise_exponent;
|
||||
int compress_exponent;
|
||||
int stride_x; /*!< Strides of width */
|
||||
int stride_y; /*!< Strides of height */
|
||||
dl_padding_type padding; /*!< Padding type */
|
||||
dl_conv_mode mode; /*!< Implementation mode */
|
||||
int dilate_exponent; /*!< Exponent of dilation filter */
|
||||
int depthwise_exponent; /*!< Exponent of depthwise filter */
|
||||
int compress_exponent; /*!< Exponent of compress filter */
|
||||
} dl_matrix3dq_mobilenet_config_t;
|
||||
|
||||
//
|
||||
@ -54,75 +62,166 @@ typedef struct
|
||||
//
|
||||
|
||||
/*
|
||||
* @brief Allocate a 3D matrix
|
||||
* @brief Allocate a 3d quantised matrix
|
||||
*
|
||||
* @param n,w,h,c number, width, height, channel
|
||||
* @return 3d matrix
|
||||
* @param n Number of filters, for input and output, should be 1
|
||||
* @param w Width of matrix
|
||||
* @param h Height of matrix
|
||||
* @param c Channel of matrix
|
||||
* @param e Exponent of matrix data
|
||||
* @return 3d quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_alloc(int n, int w, int h, int c, int e);
|
||||
|
||||
/*
|
||||
* @brief Free a 3D matrix
|
||||
* @brief Free a 3d quantized matrix
|
||||
*
|
||||
* @param m matrix
|
||||
* @param m 3d quantised matrix
|
||||
*/
|
||||
void dl_matrix3dq_free(dl_matrix3dq_t *m);
|
||||
|
||||
/**
|
||||
* @brief Zero out the matrix
|
||||
* Sets all entries in the matrix to 0.
|
||||
*
|
||||
* @param m Matrix to zero
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Copy a range of items from an existing matrix to a preallocated matrix
|
||||
*
|
||||
* @param in Old matrix (with foreign data) to re-use. Passing NULL will allocate a new matrix.
|
||||
* @param dst The resulting slice matrix
|
||||
* @param src Old matrix to slice.
|
||||
* @param x X-offset of the origin of the returned matrix within the sliced matrix
|
||||
* @param y Y-offset of the origin of the returned matrix within the sliced matrix
|
||||
* @param w Width of the resulting matrix
|
||||
* @param h Height of the resulting matrix
|
||||
* @return The resulting slice matrix
|
||||
*/
|
||||
void dl_matrix3dq_slice_copy(dl_matrix3dq_t *dst, dl_matrix3dq_t *src, int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* @brief Transform a fixed point matrix to a float point matrix
|
||||
*
|
||||
* @param m Quantized matrix
|
||||
* @return Float point matrix
|
||||
*/
|
||||
dl_matrix3d_t *dl_matrix3d_from_matrixq(dl_matrix3dq_t *m);
|
||||
|
||||
/**
|
||||
* @brief Transform a float point matrix to a fixed point matrix with pre-defined exponent
|
||||
*
|
||||
* @param m Float point matrix
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Fixed point matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrixq_from_matrix3d_qmf(dl_matrix3d_t *m, int exponent);
|
||||
|
||||
/**
|
||||
* @brief Transform a float point matrix to a fixed point matrix. The exponent is defined by the distribution of the input matrix.
|
||||
*
|
||||
* @param m Float point matrix
|
||||
* @return Fixed point matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrixq_from_matrix3d(dl_matrix3d_t *m);
|
||||
|
||||
qtp_t dl_matrix3dq_quant_range_exceeded_checking(int64_t value, char *location);
|
||||
|
||||
/**
|
||||
* @brief Reform a quantized matrix with exponent
|
||||
*
|
||||
* @param out Preallocated resulting matrix
|
||||
* @param in Input matrix
|
||||
* @param exponent Exponent for resulting matrix
|
||||
*/
|
||||
void dl_matrix3dq_shift_exponent(dl_matrix3dq_t *out, dl_matrix3dq_t *in, int exponent);
|
||||
|
||||
/**
|
||||
* @brief Do batch normalization for a quantized matrix
|
||||
*
|
||||
* @param m Input and output quantized matrix, data will be updated
|
||||
* @param scale Scale of batch-norm
|
||||
* @param offset Offset of batch-norm
|
||||
*/
|
||||
void dl_matrix3dq_batch_normalize(dl_matrix3dq_t *m, dl_matrix3dq_t *scale, dl_matrix3dq_t *offset);
|
||||
|
||||
/**
|
||||
* @brief Add two quantized matrix with a pre-defined exponent
|
||||
*
|
||||
* @param in_1 Adder 1
|
||||
* @param in_2 Adder 2
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Result of accumulation of two matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_add(dl_matrix3dq_t *in_1, dl_matrix3dq_t *in_2, int exponent);
|
||||
|
||||
//
|
||||
// Activation
|
||||
//
|
||||
/**
|
||||
* @brief Do relu for a quantized matrix
|
||||
*
|
||||
* @param in Input and output quantized matrix, data will be updated
|
||||
*/
|
||||
void dl_matrix3dq_relu(dl_matrix3dq_t *in);
|
||||
|
||||
/**
|
||||
* @brief Do relu with clips for a quantized matrix
|
||||
*
|
||||
* @param in Input and output quantized matrix, data will be updated
|
||||
* @param clip Float point value to limit the maximum data
|
||||
*/
|
||||
void dl_matrix3dq_relu_clip(dl_matrix3dq_t *in, fptp_t clip);
|
||||
|
||||
/**
|
||||
* @brief Do leaky relu for a quantized matrix
|
||||
*
|
||||
* @param in Input and output quantized matrix, data will be updated
|
||||
* @param alpha Float point value to multiply for those less than zero
|
||||
* @param clip Float point value to limit the maximum data
|
||||
*/
|
||||
void dl_matrix3dq_leaky_relu(dl_matrix3dq_t *in, fptp_t alpha, fptp_t clip);
|
||||
|
||||
/**
|
||||
* @brief Do prelu for a quantized matrix
|
||||
*
|
||||
* @param in Input and output quantized matrix, data will be updated
|
||||
* @param alpha Quantized matrix to multiply for those less than zero
|
||||
*/
|
||||
void dl_matrix3dq_p_relu(dl_matrix3dq_t *in, dl_matrix3dq_t *alpha);
|
||||
|
||||
//
|
||||
// Concat
|
||||
//
|
||||
/**
|
||||
* @brief Concatenate two quantized matrix in channel
|
||||
*
|
||||
* @param in_1 Quantized matrix to be concatenated
|
||||
* @param in_2 Quantized matrix to be concatenated
|
||||
* @return Quantized matrix with the same width and height of in_1 and in_2, and with the sum of channel number of in_1 and in_2
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_concat(dl_matrix3dq_t *in_1,
|
||||
dl_matrix3dq_t *in_2);
|
||||
|
||||
/**
|
||||
* @brief Concatenate four quantized matrix in channel
|
||||
*
|
||||
* @param in_1 Quantized matrix to be concatenated
|
||||
* @param in_2 Quantized matrix to be concatenated
|
||||
* @param in_3 Quantized matrix to be concatenated
|
||||
* @param in_4 Quantized matrix to be concatenated
|
||||
* @return Quantized matrix with the same width and height of all inputs, and with the sum of channel number of all inputs
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_concat_4(dl_matrix3dq_t *in_1,
|
||||
dl_matrix3dq_t *in_2,
|
||||
dl_matrix3dq_t *in_3,
|
||||
dl_matrix3dq_t *in_4);
|
||||
|
||||
/**
|
||||
* @brief Concatenate four quantized matrix in channel
|
||||
*
|
||||
* @param in_1 Quantized matrix to be concatenated
|
||||
* @param in_2 Quantized matrix to be concatenated
|
||||
* @param in_3 Quantized matrix to be concatenated
|
||||
* @param in_4 Quantized matrix to be concatenated
|
||||
* @param in_5 Quantized matrix to be concatenated
|
||||
* @param in_6 Quantized matrix to be concatenated
|
||||
* @param in_7 Quantized matrix to be concatenated
|
||||
* @param in_8 Quantized matrix to be concatenated
|
||||
* @return Quantized matrix with the same width and height of all inputs, and with the sum of channel number of all inputs
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_concat_8(dl_matrix3dq_t *in_1,
|
||||
dl_matrix3dq_t *in_2,
|
||||
dl_matrix3dq_t *in_3,
|
||||
@ -135,16 +234,42 @@ dl_matrix3dq_t *dl_matrix3dq_concat_8(dl_matrix3dq_t *in_1,
|
||||
//
|
||||
// Conv 1x1
|
||||
//
|
||||
/**
|
||||
* @brief Do 1x1 convolution with a quantized matrix
|
||||
*
|
||||
* @param out Preallocated quantized matrix, size (1, w, h, n)
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 1x1 filter, size (n, 1, 1, c)
|
||||
* @param mode Implementation mode
|
||||
*/
|
||||
void dl_matrix3dqq_conv_1x1(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with a quantized matrix, with relu activation
|
||||
*
|
||||
* @param out Preallocated quantized matrix, size (1, w, h, n)
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 1x1 filter, size (n, 1, 1, c)
|
||||
* @param mode Implementation mode
|
||||
*/
|
||||
void dl_matrix3dqq_conv_1x1_with_relu(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with a quantized matrix, with bias adding
|
||||
*
|
||||
* @param out Preallocated quantized matrix, size (1, w, h, n)
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 1x1 filter, size (n, 1, 1, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param mode Implementation mode
|
||||
* @param name Layer name to debug
|
||||
*/
|
||||
void dl_matrix3dqq_conv_1x1_with_bias(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
@ -152,23 +277,49 @@ void dl_matrix3dqq_conv_1x1_with_bias(dl_matrix3dq_t *out,
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
void dl_matrix3dqq_conv_1x1_with_prelu(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *prelu,
|
||||
dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with a quantized matrix, with bias adding and relu activation
|
||||
*
|
||||
* @param out Preallocated quantized matrix, size (1, w, h, n)
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 1x1 filter, size (n, 1, 1, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param mode Implementation mode
|
||||
*/
|
||||
void dl_matrix3dqq_conv_1x1_with_bias_relu(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_conv_mode mode);
|
||||
|
||||
void dl_matrix3dqq_conv_1x1_with_prelu(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *prelu,
|
||||
dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with an 8-bit fixed point matrix
|
||||
*
|
||||
* @param out Preallocated quantized matrix, size (1, w, h, n)
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 1x1 filter, size (n, 1, 1, c)
|
||||
* @param mode Implementation mode
|
||||
*/
|
||||
void dl_matrix3duq_conv_1x1(dl_matrix3dq_t *out,
|
||||
dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with an 8-bit fixed point matrix, with bias adding
|
||||
*
|
||||
* @param out Preallocated quantized matrix, size (1, w, h, n)
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 1x1 filter, size (n, 1, 1, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param mode Implementation mode
|
||||
*/
|
||||
void dl_matrix3duq_conv_1x1_with_bias(dl_matrix3dq_t *out,
|
||||
dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
@ -178,12 +329,32 @@ void dl_matrix3duq_conv_1x1_with_bias(dl_matrix3dq_t *out,
|
||||
//
|
||||
// Conv 3x3
|
||||
//
|
||||
/**
|
||||
* @brief Do 3x3 convolution basic operation with a quantized matrix
|
||||
*
|
||||
* @param out Preallocated quantized matrix
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
*/
|
||||
void dl_matrix3dqq_conv_3x3_op(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *filter,
|
||||
int stride_x,
|
||||
int stride_y);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 convolution with a quantized matrix
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
int stride_x,
|
||||
@ -191,6 +362,18 @@ dl_matrix3dq_t *dl_matrix3dqq_conv_3x3(dl_matrix3dq_t *in,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 convolution with a quantized matrix, with bias adding
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
@ -224,7 +407,7 @@ dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias_prelu(dl_matrix3du_t *in,
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Do a general CNN layer pass, dimension is (number, width, height, channel)
|
||||
* @brief Do a general convolution layer pass, size is (number, width, height, channel)
|
||||
*
|
||||
* @param in Input image
|
||||
* @param filter Weights of the neurons
|
||||
@ -245,6 +428,19 @@ dl_matrix3dq_t *dl_matrix3dqq_conv_common(dl_matrix3dq_t *in,
|
||||
int exponent,
|
||||
dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Do a general convolution layer pass for an 8-bit fixed point matrix, size is (number, width, height, channel)
|
||||
*
|
||||
* @param in Input image
|
||||
* @param filter Weights of the neurons
|
||||
* @param bias Bias for the CNN layer.
|
||||
* @param stride_x The step length of the convolution window in x(width) direction
|
||||
* @param stride_y The step length of the convolution window in y(height) direction
|
||||
* @param padding One of VALID or SAME
|
||||
* @param mode Do convolution using C implement or xtensa implement, 0 or 1, with respect.
|
||||
* If ESP_PLATFORM is not defined, this value is not used.
|
||||
* @return The result of CNN layer.
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3duq_conv_common(dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
@ -257,6 +453,17 @@ dl_matrix3dq_t *dl_matrix3duq_conv_common(dl_matrix3du_t *in,
|
||||
//
|
||||
// Depthwise 3x3
|
||||
//
|
||||
/**
|
||||
* @brief Do 3x3 depthwise convolution with an 8-bit fixed point matrix
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (1, 3, 3, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3duq_depthwise_conv_3x3(dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
int stride_x,
|
||||
@ -264,6 +471,17 @@ dl_matrix3dq_t *dl_matrix3duq_depthwise_conv_3x3(dl_matrix3du_t *in,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 depthwise convolution with a quantized matrix
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (1, 3, 3, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
int stride_x,
|
||||
@ -287,14 +505,45 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_3(dl_matrix3dq_t *in,
|
||||
int exponent);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 depthwise convolution with a quantized matrix, with bias adding
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (1, 3, 3, c)
|
||||
* @param bias Bias, size (1, 1, 1, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @param relu Whether to use relu activation
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu);
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 depthwise convolution with a quantized matrix, with bias adding and stride 1
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (1, 3, 3, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @param relu Whether to use relu activation
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3s1_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_prelu(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
@ -304,12 +553,6 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_prelu(dl_matrix3dq_t *in,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3s1_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu);
|
||||
|
||||
//
|
||||
// Depthwise Common
|
||||
@ -344,12 +587,28 @@ void dl_matrix3dqq_dot_product(dl_matrix3dq_t *out,
|
||||
//
|
||||
// FC
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Do fully connected layer forward.
|
||||
*
|
||||
* @param out Preallocated resulting matrix, size (1, 1, 1, h)
|
||||
* @param in Input matrix, size (1, 1, 1, w)
|
||||
* @param filter Filter matrix, size (1, w, h, 1)
|
||||
* @param mode Implementation mode
|
||||
*/
|
||||
void dl_matrix3dqq_fc(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Do fully connected layer forward, with bias adding
|
||||
*
|
||||
* @param out Preallocated resulting matrix, size (1, 1, 1, h)
|
||||
* @param in Input matrix, size (1, 1, 1, w)
|
||||
* @param filter Filter matrix, size (1, w, h, 1)
|
||||
* @param bias Bias matrix, size (1, 1, 1, h)
|
||||
* @param mode Implementation mode
|
||||
*/
|
||||
void dl_matrix3dqq_fc_with_bias(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
@ -360,7 +619,28 @@ void dl_matrix3dqq_fc_with_bias(dl_matrix3dq_t *out,
|
||||
//
|
||||
// Mobilefaceblock
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Do mobilefacenet process with splited pointwise 1x1 convolution, the process sequence is 1x1 pointwise->bn->relu->3x3 depthwise->bn->relu->1x1 pointwise->bn
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param pw_1 Pointwise 1x1 filter, size (n1/2, 1, 1, c)
|
||||
* @param pw_2 Pointwise 1x1 filter, size (n1/2, 1, 1, c)
|
||||
* @param pw_bias Pointwise bias, size (1, 1, 1, n1)
|
||||
* @param dw Depthwise 3x3 filter, size (1, 3, 3, n1)
|
||||
* @param dw_bias Depthwise bias, size (1, 1, 1, n1)
|
||||
* @param pw_linear_1 Pointwise 1x1 filter, size (n2/2, 1, 1, n1)
|
||||
* @param pw_linear_2 Pointwise 1x1 filter, size (n2/2, 1, 1, n1)
|
||||
* @param pw_linear_bias Pointwise bias, size (1, 1, 1, n2)
|
||||
* @param pw_exponent Exponent for pointwise resulting matrix
|
||||
* @param dw_exponent Exponent for depthwise resulting matrix
|
||||
* @param pw_linear_exponent Exponent for pointwise resulting matrix
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param mode Implementation mode
|
||||
* @param shortcut Whether has a shortcut at pointwise linear
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_split(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *pw_1,
|
||||
dl_matrix3dq_t *pw_2,
|
||||
@ -379,6 +659,26 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_split(dl_matrix3dq_t *in,
|
||||
dl_conv_mode mode,
|
||||
int shortcut);
|
||||
|
||||
/**
|
||||
* @brief Do mobilefacenet process, the process sequence is 1x1 pointwise->bn->relu->3x3 depthwise->bn->relu->1x1 pointwise->bn
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param pw Pointwise 1x1 filter, size (n1, 1, 1, c)
|
||||
* @param pw_bias Pointwise bias, size (1, 1, 1, n1)
|
||||
* @param dw Depthwise 3x3 filter, size (1, 3, 3, n1)
|
||||
* @param dw_bias Depthwise bias, size (1, 1, 1, n1)
|
||||
* @param pw_linear Pointwise 1x1 filter, size (n2, 1, 1, n1)
|
||||
* @param pw_linear_bias Pointwise bias, size (1, 1, 1, n2)
|
||||
* @param pw_exponent Exponent for pointwise resulting matrix
|
||||
* @param dw_exponent Exponent for depthwise resulting matrix
|
||||
* @param pw_linear_exponent Exponent for pointwise resulting matrix
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param mode Implementation mode
|
||||
* @param shortcut Whether has a shortcut at pointwise linear
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *pw,
|
||||
dl_matrix3dq_t *pw_bias,
|
||||
@ -399,6 +699,19 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock(dl_matrix3dq_t *in,
|
||||
// Mobilenet
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Do mobilenet process, the process sequence is 1x1 dilated->prelu->3x3 depthwise->prelu->1x1 compress->bias
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param dilate Pointwise 1x1 filter, size (n1, 1, 1, c)
|
||||
* @param dilate_prelu Pointwise prelu, size (1, 1, 1, n1)
|
||||
* @param depthwise Depthwise 3x3 filter, size (1, 3, 3, n1)
|
||||
* @param depthwise_prelu Depthwise prelu, size (1, 1, 1, n1)
|
||||
* @param compress Pointwise 1x1 filter, size (n2, 1, 1, n1)
|
||||
* @param bias Pointwise bias, size (1, 1, 1, n2)
|
||||
* @param config Mobilenet configuration
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_mobilenet(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *dilate,
|
||||
dl_matrix3dq_t *dilate_prelu,
|
||||
@ -409,6 +722,19 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilenet(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_mobilenet_config_t config,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do mobilenet process, the process sequence is 1x1 dilated->prelu->3x3 depthwise->prelu->1x1 compress->bias
|
||||
*
|
||||
* @param in Input matrix, 8-bit fixed point, size (1, w, h, c)
|
||||
* @param dilate Pointwise 1x1 filter, size (n1, 1, 1, c)
|
||||
* @param dilate_prelu Pointwise prelu, size (1, 1, 1, n1)
|
||||
* @param depthwise Depthwise 3x3 filter, size (1, 3, 3, n1)
|
||||
* @param depthwise_prelu Depthwise prelu, size (1, 1, 1, n1)
|
||||
* @param compress Pointwise 1x1 filter, size (n2, 1, 1, n1)
|
||||
* @param bias Pointwise bias, size (1, 1, 1, n2)
|
||||
* @param config Mobilenet configuration
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3duq_mobilenet(dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *dilate,
|
||||
dl_matrix3dq_t *dilate_prelu,
|
||||
@ -444,5 +770,10 @@ dl_error_type dl_matrix3duq_padding(dl_matrix3du_t **padded_in,
|
||||
//
|
||||
// Pooling
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief Calculate average value of a feature map
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @return Resulting matrix, size (1, 1, 1, c)
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_global_pool(dl_matrix3dq_t *in);
|
||||
|
@ -9,23 +9,47 @@ extern "C"
|
||||
#include "dl_lib_matrix3dq.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param in
|
||||
* @return dl_matrix3d_t*
|
||||
* @brief Forward the face recognition process with frmn model. Calculate in float.
|
||||
*
|
||||
* @param in Image matrix, rgb888 format, size is 56x56, normalized
|
||||
* @return dl_matrix3d_t* Face ID feature vector, size is 512
|
||||
*/
|
||||
dl_matrix3d_t *frmn(dl_matrix3d_t *in);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param in
|
||||
* @return dl_matrix3dq_t*
|
||||
* @brief Forward the face recognition process with frmn model. Calculate in quantization.
|
||||
*
|
||||
* @param in Image matrix, rgb888 format, size is 56x56, normalized
|
||||
* @param mode 0: C implement; 1: handwrite xtensa instruction implement
|
||||
* @return Face ID feature vector, size is 512
|
||||
*/
|
||||
dl_matrix3dq_t *frmn_q(dl_matrix3dq_t *in, dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Forward the face recognition process with frmn2 model. Calculate in quantization.
|
||||
*
|
||||
* @param in Image matrix, rgb888 format, size is 56x56, normalized
|
||||
* @param mode 0: C implement; 1: handwrite xtensa instruction implement
|
||||
* @return Face ID feature vector, size is 512
|
||||
*/
|
||||
dl_matrix3dq_t *frmn2_q(dl_matrix3dq_t *in, dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Forward the face recognition process with frmn2p model. Calculate in quantization.
|
||||
*
|
||||
* @param in Image matrix, rgb888 format, size is 56x56, normalized
|
||||
* @param mode 0: C implement; 1: handwrite xtensa instruction implement
|
||||
* @return Face ID feature vector, size is 512
|
||||
*/
|
||||
dl_matrix3dq_t *frmn2p_q(dl_matrix3dq_t *in, dl_conv_mode mode);
|
||||
|
||||
/**
|
||||
* @brief Forward the face recognition process with frmn2c model. Calculate in quantization.
|
||||
*
|
||||
* @param in Image matrix, rgb888 format, size is 56x56, normalized
|
||||
* @param mode 0: C implement; 1: handwrite xtensa instruction implement
|
||||
* @return Face ID feature vector, size is 512
|
||||
*/
|
||||
dl_matrix3dq_t *frmn2c_q(dl_matrix3dq_t *in, dl_conv_mode mode);
|
||||
|
||||
#if __cplusplus
|
||||
|
@ -30,18 +30,33 @@ extern "C"
|
||||
#include "dl_lib_matrix3d.h"
|
||||
#include "dl_lib_matrix3dq.h"
|
||||
|
||||
/**
|
||||
* Detection results with MTMN.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
dl_matrix3d_t *category;
|
||||
dl_matrix3d_t *offset;
|
||||
dl_matrix3d_t *landmark;
|
||||
dl_matrix3d_t *category; /*!< Classification result after softmax, channel is 2 */
|
||||
dl_matrix3d_t *offset; /*!< Bounding box offset of 2 points: top-left and bottom-right, channel is 4 */
|
||||
dl_matrix3d_t *landmark; /*!< Offsets of 5 landmarks:
|
||||
* - Left eye
|
||||
* - Mouth leftside
|
||||
* - Nose
|
||||
* - Right eye
|
||||
* - Mouth rightside
|
||||
*
|
||||
* channel is 10
|
||||
* */
|
||||
} mtmn_net_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Free a mtmn_net_t
|
||||
*
|
||||
* @param p A mtmn_net_t pointer
|
||||
*
|
||||
*/
|
||||
|
||||
void mtmn_net_t_free(mtmn_net_t *p);
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ uint32_t esp_dport_access_sequence_reg_read(uint32_t reg);
|
||||
//only call in case of panic().
|
||||
void esp_dport_access_int_abort(void);
|
||||
|
||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
||||
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||
#define DPORT_STALL_OTHER_CPU_START()
|
||||
#define DPORT_STALL_OTHER_CPU_END()
|
||||
#define DPORT_INTERRUPT_DISABLE()
|
||||
@ -41,7 +41,7 @@ void esp_dport_access_int_abort(void);
|
||||
#else
|
||||
#define DPORT_STALL_OTHER_CPU_START() esp_dport_access_stall_other_cpu_start()
|
||||
#define DPORT_STALL_OTHER_CPU_END() esp_dport_access_stall_other_cpu_end()
|
||||
#define DPORT_INTERRUPT_DISABLE() unsigned int intLvl = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL)
|
||||
#define DPORT_INTERRUPT_DISABLE() unsigned int intLvl = XTOS_SET_INTLEVEL(CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL)
|
||||
#define DPORT_INTERRUPT_RESTORE() XTOS_RESTORE_JUST_INTLEVEL(intLvl)
|
||||
#endif
|
||||
|
||||
|
@ -28,10 +28,60 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||
|
||||
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||
|
||||
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||
|
||||
setting default visibility to hidden by adding
|
||||
-fvisibility=hidden (for gcc)
|
||||
or
|
||||
-xldscope=hidden (for sun cc)
|
||||
to CFLAGS
|
||||
|
||||
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||
|
||||
*/
|
||||
|
||||
#define CJSON_CDECL __cdecl
|
||||
#define CJSON_STDCALL __stdcall
|
||||
|
||||
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_EXPORT_SYMBOLS
|
||||
#endif
|
||||
|
||||
#if defined(CJSON_HIDE_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||
#endif
|
||||
#else /* !__WINDOWS__ */
|
||||
#define CJSON_CDECL
|
||||
#define CJSON_STDCALL
|
||||
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 7
|
||||
#define CJSON_VERSION_PATCH 1
|
||||
#define CJSON_VERSION_PATCH 12
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@ -74,55 +124,13 @@ typedef struct cJSON
|
||||
|
||||
typedef struct cJSON_Hooks
|
||||
{
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
typedef int cJSON_bool;
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 2 define options:
|
||||
|
||||
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||
|
||||
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||
|
||||
setting default visibility to hidden by adding
|
||||
-fvisibility=hidden (for gcc)
|
||||
or
|
||||
-xldscope=hidden (for sun cc)
|
||||
to CFLAGS
|
||||
|
||||
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||
|
||||
*/
|
||||
|
||||
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_EXPORT_SYMBOLS
|
||||
#endif
|
||||
|
||||
#if defined(CJSON_HIDE_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) type __stdcall
|
||||
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall
|
||||
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall
|
||||
#endif
|
||||
#else /* !WIN32 */
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||
* This is to prevent stack overflows. */
|
||||
#ifndef CJSON_NESTING_LIMIT
|
||||
@ -156,7 +164,7 @@ CJSON_PUBLIC(void) cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||
|
@ -20,6 +20,14 @@
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON_Utils__h
|
||||
#define cJSON_Utils__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "cJSON.h"
|
||||
|
||||
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
|
||||
@ -72,3 +80,9 @@ CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const obje
|
||||
/* Sorts the members of the object into alphabetical order. */
|
||||
CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
|
||||
CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -48,7 +48,7 @@ extern "C" {
|
||||
// After completing read operations, use DPORT_STALL_OTHER_CPU_END().
|
||||
// This method uses stall other CPU while reading DPORT registers.
|
||||
// Useful for compatibility, as well as for large consecutive readings.
|
||||
// This method is slower, but must be used if ROM functions or
|
||||
// This method is slower, but must be used if ROM functions or
|
||||
// other code is called which accesses DPORT without any other workaround.
|
||||
// *) The pre-readable APB register before reading the DPORT register
|
||||
// helps synchronize the operation of the two CPUs,
|
||||
@ -73,7 +73,7 @@ extern "C" {
|
||||
*/
|
||||
static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg)
|
||||
{
|
||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
||||
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||
return _DPORT_REG_READ(reg);
|
||||
#else
|
||||
return esp_dport_access_reg_read(reg);
|
||||
@ -106,7 +106,7 @@ static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg)
|
||||
*/
|
||||
static inline uint32_t IRAM_ATTR DPORT_SEQUENCE_REG_READ(uint32_t reg)
|
||||
{
|
||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
||||
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||
return _DPORT_REG_READ(reg);
|
||||
#else
|
||||
return esp_dport_access_sequence_reg_read(reg);
|
||||
@ -166,7 +166,7 @@ static inline uint32_t IRAM_ATTR DPORT_SEQUENCE_REG_READ(uint32_t reg)
|
||||
*/
|
||||
static inline uint32_t IRAM_ATTR DPORT_READ_PERI_REG(uint32_t reg)
|
||||
{
|
||||
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
|
||||
#if defined(BOOTLOADER_BUILD) || !defined(CONFIG_ESP32_DPORT_WORKAROUND) || !defined(ESP_PLATFORM)
|
||||
return _DPORT_REG_READ(reg);
|
||||
#else
|
||||
return esp_dport_access_reg_read(reg);
|
||||
|
@ -147,7 +147,7 @@
|
||||
|
||||
#define IS_DPORT_REG(_r) (((_r) >= DR_REG_DPORT_BASE) && (_r) <= DR_REG_DPORT_END)
|
||||
|
||||
#if !defined( BOOTLOADER_BUILD ) && !defined( CONFIG_FREERTOS_UNICORE ) && defined( ESP_PLATFORM )
|
||||
#if !defined( BOOTLOADER_BUILD ) && defined( CONFIG_ESP32_DPORT_WORKAROUND ) && defined( ESP_PLATFORM )
|
||||
#define ASSERT_IF_DPORT_REG(_r, OP) TRY_STATIC_ASSERT(!IS_DPORT_REG(_r), (Cannot use OP for DPORT registers use DPORT_##OP));
|
||||
#else
|
||||
#define ASSERT_IF_DPORT_REG(_r, OP)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,6 +2,7 @@
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Espressif IoT Development Framework Configuration
|
||||
#
|
||||
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000
|
||||
|
||||
#
|
||||
# SDK tool configuration
|
||||
@ -272,6 +273,12 @@ CONFIG_FRMN2C_QUANT=
|
||||
#
|
||||
# ESP32-specific
|
||||
#
|
||||
CONFIG_ESP32_REV_MIN_0=y
|
||||
CONFIG_ESP32_REV_MIN_1=
|
||||
CONFIG_ESP32_REV_MIN_2=
|
||||
CONFIG_ESP32_REV_MIN_3=
|
||||
CONFIG_ESP32_REV_MIN=0
|
||||
CONFIG_ESP32_DPORT_WORKAROUND=y
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_80=
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_160=
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
@ -386,6 +393,7 @@ CONFIG_DISABLE_BASIC_ROM_CONSOLE=
|
||||
CONFIG_ESP_TIMER_PROFILING=
|
||||
CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS=
|
||||
CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
|
||||
CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5
|
||||
|
||||
#
|
||||
# Wi-Fi
|
||||
|
Reference in New Issue
Block a user