diff --git a/platform.txt b/platform.txt index 1b92b64efa8..03ad7846273 100644 --- a/platform.txt +++ b/platform.txt @@ -23,7 +23,7 @@ compiler.prefix={build.tarch}-{build.target}-elf- # # ESP32 Support Start # -compiler.cpreprocessor.flags.esp32=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-3235-g3e370c4296" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions/freertos" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc/esp32" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32" "-I{compiler.sdk.path}/include/soc/esp32/include" "-I{compiler.sdk.path}/include/hal/esp32/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/hal/platform_port/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/include/esp32" "-I{compiler.sdk.path}/include/esp_rom/esp32" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/esp32/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_phy/include" "-I{compiler.sdk.path}/include/esp_phy/esp32/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/xtensa" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/esp_supplicant/include" "-I{compiler.sdk.path}/include/ieee802154/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32/include" "-I{compiler.sdk.path}/include/bt/common/api/include/api" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/blufi/include" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_lcd/include" "-I{compiler.sdk.path}/include/esp_lcd/interface" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/button/button/include" "-I{compiler.sdk.path}/include/json_parser" "-I{compiler.sdk.path}/include/json_parser/jsmn/include" "-I{compiler.sdk.path}/include/json_generator" "-I{compiler.sdk.path}/include/esp_schedule/include" "-I{compiler.sdk.path}/include/esp_rainmaker/include" "-I{compiler.sdk.path}/include/qrcode/include" "-I{compiler.sdk.path}/include/ws2812_led" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/include" "-I{compiler.sdk.path}/include/esp-face/include/tool" "-I{compiler.sdk.path}/include/esp-face/include/typedef" "-I{compiler.sdk.path}/include/esp-face/include/image" "-I{compiler.sdk.path}/include/esp-face/include/math" "-I{compiler.sdk.path}/include/esp-face/include/nn" "-I{compiler.sdk.path}/include/esp-face/include/layer" "-I{compiler.sdk.path}/include/esp-face/include/detect" "-I{compiler.sdk.path}/include/esp-face/include/model_zoo" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/include" "-I{compiler.sdk.path}/include/fb_gfx/include" +compiler.cpreprocessor.flags.esp32=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-3401-gb86fe0c66c" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions/freertos" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc/esp32" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32" "-I{compiler.sdk.path}/include/soc/esp32/include" "-I{compiler.sdk.path}/include/hal/esp32/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/hal/platform_port/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/include/esp32" "-I{compiler.sdk.path}/include/esp_rom/esp32" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/esp32/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_phy/include" "-I{compiler.sdk.path}/include/esp_phy/esp32/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/xtensa" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/esp_supplicant/include" "-I{compiler.sdk.path}/include/ieee802154/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32/include" "-I{compiler.sdk.path}/include/bt/common/api/include/api" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/blufi/include" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_lcd/include" "-I{compiler.sdk.path}/include/esp_lcd/interface" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/button/button/include" "-I{compiler.sdk.path}/include/json_parser" "-I{compiler.sdk.path}/include/json_parser/jsmn/include" "-I{compiler.sdk.path}/include/json_generator" "-I{compiler.sdk.path}/include/esp_schedule/include" "-I{compiler.sdk.path}/include/esp_rainmaker/include" "-I{compiler.sdk.path}/include/qrcode/include" "-I{compiler.sdk.path}/include/ws2812_led" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/include" "-I{compiler.sdk.path}/include/esp-face/include/tool" "-I{compiler.sdk.path}/include/esp-face/include/typedef" "-I{compiler.sdk.path}/include/esp-face/include/image" "-I{compiler.sdk.path}/include/esp-face/include/math" "-I{compiler.sdk.path}/include/esp-face/include/nn" "-I{compiler.sdk.path}/include/esp-face/include/layer" "-I{compiler.sdk.path}/include/esp-face/include/detect" "-I{compiler.sdk.path}/include/esp-face/include/model_zoo" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/include" "-I{compiler.sdk.path}/include/fb_gfx/include" compiler.c.elf.libs.esp32=-lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lbt -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_lcd -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lperfmon -lspiffs -lulp -lwifi_provisioning -lbutton -ljson_parser -ljson_generator -lesp_schedule -lesp_rainmaker -lqrcode -lws2812_led -lesp-dsp -lesp32-camera -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_lcd -lesp_local_ctrl -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lperfmon -lesp_adc_cal -lesp_hid -lfatfs -lwear_levelling -lopenssl -lspiffs -lesp_rainmaker -lmqtt -lwifi_provisioning -lprotocomm -lbt -lbtdm_app -lprotobuf-c -lmdns -lconsole -ljson -ljson_parser -ljson_generator -lesp_schedule -lqrcode -lcat_face_detect -lhuman_face_detect -ldl -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lesp_phy -lphy -lrtc -lesp_phy -lphy -lrtc -lxt_hal -lm -lnewlib -lstdc++ -lpthread -lgcc -lcxx -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -Wwrite-strings -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -Wwrite-strings -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu++11 -fexceptions -fno-rtti -MMD -c @@ -38,7 +38,7 @@ build.extra_flags.esp32=-DARDUINO_USB_CDC_ON_BOOT=0 # # ESP32S2 Support Start # -compiler.cpreprocessor.flags.esp32s2=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-3235-g3e370c4296" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions/freertos" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc/esp32s2" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32s2" "-I{compiler.sdk.path}/include/soc/esp32s2/include" "-I{compiler.sdk.path}/include/hal/esp32s2/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/hal/platform_port/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/include/esp32s2" "-I{compiler.sdk.path}/include/esp_rom/esp32s2" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32s2/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32s2/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32s2/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_phy/include" "-I{compiler.sdk.path}/include/esp_phy/esp32s2/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32s2" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/xtensa" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/esp_supplicant/include" "-I{compiler.sdk.path}/include/ieee802154/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/esp_lcd/include" "-I{compiler.sdk.path}/include/esp_lcd/interface" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32s2" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/usb/include" "-I{compiler.sdk.path}/include/touch_element/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/freertos/include/freertos" "-I{compiler.sdk.path}/include/arduino_tinyusb/tinyusb/src" "-I{compiler.sdk.path}/include/arduino_tinyusb/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/include" "-I{compiler.sdk.path}/include/esp-face/include/tool" "-I{compiler.sdk.path}/include/esp-face/include/typedef" "-I{compiler.sdk.path}/include/esp-face/include/image" "-I{compiler.sdk.path}/include/esp-face/include/math" "-I{compiler.sdk.path}/include/esp-face/include/nn" "-I{compiler.sdk.path}/include/esp-face/include/layer" "-I{compiler.sdk.path}/include/esp-face/include/detect" "-I{compiler.sdk.path}/include/esp-face/include/model_zoo" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/include" "-I{compiler.sdk.path}/include/fb_gfx/include" +compiler.cpreprocessor.flags.esp32s2=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-3401-gb86fe0c66c" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions/freertos" "-I{compiler.sdk.path}/include/freertos/port/xtensa/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc/esp32s2" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32s2/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32s2" "-I{compiler.sdk.path}/include/soc/esp32s2/include" "-I{compiler.sdk.path}/include/hal/esp32s2/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/hal/platform_port/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/include/esp32s2" "-I{compiler.sdk.path}/include/esp_rom/esp32s2" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32s2/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32s2/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32s2/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_phy/include" "-I{compiler.sdk.path}/include/esp_phy/esp32s2/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/xtensa" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32s2" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/xtensa" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/esp_supplicant/include" "-I{compiler.sdk.path}/include/ieee802154/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/esp_lcd/include" "-I{compiler.sdk.path}/include/esp_lcd/interface" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32s2" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/usb/include" "-I{compiler.sdk.path}/include/touch_element/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/freertos/include/freertos" "-I{compiler.sdk.path}/include/arduino_tinyusb/tinyusb/src" "-I{compiler.sdk.path}/include/arduino_tinyusb/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dotprod/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/support/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/hann/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_harris/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/blackman_nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/nuttall/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/windows/flat_top/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/iir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fir/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/add/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sub/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mul/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/addc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/mulc/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/math/sqrt/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/matrix/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/fft/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/dct/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/conv/include" "-I{compiler.sdk.path}/include/esp-dsp/modules/common/include" "-I{compiler.sdk.path}/include/esp-face/include" "-I{compiler.sdk.path}/include/esp-face/include/tool" "-I{compiler.sdk.path}/include/esp-face/include/typedef" "-I{compiler.sdk.path}/include/esp-face/include/image" "-I{compiler.sdk.path}/include/esp-face/include/math" "-I{compiler.sdk.path}/include/esp-face/include/nn" "-I{compiler.sdk.path}/include/esp-face/include/layer" "-I{compiler.sdk.path}/include/esp-face/include/detect" "-I{compiler.sdk.path}/include/esp-face/include/model_zoo" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/include" "-I{compiler.sdk.path}/include/fb_gfx/include" compiler.c.elf.libs.esp32s2=-lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_https_server -lesp_lcd -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lperfmon -lspiffs -lusb -ltouch_element -lulp -lwifi_provisioning -lesp-dsp -lesp32-camera -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_lcd -lesp_local_ctrl -lesp_https_server -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lmqtt -lperfmon -lusb -ltouch_element -lesp_adc_cal -lesp_hid -lfatfs -lwear_levelling -lopenssl -lspiffs -lwifi_provisioning -lprotocomm -lprotobuf-c -lmdns -lconsole -ljson -larduino_tinyusb -lcat_face_detect -lhuman_face_detect -ldl -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lesp_phy -lphy -lesp_phy -lphy -lxt_hal -lm -lnewlib -lstdc++ -lpthread -lgcc -lcxx -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32s2=-mlongcalls -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -Wwrite-strings -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32s2=-mlongcalls -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -Wwrite-strings -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu++11 -fexceptions -fno-rtti -MMD -c @@ -53,8 +53,8 @@ build.extra_flags.esp32s2=-DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} -DARDUIN # # ESP32C3 Support Start # -compiler.cpreprocessor.flags.esp32c3=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-3235-g3e370c4296" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions/freertos" "-I{compiler.sdk.path}/include/freertos/port/riscv/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc/esp32c3" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32c3" "-I{compiler.sdk.path}/include/soc/esp32c3/include" "-I{compiler.sdk.path}/include/hal/esp32c3/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/hal/platform_port/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/include/esp32c3" "-I{compiler.sdk.path}/include/esp_rom/esp32c3" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/include/riscv" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/riscv/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32c3/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32c3/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_phy/include" "-I{compiler.sdk.path}/include/esp_phy/esp32c3/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/riscv" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32c3" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/riscv" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/esp_supplicant/include" "-I{compiler.sdk.path}/include/ieee802154/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32c3/include" "-I{compiler.sdk.path}/include/bt/common/api/include/api" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/blufi/include" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/esp_lcd/include" "-I{compiler.sdk.path}/include/esp_lcd/interface" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32c3" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/fb_gfx/include" -compiler.c.elf.libs.esp32c3=-lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lbt -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_https_server -lesp_lcd -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lspiffs -lwifi_provisioning -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_lcd -lesp_local_ctrl -lesp_https_server -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lmqtt -lesp_adc_cal -lesp_hid -lfatfs -lwear_levelling -lopenssl -lspiffs -lwifi_provisioning -lprotocomm -lbt -lbtdm_app -lprotobuf-c -lmdns -lconsole -ljson -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lbtbb -lesp_phy -lphy -lbtbb -lesp_phy -lphy -lbtbb -lm -lnewlib -lstdc++ -lpthread -lgcc -lcxx -lapp_trace -lgcov -lapp_trace -lgcov -lc +compiler.cpreprocessor.flags.esp32c3=-DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -D_GNU_SOURCE -DIDF_VER="v4.4-dev-3401-gb86fe0c66c" -DESP_PLATFORM "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/newlib/platform_include" "-I{compiler.sdk.path}/include/freertos/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions/freertos" "-I{compiler.sdk.path}/include/freertos/port/riscv/include" "-I{compiler.sdk.path}/include/freertos/include/esp_additions" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc" "-I{compiler.sdk.path}/include/esp_hw_support/include/soc/esp32c3" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3" "-I{compiler.sdk.path}/include/esp_hw_support/port/esp32c3/private_include" "-I{compiler.sdk.path}/include/heap/include" "-I{compiler.sdk.path}/include/log/include" "-I{compiler.sdk.path}/include/lwip/include/apps" "-I{compiler.sdk.path}/include/lwip/include/apps/sntp" "-I{compiler.sdk.path}/include/lwip/lwip/src/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include" "-I{compiler.sdk.path}/include/lwip/port/esp32/include/arch" "-I{compiler.sdk.path}/include/soc/include" "-I{compiler.sdk.path}/include/soc/esp32c3" "-I{compiler.sdk.path}/include/soc/esp32c3/include" "-I{compiler.sdk.path}/include/hal/esp32c3/include" "-I{compiler.sdk.path}/include/hal/include" "-I{compiler.sdk.path}/include/hal/platform_port/include" "-I{compiler.sdk.path}/include/esp_rom/include" "-I{compiler.sdk.path}/include/esp_rom/include/esp32c3" "-I{compiler.sdk.path}/include/esp_rom/esp32c3" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/esp_system/port/soc" "-I{compiler.sdk.path}/include/esp_system/port/include/riscv" "-I{compiler.sdk.path}/include/esp_system/port/public_compat" "-I{compiler.sdk.path}/include/riscv/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32c3/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/esp_ringbuf/include" "-I{compiler.sdk.path}/include/efuse/include" "-I{compiler.sdk.path}/include/efuse/esp32c3/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_event/include" "-I{compiler.sdk.path}/include/esp_netif/include" "-I{compiler.sdk.path}/include/esp_eth/include" "-I{compiler.sdk.path}/include/tcpip_adapter/include" "-I{compiler.sdk.path}/include/esp_phy/include" "-I{compiler.sdk.path}/include/esp_phy/esp32c3/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/app_trace/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/mbedtls/port/include" "-I{compiler.sdk.path}/include/mbedtls/mbedtls/include" "-I{compiler.sdk.path}/include/mbedtls/esp_crt_bundle/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/bootloader_support/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/esp_gdbstub/include" "-I{compiler.sdk.path}/include/esp_gdbstub/riscv" "-I{compiler.sdk.path}/include/esp_gdbstub/esp32c3" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/espcoredump/include/port/riscv" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/esp_supplicant/include" "-I{compiler.sdk.path}/include/ieee802154/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/common/osi/include" "-I{compiler.sdk.path}/include/bt/include/esp32c3/include" "-I{compiler.sdk.path}/include/bt/common/api/include/api" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/blufi/include" "-I{compiler.sdk.path}/include/bt/common/btc/profile/esp/include" "-I{compiler.sdk.path}/include/bt/host/bluedroid/api/include/api" "-I{compiler.sdk.path}/include/cbor/port/include" "-I{compiler.sdk.path}/include/unity/include" "-I{compiler.sdk.path}/include/unity/unity/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/nghttp/port/include" "-I{compiler.sdk.path}/include/nghttp/nghttp2/lib/includes" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp-tls/esp-tls-crypto" "-I{compiler.sdk.path}/include/esp_adc_cal/include" "-I{compiler.sdk.path}/include/esp_hid/include" "-I{compiler.sdk.path}/include/tcp_transport/include" "-I{compiler.sdk.path}/include/esp_http_client/include" "-I{compiler.sdk.path}/include/esp_http_server/include" "-I{compiler.sdk.path}/include/esp_https_ota/include" "-I{compiler.sdk.path}/include/esp_https_server/include" "-I{compiler.sdk.path}/include/esp_lcd/include" "-I{compiler.sdk.path}/include/esp_lcd/interface" "-I{compiler.sdk.path}/include/protobuf-c/protobuf-c" "-I{compiler.sdk.path}/include/protocomm/include/common" "-I{compiler.sdk.path}/include/protocomm/include/security" "-I{compiler.sdk.path}/include/protocomm/include/transports" "-I{compiler.sdk.path}/include/mdns/include" "-I{compiler.sdk.path}/include/esp_local_ctrl/include" "-I{compiler.sdk.path}/include/sdmmc/include" "-I{compiler.sdk.path}/include/esp_serial_slave_link/include" "-I{compiler.sdk.path}/include/esp_websocket_client/include" "-I{compiler.sdk.path}/include/expat/expat/expat/lib" "-I{compiler.sdk.path}/include/expat/port/include" "-I{compiler.sdk.path}/include/wear_levelling/include" "-I{compiler.sdk.path}/include/fatfs/diskio" "-I{compiler.sdk.path}/include/fatfs/vfs" "-I{compiler.sdk.path}/include/fatfs/src" "-I{compiler.sdk.path}/include/freemodbus/common/include" "-I{compiler.sdk.path}/include/idf_test/include" "-I{compiler.sdk.path}/include/idf_test/include/esp32c3" "-I{compiler.sdk.path}/include/jsmn/include" "-I{compiler.sdk.path}/include/json/cJSON" "-I{compiler.sdk.path}/include/libsodium/libsodium/src/libsodium/include" "-I{compiler.sdk.path}/include/libsodium/port_include" "-I{compiler.sdk.path}/include/mqtt/esp-mqtt/include" "-I{compiler.sdk.path}/include/openssl/include" "-I{compiler.sdk.path}/include/spiffs/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/esp_littlefs/src" "-I{compiler.sdk.path}/include/esp_littlefs/include" "-I{compiler.sdk.path}/include/esp-face/include" "-I{compiler.sdk.path}/include/esp-face/include/tool" "-I{compiler.sdk.path}/include/esp-face/include/typedef" "-I{compiler.sdk.path}/include/esp-face/include/image" "-I{compiler.sdk.path}/include/esp-face/include/math" "-I{compiler.sdk.path}/include/esp-face/include/nn" "-I{compiler.sdk.path}/include/esp-face/include/layer" "-I{compiler.sdk.path}/include/esp-face/include/detect" "-I{compiler.sdk.path}/include/esp-face/include/model_zoo" "-I{compiler.sdk.path}/include/fb_gfx/include" +compiler.c.elf.libs.esp32c3=-lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lbt -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_https_server -lesp_lcd -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lspiffs -lwifi_provisioning -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_lcd -lesp_local_ctrl -lesp_https_server -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lmqtt -lesp_adc_cal -lesp_hid -lfatfs -lwear_levelling -lopenssl -lspiffs -lwifi_provisioning -lprotocomm -lbt -lbtdm_app -lprotobuf-c -lmdns -lconsole -ljson -lcat_face_detect -lhuman_face_detect -ldl -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -llwip -llog -lheap -lsoc -lesp_hw_support -lriscv -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lbtbb -lesp_phy -lphy -lbtbb -lesp_phy -lphy -lbtbb -lm -lnewlib -lstdc++ -lpthread -lgcc -lcxx -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32c3=-march=rv32imc -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -Wno-error=format= -nostartfiles -Wno-format -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32c3=-march=rv32imc -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -Wno-error=format= -nostartfiles -Wno-format -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu++11 -fno-exceptions -fno-rtti -MMD -c compiler.S.flags.esp32c3=-ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -Wno-error=format= -nostartfiles -Wno-format -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -x assembler-with-cpp -MMD -c diff --git a/tools/platformio-build-esp32.py b/tools/platformio-build-esp32.py index 083169f60d9..206b17a71ad 100644 --- a/tools/platformio-build-esp32.py +++ b/tools/platformio-build-esp32.py @@ -300,7 +300,7 @@ "UNITY_INCLUDE_CONFIG_H", "WITH_POSIX", "_GNU_SOURCE", - ("IDF_VER", '\\"v4.4-dev-3235-g3e370c4296\\"'), + ("IDF_VER", '\\"v4.4-dev-3401-gb86fe0c66c\\"'), "ESP_PLATFORM", "ARDUINO_ARCH_ESP32", "ESP32", diff --git a/tools/platformio-build-esp32c3.py b/tools/platformio-build-esp32c3.py index 63680ad42a9..f53295e3267 100644 --- a/tools/platformio-build-esp32c3.py +++ b/tools/platformio-build-esp32c3.py @@ -263,6 +263,15 @@ join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wifi_provisioning", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_littlefs", "src"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_littlefs", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "tool"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "typedef"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "image"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "math"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "nn"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "layer"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "detect"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "model_zoo"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "fb_gfx", "include"), join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core")) ], @@ -273,7 +282,7 @@ ], LIBS=[ - "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lbt", "-lcbor", "-lunity", "-lcmock", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lesp_https_server", "-lesp_lcd", "-lprotobuf-c", "-lprotocomm", "-lmdns", "-lesp_local_ctrl", "-lsdmmc", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lwear_levelling", "-lfatfs", "-lfreemodbus", "-ljsmn", "-ljson", "-llibsodium", "-lmqtt", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_lcd", "-lesp_local_ctrl", "-lesp_https_server", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lesp_adc_cal", "-lesp_hid", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lprotocomm", "-lbt", "-lbtdm_app", "-lprotobuf-c", "-lmdns", "-lconsole", "-ljson", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lm", "-lnewlib", "-lstdc++", "-lpthread", "-lgcc", "-lcxx", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc" + "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lbt", "-lcbor", "-lunity", "-lcmock", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lesp_https_server", "-lesp_lcd", "-lprotobuf-c", "-lprotocomm", "-lmdns", "-lesp_local_ctrl", "-lsdmmc", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lwear_levelling", "-lfatfs", "-lfreemodbus", "-ljsmn", "-ljson", "-llibsodium", "-lmqtt", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_lcd", "-lesp_local_ctrl", "-lesp_https_server", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lesp_adc_cal", "-lesp_hid", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lprotocomm", "-lbt", "-lbtdm_app", "-lprotobuf-c", "-lmdns", "-lconsole", "-ljson", "-lcat_face_detect", "-lhuman_face_detect", "-ldl", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lm", "-lnewlib", "-lstdc++", "-lpthread", "-lgcc", "-lcxx", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc" ], CPPDEFINES=[ @@ -282,7 +291,7 @@ "UNITY_INCLUDE_CONFIG_H", "WITH_POSIX", "_GNU_SOURCE", - ("IDF_VER", '\\"v4.4-dev-3235-g3e370c4296\\"'), + ("IDF_VER", '\\"v4.4-dev-3401-gb86fe0c66c\\"'), "ESP_PLATFORM", "ARDUINO_ARCH_ESP32", "ESP32", diff --git a/tools/platformio-build-esp32s2.py b/tools/platformio-build-esp32s2.py index dac966a52b0..393cc493630 100644 --- a/tools/platformio-build-esp32s2.py +++ b/tools/platformio-build-esp32s2.py @@ -286,7 +286,7 @@ "UNITY_INCLUDE_CONFIG_H", "WITH_POSIX", "_GNU_SOURCE", - ("IDF_VER", '\\"v4.4-dev-3235-g3e370c4296\\"'), + ("IDF_VER", '\\"v4.4-dev-3401-gb86fe0c66c\\"'), "ESP_PLATFORM", "ARDUINO_ARCH_ESP32", "ESP32", diff --git a/tools/sdk/esp32/include/asio/port/include/esp_asio_config.h b/tools/sdk/esp32/include/asio/port/include/esp_asio_config.h index cba316527e6..3f3a9b03ed4 100644 --- a/tools/sdk/esp32/include/asio/port/include/esp_asio_config.h +++ b/tools/sdk/esp32/include/asio/port/include/esp_asio_config.h @@ -18,6 +18,11 @@ # define ASIO_NO_TYPEID # endif // CONFIG_COMPILER_RTTI +// +// Supress OpenSSL deprecation warning, when building ASIO +// +#define ESP_OPENSSL_SUPPRESS_LEGACY_WARNING + // // LWIP compatibility inet and address macros/functions // diff --git a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_block_internal.h b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_block_internal.h index 9abe81557fa..b7ad0a554cc 100644 --- a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_block_internal.h +++ b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_block_internal.h @@ -191,6 +191,9 @@ int coap_handle_response_get_block(coap_context_t *context, void coap_block_delete_lg_xmit(coap_session_t *session, coap_lg_xmit_t *lg_xmit); +coap_tick_t coap_block_check_lg_xmit_timeouts(coap_session_t *session, + coap_tick_t now); + /** * The function that does all the work for the coap_add_data_large*() * functions. diff --git a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_dtls.h b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_dtls.h index cbd369dfce6..fc30445431d 100644 --- a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_dtls.h +++ b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_dtls.h @@ -27,6 +27,12 @@ typedef struct coap_dtls_pki_t coap_dtls_pki_t; #ifndef COAP_DTLS_HINT_LENGTH #define COAP_DTLS_HINT_LENGTH 128 #endif +#ifndef COAP_DTLS_MAX_PSK_IDENTITY +#define COAP_DTLS_MAX_PSK_IDENTITY 64 +#endif +#ifndef COAP_DTLS_MAX_PSK +#define COAP_DTLS_MAX_PSK 64 +#endif typedef enum coap_dtls_role_t { COAP_DTLS_ROLE_CLIENT, /**< Internal function invoked for client */ diff --git a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_event.h b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_event.h index 89b2a63967c..b6ea60524a2 100644 --- a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_event.h +++ b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_event.h @@ -24,34 +24,34 @@ * Scalar type to represent different events, e.g. DTLS events or * retransmission timeouts. */ - typedef unsigned int coap_event_t; - +typedef enum coap_event_t { /** * (D)TLS events for COAP_PROTO_DTLS and COAP_PROTO_TLS */ -#define COAP_EVENT_DTLS_CLOSED 0x0000 -#define COAP_EVENT_DTLS_CONNECTED 0x01DE -#define COAP_EVENT_DTLS_RENEGOTIATE 0x01DF -#define COAP_EVENT_DTLS_ERROR 0x0200 + COAP_EVENT_DTLS_CLOSED = 0x0000, + COAP_EVENT_DTLS_CONNECTED = 0x01DE, + COAP_EVENT_DTLS_RENEGOTIATE = 0x01DF, + COAP_EVENT_DTLS_ERROR = 0x0200, /** * TCP events for COAP_PROTO_TCP and COAP_PROTO_TLS */ -#define COAP_EVENT_TCP_CONNECTED 0x1001 -#define COAP_EVENT_TCP_CLOSED 0x1002 -#define COAP_EVENT_TCP_FAILED 0x1003 + COAP_EVENT_TCP_CONNECTED = 0x1001, + COAP_EVENT_TCP_CLOSED = 0x1002, + COAP_EVENT_TCP_FAILED = 0x1003, /** * CSM exchange events for reliable protocols only */ -#define COAP_EVENT_SESSION_CONNECTED 0x2001 -#define COAP_EVENT_SESSION_CLOSED 0x2002 -#define COAP_EVENT_SESSION_FAILED 0x2003 + COAP_EVENT_SESSION_CONNECTED = 0x2001, + COAP_EVENT_SESSION_CLOSED = 0x2002, + COAP_EVENT_SESSION_FAILED = 0x2003, /** - * BLOCK2 receive errors + * (Q-)BLOCK receive errors */ -#define COAP_EVENT_PARTIAL_BLOCK 0x3001 + COAP_EVENT_PARTIAL_BLOCK = 0x3001 +} coap_event_t; /** * Type for event handler functions that can be registered with a CoAP diff --git a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_time.h b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_time.h index baa8650eaff..99d117a4eb7 100644 --- a/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_time.h +++ b/tools/sdk/esp32/include/coap/libcoap/include/coap3/coap_time.h @@ -88,7 +88,11 @@ COAP_STATIC_INLINE uint64_t coap_ticks_to_rt_us(coap_tick_t t) { #elif defined(RIOT_VERSION) #include +#ifdef XTIMER_HZ #define COAP_TICKS_PER_SECOND (XTIMER_HZ) +#else /* XTIMER_HZ */ +#define COAP_TICKS_PER_SECOND (XTIMER_HZ_BASE) +#endif /* XTIMER_HZ */ typedef uint64_t coap_tick_t; typedef int64_t coap_tick_diff_t; diff --git a/tools/sdk/esp32/include/coap/libcoap/include/coap3/net.h b/tools/sdk/esp32/include/coap/libcoap/include/coap3/net.h index 577a0b5d5a5..ea5a2cba1bb 100644 --- a/tools/sdk/esp32/include/coap/libcoap/include/coap3/net.h +++ b/tools/sdk/esp32/include/coap/libcoap/include/coap3/net.h @@ -15,6 +15,7 @@ #include #include #ifndef _WIN32 +#include #include #endif #include diff --git a/tools/sdk/esp32/include/coap/libcoap/include/coap3/pdu.h b/tools/sdk/esp32/include/coap/libcoap/include/coap3/pdu.h index a22869b69ed..8031a1c2c40 100644 --- a/tools/sdk/esp32/include/coap/libcoap/include/coap3/pdu.h +++ b/tools/sdk/esp32/include/coap/libcoap/include/coap3/pdu.h @@ -299,7 +299,6 @@ typedef enum coap_pdu_code_t { COAP_REQUEST_CODE_PATCH = COAP_REQUEST_PATCH, COAP_REQUEST_CODE_IPATCH = COAP_REQUEST_IPATCH, - COAP_RESPONSE_CODE_OK = COAP_RESPONSE_CODE(200), COAP_RESPONSE_CODE_CREATED = COAP_RESPONSE_CODE(201), COAP_RESPONSE_CODE_DELETED = COAP_RESPONSE_CODE(202), COAP_RESPONSE_CODE_VALID = COAP_RESPONSE_CODE(203), diff --git a/tools/sdk/esp32/include/coap/libcoap/include/coap3/resource.h b/tools/sdk/esp32/include/coap/libcoap/include/coap3/resource.h index 2cd9aea48fa..5cf7751f67e 100644 --- a/tools/sdk/esp32/include/coap/libcoap/include/coap3/resource.h +++ b/tools/sdk/esp32/include/coap/libcoap/include/coap3/resource.h @@ -83,7 +83,8 @@ typedef void (*coap_method_handler_t) * variable of coap_str_const_t has to point to constant text, or point to data * within the allocated coap_str_const_t parameter. * - * @param uri_path The string URI path of the new resource. + * @param uri_path The string URI path of the new resource. The leading '/' is + * not normally required - e.g. just "full/path/for/resource". * @param flags Flags for memory management (in particular release of * memory). Possible values:@n * diff --git a/tools/sdk/esp32/include/config/sdkconfig.h b/tools/sdk/esp32/include/config/sdkconfig.h index b57d1022057..084b3a554b5 100644 --- a/tools/sdk/esp32/include/config/sdkconfig.h +++ b/tools/sdk/esp32/include/config/sdkconfig.h @@ -26,6 +26,7 @@ #define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 #define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1 +#define CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR 1 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "40m" @@ -369,6 +370,7 @@ #define CONFIG_LWIP_GARP_TMR_INTERVAL 60 #define CONFIG_LWIP_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_LWIP_DHCP_RESTORE_LAST_IP 1 +#define CONFIG_LWIP_DHCP_OPTIONS_LEN 68 #define CONFIG_LWIP_DHCPS 1 #define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 #define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 @@ -480,6 +482,7 @@ #define CONFIG_MDNS_TASK_AFFINITY 0x0 #define CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS 2000 #define CONFIG_MDNS_TIMER_PERIOD_MS 100 +#define CONFIG_MDNS_MULTIPLE_INSTANCE 1 #define CONFIG_MQTT_PROTOCOL_311 1 #define CONFIG_MQTT_TRANSPORT_SSL 1 #define CONFIG_MQTT_TRANSPORT_WEBSOCKET 1 @@ -675,5 +678,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 "3e370c4296" +#define CONFIG_ARDUINO_IDF_COMMIT "b86fe0c66c" #define CONFIG_ARDUINO_IDF_BRANCH "master" diff --git a/tools/sdk/esp32/include/driver/include/driver/rmt.h b/tools/sdk/esp32/include/driver/include/driver/rmt.h index a7e2aad5f24..bc07954a080 100644 --- a/tools/sdk/esp32/include/driver/include/driver/rmt.h +++ b/tools/sdk/esp32/include/driver/include/driver/rmt.h @@ -856,16 +856,35 @@ esp_err_t rmt_remove_channel_from_group(rmt_channel_t channel); #if SOC_RMT_SUPPORT_TX_LOOP_COUNT /** - * @brief Set loop count for RMT TX channel + * @brief Set loop count threshold value for RMT TX channel + * + * When tx loop count reaches this value, an ISR callback will notify user * * @param channel RMT channel - * @param count loop count + * @param count loop count, 1 ~ 1023 * @return * - ESP_ERR_INVALID_ARG Parameter error * - ESP_OK Success */ esp_err_t rmt_set_tx_loop_count(rmt_channel_t channel, uint32_t count); -#endif + +/** + * @brief Enable or disable the feature that when loop count reaches the threshold, RMT will stop transmitting. + * + * - When the loop auto-stop feature is enabled will halt RMT transmission after the loop count reaches a certain threshold + * - When disabled, the RMT transmission continue indefinitely until halted by the users + * + * @note The auto-stop feature is implemented in hardware on particular targets (i.e. those with SOC_RMT_SUPPORT_TX_LOOP_AUTOSTOP defined). + * Otherwise, the auto-stop feature is implemented in software via the interrupt. + * + * @param channel RMT channel + * @param en enable bit + * @return + * - ESP_ERR_INVALID_ARG Parameter error + * - ESP_OK Success + */ +esp_err_t rmt_enable_tx_loop_autostop(rmt_channel_t channel, bool en); +#endif // SOC_RMT_SUPPORT_TX_LOOP_COUNT /** * @brief Reset RMT TX/RX memory index. diff --git a/tools/sdk/esp32/include/esp-face/include/dl_define.hpp b/tools/sdk/esp32/include/esp-face/include/dl_define.hpp index 16eb0881562..7809768a5bc 100644 --- a/tools/sdk/esp32/include/esp-face/include/dl_define.hpp +++ b/tools/sdk/esp32/include/esp-face/include/dl_define.hpp @@ -10,7 +10,7 @@ #define DL_LOG_LAYER_LATENCY 0 /**/ - PADDING_SAME, /**/ - PADDING_SAME_MXNET /**/ + PADDING_NOT_SET, + PADDING_VALID, /**/ + PADDING_SAME_BEGIN, /**/ + PADDING_SAME_END, /**/ } padding_type_t; -} // namespace dl \ No newline at end of file + + typedef enum + { + CONSTANT, + EDGE, + REFLECT, + SYMMETRIC, + } padding_mode_t; +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/image/dl_image.hpp b/tools/sdk/esp32/include/esp-face/include/image/dl_image.hpp index c7fecdc49cc..4a974df063a 100644 --- a/tools/sdk/esp32/include/esp-face/include/image/dl_image.hpp +++ b/tools/sdk/esp32/include/esp-face/include/image/dl_image.hpp @@ -370,11 +370,70 @@ namespace dl */ uint32_t get_moving_point_number(uint8_t *f1, uint8_t *f2, const uint32_t height, const uint32_t width, const uint32_t stride, const uint32_t threshold = 5); - + /** + * @brief Apply an affine transformation to an image. + * + * @tparam T + * @param input the input image. + * @param output the output image. + * @param M_inv the inverse transformation matrix. + */ template void warp_affine(dl::Tensor *input, dl::Tensor *output, dl::math::Matrix *M_inv); + + /** + * @brief Apply an affine transformation to an image. + * + * @tparam T + * @param input the pointer of the input image. + * @param shape the shape of the input image. + * @param output the output image. + * @param M_inv the inverse transformation matrix. + */ template void warp_affine(uint16_t *input, std::vector shape, dl::Tensor *output, dl::math::Matrix *M_inv); + /** + * @brief Get the otsu thresh object. + * + * @param image the gray image. + * @return uint8_t the otsu thresh. + */ + uint8_t get_otsu_thresh(Tensor &image); + + /** + * @brief Convert RGB image to gray image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @return Tensor* output image in gray format + */ + Tensor *rgb2gray(Tensor &image, bool bgr = false); + + /** + * @brief Convert RGB image to LAB image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @param fast true: use the fast alogrithm, but the accuracy will be reduced + * false: do not use the fast alogrithm + * @return Tensor* output image in LAB foramt + */ + Tensor *rgb2lab(Tensor &image, bool bgr = false, bool fast = true); + + /** + * @brief Convert RGB image to HSV image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @param fast true: use the fast alogrithm, but the accuracy will be reduced + * false: do not use the fast alogrithm + * @return Tensor* output image in HSV format + */ + Tensor *rgb2hsv(Tensor &image, bool bgr = false, bool fast = true); + } // namespace image } // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_add2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_add2d.hpp index f0c5964b3d1..c43282b42de 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_add2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_add2d.hpp @@ -25,7 +25,8 @@ namespace dl const int output_exponent; /**/ Tensor *output; /**/ bool inplace; /**/ + false: the output will store to a separate memory >*/ + std::vector output_shape; /**/ public: /** @@ -35,19 +36,21 @@ namespace dl * @param activation activation of add2d, if you don't specify anything, no activation is applied * @param name name of add2d * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Add2D(const int output_exponent, const Activation *activation = NULL, const char *name = NULL, bool inplace = false) : Layer(name), activation(activation), output_exponent(output_exponent), output(NULL) - { - this->inplace = inplace; - } + Add2D(const int output_exponent, const Activation *activation = NULL, const char *name = "Add2D", bool inplace = false) : Layer(name), + activation(activation), + output_exponent(output_exponent), + output(NULL), + inplace(inplace), + output_shape({}) {} /** * @brief Destroy the Add2D object */ ~Add2D() { - if((!this->inplace) && (this->output != NULL)) + if ((!this->inplace) && (this->output != NULL)) { delete this->output; } @@ -59,10 +62,12 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; if (!this->inplace) { @@ -78,6 +83,11 @@ namespace dl { this->output = &input0; } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -105,7 +115,11 @@ namespace dl if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -116,6 +130,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::add2d(*this->output, input0, input1, this->activation, assign_core, this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "add2d"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp index f78b262beb9..8a9aaa8dfbe 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp @@ -24,23 +24,26 @@ namespace dl std::vector filter_shape; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ + const padding_type_t padding_type; /**/ std::vector padding; /**/ - Tensor *output; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new AvgPool2D object. * * @param output_exponent exponent of output * @param filter_shape filter shape in [filter_height, filter_width] - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y stride in height * @param stride_x stride in width * @param name name of layer @@ -48,16 +51,23 @@ namespace dl AvgPool2D(const int output_exponent, const std::vector filter_shape, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - output_exponent(output_exponent), - filter_shape(filter_shape), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type) + const char *name = "AvgPool2D") : Layer(name), + output_exponent(output_exponent), + filter_shape(filter_shape), + padding_type(padding_type), + padding(padding), + stride_y(stride_y), + stride_x(stride_x), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** @@ -66,7 +76,7 @@ namespace dl */ ~AvgPool2D() { - if(this->output != NULL) + if (this->output != NULL) { delete this->output; } @@ -76,20 +86,31 @@ namespace dl * @brief Update output shape and padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); - std::vector output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - this->output->set_shape(output_shape); + assert(input.shape.size() == 3); + + this->output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); - this->padding = nn::get_pad_size(output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); + } + this->output->free_element(); - } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } /** * @brief Get the output @@ -108,7 +129,6 @@ namespace dl * @param autoload_enable one of true or false, * - true: load input and output from PSRAM to CACHE automatically * - false: do not - * @param assign_core not effective yet * @return AvgPool2D result */ Tensor &call(Tensor &input, uint8_t autoload_enable = 0) @@ -116,7 +136,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_base.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_base.hpp index 5c7d28d52b1..b265b454538 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_base.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_base.hpp @@ -1,6 +1,7 @@ #pragma once #include "dl_tool.hpp" #include "dl_tool_cache.hpp" +#include namespace dl { diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_concat.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_concat.hpp new file mode 100644 index 00000000000..35ebe652e53 --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_concat.hpp @@ -0,0 +1,139 @@ +#pragma once + +#include +#include + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" +#include "dl_nn_concat.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Concat(input1, input2, input3, ...). + * + * @tparam feature_t support all kinds of integer and float data type + */ + template + class Concat : Layer + { + private: + int output_exponent; /**/ + int axis; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Concat object. + * + * @param name name of layer + * @param axis The axis along which the Tensor will be concatenated. + */ + Concat(int axis, const char *name = "Concat") : Layer(name), axis(axis), output_shape({}) + { + this->output = new Tensor; + } + + /** + * @brief Destroy the Concat object + */ + ~Concat() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Collect inputs' channel and memory offset, called in Model.build(). + * + * @param args pointers of concatenated Tensor + * @param print_shape whether to print the output shape. + */ + void build(std::vector *> args, bool print_shape = false) + { + assert(args.size() > 1); + int shape_size = args[0]->shape.size(); + + if (this->axis < 0) + { + this->axis = shape_size + this->axis; + } + assert((this->axis < shape_size) && (this->axis > -1)); + + int output_shape_axis = args[0]->shape[this->axis]; + + for (int i = 1; i < args.size(); i++) + { + assert(shape_size == args[i]->shape.size()); + assert(args[i]->exponent == args[i - 1]->exponent); + output_shape_axis += args[i]->shape[this->axis]; + + for (int j = 0; j < shape_size; j++) + { + if (j != this->axis) + { + assert(args[i]->shape[j] == args[i - 1]->shape[j]); + } + } + } + + this->output_exponent = args[0]->exponent; + this->output_shape = args[0]->shape; + this->output_shape[this->axis] = output_shape_axis; + + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Call Concat operation + * + * @param inputs the pointers of inputs + * @param free_inputs true: free the inputs after call + * false: do not free inputs + * @return Tensor& concat result + */ + Tensor &call(std::vector *> inputs, bool free_inputs = false) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::concat(*this->output, inputs, this->axis, free_inputs); + DL_LOG_LAYER_LATENCY_END(this->name, "concat"); + return *this->output; + } + + /** + * @brief Get the output + * + * @return Tensor& Concat result + */ + Tensor &get_output() + { + return *this->output; + } + }; + } // namespace layer +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_conv2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_conv2d.hpp index a7c2229db09..038dd6cd79f 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_conv2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_conv2d.hpp @@ -13,8 +13,11 @@ namespace dl * @tparam feature_t supports int16_t and int8_t, * - int16_t: stands for operation in int16_t quantize * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization */ - template + template class Conv2D : public Layer { private: @@ -22,14 +25,14 @@ namespace dl const Filter *filter; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ - const Bias *bias; /**/ + const padding_type_t padding_type; /**/ + const Bias *bias; /**/ const Activation *activation; /**/ std::vector padding; /**/ - Tensor *output; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new Conv2D object. * @@ -37,33 +40,43 @@ namespace dl * @param filter filter of Conv2D * @param bias bias of Conv2D, if you don't specify anything, no bias is added * @param activation activation of Conv2D, if you don't specify anything, no activation is applied - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y stride in height * @param stride_x stride in width * @param name name of layer */ Conv2D(const int output_exponent, const Filter *filter, - const Bias *bias = NULL, + const Bias *bias = NULL, const Activation *activation = NULL, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - output_exponent(output_exponent), - filter(filter), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type), - bias(bias), - activation(activation) + const char *name = "Conv2D") : Layer(name), + output_exponent(output_exponent), + filter(filter), + stride_y(stride_y), + stride_x(stride_x), + padding_type(padding_type), + bias(bias), + activation(activation), + padding(padding), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** @@ -82,19 +95,30 @@ namespace dl * @brief Update output padding and input padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + assert(this->filter->shape.size() == 4); + assert(input.shape[2] == this->filter->shape[2]); - std::vector output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, true); - this->output->set_shape(output_shape); + this->output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, true, this->padding); + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); this->output->free_element(); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); + } - this->padding = nn::get_pad_size(output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -122,7 +146,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -153,5 +181,6 @@ namespace dl dl::tool::cache::preload_func((uint32_t)(this->filter->element), size); } }; + } // namespace layer } // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp index 37475353209..30b2c2a6c77 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp @@ -13,8 +13,11 @@ namespace dl * @tparam feature_t supports int16_t and int8_t, * - int16_t: stands for operation in int16_t quantize * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization */ - template + template class DepthwiseConv2D : public Layer { private: @@ -22,14 +25,14 @@ namespace dl const Filter *filter; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ - const Bias *bias; /**/ + const padding_type_t padding_type; /**/ + const Bias *bias; /**/ const Activation *activation; /**/ std::vector padding; /**/ Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new DepthwiseConv2D object. * @@ -37,40 +40,50 @@ namespace dl * @param filter filter of DepthwiseConv2D * @param bias bias of DepthwiseConv2D, if you don't specify anything, no bias is added * @param activation activation of DepthwiseConv2D, if you don't specify anything, no activation is applied - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input - * such that output has the same height/width dimension as the input - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y - stride in height * @param stride_x - stride in width * @param name name of layer */ DepthwiseConv2D(const int output_exponent, const Filter *filter, - const Bias *bias = NULL, + const Bias *bias = NULL, const Activation *activation = NULL, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - output_exponent(output_exponent), - filter(filter), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type), - bias(bias), - activation(activation) + const char *name = "DepthwiseConv2D") : Layer(name), + output_exponent(output_exponent), + filter(filter), + stride_y(stride_y), + stride_x(stride_x), + padding_type(padding_type), + bias(bias), + activation(activation), + padding(padding), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** * @brief Destroy the DepthwiseConv2D object. * */ - ~DepthwiseConv2D() + ~DepthwiseConv2D() { if (this->output != NULL) { @@ -82,19 +95,31 @@ namespace dl * @brief Update output shape and padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + assert(this->filter->shape.size() == 4); + assert(input.shape[2] == this->filter->shape[2]); - std::vector output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); - this->output->set_shape(output_shape); + this->output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); - this->padding = nn::get_pad_size(output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); + } this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -122,7 +147,12 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_expand_dims.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_expand_dims.hpp new file mode 100644 index 00000000000..a59bed183fb --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_expand_dims.hpp @@ -0,0 +1,128 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class ExpandDims : public Layer + { + private: + std::vector output_shape; /**/ + std::vector axis; /**/ + Tensor *output; /**/ + bool inplace; /**/ + + public: + int output_exponent; + + /** + * @brief Construct a new ExpandDims object + * + * @param axis position where the new axis is placed. + * @param name name of layer + * @param inplace true: the output will store to input + * false: the output will store to a separate memory + */ + ExpandDims(std::vector axis, const char *name = "ExpandDims", bool inplace = false) : Layer(name), + axis(axis), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the ExpandDims object + * + */ + ~ExpandDims() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * + * @param input as an input. + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->expand_dims(this->axis); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + this->output->expand_dims(this->axis); + } + this->output_shape = this->output->shape; + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& ExpandDims result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief call ExpandDims opeartion + * + * @param input + * @return Tensor& ExpandDims result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "ExpandDims"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_shape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "ExpandDims"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_flatten.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_flatten.hpp new file mode 100644 index 00000000000..70ae483a07f --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_flatten.hpp @@ -0,0 +1,120 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Flatten : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new Flatten object + * + * @param name name of layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Flatten(const char *name = "Flatten", bool inplace = false) : Layer(name), inplace(inplace), output_shape({}) + {} + + /** + * @brief Destroy the Flatten object + * + */ + ~Flatten() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + this->output_shape = {input.get_size()}; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Flatten result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Flatten operation. + * + * @param input as an input + * @return Tensor& Flatten result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->flatten(); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "flatten"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->flatten(); + DL_LOG_LAYER_LATENCY_END(this->name, "flatten"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_fullyconnected.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_fullyconnected.hpp new file mode 100644 index 00000000000..afa7e5befba --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_fullyconnected.hpp @@ -0,0 +1,167 @@ +#pragma once + +#include "dl_nn_fully_connected.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(FullyConnected(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization + */ + template + class FullyConnected : public Layer + { + private: + const int output_exponent; /**/ + const bool flatten; /**/ + const Filter *filter; /**/ + const Bias *bias; /**/ + const Activation *activation; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new FullyConnected object. + * + * @param output_exponent exponent of output + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param name name of layer + */ + FullyConnected(const int output_exponent, + const Filter *filter, + const Bias *bias = NULL, + const Activation *activation = NULL, + const bool flatten = true, + const char *name = "FullyConnected") : Layer(name), + output_exponent(output_exponent), + flatten(flatten), + filter(filter), + bias(bias), + activation(activation), + output_shape({}) + { + this->output = new Tensor; + } + + /** + * @brief Destroy the FullyConnected object. + * + */ + ~FullyConnected() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output padding and input padding. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(this->filter->shape.size() == 4); + assert(this->filter->shape[0] == 1); + assert(this->filter->shape[1] == 1); + if (this->flatten) + { + assert(input.get_size() == this->filter->shape[2]); + this->output_shape = {this->filter->shape[3]}; + } + else + { + assert(input.shape.back() == this->filter->shape[2]); + this->output_shape = input.shape; + this->output_shape[this->output_shape.size() - 1] = this->filter->shape[3]; + } + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& FullyConnected result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call FullyConnected operation + * + * @param input as an input. + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return FullyConnected result + */ + Tensor &call(Tensor &input, bool autoload_enable = false, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::fully_connected(*this->output, input, *(this->filter), this->bias, this->activation, this->flatten, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "fully_connected"); + return *this->output; + } + + /** + * @brief Preload the filter to Cache. + * NOTE: Call this layer's preload() before previous layer's call() such that filter could be loaded while previous layer is doing calculation. + */ + void preload() + { + size_t size = sizeof(feature_t); + int shape_size = this->filter->shape.size(); + for (int i = 0; i < shape_size; ++i) + { + size *= filter->shape[i]; + } + dl::tool::cache::preload_func((uint32_t)(this->filter->element), size); + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp index 044c5f61847..93f2d30ac89 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp @@ -20,8 +20,9 @@ namespace dl class GlobalAveragePool2D : public Layer { private: - const int output_exponent; /**/ - Tensor *output; /**/ + const int output_exponent; /**/ + std::vector output_shape; /**/ + Tensor *output; /**/ public: /** * @brief Construct a new GlobalAveragePool2D object. @@ -29,8 +30,9 @@ namespace dl * @param output_exponent exponent of output * @param name name of layer */ - GlobalAveragePool2D(const int output_exponent, const char *name = NULL) : Layer(name), - output_exponent(output_exponent) + GlobalAveragePool2D(const int output_exponent, const char *name = "GlobalAveragePool2D") : Layer(name), + output_exponent(output_exponent), + output_shape({}) { this->output = new Tensor; @@ -52,17 +54,26 @@ namespace dl * @brief Update output shape. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; - this->output->set_shape(output_shape); + this->output_shape = output_shape; + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -90,7 +101,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp index aa146823b78..f9b7f73ff8c 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp @@ -20,15 +20,15 @@ namespace dl class GlobalMaxPool2D : public Layer { private: - Tensor *output; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new GlobalMaxPool2D object. * * @param name name of layer */ - GlobalMaxPool2D(const char *name = NULL) : Layer(name) + GlobalMaxPool2D(const char *name = "GlobalMaxPool2D") : Layer(name), output_shape({}) { this->output = new Tensor; } @@ -49,17 +49,26 @@ namespace dl * @brief Update output shape and exponent. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); this->output->set_exponent(input.exponent); std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; - this->output->set_shape(output_shape); + this->output_shape = output_shape; + this->output->set_shape(this->output_shape); this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -87,7 +96,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_leakyrelu.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_leakyrelu.hpp index f18d9b1c522..a972e135006 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_leakyrelu.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_leakyrelu.hpp @@ -2,7 +2,7 @@ #include "dl_constant.hpp" #include "dl_variable.hpp" -#include "dl_nn_LeakyReLU.hpp" +#include "dl_nn_leakyrelu.hpp" #include "dl_layer_base.hpp" namespace dl @@ -20,13 +20,13 @@ namespace dl class LeakyReLU : public Layer { private: - feature_t activation_alpha; /**/ - int activation_exponent; /**/ - Tensor *output; /**/ - bool inplace; /**/ + feature_t activation_alpha; /**/ + int activation_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new LeakyReLU object * @@ -34,9 +34,9 @@ namespace dl * @param activation_exponent exponent of quantized alpha * @param name name of leakyrelu * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - LeakyReLU(const int activation_alpha, const int activation_exponent, const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + LeakyReLU(const int activation_alpha, const int activation_exponent, const char *name = "LeakyReLU", bool inplace = false) : Layer(name), output(NULL), output_shape({}) { this->activation_alpha = activation_alpha; this->activation_exponent = activation_exponent; @@ -47,7 +47,7 @@ namespace dl * @brief Destroy the LeakyReLU object * */ - ~LeakyReLU() + ~LeakyReLU() { if ((!this->inplace) && (this->output != NULL)) { @@ -59,24 +59,32 @@ namespace dl * @brief Update output shape and exponent * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { - if(!this->inplace) + this->output_shape = input.shape; + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; - } - this->output->set_shape(input.shape); + } + this->output->set_shape(this->output_shape); this->output->set_exponent(input.exponent); this->output->free_element(); } else { this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); } - } /** @@ -100,10 +108,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -114,6 +126,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::leakyrelu(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max2d.hpp index 8a775a2e0f0..93bc5899443 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max2d.hpp @@ -22,28 +22,28 @@ namespace dl class Max2D : public Layer { private: - Tensor *output; /**/ - bool inplace; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new Max2D object. * * @param name name of max2d * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Max2D(const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + Max2D(const char *name = "Max2D", bool inplace = false) : Layer(name), + output(NULL), inplace(inplace), output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the Max2D object * */ - ~Max2D() + ~Max2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -58,24 +58,34 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); + this->output_shape = input0.shape; - if(!this->inplace) + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(this->output_exponent); - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } else + { this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -100,10 +110,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input0.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -114,6 +128,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::max2d(*this->output, input0, input1, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "max2d"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max_pool2d.hpp index f836a983b34..629aa87f515 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max_pool2d.hpp @@ -23,44 +23,54 @@ namespace dl std::vector filter_shape; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ + const padding_type_t padding_type; /**/ std::vector padding; /**/ Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new MaxPool2D object. * * @param filter_shape filter shape in [filter_height, filter_width] - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y stride in height * @param stride_x stride in width * @param name name of layer */ MaxPool2D(const std::vector filter_shape, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - filter_shape(filter_shape), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type) + const char *name = "MaxPool2D") : Layer(name), + filter_shape(filter_shape), + padding_type(padding_type), + padding(padding), + stride_y(stride_y), + stride_x(stride_x), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** * @brief Destroy the MaxPool2D object. * */ - ~MaxPool2D() + ~MaxPool2D() { if (this->output != NULL) { @@ -72,18 +82,29 @@ namespace dl * @brief Update output shape and padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + this->output->set_exponent(input.exponent); - std::vector output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - this->output->set_shape(output_shape); + this->output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); - this->padding = nn::get_pad_size(output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); + } this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -111,7 +132,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_min2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_min2d.hpp index 71d39c9b285..e38fbf3d0d2 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_min2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_min2d.hpp @@ -22,28 +22,28 @@ namespace dl class Min2D : public Layer { private: - Tensor *output; /**/ - bool inplace; /**/ - public: - + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: /** * @brief Construct a new Min2D object * * @param name name of min2d * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Min2D(const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) - { - this->inplace = inplace; - } + Min2D(const char *name = "Min2D", bool inplace = false) : Layer(name), + output(NULL), + inplace(inplace), + output_shape({}) {} /** * @brief Destroy the Min2D object * */ - ~Min2D() + ~Min2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -58,25 +58,34 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); + this->output_shape = input0.shape; - if(!this->inplace) + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->set_exponent(input0.exponent); this->output->free_element(); } else + { this->output = &input0; - + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -101,10 +110,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input0.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -115,6 +128,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::min2d(*this->output, input0, input1, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "min2d"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_mul2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_mul2d.hpp index 0edfc9a93f0..21bcca7a81e 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_mul2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_mul2d.hpp @@ -21,14 +21,13 @@ namespace dl class Mul2D : public Layer { private: - const int output_exponent; /**/ + const int output_exponent; /**/ const Activation *activation; /**/ - Tensor *output; /**/ - bool inplace; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - const int output_exponent; /**/ - /** * @brief Construct a new Mul2D object. * @@ -36,18 +35,24 @@ namespace dl * @param activation activation of Mul2D, if you don't specify anything, no activation is applied * @param name name of layer * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Mul2D(const int output_exponent, const Activation *activation = NULL, const char *name = NULL, bool inplace = false) : Layer(name), - output_exponent(output_exponent),activation(activation), output(NULL) + Mul2D(const int output_exponent, + const Activation *activation = NULL, + const char *name = "Mul2D", + bool inplace = false) : Layer(name), + output_exponent(output_exponent), + activation(activation), + output(NULL), + inplace(inplace), + output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the Multiply2D object. */ - ~Mul2D() + ~Mul2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -61,24 +66,34 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(this->output_exponent); - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } - + else + { this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -106,7 +121,11 @@ namespace dl if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -117,6 +136,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::mul2d(*this->output, input0, input1, this->activation, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "mul2d"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_prelu.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_prelu.hpp index 4781a669130..96168a783b1 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_prelu.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_prelu.hpp @@ -24,9 +24,9 @@ namespace dl int activation_exponent; /**/ Tensor *output; /**/ bool inplace; /**/ + false: the output will store to a separate memory >*/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new PReLU object * @@ -34,20 +34,25 @@ namespace dl * @param activation_exponent exponent of quantized alpha elements * @param name name of prelu * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - PReLU(const feature_t *activation_element, const int activation_exponent = 0, const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + PReLU(const feature_t *activation_element, + const int activation_exponent = 0, + const char *name = NULL, + bool inplace = "PReLU") : Layer(name), + activation_element(activation_element), + activation_exponent(activation_exponent), + output(NULL), + inplace(inplace), + output_shape({}) { - this->activation_element = activation_element; - this->activation_exponent = activation_exponent; - this->inplace = inplace; } /** * @brief Destroy the PReLU object * */ - ~PReLU() + ~PReLU() { if ((!this->inplace) && (this->output != NULL)) { @@ -59,23 +64,31 @@ namespace dl * @brief Update output shape and exponent * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { - if(!this->inplace) + this->output_shape = input.shape; + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(input.exponent); - this->output->set_shape(input.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } else { this->output = &input; } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -99,11 +112,15 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } this->output->set_exponent(input.exponent); - this->output->apply_element(); + this->output->malloc_element(); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); DL_LOG_LAYER_LATENCY_START(); @@ -113,6 +130,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::prelu(*this->output, input, this->activation_element, this->activation_exponent, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_relu.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_relu.hpp index e70663b798c..7dd29d4a178 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_relu.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_relu.hpp @@ -21,29 +21,28 @@ namespace dl class ReLU : public Layer { private: - Tensor *output; /**/ - bool inplace; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - - /** * @brief Construct a new ReLU object * * @param name name of relu * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - ReLU(const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + ReLU(const char *name = "ReLU", bool inplace = false) : Layer(name), + output(NULL), inplace(inplace), output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the ReLU object * */ - ~ReLU() + ~ReLU() { if ((!this->inplace) && (this->output != NULL)) { @@ -55,23 +54,31 @@ namespace dl * @brief Update output shape and exponent * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { - if(!this->inplace) + this->output_shape = input.shape; + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(input.exponent); - this->output->set_shape(input.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } else { this->output = &input; } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -95,10 +102,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -109,6 +120,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::relu(*this->output, input, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "relu"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_reshape.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_reshape.hpp new file mode 100644 index 00000000000..3f2ed72b6e0 --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_reshape.hpp @@ -0,0 +1,124 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Reshape(input) + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Reshape : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Reshape object + * + * @param shape the target shape + * @param name name of Reshape layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Reshape(std::vector shape, const char *name = "Reshape", bool inplace = false) : Layer(name), + output_shape(shape), inplace(inplace) + { + } + + /** + * @brief Destroy the Reshape object + * + */ + ~Reshape() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Reshape result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Reshape operation. + * + * @param input as an input + * @return Tensor& Reshape result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->reshape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "reshape"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->reshape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "reshape"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_squeeze.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_squeeze.hpp new file mode 100644 index 00000000000..cee92f22764 --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_squeeze.hpp @@ -0,0 +1,127 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Squeeze : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + int axis; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Squeeze object + * + * @param axis the dim to to be remove. make sure the length of the dim is equal to 1. + * if axis == INT32_MAX, all the dims with length==1 will be removed. + * @param name name of Squeeze layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Squeeze(int axis = INT32_MAX, const char *name = "Squeeze", bool inplace = false) : Layer(name), axis(axis), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Squeeze object + * + */ + ~Squeeze() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(input.shape); + this->output->squeeze(this->axis); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(input.shape); + this->output->squeeze(this->axis); + } + this->output_shape = this->output->shape; + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Squeeze result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Squeeze operation. + * + * @param input as an input + * @return Tensor& Squeeze result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "Squeeze"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_shape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "Squeeze"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_sub2d.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_sub2d.hpp index e3453c08b97..da03b4aad85 100644 --- a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_sub2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_sub2d.hpp @@ -21,13 +21,13 @@ namespace dl class Sub2D : public Layer { private: - const int output_exponent; /**/ - const Activation *activation; /**/ - Tensor *output; /**/ - bool inplace; /**/ + const int output_exponent; /**/ + const Activation *activation; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new Sub2D object. * @@ -35,18 +35,17 @@ namespace dl * @param activation activation of Mul2D, if you don't specify anything, no activation is applied * @param name name of layer * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Sub2D(const int output_exponent, const Activation *activation = NULL, const char *name = NULL, bool inplace = false) : Layer(name), - output_exponent(output_exponent), activation(activation), output(NULL) + Sub2D(const int output_exponent, const Activation *activation = NULL, const char *name = "Sub2D", bool inplace = false) : Layer(name), + output_exponent(output_exponent), activation(activation), output(NULL), inplace(inplace), output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the Sub2D object. */ - ~Sub2D() + ~Sub2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -60,22 +59,32 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(this->output_exponent); - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); - } + } else + { this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -103,7 +112,11 @@ namespace dl if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output.apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output.malloc_element(); this->output->set_exponent(input0.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -114,6 +127,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::sub2d(this->output, input0, input1, this->activation, assign_core, this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "sub2d"); } diff --git a/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_transpose.hpp b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_transpose.hpp new file mode 100644 index 00000000000..d89ba8daed5 --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/layer/dl_layer_transpose.hpp @@ -0,0 +1,126 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Transpose : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector perm; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Transpose object + * + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @param name name of Transpose layer + * @param inplace true: the output will store to input + * false: the output will store to a separate memory + */ + Transpose(std::vector perm = {}, const char *name = "Transpose", bool inplace = false) : Layer(name), perm(perm), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Transpose object + * + */ + ~Transpose() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + this->output_shape = input.shape; + for (int i = 0; i < this->perm.size(); i++) + { + this->output_shape[i] = input.shape[this->perm[i]]; + } + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Transpose result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Transpose operation. + * + * @param input as an input. + * @return Tensor& Transpose result. + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->transpose(input, this->perm); + DL_LOG_LAYER_LATENCY_END(this->name, "transpose"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->transpose(this->perm); + DL_LOG_LAYER_LATENCY_END(this->name, "transpose"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/model_zoo/color_detector.hpp b/tools/sdk/esp32/include/esp-face/include/model_zoo/color_detector.hpp new file mode 100644 index 00000000000..063ab20b34a --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/model_zoo/color_detector.hpp @@ -0,0 +1,68 @@ +#pragma once + +#include "dl_image.hpp" + +typedef struct +{ + int area; /*!< Area of connected domains >*/ + std::vector center; /**/ + std::vector box; /**/ +} components_stats_t; + +class ColorDetector +{ +private: + std::vector> results; /*!< detection results >*/ + +public: + std::vector> color_thresh; /*!< threshold of colors, The threshold of each color is composed of 6 numbers >*/ + std::vector area_thresh; /*!< the area threshold of each color, + the area that is smaller than the threshold is filtered >*/ + bool bgr; /*!< true: the input image is in BGR format + false: the input image is in RGB format >*/ + + /** + * @brief get the color threshold of rectangular region in the image + * + * @param image the input image + * @param box the coordinates of the rectanglar region : [left_up_x, left_up_y, right_down_x, right_down_y] + * @return std::vector the threshold. + */ + std::vector cal_color_thresh(dl::Tensor &image, std::vector box); + + /** + * @brief detect the colors based on the color thresholds + * + * @param image the input image. + * @return std::vector>& detection result. + */ + std::vector> &detect(dl::Tensor &image); + + /** + * @brief Construct a new Color Detector object + * + * @param color_thresh threshold of colors, The threshold of each color is composed of 6 numbers + * @param area_thresh the area threshold of each color,the area that is smaller than the threshold is filtered + * @param bgr true: the input image is in BGR format + * false: the input image is in RGB format + */ + ColorDetector(std::vector> color_thresh, std::vector area_thresh, bool bgr = false) : color_thresh(color_thresh), area_thresh(area_thresh), bgr(bgr) + { + } + + /** + * @brief Destroy the Color Detector object + * + */ + ~ColorDetector() {} + + /** + * @brief Get the results object + * + * @return std::vector>& the detection result. + */ + std::vector> &get_results() + { + return this->results; + } +}; \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-face/include/model_zoo/face_recognition_tool.hpp b/tools/sdk/esp32/include/esp-face/include/model_zoo/face_recognition_tool.hpp index 12fe8a842a2..2226d32daf9 100644 --- a/tools/sdk/esp32/include/esp-face/include/model_zoo/face_recognition_tool.hpp +++ b/tools/sdk/esp32/include/esp-face/include/model_zoo/face_recognition_tool.hpp @@ -92,7 +92,7 @@ namespace face_recognition_tool * @return dl::Tensor* */ template - dl::Tensor *transform_mfn_input(dl::Tensor &image, bool free_input = false, bool do_padding = true); + dl::Tensor *transform_mfn_input(dl::Tensor &image, bool free_input = false); /** * @brief transform the image to the input of a mfn model @@ -106,7 +106,7 @@ namespace face_recognition_tool * false: do not pad the result */ template - void transform_mfn_input(dl::Tensor &image, dl::Tensor &output, bool free_input = false, bool do_padding = true); + void transform_mfn_input(dl::Tensor &image, dl::Tensor &output, bool free_input = false); /** * @brief transform the mfn output embedding to a floating embedding diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn.hpp index 6dba8016f26..6c737c1d341 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn.hpp @@ -14,13 +14,13 @@ namespace dl * @param filter_shape filter shape with dilation * @param stride_y stride in height * @param stride_x stride in width - * @param pad_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET + * @param pad_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN * @param is_conv2d one of true or false, * - true: serve for Conv2D * - false: serve for other operations * @return std::vector */ - std::vector get_output_shape(const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t pad_type, const bool is_conv2d = false); + std::vector get_output_shape(const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t pad_type, const bool is_conv2d = false, std::vector padding = {}); /** * @brief Get the pad size object @@ -30,7 +30,7 @@ namespace dl * @param filter_shape filter shape with dilation * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN * @return padding size */ std::vector get_pad_size(const std::vector &output_shape, const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t padding_type); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_add2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_add2d.hpp index d296be5350b..4d4daaaef05 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_add2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_add2d.hpp @@ -58,20 +58,20 @@ namespace dl */ template auto add2d(const int output_exponent, - Tensor &input0, - Tensor &input1, - const Activation *activation, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(output_exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp index 5b298d98c44..6e7db6ed0e0 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp @@ -58,12 +58,12 @@ namespace dl * @param filter_shape filter_shape in [filter_height, filter_width] * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID: no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param assign_core not effective yet * @return avg_pool2d result */ @@ -81,19 +81,19 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter_shape, stride_y, stride_x, padding_type); Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); - input.set_padding_size(padding); + padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - avg_pool2d(output, input, input.padding, filter_shape, stride_y, stride_x, assign_core); + avg_pool2d(output, input, padding, filter_shape, stride_y, stride_x, assign_core); DL_LOG_NN_LATENCY_END("avg_pool2d"); return output; diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_concat.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_concat.hpp new file mode 100644 index 00000000000..73ed1aae905 --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_concat.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + template + void concat(Tensor &output, std::vector *> &inputs, int axis, bool free_inputs = false); + + template + Tensor concat(std::vector *> &inputs, int axis, bool free_inputs = false) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + assert(inputs.size() > 1); + int shape_size = inputs[0]->shape.size(); + + if (axis < 0) + { + axis = shape_size + axis; + } + + assert((axis < shape_size) && (axis > -1)); + + int output_shape_axis = inputs[0]->shape[axis]; + + for (int i = 1; i < inputs.size(); i++) + { + assert(shape_size == inputs[i]->shape.size()); + assert(inputs[i]->exponent == inputs[i - 1]->exponent); + output_shape_axis += inputs[i]->shape[axis]; + + for (int j = 0; j < shape_size; j++) + { + if (j != axis) + { + assert(inputs[i]->shape[j] == inputs[i - 1]->shape[j]); + } + } + } + DL_LOG_NN_LATENCY_END("assert"); + + DL_LOG_NN_LATENCY_START(); + Tensor output; + std::vector output_shape = inputs[0]->shape; + output_shape[axis] = output_shape_axis; + output.set_shape(output_shape); + output.set_exponent(inputs[0]->exponent); + output.malloc_element(); + DL_LOG_NN_LATENCY_END("malloc"); + + DL_LOG_NN_LATENCY_START(); + concat(output, inputs, axis, free_inputs); + DL_LOG_NN_LATENCY_END("concat"); + return output; + } + } // namespace nn +} // namespace dl diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_conv2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_conv2d.hpp index 77e2c617d04..27ba0372730 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_conv2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_conv2d.hpp @@ -10,7 +10,6 @@ namespace dl { /** * @brief activation(conv2d(input, filter) + bias). - * NOTE: When padding_type is SAME, make sure padding is already added in input. * * @param output as an output * @param input as an input @@ -34,7 +33,6 @@ namespace dl /** * @brief activation(conv2d(input, filter) + bias). - * NOTE: When padding_type is SAME, make sure padding is already added in input. * * @param output as an output * @param input as an input @@ -56,6 +54,29 @@ namespace dl const Activation *const activation = NULL, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** + * @brief activation(conv2d(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter filter of conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of conv2d, if you don't specify anything, no bias is added + * @param activation activation of conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** * @brief activation(conv2d(input, filter) + bias). * @@ -67,25 +88,25 @@ namespace dl * @param filter Filter of conv2d * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID: no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param bias bias of conv2d, if you don't specify anything, no bias is added * @param activation activation of conv2d, if you don't specify anything, no activation is applied * @param assign_core not effective yet * @return conv2d result */ - template + template Tensor conv2d(const int output_exponent, Tensor &input, const Filter &filter, const int stride_y, const int stride_x, const padding_type_t padding_type, - const Bias *bias, + const Bias *bias, const Activation *activation, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) { @@ -94,20 +115,19 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type, true); Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); - input.set_padding_size(padding); - input.set_padding_value(padding, 0); + padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - conv2d(output, input, input.padding, filter, stride_y, stride_x, bias, activation, assign_core); + conv2d(output, input, padding, filter, stride_y, stride_x, bias, activation, assign_core); DL_LOG_NN_LATENCY_END("conv2d"); return output; diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp index 6e972bfd81b..135815a65cb 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp @@ -10,7 +10,6 @@ namespace dl { /** * @brief activate(depthwise_conv2d(input, filter) + bias) - * NOTE: When padding_type is SAME, make sure padding is already added in input * * @param output as an output * @param input as an input @@ -34,7 +33,6 @@ namespace dl /** * @brief activate(depthwise_conv2d(input, filter) + bias) - * NOTE: When padding_type is SAME, make sure padding is already added in input * * @param output as an output * @param input as an input @@ -56,6 +54,29 @@ namespace dl const Activation *activation = NULL, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** + * @brief activate(depthwise_conv2d(input, filter) + bias) + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter Filter of depthwise_conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added + * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void depthwise_conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *bias = NULL, + const Activation *activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** * @brief activation(depthwise_conv2d(input, filter) + bias) * @@ -67,25 +88,25 @@ namespace dl * @param filter filter of depthwise_conv2d * @param stride_y stride in height * @param stride_x stride in width - * @param pad_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param pad_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied * @param assign_core not effective yet * @return depthwise_conv2d result */ - template + template Tensor depthwise_conv2d(const int output_exponent, Tensor &input, const Filter &filter, const int stride_y, const int stride_x, const padding_type_t padding_type, - const Bias *bias, + const Bias *bias, const Activation *activation, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) { @@ -94,20 +115,20 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); + DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); - input.set_padding_size(padding); - input.set_padding_value(padding, 0); + padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - depthwise_conv2d(output, input, input.padding, filter, stride_y, stride_x, bias, activation, assign_core); + depthwise_conv2d(output, input, padding, filter, stride_y, stride_x, bias, activation, assign_core); DL_LOG_NN_LATENCY_END("depthwise_conv2d"); return output; diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_fully_connected.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_fully_connected.hpp new file mode 100644 index 00000000000..372c84825fd --- /dev/null +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_fully_connected.hpp @@ -0,0 +1,126 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input as an input + * @param filter Filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + * @return FullyConnected result + */ + template + Tensor fully_connected(const int output_exponent, + Tensor &input, + const Filter &filter, + const Bias *bias, + const Activation *activation, + const bool flatten, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + assert(filter.shape.size() == 4); + assert(filter.shape[0] == 1); + assert(filter.shape[1] == 1); + + std::vector output_shape; + if (flatten) + { + assert(input.get_size() == filter.shape[2]); + output_shape = {filter.shape.back()}; + } + else + { + assert(input.shape.back() == filter->shape[2]); + output_shape = input.shape; + output_shape[output_shape.size() - 1] = filter.shape.back(); + } + Tensor output; + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + fully_connected(output, input, filter, bias, activation, flatten, assign_core); + DL_LOG_NN_LATENCY_END("fully_connected"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp index 723ca9eddc4..724d3ca0952 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp @@ -53,7 +53,7 @@ namespace dl std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp index 945645cfd55..f6f15e91bd3 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp @@ -51,7 +51,7 @@ namespace dl std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; Tensor output; - output.set_exponent(input.exponent).set_shape(output_shape).apply_element(); + output.set_exponent(input.exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_leakyrelu.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_leakyrelu.hpp index d3738fc44ca..c41728b1ad5 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_leakyrelu.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_leakyrelu.hpp @@ -52,17 +52,17 @@ namespace dl * @return leakyrelu result or no return(result store to input) */ template - auto leakyrelu(Tensor &input, - const int activation_alpha, - const int activation_exponent, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto leakyrelu(Tensor &input, + const int activation_alpha, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input.exponent).set_shape(input.shape).apply_element(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max2d.hpp index 0a5e8f43221..466089bc386 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max2d.hpp @@ -48,20 +48,20 @@ namespace dl * @return max2d result or no return(result store to input0) */ template - auto max2d(Tensor &input0, - Tensor &input1, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto max2d(Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); DL_LOG_NN_LATENCY_INIT(); Tensor output; - - if constexpr(!inplace) + + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input0.exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(input0.exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max_pool2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max_pool2d.hpp index 7f95f3d4278..50d51728ce0 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max_pool2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_max_pool2d.hpp @@ -57,12 +57,12 @@ namespace dl * @param filter_shape filter shape in [filter_height, filter_width] * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID: no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param assign_core not effective yet * @return max_pool2d result */ @@ -79,20 +79,20 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter_shape, stride_y, stride_x, padding_type); Tensor output; - output.set_exponent(input.exponent).set_shape(output_shape).apply_element(); + output.set_exponent(input.exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); + DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); - input.set_padding_size(padding); - input.set_padding_value(padding, 0); + padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - max_pool2d(output, input, input.padding, filter_shape, stride_y, stride_x, assign_core); + max_pool2d(output, input, padding, filter_shape, stride_y, stride_x, assign_core); DL_LOG_NN_LATENCY_END("max_pool2d"); return output; diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_min2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_min2d.hpp index 71cb87d50d5..8faddf3c228 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_min2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_min2d.hpp @@ -47,20 +47,20 @@ namespace dl * @return min2d result or no return(result store to input0) */ template - auto min2d(Tensor &input0, - Tensor &input1, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto min2d(Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); DL_LOG_NN_LATENCY_INIT(); Tensor output; - - if constexpr(!inplace) + + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input0.exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(input0.exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_mul2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_mul2d.hpp index 410528a05a3..909619a8767 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_mul2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_mul2d.hpp @@ -18,12 +18,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void mul2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void mul2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(mul2d(input0, input1)). @@ -35,12 +35,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void mul2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void mul2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(mul2d(input0, input1)). @@ -57,21 +57,21 @@ namespace dl * @return mul2d result or no return(result store to input0) */ template - auto mul2d(const int output_exponent, - Tensor &input0, - Tensor &input1, - const Activation *activation, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto mul2d(const int output_exponent, + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(output_exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_prelu.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_prelu.hpp index fb4315d9fc3..e83e8975604 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_prelu.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_prelu.hpp @@ -52,17 +52,17 @@ namespace dl * @return prelu result or no return(result store to input) */ template - auto prelu(Tensor &input, - const feature_t *activation_element, - const int activation_exponent, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto prelu(Tensor &input, + const feature_t *activation_element, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input.exponent).set_shape(input.shape).apply_element(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); @@ -76,7 +76,7 @@ namespace dl DL_LOG_NN_LATENCY_START(); prelu(input, input, activation_element, activation_exponent, assign_core); DL_LOG_NN_LATENCY_END("prelu"); - } + } } } // namespace nn } // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_relu.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_relu.hpp index e4159fdf898..308492dfe4b 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_relu.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_relu.hpp @@ -15,9 +15,9 @@ namespace dl * @param input as an input * @param assign_core not effective yet */ - void relu(Tensor &output, - Tensor &input, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + void relu(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); /** * @brief relu(input). @@ -26,9 +26,9 @@ namespace dl * @param input as an input * @param assign_core not effective yet */ - void relu(Tensor &output, - Tensor &input, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + void relu(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); /** * @brief relu(input) @@ -46,11 +46,11 @@ namespace dl { DL_LOG_NN_LATENCY_INIT(); Tensor output; - - if constexpr(!inplace) + + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input.exponent).set_shape(input.shape).apply_element(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_sub2d.hpp b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_sub2d.hpp index 385188e4ba2..5bbd4940b10 100644 --- a/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_sub2d.hpp +++ b/tools/sdk/esp32/include/esp-face/include/nn/dl_nn_sub2d.hpp @@ -18,12 +18,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void sub2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void sub2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(sub2d(input0, input1)). @@ -35,12 +35,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void sub2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void sub2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(sub2d(input0, input1)). @@ -57,20 +57,20 @@ namespace dl * @return sub2d result or no return(result store to input0) */ template - auto sub2d(const int output_exponent, - Tensor &input0, - Tensor &input1, - const Activation *activation, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto sub2d(const int output_exponent, + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(output_exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32/include/esp-face/include/tool/dl_tool.hpp b/tools/sdk/esp32/include/esp-face/include/tool/dl_tool.hpp index f8e0871a04f..e5490e073d1 100644 --- a/tools/sdk/esp32/include/esp-face/include/tool/dl_tool.hpp +++ b/tools/sdk/esp32/include/esp-face/include/tool/dl_tool.hpp @@ -67,62 +67,49 @@ namespace dl void copy_memory(void *dst, void *src, const int n); /** - * @brief Apply memory without initialized. Must use free_aligned() to free the memory. + * @brief Apply memory without initialized. Can use free_aligned() to free the memory. * * @param number number of elements * @param size size of element - * @param align number of aligned, e.g., 16 means 16-byte aligned + * @param align number of byte aligned, e.g., 16 means 16-byte aligned * @return pointer of allocated memory. NULL for failed */ - inline void *malloc_aligned(int number, int size, int align = 0) + inline void *malloc_aligned(int number, int size, int align = 4) { - int n = number * size; - n >>= 4; - n += 2; - n <<= 4; - int total_size = n + align + sizeof(void *) + sizeof(int); - void *res = malloc(total_size); + assert((align > 0) && (((align & (align-1)) == 0))); + int total_size = number * size; + + void *res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); #if DL_SPIRAM_SUPPORT if (NULL == res) - res = heap_caps_malloc(total_size, MALLOC_CAP_SPIRAM); + res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_SPIRAM); #endif if (NULL == res) { printf("Fail to malloc %d bytes from DRAM(%d bytyes) and PSRAM(%d bytes), PSRAM is %s.\n", total_size, - heap_caps_get_free_size(MALLOC_CAP_INTERNAL), + heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL), heap_caps_get_free_size(MALLOC_CAP_SPIRAM), DL_SPIRAM_SUPPORT ? "on" : "off"); return NULL; } - void **data = (void **)res + 2; // 4-byte for pointer, 4-bytes for n - void **aligned; - if (align) - aligned = (void **)(((size_t)data + (align - 1)) & -align); - else - aligned = data; - - aligned[-1] = res; - int *temp = (int *)aligned; - temp[-2] = n; - return (void *)aligned; + return (void *)res; } /** - * @brief Apply memory with zero-initialized. Must use dl_lib_free() to free the memory. + * @brief Apply memory with zero-initialized. Can use free_aligned() to free the memory. * * @param number number of elements * @param size size of element - * @param align number of aligned, e.g., 16 means 16-byte aligned + * @param align number of byte aligned, e.g., 16 means 16-byte aligned * @return pointer of allocated memory. NULL for failed */ - inline void *calloc_aligned(int number, int size, int align = 0) + inline void *calloc_aligned(int number, int size, int align = 4) { void *aligned = malloc_aligned(number, size, align); - int n = *((int *)aligned - 2); - set_zero(aligned, n); + set_zero(aligned, number * size); return (void *)aligned; } @@ -137,7 +124,70 @@ namespace dl if (NULL == address) return; - free(((void **)address)[-1]); + heap_caps_free(address); + } + + /** + * @brief Apply memory without initialized in preference order: internal aligned, internal, external aligned + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *malloc_aligned_prefer(int number, int size, int align = 4) + { + assert((align > 0) && (((align & (align-1)) == 0))); + int total_size = number * size; + void *res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); + if (NULL == res){ + res = heap_caps_malloc(total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); + } +#if DL_SPIRAM_SUPPORT + if (NULL == res){ + res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_SPIRAM); + } +#endif + if (NULL == res) + { + printf("Fail to malloc %d bytes from DRAM(%d bytyes) and PSRAM(%d bytes), PSRAM is %s.\n", + total_size, + heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL), + heap_caps_get_free_size(MALLOC_CAP_SPIRAM), + DL_SPIRAM_SUPPORT ? "on" : "off"); + return NULL; + } + + return res; + } + + /** + * @brief Apply memory with zero-initialized in preference order: internal aligned, internal, external aligned + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *calloc_aligned_prefer(int number, int size, int align = 4) + { + void *res = malloc_aligned_prefer(number, size, align); + set_zero(res, number * size); + + return (void *)res; + } + + /** + * @brief Free the calloc_aligned_prefer() and malloc_aligned_prefer() memory + * + * @param address pointer of memory to free + */ + inline void free_aligned_prefer(void *address) + { + if (NULL == address) + return; + + heap_caps_free(address); } /** diff --git a/tools/sdk/esp32/include/esp-face/include/typedef/dl_constant.hpp b/tools/sdk/esp32/include/esp-face/include/typedef/dl_constant.hpp index 73e3b0832e7..07b2dd24ee1 100644 --- a/tools/sdk/esp32/include/esp-face/include/typedef/dl_constant.hpp +++ b/tools/sdk/esp32/include/esp-face/include/typedef/dl_constant.hpp @@ -57,7 +57,8 @@ namespace dl * @param exponent exponent of element * @param shape shape of Filter, * - 1D: reserved - * - 2D: [filter_height, filter_width, input_channel, output_channel] + * - 2D: for convolution is [filter_height, filter_width, input_channel, output_channel], + * for depthwise convolution is [filter_height, filter_width, input_channel, 1] * @param dilation dilation of Filter * - 1D: reserved * - 2D: [dilation_in_height, dilation_in_width] @@ -97,6 +98,9 @@ namespace dl { public: using Constant::Constant; + std::vector channel_exponent; /**/ + + Bias(const T *element, const std::vector channel_exponent, const std::vector shape); }; /** diff --git a/tools/sdk/esp32/include/esp-face/include/typedef/dl_variable.hpp b/tools/sdk/esp32/include/esp-face/include/typedef/dl_variable.hpp index bf6e8630856..18cbe9707e9 100644 --- a/tools/sdk/esp32/include/esp-face/include/typedef/dl_variable.hpp +++ b/tools/sdk/esp32/include/esp-face/include/typedef/dl_variable.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "dl_tool.hpp" @@ -17,27 +18,20 @@ namespace dl class Tensor { private: - int size; /* axis_offset; /* shape; /* shape_with_padding; /* padding; /* shape; /*set_shape({0}); } /** * @brief Construct a new Tensor object by copying from input. @@ -49,21 +43,20 @@ namespace dl */ Tensor(Tensor &input, bool deep) : size(input.size), auto_free(input.auto_free), - exponent(input.exponent), - shape(input.shape), - shape_with_padding(input.shape_with_padding), - padding(input.padding) + exponent(input.exponent) { - if (deep) + this->set_shape(input.shape); + if (deep && (input.element != NULL)) { - int size_real = input.shape_with_padding.size() ? input.shape_with_padding[0] * input.shape_with_padding[1] * input.shape_with_padding[2] : 0; - T *new_element = (T *)tool::calloc_aligned(size_real, sizeof(T), 16); + int size_real = input.get_size(); + T *new_element = (T *)tool::calloc_aligned_prefer(size_real, sizeof(T), 16); tool::copy_memory(new_element, input.element, size_real * sizeof(T)); this->element = new_element; } else { this->element = input.element; + this->auto_free = false; } } @@ -77,6 +70,33 @@ namespace dl this->free_element(); } + /** + * @brief + * + * @param input an input Tensor + * @param deep one of true or false + * - true: apply a new memory, copy value from input.element to this new memory + * - false: take over input.element to this->element + * @return Tensor& self + */ + Tensor ©_element(Tensor &input, bool deep) + { + assert(this->get_size() == input.get_size()); + assert(input.element != NULL); + + this->malloc_element(); + if (deep) + { + tool::copy_memory(this->element, input.element, this->get_size() * sizeof(T)); + } + else + { + this->element = input.element; + this->auto_free = false; + } + return *this; + } + /** * @brief Set the auto free object. * @@ -120,190 +140,144 @@ namespace dl } /** - * @brief Set the shape of Tensor. Initial this->padding = {0}. Initial this->size = -1. + * @brief Set the shape of Tensor. * - * @param shape shape in - * - 2D: [height, width] + * @param shape the target shape + * * @return self */ - Tensor &set_shape(const std::vector shape) - { - for (int i = 0; i < shape.size(); ++i) - { - assert(shape[i] > 0); - } - this->shape = shape; - this->shape_with_padding = shape; - this->size = -1; - this->padding = std::vector(((this->shape.size() - 1) << 1), 0); - return *this; - } + Tensor &set_shape(const std::vector shape); /** - * @brief Set the padding size object. + * @brief print the shape of the Tensor * - * @param padding padding size in - * - 2D: [top, bottom, left, right] - * @return self */ - Tensor &set_padding_size(std::vector &padding) + void print_shape() { - assert(this->shape.size()); // call Tensor.set_shape() first - assert(this->shape.size() == 3); // TODO: || this->shape.size() == 2 - - if (this->shape.size() == 3) + if (this->shape.size()) { - std::vector new_padding = this->padding; - bool dont_update = true; - - if (padding[0] > this->padding[0]) + printf("shape = ("); + for (int i = 0; i < this->shape.size() - 1; i++) { - new_padding[0] = padding[0]; - dont_update = false; - } - - if (padding[1] > this->padding[1]) - { - new_padding[1] = padding[1]; - dont_update = false; - } - - if (padding[2] > this->padding[2]) - { - new_padding[2] = padding[2]; - dont_update = false; - } - - if (padding[3] > this->padding[3]) - { - new_padding[3] = padding[3]; - dont_update = false; + printf("%d, ", this->shape[i]); } + printf("%d)\n", this->shape.back()); + } + else + { + printf("shape = ()\n"); + } + } - if (dont_update) - { - return *this; - } + /** + * @brief flatten the Tensor + * + * @return Tensor& self + */ + Tensor &flatten(); - std::vector new_shape_with_padding = this->shape; + /** + * @brief Change a new shape to the Tensor without changing its data. + * + * @param shape the target shape + * @return Tensor& self + */ + Tensor &reshape(std::vector shape); - new_shape_with_padding[0] += (new_padding[0] + new_padding[1]); - new_shape_with_padding[1] += (new_padding[2] + new_padding[3]); - int new_size = new_shape_with_padding[0] * new_shape_with_padding[1] * new_shape_with_padding[2]; + /** + * @brief Remove dims with length==1 from Tensor + * + * @param axis the dim to to be remove. make sure the length of the dim is equal to 1. + * if axis == INT32_MAX, all the dims with length==1 will be removed. + * @return Tensor& self + */ + Tensor &squeeze(int axis = INT32_MAX); - if (this->element) // if this->element != NULL, do padding by copy memory - { - T *new_element = (T *)tool::malloc_aligned(new_size, sizeof(T), 16); - T *dst = new_element + ((new_padding[0] * new_shape_with_padding[1]) + new_padding[2]) * new_shape_with_padding[2]; - T *src = this->get_element_ptr(); - int offset_dst_next_y = new_shape_with_padding[1] * new_shape_with_padding[2]; // width * channel - int src_copy_length = this->shape[1] * this->shape[2]; // width * channel - int offset_src_next_y = this->shape_with_padding[1] * this->shape_with_padding[2]; // width * channel - for (int y = 0; y < this->shape[0]; y++) - { - tool::copy_memory(dst, src, src_copy_length * sizeof(T)); - dst += offset_dst_next_y; - src += offset_src_next_y; - } + /** + * @brief Insert a new dim that will appear at the axis position in the expanded Tensor shape. + * + * @param axis the dim to be inserted + * @return Tensor& self + */ + Tensor &expand_dims(int axis); - if (this->auto_free) - tool::free_aligned(this->element); - this->element = new_element; - this->auto_free = true; - } - this->padding = new_padding; - this->shape_with_padding = new_shape_with_padding; - this->size = new_size; - } - else if (this->shape.size() == 2) - { - printf("Tensor.set_padding_size with this->shape.size() == 2 not implement yet.\n"); - } + /** + * @brief Insert a new dim that will appear at the axis position in the expanded Tensor shape. + * + * @param axis the dim to be inserted + * @return Tensor& self + */ + Tensor &expand_dims(std::vector axis); - return *this; - } + /** + * @brief Reverse or permute the axes of the Tensor + * + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @return Tensor& self + */ + Tensor &transpose(std::vector perm = {}); /** - * @brief Set the padding value object. + * @brief Reverse or permute the axes of the input Tensor * - * @param padding padding size in - * - 2D: [top, bottom, left, right] - * @param value value to set - * @return self + * @param input the input Tensor + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @return Tensor& self */ - Tensor &set_padding_value(std::vector &padding, T value); + Tensor &transpose(Tensor &input, std::vector perm = {}); /** * @brief Get the element pointer. * - * @param padding padding size in - * - 2D: [top, bottom, left, right] - * @return pointer to memory with padding + * @return pointer to memory */ - T *get_element_ptr(const std::vector padding = {0, 0, 0, 0}) + T *get_element_ptr() { - assert(this->shape.size() == 3); // TODO: || this->shape.size() == 2 - - if (this->shape.size() == 3) - { - return this->element + ((this->padding[0] - padding[0]) * this->shape_with_padding[1] + (this->padding[2] - padding[2])) * this->shape_with_padding[2]; - } - else if (this->shape.size() == 2) - { - printf("Tensor.get_element_ptr with this->shape.size() == 2 is not implemented.\n"); - } - - return NULL; + return this->element; } /** * @brief Get the element value. * - * @param index index in - * - 2D: [y, x, c] - * @param with_padding one of true or false, - * - true: make padding size in count - * - false: do not - * @return element value + * @param index the index of each dim. + * @return T element value */ - T &get_element_value(const std::vector index, const bool with_padding = false) + T get_element_value(const std::vector index) { - assert(index.size() == this->shape.size()); - assert(this->shape.size() == 3); // TODO: || this->shape() == 2 - - int i = 0; - if (this->shape.size() == 3) - { - int y = index[0]; - int x = index[1]; - int c = index[2]; - i = with_padding ? (y * this->shape_with_padding[1] + x) * this->shape_with_padding[2] + c : ((y + this->padding[0]) * this->shape_with_padding[1] + x + this->padding[2]) * this->shape_with_padding[2] + c; - } - else if (this->shape.size() == 2) - { - printf("Tensor.get_element_value with this->shape.size() == 2 is not implemented.\n"); - } + return this->element[this->get_element_index(index)]; + } - return this->element[i]; + /** + * @brief Get the element value. + * + * @param index the index of the element. + * @return T element value + */ + T get_element_value(int index) + { + return this->element[index]; } /** - * @brief Get the size of element. + * @brief Get the size of Tensor. * - * @return size of element including padding + * @return the size of Tensor. */ int get_size() { - if (this->size == -1) // didn't call Tensor.set_padding_size() before - { - this->size = 1; - for (std::vector::iterator d = this->shape.begin(); d != this->shape.end(); d++) - this->size *= *d; - } - return this->size; } + /** + * @brief Get the axis offset + * + * @return std::vector the axis offset + */ + std::vector get_axis_offset() + { + return this->axis_offset; + } + /** * @brief Apply memory with zero-initialized only if this->element is NULL. * @@ -319,7 +293,7 @@ namespace dl if (this->element != NULL) return false; - this->element = (T *)dl::tool::calloc_aligned(this->get_size(), sizeof(T), 16); + this->element = (T *)dl::tool::calloc_aligned_prefer(this->get_size(), sizeof(T), 16); this->auto_free = auto_free; return true; @@ -340,31 +314,7 @@ namespace dl if (this->element != NULL) return false; - this->element = (T *)tool::malloc_aligned(this->get_size(), sizeof(T), 16); - this->auto_free = auto_free; - - return true; - } - - /** - * @brief If this->element != NULL no memory will be applied and no value will be set in padding. - * Else apply memory without initialized and set value to padding. - * - * @param padding_value value to set in padding - * @param auto_free one of true of false - * - true: free element when object destroyed - * - false: do not - * @return - * - true: apply memory and set padding value successfully - * - false: no memory applied and no padding value set - */ - bool apply_element(const T padding_value = 0, const bool auto_free = true) - { - if (this->element != NULL) - return false; - - this->element = (T *)tool::malloc_aligned(this->get_size(), sizeof(T), 16); - this->set_padding_value(this->padding, padding_value); + this->element = (T *)tool::malloc_aligned_prefer(this->get_size(), sizeof(T), 16); this->auto_free = auto_free; return true; @@ -379,258 +329,56 @@ namespace dl { if (this->auto_free && this->element) { - tool::free_aligned(this->element); + tool::free_aligned_prefer(this->element); this->element = NULL; } } /** - * @brief Print the shape of Tensor in format "shape = ({top_padding} + {height} + {bottom_padding}, {left_padding} + {width} + {right_padding}, {channel}(channel_with_padding))\n". + * @brief print the element of the tensor + * + * @param axis_index_range the element range of each dims to be print. if axis_index_range == {}, all the element will be print. + * @param message to print */ - void print_shape() - { - printf("shape = (%d + %d + %d, %d + %d + %d, %d(%d))\n", - this->padding[0], this->shape[0], this->padding[1], - this->padding[2], this->shape[1], this->padding[3], - this->shape[2], this->shape_with_padding[2]); - } + void print(std::vector axis_index_range = {}, const char *message = ""); /** - * @brief Take numpy for example, this function print Tensor[y_start:y_end, x_start:x_end, c_start:c_end]. + * @brief print all the element of the Tensor. * - * inner box is effective value of Tensor, "0" around is padding. - * - * (with padding) - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * 000000(without padding) 00000000 - * 000000 00000000 - * 000000 00000000 - * 000000 effective value 00000000 - * 000000 00000000 - * 000000 00000000 - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * - * @param y_start start index in height - * @param y_end end index in height - * @param x_start start index in width - * @param x_end end index in width - * @param c_start start index in channel - * @param c_end end index in channel - * @param message to print - * @param axis print aligned this axis, effective only if all y_end - y_start, x_end - x_start and c_end - c_start equals to 1 + * @param message to print * @param with_padding one of true or false, - * - true: count from (with padding) in upper image - * - false: count from (without padding) in upper image + * - true: the padding element will also be ed + * - false: the padding element will not be ed */ - void print(int y_start, int y_end, - int x_start, int x_end, - int c_start, int c_end, - const char *message, int axis = 0, const bool with_padding = false) + void print_all(const char *message = "") { - assert(y_end > y_start); - assert(x_end > x_start); - assert(c_end > c_start); - - y_start = DL_MAX(y_start, 0); - x_start = DL_MAX(x_start, 0); - c_start = DL_MAX(c_start, 0); - if (with_padding) - { - y_end = DL_MIN(y_end, this->shape_with_padding[0]); - x_end = DL_MIN(x_end, this->shape_with_padding[1]); - c_end = DL_MIN(c_end, this->shape_with_padding[2]); - } - else - { - y_end = DL_MIN(y_end, this->shape[0]); - x_end = DL_MIN(x_end, this->shape[1]); - c_end = DL_MIN(c_end, this->shape[2]); - } - - printf("%s[%d:%d, %d:%d, %d:%d] | ", message, y_start, y_end, x_start, x_end, c_start, c_end); + std::cout << "\n" + << message << " | "; this->print_shape(); - if (y_end - y_start == 1) - { - if (x_end - x_start == 1) - { - for (int c = c_start; c < c_end; c++) - printf("%7d", c); - printf("\n"); - - for (int c = c_start; c < c_end; c++) - printf("%7d", this->get_element_value({y_start, x_start, c}, with_padding)); - printf("\n"); - - return; - } - else - { - if (c_end - c_start == 1) - { - for (int x = x_start; x < x_end; x++) - printf("%7d", x); - printf("\n"); - - for (int x = x_start; x < x_end; x++) - printf("%7d", this->get_element_value({y_start, x, c_start}, with_padding)); - printf("\n"); - - return; - } - } - } - else + for (int i = 0; i < this->get_size(); i++) { - if (x_end - x_start == 1) - { - if (c_end - c_start == 1) - { - for (int y = y_start; y < y_end; y++) - printf("%7d", y); - printf("\n"); - - for (int y = y_start; y < y_end; y++) - printf("%7d", this->get_element_value({y, x_start, c_start}, with_padding)); - printf("\n"); - - return; - } - } + std::cout << this->element[i] << " "; } - - if (y_end - y_start == 1) - axis = 0; - - if (x_end - x_start == 1) - axis = 1; - - if (c_end - c_start == 1) - axis = 2; - - if (axis == 0) - { - // ______c - // | - // | - // x - // - for (int y = y_start; y < y_end; y++) - { - printf("y = %d\n ", y); - - for (int c = c_start; c < c_end; c++) - printf("%7d", c); - printf("\n"); - - for (int x = x_start; x < x_end; x++) - { - printf("%5d", x); - for (int c = c_start; c < c_end; c++) - printf("%7d", this->get_element_value({y, x, c}, with_padding)); - printf("\n"); - } - printf("\n"); - } - } - else if (axis == 1) - { - // ______c - // | - // | - // y - // - for (int x = x_start; x < x_end; x++) - { - printf("x = %d\n ", x); - - for (int c = c_start; c < c_end; c++) - printf("%7d", c); - printf("\n"); - - for (int y = y_start; y < y_end; y++) - { - printf("%5d", y); - for (int c = c_start; c < c_end; c++) - printf("%7d", this->get_element_value({y, x, c}, with_padding)); - printf("\n"); - } - printf("\n"); - } - } - else - { - // ______x - // | - // | - // y - // - for (int c = c_start; c < c_end; c++) - { - printf("c = %d\n ", c); - - for (int x = x_start; x < x_end; x++) - printf("%7d", x); - printf("\n"); - - for (int y = y_start; y < y_end; y++) - { - printf("%5d", y); - for (int x = x_start; x < x_end; x++) - printf("%7d", this->get_element_value({y, x, c}, with_padding)); - printf("\n"); - } - printf("\n"); - } - } - + std::cout << "\n"; return; } /** - * @brief print all the element of the Tensor. + * @brief Get the index of each dims * - * @param message to print - * @param with_padding one of true or false, - * - true: the padding element will also be printed - * - false: the padding element will not be printed + * @param element_index the index of the element + * @return std::vector the index of each dims */ - void print_all(const char *message, const bool with_padding = false) - { - int y_end; - int x_end; - int c_end; - if (with_padding) - { - y_end = this->shape_with_padding[0]; - x_end = this->shape_with_padding[1]; - c_end = this->shape_with_padding[2]; - } - else - { - y_end = this->shape[0]; - x_end = this->shape[1]; - c_end = this->shape[2]; - } + std::vector get_axis_index(int element_index); - printf("\n%s | ", message); - this->print_shape(); - - for (int y = 0; y < y_end; y++) - { - for (int x = 0; x < x_end; x++) - { - for (int c = 0; c < c_end; c++) - printf("%d ", this->get_element_value({y, x, c}, with_padding)); - } - } - printf("\n"); - return; - } + /** + * @brief Get the index of element + * + * @param axis_index the index of each dims + * @return int the index of element + */ + int get_element_index(const std::vector axis_index); /** * @brief Check the element value with input ground-truth. @@ -638,35 +386,39 @@ namespace dl * @param gt_element ground-truth value of element * @param bias permissible error * @param info one of true or false - * - true: print shape and result + * - true: shape and result * - false: do not + * @param failed_number maximum number of wrong element that will be printed + * * @return * - true: in permissible error * - false: not */ - bool check_element(T *gt_element, int bias = 2, bool info = true) + bool check_element(T *gt_element, int bias = 2, bool info = true, int failed_number = 0) { + int count = 0; if (info) this->print_shape(); - int i = 0; - for (int y = 0; y < this->shape[0]; y++) + int size = this->get_size(); + for (int i = 0; i < size; i++) { - for (int x = 0; x < this->shape[1]; x++) + if (DL_ABS(this->element[i] - gt_element[i]) > bias) { - for (int c = 0; c < this->shape[2]; c++) + std::vector index = get_axis_index(i); + std::cout << "element["; + for (int j = 0; j < index.size() - 1; j++) { - int a = this->get_element_value({y, x, c}); - int b = gt_element[i]; - int offset = DL_ABS(a - b); - if (offset > bias) - { - printf("element[%d, %d, %d]: %d v.s. %d\n", y, x, c, a, b); - return false; - } - i++; + std::cout << index[j] << ", "; } + std::cout << index.back() << "]: "; + std::cout << +this->element[i] << " v.s. " << +gt_element[i] << "\n"; + count++; + if (count > failed_number) + return false; } } + if (count) + return false; if (info) printf("PASS\n"); @@ -700,35 +452,44 @@ namespace dl Tensor &operator=(const Tensor &input) { - this->size = input.size; this->auto_free = input.auto_free; this->exponent = input.exponent; - this->shape = input.shape; - this->padding = input.padding; - int size_real_tmp = this->shape_with_padding.size() ? this->shape_with_padding[0] * this->shape_with_padding[1] * this->shape_with_padding[2] : 0; - int size_input_real = input.shape_with_padding.size() ? input.shape_with_padding[0] * input.shape_with_padding[1] * input.shape_with_padding[2] : 0; - this->shape_with_padding = input.shape_with_padding; - if (this->element) + int size_real_tmp = this->size; + int size_input_real = input.size; + this->set_shape(input.shape); + if (input.element) { - if (size_real_tmp != size_input_real) + if (this->element) { - tool::free_aligned(this->element); - T *new_element = (T *)tool::calloc_aligned(size_input_real, sizeof(T), 16); - tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); - this->element = new_element; + if (size_real_tmp != size_input_real) + { + tool::free_aligned_prefer(this->element); + T *new_element = (T *)tool::malloc_aligned_prefer(size_input_real, sizeof(T), 16); + tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); + this->element = new_element; + } + else + { + tool::copy_memory(this->element, input.element, size_input_real * sizeof(T)); + } } else { - tool::copy_memory(this->element, input.element, size_input_real * sizeof(T)); + T *new_element = (T *)tool::malloc_aligned_prefer(size_input_real, sizeof(T), 16); + tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); + this->element = new_element; } + return *this; } else { - T *new_element = (T *)tool::calloc_aligned(size_input_real, sizeof(T), 16); - tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); - this->element = new_element; + if (this->element) + { + tool::free_aligned_prefer(this->element); + this->element = NULL; + } + return *this; } - return *this; } }; } // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp_hw_support/include/esp_sleep.h b/tools/sdk/esp32/include/esp_hw_support/include/esp_sleep.h index cfdfbc04186..75d2f9726c3 100644 --- a/tools/sdk/esp32/include/esp_hw_support/include/esp_sleep.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/esp_sleep.h @@ -44,6 +44,7 @@ typedef enum { #if SOC_PM_SUPPORT_CPU_PD ESP_PD_DOMAIN_CPU, //!< CPU core #endif + ESP_PD_DOMAIN_RTC8M, //!< Internal 8M oscillator ESP_PD_DOMAIN_VDDSDIO, //!< VDD_SDIO ESP_PD_DOMAIN_MAX //!< Number of domains } esp_sleep_pd_domain_t; diff --git a/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_io.h b/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_io.h index eebcabf42b4..330f4d9a165 100644 --- a/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_io.h +++ b/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_io.h @@ -65,6 +65,22 @@ esp_err_t esp_lcd_panel_io_tx_color(esp_lcd_panel_io_handle_t io, int lcd_cmd, c */ esp_err_t esp_lcd_panel_io_del(esp_lcd_panel_io_handle_t io); +/** + * @brief Type of LCD panel IO event data + */ +typedef struct { +} esp_lcd_panel_io_event_data_t; + +/** + * @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data + * + * @param[in] panel_io LCD panel IO handle, which is created by factory API like `esp_lcd_new_panel_io_spi()` + * @param[in] edata Panel IO event data, fed by driver + * @param[in] user_ctx User data, passed from `esp_lcd_panel_io_xxx_config_t` + * @return Whether a high priority task has been waken up by this function + */ +typedef bool (*esp_lcd_panel_io_color_trans_done_cb_t)(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx); + /** * @brief Panel IO configuration structure, for SPI interface */ @@ -74,8 +90,8 @@ typedef struct { int spi_mode; /*!< Traditional SPI mode (0~3) */ unsigned int pclk_hz; /*!< Frequency of pixel clock */ size_t trans_queue_depth; /*!< Size of internal transaction queue */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */ - void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ int lcd_param_bits; /*!< Bit-width of LCD parameter */ struct { @@ -100,8 +116,8 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p typedef struct { uint32_t dev_addr; /*!< I2C device address */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */ - void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ size_t control_phase_bytes; /*!< I2C LCD panel will encode control information (e.g. D/C seclection) into control phase, in several bytes */ unsigned int dc_bit_offset; /*!< Offset of the D/C selection bit in control phase */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ @@ -168,8 +184,8 @@ typedef struct { int cs_gpio_num; /*!< GPIO used for CS line, set to -1 will declaim exclusively use of I80 bus */ unsigned int pclk_hz; /*!< Frequency of pixel clock */ size_t trans_queue_depth; /*!< Transaction queue size, larger queue, higher throughput */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data was tranferred done */ - void *user_data; /*!< User private data, passed directly to on_trans_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data was tranferred done */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ int lcd_param_bits; /*!< Bit-width of LCD parameter */ struct { diff --git a/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_rgb.h b/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_rgb.h index 2ddd2b6b9a6..1368bb787f6 100644 --- a/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_rgb.h +++ b/tools/sdk/esp32/include/esp_lcd/include/esp_lcd_panel_rgb.h @@ -18,6 +18,37 @@ extern "C" { #if SOC_LCD_RGB_SUPPORTED /** * @brief LCD RGB timing structure + * + * Total Width + * <---------------------------------------------------> + * Hsync width HBP Active Width HFP + * <---><--><--------------------------------------><---> + * ____ ____|_______________________________________|____| + * |___| | | | + * | | | + * __| | | | + * /|\ /|\ | | | | + * | VSYNC| | | | | + * |Width\|/ |__ | | | + * | /|\ | | | | + * | VBP | | | | | + * | \|/_____|_________|_______________________________________| | + * | /|\ | | / / / / / / / / / / / / / / / / / / / | | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * Total | | | |/ / / / / / / / / / / / / / / / / / / /| | + * Heigh | | | |/ / / / / / / / / / / / / / / / / / / /| | + * |Active| | |/ / / / / / / / / / / / / / / / / / / /| | + * |Heigh | | |/ / / / / / Active Display Area / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | \|/_____|_________|_______________________________________| | + * | /|\ | | + * | VFP | | | + * \|/ \|/_____|______________________________________________________| + * */ typedef struct { unsigned int pclk_hz; /*!< Frequency of pixel clock */ @@ -38,6 +69,22 @@ typedef struct { } flags; } esp_lcd_rgb_timing_t; +/** + * @brief Type of RGB LCD panel event data + */ +typedef struct { +} esp_lcd_rgb_panel_event_data_t; + +/** + * @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data + * + * @param[in] panel LCD panel handle, returned from `esp_lcd_new_rgb_panel` + * @param[in] edata Panel event data, fed by driver + * @param[in] user_ctx User data, passed from `esp_lcd_rgb_panel_config_t` + * @return Whether a high priority task has been waken up by this function + */ +typedef bool (*esp_lcd_rgb_panel_frame_trans_done_cb_t)(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx); + /** * @brief LCD RGB panel configuration structure */ @@ -51,8 +98,8 @@ typedef struct { int pclk_gpio_num; /*!< GPIO used for PCLK signal */ int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; /*!< GPIOs used for data lines */ int disp_gpio_num; /*!< GPIO used for display control signal, set to -1 if it's not used */ - bool (*on_frame_trans_done)(esp_lcd_panel_handle_t panel, void *user_data); /*!< Callback, invoked when one frame buffer has transferred done */ - void *user_data; /*!< User data which would be passed to on_frame_trans_done's user_data */ + esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; /*!< Callback invoked when one frame buffer has transferred done */ + void *user_ctx; /*!< User data which would be passed to on_frame_trans_done's user_ctx */ 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) */ diff --git a/tools/sdk/esp32/include/esp_littlefs/include/esp_littlefs.h b/tools/sdk/esp32/include/esp_littlefs/include/esp_littlefs.h index dbb1028790d..7b5abe9248f 100644 --- a/tools/sdk/esp32/include/esp_littlefs/include/esp_littlefs.h +++ b/tools/sdk/esp32/include/esp_littlefs/include/esp_littlefs.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include "sdkconfig.h" diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_coexist.h b/tools/sdk/esp32/include/esp_wifi/include/esp_coexist.h index 1ff624d9b55..14b7c9aa506 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_coexist.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_coexist.h @@ -1,16 +1,8 @@ -// Copyright 2015-2018 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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_COEXIST_H__ #define __ESP_COEXIST_H__ @@ -32,6 +24,13 @@ typedef enum { ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */ } esp_coex_prefer_t; +typedef enum { + EXTERN_COEX_WIRE_1 = 0, + EXTERN_COEX_WIRE_2, + EXTERN_COEX_WIRE_3, + EXTERN_COEX_WIRE_NUM, +} external_coex_wire_t; + /** * @brief coex status type */ @@ -41,6 +40,36 @@ typedef enum { ESP_COEX_ST_TYPE_BT, } esp_coex_status_type_t; +/** + * @brief external coex gpio pti + */ +typedef struct { + int32_t in_pin0; + int32_t in_pin1; + int32_t out_pin0; +} esp_external_coex_gpio_set_t; + +/** + * @brief external coex pti level + */ +typedef enum { + EXTERN_COEX_PTI_MID = 0, + EXTERN_COEX_PTI_HIGH, + EXTERN_COEX_PTI_NUM, +} esp_coex_pti_level_t; + +/** + * @brief external coex pti + */ +typedef struct { + uint32_t in_pti1; + uint32_t in_pti2; + uint32_t in_pti3; + uint32_t out_pti1; + uint32_t out_pti2; + uint32_t out_pti3; +} esp_external_coex_pti_set_t; + #define ESP_COEX_BLE_ST_MESH_CONFIG 0x08 #define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10 #define ESP_COEX_BLE_ST_MESH_STANDBY 0x20 @@ -84,6 +113,18 @@ esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status); */ esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status); +#if CONFIG_EXTERNAL_COEX_ENABLE +/** + * @brief Setup gpio pin and corresponding pti level, start external coex. + * @param wire_type : to select the whole external coex gpio number. + * @param gpio_pin : gpio pin number to choose. + * @return : ESP_OK - success, other - failed + */ +esp_err_t esp_enable_extern_coex_gpio_pin(external_coex_wire_t wire_type, + esp_external_coex_gpio_set_t gpio_pin); + +esp_err_t esp_disable_extern_coex_gpio_pin(); +#endif #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_internal.h b/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_internal.h index 3501f0da6fb..7ba06d4c690 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_internal.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_internal.h @@ -1,21 +1,14 @@ -// Copyright 2018-2018 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: 2018-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_COEXIST_INTERNAL_H__ #define __ESP_COEXIST_INTERNAL_H__ #include +#include "esp_coexist.h" #include "esp_coexist_adapter.h" #ifdef __cplusplus @@ -210,6 +203,29 @@ int coex_schm_curr_phase_idx_get(void); */ esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs); +#if CONFIG_EXTERNAL_COEX_ENABLE +/** + * @brief Set external coexistence pti level and enable it. + * + * @param level1 external coex low pti + * @param level2 external coex mid pti + * @param level3 external coex high pti + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_coex_external_set(esp_coex_pti_level_t level1, + esp_coex_pti_level_t level2, esp_coex_pti_level_t level3); + +/** + * @brief Disable external coexist + * + * @return + * - ESP_OK: succeed + */ +void esp_coex_external_stop(void); +#endif /*External Coex*/ + /** * @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library * diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_types.h b/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_types.h index 503e8d7bb05..cee23f3fafc 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_types.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_types.h @@ -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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_WIFI_TYPES_H__ @@ -80,6 +72,7 @@ typedef enum { WIFI_REASON_ASSOC_NOT_AUTHED = 9, WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11, + WIFI_REASON_BSS_TRANSITION_DISASSOC = 12, WIFI_REASON_IE_INVALID = 13, WIFI_REASON_MIC_FAILURE = 14, WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, @@ -250,7 +243,8 @@ typedef struct { wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame. Will be advertized in RSN Capabilities in RSN IE. */ uint32_t rm_enabled:1; /**< Whether Radio Measurements are enabled for the connection */ uint32_t btm_enabled:1; /**< Whether BSS Transition Management is enabled for the connection */ - uint32_t reserved:30; /**< Reserved for future feature set */ + uint32_t mbo_enabled:1; /**< Whether MBO is enabled for the connection */ + uint32_t reserved:29; /**< Reserved for future feature set */ } wifi_sta_config_t; /** @brief Configuration data for ESP32 AP or STA. diff --git a/tools/sdk/esp32/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h b/tools/sdk/esp32/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h index a01a56e9fd4..675af141ebc 100644 --- a/tools/sdk/esp32/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h +++ b/tools/sdk/esp32/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h @@ -90,7 +90,6 @@ #define portNUM_PROCESSORS 1 #endif -#define configASSERT_2 0 #define portUSING_MPU_WRAPPERS 0 #define configUSE_MUTEX 1 @@ -206,7 +205,6 @@ #define configGENERATE_RUN_TIME_STATS 1 /* Used by vTaskGetRunTimeStats() */ #endif -#define configUSE_TRACE_FACILITY_2 0 #define configBENCHMARK 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 0 @@ -306,4 +304,9 @@ extern void vPortCleanUpTCB ( void *pxTCB ); #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1 +// backward compatibility for 4.4 +#define xTaskRemoveFromUnorderedEventList vTaskRemoveFromUnorderedEventList + +#define configNUM_CORES portNUM_PROCESSORS + #endif /* FREERTOS_CONFIG_H */ diff --git a/tools/sdk/esp32/include/freertos/include/freertos/event_groups.h b/tools/sdk/esp32/include/freertos/include/freertos/event_groups.h index 84505ddaaa0..9792296e566 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/event_groups.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/event_groups.h @@ -64,7 +64,7 @@ * used to create a synchronisation point between multiple tasks (a * 'rendezvous'). * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventGroup EventGroup * @endcond */ @@ -78,7 +78,7 @@ * xEventGroupCreate() returns an EventGroupHandle_t variable that can then * be used as a parameter to other event group functions. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventGroupHandle_t EventGroupHandle_t * @endcond * \ingroup EventGroup @@ -94,7 +94,7 @@ typedef struct EventGroupDef_t * EventGroupHandle_t; * number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1, * 32 bits if set to 0. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventBits_t EventBits_t * @endcond * \ingroup EventGroup @@ -102,7 +102,7 @@ typedef struct EventGroupDef_t * EventGroupHandle_t; typedef TickType_t EventBits_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventGroupHandle_t xEventGroupCreate( void ); @@ -152,7 +152,7 @@ typedef TickType_t EventBits_t; * // The event group was created. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupCreate xEventGroupCreate * @endcond * \ingroup EventGroup @@ -162,7 +162,7 @@ typedef TickType_t EventBits_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventGroupHandle_t xEventGroupCreateStatic( EventGroupHandle_t * pxEventGroupBuffer ); @@ -217,7 +217,7 @@ typedef TickType_t EventBits_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, @@ -307,7 +307,7 @@ typedef TickType_t EventBits_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupWaitBits xEventGroupWaitBits * @endcond * \ingroup EventGroup @@ -319,7 +319,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ); @@ -372,7 +372,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupClearBits xEventGroupClearBits * @endcond * \ingroup EventGroup @@ -381,7 +381,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); @@ -432,7 +432,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR * @endcond * \ingroup EventGroup @@ -446,7 +446,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); @@ -516,7 +516,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSetBits xEventGroupSetBits * @endcond * \ingroup EventGroup @@ -525,7 +525,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ); @@ -595,7 +595,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR * @endcond * \ingroup EventGroup @@ -610,7 +610,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, @@ -732,7 +732,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSync xEventGroupSync * @endcond * \ingroup EventGroup @@ -744,7 +744,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup ); @@ -758,7 +758,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, * * @return The event group bits at the time xEventGroupGetBits() was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupGetBits xEventGroupGetBits * @endcond * \ingroup EventGroup @@ -766,7 +766,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, #define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( xEventGroup, 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ); @@ -779,7 +779,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, * * @return The event group bits at the time xEventGroupGetBitsFromISR() was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR * @endcond * \ingroup EventGroup @@ -787,7 +787,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * void xEventGroupDelete( EventGroupHandle_t xEventGroup ); @@ -802,7 +802,7 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEG */ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* For internal use only. */ void vEventGroupSetBitsCallback( void * pvEventGroup, diff --git a/tools/sdk/esp32/include/freertos/include/freertos/message_buffer.h b/tools/sdk/esp32/include/freertos/include/freertos/message_buffer.h index e57c589fbac..af5c3290b7c 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/message_buffer.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/message_buffer.h @@ -85,7 +85,7 @@ typedef void * MessageBufferHandle_t; /*-----------------------------------------------------------*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -139,7 +139,7 @@ typedef void * MessageBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferCreate xMessageBufferCreate * @endcond * \ingroup MessageBufferManagement @@ -148,7 +148,7 @@ typedef void * MessageBufferHandle_t; ( MessageBufferHandle_t ) xStreamBufferGenericCreate( xBufferSizeBytes, ( size_t ) 0, pdTRUE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -210,7 +210,7 @@ typedef void * MessageBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferCreateStatic xMessageBufferCreateStatic * @endcond * \ingroup MessageBufferManagement @@ -219,7 +219,7 @@ typedef void * MessageBufferHandle_t; ( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -314,7 +314,7 @@ typedef void * MessageBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSend xMessageBufferSend * @endcond * \ingroup MessageBufferManagement @@ -323,7 +323,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSend( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -423,7 +423,7 @@ typedef void * MessageBufferHandle_t; * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSendFromISR xMessageBufferSendFromISR * @endcond * \ingroup MessageBufferManagement @@ -432,7 +432,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSendFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -516,7 +516,7 @@ typedef void * MessageBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceive xMessageBufferReceive * @endcond * \ingroup MessageBufferManagement @@ -526,7 +526,7 @@ typedef void * MessageBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -622,7 +622,7 @@ typedef void * MessageBufferHandle_t; * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceiveFromISR xMessageBufferReceiveFromISR * @endcond * \ingroup MessageBufferManagement @@ -631,7 +631,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferReceiveFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -654,7 +654,7 @@ typedef void * MessageBufferHandle_t; vStreamBufferDelete( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferIsFull( MessageBufferHandle_t xMessageBuffer ) ); @@ -674,7 +674,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferIsFull( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferIsEmpty( MessageBufferHandle_t xMessageBuffer ) ); @@ -693,7 +693,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferIsEmpty( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferReset( MessageBufferHandle_t xMessageBuffer ); @@ -712,7 +712,7 @@ typedef void * MessageBufferHandle_t; * the message queue to wait for space to become available, or to wait for a * a message to be available, then pdFAIL is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReset xMessageBufferReset * @endcond * \ingroup MessageBufferManagement @@ -722,7 +722,7 @@ typedef void * MessageBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * size_t xMessageBufferSpaceAvailable( MessageBufferHandle_t xMessageBuffer ) ); @@ -740,7 +740,7 @@ typedef void * MessageBufferHandle_t; * architecture, so if xMessageBufferSpacesAvailable() returns 10, then the size * of the largest message that can be written to the message buffer is 6 bytes. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSpaceAvailable xMessageBufferSpaceAvailable * @endcond * \ingroup MessageBufferManagement @@ -751,7 +751,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSpacesAvailable( ( StreamBufferHandle_t ) xMessageBuffer ) /* Corrects typo in original macro name. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * size_t xMessageBufferNextLengthBytes( MessageBufferHandle_t xMessageBuffer ) ); @@ -767,7 +767,7 @@ typedef void * MessageBufferHandle_t; * @return The length (in bytes) of the next message in the message buffer, or 0 * if the message buffer is empty. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferNextLengthBytes xMessageBufferNextLengthBytes * @endcond * \ingroup MessageBufferManagement @@ -776,7 +776,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferNextMessageLengthBytes( ( StreamBufferHandle_t ) xMessageBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -811,7 +811,7 @@ typedef void * MessageBufferHandle_t; * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSendCompletedFromISR xMessageBufferSendCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -820,7 +820,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSendCompletedFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -856,7 +856,7 @@ typedef void * MessageBufferHandle_t; * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceiveCompletedFromISR xMessageBufferReceiveCompletedFromISR * @endcond * \ingroup StreamBufferManagement diff --git a/tools/sdk/esp32/include/freertos/include/freertos/queue.h b/tools/sdk/esp32/include/freertos/include/freertos/queue.h index 81cccc05df3..05ca7de4546 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/queue.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/queue.h @@ -62,7 +62,7 @@ typedef struct QueueDefinition * QueueSetHandle_t; */ typedef struct QueueDefinition * QueueSetMemberHandle_t; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* For internal use only. */ #define queueSEND_TO_BACK ( ( BaseType_t ) 0 ) @@ -80,7 +80,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * QueueHandle_t xQueueCreate( @@ -146,7 +146,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueCreate xQueueCreate * @endcond * \ingroup QueueManagement @@ -156,7 +156,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * QueueHandle_t xQueueCreateStatic( @@ -235,7 +235,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueCreateStatic xQueueCreateStatic * @endcond * \ingroup QueueManagement @@ -245,7 +245,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToToFront( @@ -321,7 +321,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -330,7 +330,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToBack( @@ -408,7 +408,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -417,7 +417,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSend( @@ -497,7 +497,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -506,7 +506,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueOverwrite( @@ -585,7 +585,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueOverwrite xQueueOverwrite * @endcond * \ingroup QueueManagement @@ -595,7 +595,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueGenericSend( @@ -678,7 +678,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -689,7 +689,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueuePeek( @@ -780,7 +780,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueuePeek xQueuePeek * @endcond * \ingroup QueueManagement @@ -790,7 +790,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueuePeekFromISR( @@ -820,7 +820,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, * @return pdTRUE if an item was successfully received from the queue, * otherwise pdFALSE. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueuePeekFromISR xQueuePeekFromISR * @endcond * \ingroup QueueManagement @@ -829,7 +829,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueReceive( @@ -917,7 +917,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueReceive xQueueReceive * @endcond * \ingroup QueueManagement @@ -927,7 +927,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ); @@ -940,7 +940,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, * * @return The number of messages available in the queue. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * @endcond * \ingroup QueueManagement @@ -948,7 +948,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ); @@ -963,7 +963,7 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNC * * @return The number of spaces available in the queue. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * @endcond * \ingroup QueueManagement @@ -971,7 +971,7 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNC UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * void vQueueDelete( QueueHandle_t xQueue ); @@ -983,7 +983,7 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNC * * @param xQueue A handle to the queue to be deleted. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vQueueDelete vQueueDelete * @endcond * \ingroup QueueManagement @@ -991,7 +991,7 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNC void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToFrontFromISR( @@ -1057,7 +1057,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1067,7 +1067,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToBackFromISR( @@ -1133,7 +1133,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1142,7 +1142,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueOverwriteFromISR( @@ -1225,7 +1225,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueOverwriteFromISR xQueueOverwriteFromISR * @endcond * \ingroup QueueManagement @@ -1234,7 +1234,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueOVERWRITE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendFromISR( @@ -1304,7 +1304,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1312,10 +1312,10 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; #define xQueueSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \ xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK ) -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /**@{*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueGenericSendFromISR( @@ -1402,7 +1402,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueReceiveFromISR( @@ -1487,7 +1487,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR * @endcond * \ingroup QueueManagement @@ -1504,7 +1504,7 @@ BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FU BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * The functions defined above are for passing data to and from tasks. The * functions below are the equivalents for passing data to and from @@ -1778,7 +1778,7 @@ QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, */ QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* Not public API functions. */ void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, diff --git a/tools/sdk/esp32/include/freertos/include/freertos/semphr.h b/tools/sdk/esp32/include/freertos/include/freertos/semphr.h index 7e99c0b396c..2041641b91d 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/semphr.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/semphr.h @@ -39,7 +39,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U ) #define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U ) -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** * semphr. h * @code{c} @@ -88,7 +88,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary * @endcond * \ingroup Semaphores @@ -106,7 +106,7 @@ typedef QueueHandle_t SemaphoreHandle_t; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateBinary( void ); @@ -163,7 +163,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateBinary xSemaphoreCreateBinary * @endcond * \ingroup Semaphores @@ -173,7 +173,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateBinaryStatic( StaticSemaphore_t *pxSemaphoreBuffer ); @@ -229,7 +229,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // Rest of task code goes here. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateBinaryStatic xSemaphoreCreateBinaryStatic * @endcond * \ingroup Semaphores @@ -239,7 +239,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTake( @@ -304,7 +304,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreTake xSemaphoreTake * @endcond * \ingroup Semaphores @@ -312,7 +312,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueSemaphoreTake( ( xSemaphore ), ( xBlockTime ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTakeRecursive( @@ -403,7 +403,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive * @endcond * \ingroup Semaphores @@ -465,7 +465,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGive xSemaphoreGive * @endcond * \ingroup Semaphores @@ -473,7 +473,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex ); @@ -555,7 +555,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive * @endcond * \ingroup Semaphores @@ -641,7 +641,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR * @endcond * \ingroup Semaphores @@ -649,7 +649,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGiveFromISR( ( QueueHandle_t ) ( xSemaphore ), ( pxHigherPriorityTaskWoken ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTakeFromISR( @@ -686,7 +686,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateMutex( void ); @@ -741,7 +741,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex * @endcond * \ingroup Semaphores @@ -751,7 +751,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateMutexStatic( StaticSemaphore_t *pxMutexBuffer ); @@ -808,7 +808,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // so there is no need to check it. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic * @endcond * \ingroup Semaphores @@ -951,7 +951,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount ); @@ -1027,7 +1027,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting * @endcond * \ingroup Semaphores @@ -1037,7 +1037,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateCountingStatic( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount, StaticSemaphore_t *pxSemaphoreBuffer ); @@ -1118,7 +1118,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // is no need to check its value. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateCountingStatic xSemaphoreCreateCountingStatic * @endcond * \ingroup Semaphores @@ -1128,7 +1128,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * void vSemaphoreDelete( SemaphoreHandle_t xSemaphore ); @@ -1140,7 +1140,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * * @param xSemaphore A handle to the semaphore to be deleted. * - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * \defgroup vSemaphoreDelete vSemaphoreDelete * @endcond * \ingroup Semaphores @@ -1148,7 +1148,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex ); @@ -1167,7 +1167,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * TaskHandle_t xSemaphoreGetMutexHolderFromISR( SemaphoreHandle_t xMutex ); @@ -1182,7 +1182,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * UBaseType_t uxSemaphoreGetCount( SemaphoreHandle_t xSemaphore ); diff --git a/tools/sdk/esp32/include/freertos/include/freertos/stream_buffer.h b/tools/sdk/esp32/include/freertos/include/freertos/stream_buffer.h index 9e58cff120c..a20dcf0375e 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/stream_buffer.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/stream_buffer.h @@ -71,7 +71,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -134,7 +134,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferCreate xStreamBufferCreate * @endcond * \ingroup StreamBufferManagement @@ -142,7 +142,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; #define xStreamBufferCreate( xBufferSizeBytes, xTriggerLevelBytes ) xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -220,7 +220,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferCreateStatic xStreamBufferCreateStatic * @endcond * \ingroup StreamBufferManagement @@ -229,7 +229,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, pucStreamBufferStorageArea, pxStaticStreamBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -319,7 +319,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSend xStreamBufferSend * @endcond * \ingroup StreamBufferManagement @@ -330,7 +330,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -424,7 +424,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, * taskYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSendFromISR xStreamBufferSendFromISR * @endcond * \ingroup StreamBufferManagement @@ -435,7 +435,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -517,7 +517,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceive xStreamBufferReceive * @endcond * \ingroup StreamBufferManagement @@ -528,7 +528,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -607,7 +607,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, * taskYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceiveFromISR xStreamBufferReceiveFromISR * @endcond * \ingroup StreamBufferManagement @@ -618,7 +618,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -636,7 +636,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, * * @param xStreamBuffer The handle of the stream buffer to be deleted. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vStreamBufferDelete vStreamBufferDelete * @endcond * \ingroup StreamBufferManagement @@ -644,7 +644,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -660,7 +660,7 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTI * @return If the stream buffer is full then pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferIsFull xStreamBufferIsFull * @endcond * \ingroup StreamBufferManagement @@ -668,7 +668,7 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTI BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -684,7 +684,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_ * @return If the stream buffer is empty then pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferIsEmpty xStreamBufferIsEmpty * @endcond * \ingroup StreamBufferManagement @@ -692,7 +692,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -711,7 +711,7 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED * a task blocked waiting to send to or read from the stream buffer then the * stream buffer is not reset and pdFAIL is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReset xStreamBufferReset * @endcond * \ingroup StreamBufferManagement @@ -719,7 +719,7 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -736,7 +736,7 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_F * @return The number of bytes that can be written to the stream buffer before * the stream buffer would be full. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSpacesAvailable xStreamBufferSpacesAvailable * @endcond * \ingroup StreamBufferManagement @@ -744,7 +744,7 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_F size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -761,7 +761,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVIL * @return The number of bytes that can be read from the stream buffer before * the stream buffer would be empty. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferBytesAvailable xStreamBufferBytesAvailable * @endcond * \ingroup StreamBufferManagement @@ -769,7 +769,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVIL size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -802,7 +802,7 @@ size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILE * then the trigger level will be updated and pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSetTriggerLevel xStreamBufferSetTriggerLevel * @endcond * \ingroup StreamBufferManagement @@ -811,7 +811,7 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -846,7 +846,7 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSendCompletedFromISR xStreamBufferSendCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -855,7 +855,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -891,7 +891,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceiveCompletedFromISR xStreamBufferReceiveCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -899,7 +899,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* Functions below here are not part of the public API. */ StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, diff --git a/tools/sdk/esp32/include/freertos/include/freertos/task.h b/tools/sdk/esp32/include/freertos/include/freertos/task.h index 9135b76f014..125a924d061 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/task.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/task.h @@ -76,7 +76,7 @@ * returns (via a pointer parameter) an TaskHandle_t variable that can then * be used as a parameter to vTaskDelete to delete the task. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup TaskHandle_t TaskHandle_t * @endcond * \ingroup Tasks @@ -114,7 +114,7 @@ typedef enum eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */ } eNotifyAction; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** * Used internally only. */ @@ -189,11 +189,13 @@ typedef enum #define tskIDLE_PRIORITY ( ( UBaseType_t ) 0U ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro for forcing a context switch. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskYIELD taskYIELD * @endcond * \ingroup SchedulerControl @@ -201,7 +203,9 @@ typedef enum #define taskYIELD() portYIELD() /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to mark the start of a critical code region. Preemptive context * switches cannot occur when in a critical region. @@ -209,7 +213,7 @@ typedef enum * @note This may alter the stack (depending on the portable implementation) * so must be used with care! * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskENTER_CRITICAL taskENTER_CRITICAL * @endcond * \ingroup SchedulerControl @@ -228,7 +232,9 @@ typedef enum #endif // ESP_PLATFORM /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to mark the end of a critical code region. Preemptive context * switches cannot occur when in a critical region. @@ -236,7 +242,7 @@ typedef enum * @note This may alter the stack (depending on the portable implementation) * so must be used with care! * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskEXIT_CRITICAL taskEXIT_CRITICAL * @endcond * \ingroup SchedulerControl @@ -255,11 +261,13 @@ typedef enum #define taskEXIT_CRITICAL_ISR( ) portEXIT_CRITICAL_ISR( ) #endif // ESP_PLATFORM /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to disable all maskable interrupts. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS * @endcond * \ingroup SchedulerControl @@ -267,11 +275,13 @@ typedef enum #define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS() /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to enable microcontroller interrupts. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskENABLE_INTERRUPTS taskENABLE_INTERRUPTS * @endcond * \ingroup SchedulerControl @@ -422,7 +432,7 @@ typedef enum * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreate xTaskCreate * @endcond * \ingroup Tasks @@ -430,14 +440,14 @@ typedef enum #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) static inline IRAM_ATTR BaseType_t xTaskCreate( - TaskFunction_t pvTaskCode, - const char * const pcName, - const uint32_t usStackDepth, - void * const pvParameters, - UBaseType_t uxPriority, - TaskHandle_t * const pvCreatedTask) + TaskFunction_t pvTaskCode, + const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + const uint32_t usStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + TaskHandle_t * const pxCreatedTask) PRIVILEGED_FUNCTION { - return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, tskNO_AFFINITY ); + return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, tskNO_AFFINITY ); } #endif @@ -599,20 +609,20 @@ typedef enum #if( configSUPPORT_STATIC_ALLOCATION == 1 ) static inline IRAM_ATTR TaskHandle_t xTaskCreateStatic( - TaskFunction_t pvTaskCode, - const char * const pcName, - const uint32_t ulStackDepth, - void * const pvParameters, - UBaseType_t uxPriority, - StackType_t * const pxStackBuffer, - StaticTask_t * const pxTaskBuffer) + TaskFunction_t pvTaskCode, + const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + const uint32_t ulStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + StackType_t * const puxStackBuffer, + StaticTask_t * const pxTaskBuffer) PRIVILEGED_FUNCTION { - return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, pxStackBuffer, pxTaskBuffer, tskNO_AFFINITY ); + return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, tskNO_AFFINITY ); } #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskCreateRestricted( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask ); @@ -683,18 +693,18 @@ typedef enum * for( ;; ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestricted xTaskCreateRestricted * @endcond * \ingroup Tasks */ #if ( portUSING_MPU_WRAPPERS == 1 ) BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, - TaskHandle_t * pxCreatedTask ); + TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskCreateRestrictedStatic( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask ); @@ -777,7 +787,7 @@ typedef enum * for( ;; ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestrictedStatic xTaskCreateRestrictedStatic * @endcond * \ingroup Tasks @@ -788,7 +798,7 @@ typedef enum #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ); @@ -833,7 +843,7 @@ typedef enum * // defined or shared regions have been declared elsewhere). * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestricted xTaskCreateRestricted * @endcond * \ingroup Tasks @@ -842,7 +852,7 @@ void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskDelete( TaskHandle_t xTask ); @@ -881,7 +891,7 @@ void vTaskAllocateMPURegions( TaskHandle_t xTask, * vTaskDelete( xHandle ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskDelete vTaskDelete * @endcond * \ingroup Tasks @@ -893,10 +903,12 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; *----------------------------------------------------------*/ /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskDelay( const TickType_t xTicksToDelay ); * @endcode + * @endcond * * Delay a task for a given number of ticks. The actual time that the * task remains blocked depends on the tick rate. The constant @@ -938,7 +950,7 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskDelay vTaskDelay * @endcond * \ingroup TaskCtrl @@ -946,10 +958,12 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION; /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement ); * @endcode + * @endcond * * INCLUDE_xTaskDelayUntil must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -1007,7 +1021,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskDelayUntil xTaskDelayUntil * @endcond * \ingroup TaskCtrl @@ -1026,7 +1040,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskAbortDelay( TaskHandle_t xTask ); @@ -1054,7 +1068,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, * @return If the task referenced by xTask was not in the Blocked state then * pdFAIL is returned. Otherwise pdPASS is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskAbortDelay xTaskAbortDelay * @endcond * \ingroup TaskCtrl @@ -1062,7 +1076,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ); @@ -1107,7 +1121,7 @@ BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxTaskPriorityGet uxTaskPriorityGet * @endcond * \ingroup TaskCtrl @@ -1115,7 +1129,7 @@ BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ); @@ -1127,7 +1141,7 @@ UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * eTaskState eTaskGetState( TaskHandle_t xTask ); @@ -1149,7 +1163,7 @@ UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNC eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ); @@ -1203,7 +1217,7 @@ eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; * eInvalid ); // Include the task state in xTaskDetails. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskGetInfo vTaskGetInfo * @endcond * \ingroup TaskCtrl @@ -1214,7 +1228,7 @@ void vTaskGetInfo( TaskHandle_t xTask, eTaskState eState ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ); @@ -1254,7 +1268,7 @@ void vTaskGetInfo( TaskHandle_t xTask, * vTaskPrioritySet( NULL, tskIDLE_PRIORITY + 1 ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskPrioritySet vTaskPrioritySet * @endcond * \ingroup TaskCtrl @@ -1263,7 +1277,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskSuspend( TaskHandle_t xTaskToSuspend ); @@ -1312,7 +1326,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, * // with our handle as the parameter. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskSuspend vTaskSuspend * @endcond * \ingroup TaskCtrl @@ -1320,7 +1334,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskResume( TaskHandle_t xTaskToResume ); @@ -1367,7 +1381,7 @@ void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; * // time in accordance with its priority within the system. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskResume vTaskResume * @endcond * \ingroup TaskCtrl @@ -1375,7 +1389,7 @@ void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void xTaskResumeFromISR( TaskHandle_t xTaskToResume ); @@ -1402,7 +1416,7 @@ void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; * otherwise pdFALSE. This is used by the ISR to determine if a context switch * may be required following the ISR. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskResumeFromISR vTaskResumeFromISR * @endcond * \ingroup TaskCtrl @@ -1412,9 +1426,9 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * SCHEDULER CONTROL *----------------------------------------------------------*/ -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskStartScheduler( void ); @@ -1445,7 +1459,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskStartScheduler vTaskStartScheduler * @endcond * \ingroup SchedulerControl @@ -1453,7 +1467,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskEndScheduler( void ); @@ -1507,7 +1521,7 @@ void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskEndScheduler vTaskEndScheduler * @endcond * \ingroup SchedulerControl @@ -1517,7 +1531,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskSuspendAll( void ); @@ -1566,7 +1580,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskSuspendAll vTaskSuspendAll * @endcond * \ingroup SchedulerControl @@ -1574,7 +1588,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskResumeAll( void ); @@ -1626,7 +1640,7 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskResumeAll xTaskResumeAll * @endcond * \ingroup SchedulerControl @@ -1638,7 +1652,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; *----------------------------------------------------------*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TickType_t xTaskGetTickCount( void ); @@ -1647,7 +1661,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; * * @return The count of ticks since vTaskStartScheduler was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskGetTickCount xTaskGetTickCount * @endcond * \ingroup TaskUtils @@ -1655,7 +1669,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TickType_t xTaskGetTickCountFromISR( void ); @@ -1669,7 +1683,7 @@ TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; * microcontroller being used or interrupt nesting is either not supported or * not being used. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR * @endcond * \ingroup TaskUtils @@ -1677,7 +1691,7 @@ TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint16_t uxTaskGetNumberOfTasks( void ); @@ -1689,7 +1703,7 @@ TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; * has been deleted but not yet freed by the idle task will also be * included in the count. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks * @endcond * \ingroup TaskUtils @@ -1697,7 +1711,7 @@ TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * char *pcTaskGetName( TaskHandle_t xTaskToQuery ); @@ -1708,7 +1722,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; * xTaskToQuery. A task can query its own name by either passing in its own * handle, or by setting xTaskToQuery to NULL. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup pcTaskGetName pcTaskGetName * @endcond * \ingroup TaskUtils @@ -1716,7 +1730,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ); @@ -1730,7 +1744,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lin * NULL is returned if no matching name is found. INCLUDE_xTaskGetHandle * must be set to 1 in FreeRTOSConfig.h for pcTaskGetHandle() to be available. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup pcTaskGetHandle pcTaskGetHandle * @endcond * \ingroup TaskUtils @@ -1813,7 +1827,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #ifdef configUSE_APPLICATION_TASK_TAG #if configUSE_APPLICATION_TASK_TAG == 1 /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ); @@ -1830,7 +1844,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; TaskHookFunction_t pxHookFunction ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void xTaskGetApplicationTaskTag( TaskHandle_t xTask ); @@ -1844,7 +1858,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ); @@ -1932,7 +1946,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName); @@ -1952,7 +1966,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configUSE_TICK_HOOK > 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationTickHook( void ); @@ -1967,7 +1981,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) @@ -1986,7 +2000,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ); @@ -2155,7 +2169,7 @@ UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, * enough to contain the generated report. Approximately 40 bytes per * task should be sufficient. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskList vTaskList * @endcond * \ingroup TaskUtils @@ -2210,7 +2224,7 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unq * contain the generated report. Approximately 40 bytes per task should * be sufficient. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskGetRunTimeStats vTaskGetRunTimeStats * @endcond * \ingroup TaskUtils @@ -2218,7 +2232,7 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unq void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code * uint32_t ulTaskGetIdleRunTimeCounter( void ); @@ -2246,7 +2260,7 @@ void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lin * frequency configured using the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and * portGET_RUN_TIME_COUNTER_VALUE() macros. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter * @endcond * \ingroup TaskUtils @@ -2254,11 +2268,13 @@ void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lin uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction ); * BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2359,7 +2375,9 @@ uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; * @return Dependent on the value of eAction. See the description of the * eAction parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyIndexed xTaskNotifyIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, @@ -2373,11 +2391,13 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), NULL ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyAndQueryIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue ); * BaseType_t xTaskNotifyAndQuery( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2393,7 +2413,9 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, * than when the function returns) in the additional pulPreviousNotifyValue * parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyAndQueryIndexed xTaskNotifyAndQueryIndexed + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyAndQuery( xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue ) \ @@ -2402,11 +2424,13 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ); * BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2511,7 +2535,9 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, * @return Dependent on the value of eAction. See the description of the * eAction parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyIndexedFromISR xTaskNotifyIndexedFromISR + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, @@ -2526,11 +2552,13 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyAndQueryIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ); * BaseType_t xTaskNotifyAndQueryFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2546,7 +2574,9 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, * function is called rather than at the time the function returns) in the * additional pulPreviousNotifyValue parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyAndQueryIndexedFromISR xTaskNotifyAndQueryIndexedFromISR + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyAndQueryIndexedFromISR( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) \ @@ -2555,12 +2585,14 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( tskDEFAULT_INDEX_TO_NOTIFY ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyWaitIndexed( UBaseType_t uxIndexToWaitOn, uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); * * BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); * @endcode + * @endcond * * Waits for a direct to task notification to be pending at a given index within * an array of direct to task notifications. @@ -2655,7 +2687,9 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, * already pending when xTaskNotifyWait was called) then pdPASS is * returned. Otherwise pdFAIL is returned. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyWaitIndexed xTaskNotifyWaitIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, @@ -2669,11 +2703,13 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, xTaskGenericNotifyWait( ( uxIndexToWaitOn ), ( ulBitsToClearOnEntry ), ( ulBitsToClearOnExit ), ( pulNotificationValue ), ( xTicksToWait ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyGiveIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify ); * BaseType_t xTaskNotifyGive( TaskHandle_t xTaskToNotify ); * @endcode + * @endcond * * Sends a direct to task notification to a particular index in the target * task's notification array in a manner similar to giving a counting semaphore. @@ -2737,7 +2773,9 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, * @return xTaskNotifyGive() is a macro that calls xTaskNotify() with the * eAction parameter set to eIncrement - so pdPASS is always returned. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyGiveIndexed xTaskNotifyGiveIndexed + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyGive( xTaskToNotify ) \ @@ -2746,11 +2784,13 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( 0 ), eIncrement, NULL ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskNotifyGiveIndexedFromISR( TaskHandle_t xTaskHandle, UBaseType_t uxIndexToNotify, BaseType_t *pxHigherPriorityTaskWoken ); * void vTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * A version of xTaskNotifyGiveIndexed() that can be called from an interrupt * service routine (ISR). @@ -2821,7 +2861,9 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, * requested from an ISR is dependent on the port - see the documentation page * for the port in use. * + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskNotifyGiveIndexedFromISR vTaskNotifyGiveIndexedFromISR + * @endcond * \ingroup TaskNotifications */ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, @@ -2833,12 +2875,14 @@ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, vTaskGenericNotifyGiveFromISR( ( xTaskToNotify ), ( uxIndexToNotify ), ( pxHigherPriorityTaskWoken ) ); /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint32_t ulTaskNotifyTakeIndexed( UBaseType_t uxIndexToWaitOn, BaseType_t xClearCountOnExit, TickType_t xTicksToWait ); * * uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ); * @endcode + * @endcond * * Waits for a direct to task notification on a particular index in the calling * task's notification array in a manner similar to taking a counting semaphore. @@ -2927,7 +2971,9 @@ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, * @return The task's notification count before it is either cleared to zero or * decremented (see the xClearCountOnExit parameter). * + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskNotifyTakeIndexed ulTaskNotifyTakeIndexed + * @endcond * \ingroup TaskNotifications */ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, @@ -2939,12 +2985,14 @@ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, ulTaskGenericNotifyTake( ( uxIndexToWaitOn ), ( xClearCountOnExit ), ( xTicksToWait ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyStateClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToCLear ); * * BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2992,7 +3040,9 @@ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, * @return pdTRUE if the task's notification state was set to * eNotWaitingNotification, otherwise pdFALSE. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyStateClearIndexed xTaskNotifyStateClearIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, @@ -3003,12 +3053,14 @@ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, xTaskGenericNotifyStateClear( ( xTask ), ( uxIndexToClear ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint32_t ulTaskNotifyValueClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToClear, uint32_t ulBitsToClear ); * * uint32_t ulTaskNotifyValueClear( TaskHandle_t xTask, uint32_t ulBitsToClear ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -3057,7 +3109,9 @@ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, * * @return The value of the target task's notification value before the bits * specified by ulBitsToClear were cleared. + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskNotifyValueClear ulTaskNotifyValueClear + * @endcond * \ingroup TaskNotifications */ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, @@ -3069,7 +3123,7 @@ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, ulTaskGenericNotifyValueClear( ( xTask ), ( uxIndexToClear ), ( ulBitsToClear ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ); @@ -3082,14 +3136,14 @@ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, * is to be captured. The captured time includes the tick count and the number * of times the tick count has overflowed since the system first booted. * \defgroup vTaskSetTimeOutState vTaskSetTimeOutState - * @cond + * @cond !DOC_SINGLE_GROUP * \ingroup TaskCtrl * @endcond */ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code * BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ); @@ -3170,7 +3224,7 @@ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; * return uxReceived; * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCheckForTimeOut xTaskCheckForTimeOut * @endcond * \ingroup TaskCtrl @@ -3179,7 +3233,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ); @@ -3204,7 +3258,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, * blocked state and a context switch being performed. Otherwise pdFALSE. * * \defgroup xTaskCatchUpTicks xTaskCatchUpTicks - * @cond + * @cond !DOC_SINGLE_GROUP * \ingroup TaskCtrl * @endcond */ @@ -3214,7 +3268,7 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES *----------------------------------------------------------*/ -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * Return the handle of the task running on a certain CPU. Because of * the nature of SMP processing, there is no guarantee that this @@ -3335,8 +3389,8 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, * making the call, otherwise pdFALSE. */ BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION; -BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, - const TickType_t xItemValue ) PRIVILEGED_FUNCTION; +void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, + const TickType_t xItemValue ) PRIVILEGED_FUNCTION; /* * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY @@ -3399,11 +3453,6 @@ void vTaskPriorityDisinheritAfterTimeout( TaskHandle_t const pxMutexHolder, */ UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; -/* - * Get the current core affinity of a task - */ -BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; - /* * Set the uxTaskNumber of the task referenced by the xTask parameter to * uxHandle. diff --git a/tools/sdk/esp32/include/freertos/include/freertos/timers.h b/tools/sdk/esp32/include/freertos/include/freertos/timers.h index a8bc4f38c78..af6dcb23501 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/timers.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/timers.h @@ -450,7 +450,7 @@ void vTimerSetTimerID( TimerHandle_t xTimer, BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * @endcond * @@ -1315,7 +1315,7 @@ TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; */ TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * Functions beyond this part are not part of the public API and are intended @@ -1339,7 +1339,7 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) diff --git a/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h index 248c86d15c7..47187379c6c 100644 --- a/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h @@ -24,317 +24,449 @@ * * 1 tab == 4 spaces! */ + #ifndef PORTMACRO_H #define PORTMACRO_H -#ifdef __cplusplus -extern "C" { -#endif - #ifndef __ASSEMBLER__ -#include +#include "sdkconfig.h" #include #include #include #include -#include #include -#include /* required for XSHAL_CLIB */ -#include -#include "esp_private/crosscore_int.h" -#include "esp_timer.h" /* required for FreeRTOS run time stats */ -#include "esp_system.h" -#include "esp_newlib.h" +#include /* required for xthal_get_ccount. [refactor-todo] use cpu_hal instead */ +#include /* required for XTOS_SET_INTLEVEL. [refactor-todo] add common intr functions to esp_hw_support */ +#include "xt_instr_macros.h" #include "soc/spinlock.h" -#include +#include "hal/cpu_hal.h" +#include "esp_private/crosscore_int.h" +#include "esp_attr.h" +#include "esp_timer.h" /* required for esp_timer_get_time. [refactor-todo] make this common between archs */ +#include "esp_newlib.h" /* required for esp_reent_init() in tasks.c */ +#include "esp_heap_caps.h" #include "esp_rom_sys.h" -#include "sdkconfig.h" -#include "freertos/xtensa_api.h" -#include "esp_system.h" -#include "soc/cpu.h" -#include +#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */ +#include "portbenchmark.h" +/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */ +#include +#include +#include +#include "soc/cpu.h" #ifdef CONFIG_LEGACY_INCLUDE_COMMON_HEADERS #include "soc/soc_memory_layout.h" #endif -/*----------------------------------------------------------- - * Port specific definitions. - * - * The settings in this file configure FreeRTOS correctly for the - * given hardware and compiler. - * - * These settings should not be altered. - *----------------------------------------------------------- - */ +#ifdef __cplusplus +extern "C" { +#endif + -#include "esp_system.h" -#include "hal/cpu_hal.h" -#include "xt_instr_macros.h" -/* Type definitions. */ -#define portCHAR int8_t -#define portFLOAT float -#define portDOUBLE double -#define portLONG int32_t -#define portSHORT int16_t -#define portSTACK_TYPE uint8_t -#define portBASE_TYPE int +/* --------------------------------------------------- Port Types ------------------------------------------------------ + * - Port specific types. + * - The settings in this file configure FreeRTOS correctly for the given hardware and compiler. + * - These settings should not be altered. + * - The port types must come before first as they are used further down the file + * ------------------------------------------------------------------------------------------------------------------ */ -typedef portSTACK_TYPE StackType_t; -typedef portBASE_TYPE BaseType_t; -typedef unsigned portBASE_TYPE UBaseType_t; +#define portCHAR int8_t +#define portFLOAT float +#define portDOUBLE double +#define portLONG int32_t +#define portSHORT int16_t +#define portSTACK_TYPE uint8_t +#define portBASE_TYPE int + +typedef portSTACK_TYPE StackType_t; +typedef portBASE_TYPE BaseType_t; +typedef unsigned portBASE_TYPE UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef uint16_t TickType_t; - #define portMAX_DELAY ( TickType_t ) 0xffff +typedef uint16_t TickType_t; +#define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef uint32_t TickType_t; - #define portMAX_DELAY ( TickType_t ) 0xffffffffUL +typedef uint32_t TickType_t; +#define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ -// portbenchmark -#include "portbenchmark.h" +/* Task function macros as described on the FreeRTOS.org WEB site. */ +#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) +#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) -#include "sdkconfig.h" -#include "esp_attr.h" -#include "portmacro_priv.h" - -// Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. -// They can be called from interrupts too. -// WARNING: Only applies to current CPU. See notes above. -static inline unsigned portENTER_CRITICAL_NESTED(void) { - unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); - portbenchmarkINTERRUPT_DISABLE(); - return state; -} -#define portEXIT_CRITICAL_NESTED(state) do { portbenchmarkINTERRUPT_RESTORE(state); XTOS_RESTORE_JUST_INTLEVEL(state); } while (0) -/* -Modifications to portENTER_CRITICAL. -For an introduction, see "Critical Sections & Disabling Interrupts" in docs/api-guides/freertos-smp.rst +/* ----------------------------------------------- Port Configurations ------------------------------------------------- + * - Configurations values supplied by each port + * - Required by FreeRTOS + * ------------------------------------------------------------------------------------------------------------------ */ -The original portENTER_CRITICAL only disabled the ISRs. This is enough for single-CPU operation: by -disabling the interrupts, there is no task switch so no other tasks can meddle in the data, and because -interrupts are disabled, ISRs can't corrupt data structures either. +#define portCRITICAL_NESTING_IN_TCB 0 +#define portSTACK_GROWTH ( -1 ) +#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portBYTE_ALIGNMENT 4 +#define portNOP() XT_NOP() -For multiprocessing, things get a bit more hairy. First of all, disabling the interrupts doesn't stop -the tasks or ISRs on the other processors meddling with our CPU. For tasks, this is solved by adding -a spinlock to the portENTER_CRITICAL macro. A task running on the other CPU accessing the same data will -spinlock in the portENTER_CRITICAL code until the first CPU is done. -For ISRs, we now also need muxes: while portENTER_CRITICAL disabling interrupts will stop ISRs on the same -CPU from meddling with the data, it does not stop interrupts on the other cores from interfering with the -data. For this, we also use a spinlock in the routines called by the ISR, but these spinlocks -do not disable the interrupts (because they already are). -This all assumes that interrupts are either entirely disabled or enabled. Interrupt priority levels -will break this scheme. +/* ---------------------------------------------- Forward Declarations ------------------------------------------------- + * - Forward declarations of all the port functions and macros need to implement the FreeRTOS porting interface + * - These must come before definition/declaration of the FreeRTOS porting interface + * ------------------------------------------------------------------------------------------------------------------ */ -Remark: For the ESP32, portENTER_CRITICAL and portENTER_CRITICAL_ISR both alias vPortEnterCritical, meaning -that either function can be called both from ISR as well as task context. This is not standard FreeRTOS -behaviour; please keep this in mind if you need any compatibility with other FreeRTOS implementations. -*/ -/* "mux" data structure (spinlock) */ -typedef spinlock_t portMUX_TYPE; +// --------------------- Interrupts ------------------------ -#define portMUX_FREE_VAL SPINLOCK_FREE -#define portMUX_NO_TIMEOUT SPINLOCK_WAIT_FOREVER /* When passed for 'timeout_cycles', spin forever if necessary */ -#define portMUX_TRY_LOCK SPINLOCK_NO_WAIT /* Try to acquire the spinlock a single time only */ -#define portMUX_INITIALIZER_UNLOCKED SPINLOCK_INITIALIZER +/** + * @brief Checks if the current core is in an ISR context + * + * - ISR context consist of Low/Mid priority ISR, or time tick ISR + * - High priority ISRs aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. + * + * @note [refactor-todo] Check if this should be inlined + * @return + * - pdTRUE if in ISR + * - pdFALSE otherwise + */ +BaseType_t xPortInIsrContext(void); -#define portCRITICAL_NESTING_IN_TCB 0 +/** + * @brief Asserts if in ISR context + * + * - Asserts on xPortInIsrContext() internally + * + * @note [refactor-todo] Check if this API is still required + * @note [refactor-todo] Check if this should be inlined + */ +void vPortAssertIfInISR(void); -static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux) -{ - spinlock_initialize(mux); -} +/** + * @brief Check if in ISR context from High priority ISRs + * + * - Called from High priority ISR + * - Checks if the previous context (before high priority interrupt) was in ISR context (meaning low/med priority) + * + * @note [refactor-todo] Check if this should be inlined + * @return + * - pdTRUE if in previous in ISR context + * - pdFALSE otherwise + */ +BaseType_t xPortInterruptedFromISRContext(void); -static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux) -{ - spinlock_acquire(mux, portMUX_NO_TIMEOUT); -} +/** + * @brief Disable interrupts in a nested manner + * + * - Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. + * - They can be called from interrupts too. + * - WARNING Only applies to current CPU. + * @note [refactor-todo] Define this as portSET_INTERRUPT_MASK_FROM_ISR() instead + * @return unsigned Previous interrupt state + */ +static inline unsigned __attribute__((always_inline)) portENTER_CRITICAL_NESTED(void); + +/* ---------------------- Spinlocks ------------------------ + * - Modifications made to critical sections to support SMP + * - See "Critical Sections & Disabling Interrupts" in docs/api-guides/freertos-smp.rst for more details + * - Remark: For the ESP32, portENTER_CRITICAL and portENTER_CRITICAL_ISR both alias vPortEnterCritical, meaning that + * either function can be called both from ISR as well as task context. This is not standard FreeRTOS + * behaviorr; please keep this in mind if you need any compatibility with other FreeRTOS implementations. + * @note [refactor-todo] Check if these comments are still true + * ------------------------------------------------------ */ + +typedef spinlock_t portMUX_TYPE; /**< Spinlock type used by FreeRTOS critical sections */ +#define portMUX_INITIALIZER_UNLOCKED SPINLOCK_INITIALIZER /**< Spinlock initializer */ +#define portMUX_FREE_VAL SPINLOCK_FREE /**< Spinlock is free. [refactor-todo] check if this is still required */ +#define portMUX_NO_TIMEOUT SPINLOCK_WAIT_FOREVER /**< When passed for 'timeout_cycles', spin forever if necessary. [refactor-todo] check if this is still required */ +#define portMUX_TRY_LOCK SPINLOCK_NO_WAIT /**< Try to acquire the spinlock a single time only. [refactor-todo] check if this is still required */ -static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout) -{ - return (spinlock_acquire(mux, timeout)); -} +/** + * @brief Initialize a spinlock + * + * - Initializes a spinlock that is used by FreeRTOS SMP critical sections + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux); -static inline void __attribute__((always_inline)) vPortCPUReleaseMutex(portMUX_TYPE *mux) -{ - spinlock_release(mux); -} +/** + * @brief Acquire a spinlock + * + * @note [refactor-todo] check if we still need this + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux); +/** + * @brief Acquire a spinlock but with a specified timeout + * + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this function should be renamed (due to bool return type) + * + * @param[in] mux Spinlock + * @param timeout + * @return true Spinlock acquired + * @return false Timed out + */ +static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout); + +/** + * @brief Release a spinlock + * + * @note [refactor-todo] check if we still need this + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortCPUReleaseMutex(portMUX_TYPE *mux); + +/** + * @brief Wrapper for atomic compare-and-set instruction + * + * This subroutine will atomically compare *addr to 'compare'. If *addr == compare, *addr is set to *set. *set is + * updated with the previous value of *addr (either 'compare' or some other value.) + * + * @warning From the ISA docs: in some (unspecified) cases, the s32c1i instruction may return the "bitwise inverse" of + * the old mem if the mem wasn't written. This doesn't seem to happen on the ESP32 (portMUX assertions would + * fail). + * + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this function should be renamed (due to void return type) + * + * @param[inout] addr Pointer to target address + * @param[in] compare Compare value + * @param[inout] set Pointer to set value + */ +static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set); + +/** + * @brief Wrapper for atomic compare-and-set instruction in external RAM + * + * Atomic compare-and-set but the target address is placed in external RAM + * + * @note [refactor-todo] check if we still need this + * + * @param[inout] addr Pointer to target address + * @param[in] compare Compare value + * @param[inout] set Pointer to set value + */ +static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set); + +// ------------------ Critical Sections -------------------- + +/** + * @brief Enter a SMP critical section + * + * - Disable interrupts + * - Takes spinlock + * - Can be nested + * + * @param[in] mux Spinlock + */ void vPortEnterCritical(portMUX_TYPE *mux); + +/** + * @brief Exit a SMP critical section + * + * - Releases spinlock + * - Reenables interrupts + * - Can be nested + * + * @param[in] mux Spinlock + */ void vPortExitCritical(portMUX_TYPE *mux); -#define portASSERT_IF_IN_ISR() vPortAssertIfInISR() -void vPortAssertIfInISR(void); +/** + * @brief FreeRTOS compliant version of enter critical + * + * - Ensures that critical section is only entered from task context + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(portMUX_TYPE *mux); -/* - * Returns true if the current core is in ISR context; low prio ISR, med prio ISR or timer tick ISR. High prio ISRs - * aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. +/** + * @brief FreeRTOS compliant version of exit critical + * + * @param[in] mux Spinlock */ -BaseType_t xPortInIsrContext(void); +static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(portMUX_TYPE *mux); -static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(portMUX_TYPE *mux) -{ - if(!xPortInIsrContext()) { - vPortEnterCritical(mux); - } else { - esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", - __FILE__, __LINE__, __FUNCTION__); - abort(); - } -} +/** + * @brief Safe version of enter critical + * + * - This function can be used to enter a critical section from both task and ISR contexts + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortEnterCriticalSafe(portMUX_TYPE *mux); -static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(portMUX_TYPE *mux) -{ - if(!xPortInIsrContext()) { - vPortExitCritical(mux); - } else { - esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", - __FILE__, __LINE__, __FUNCTION__); - abort(); - } -} +/** + * @brief Safe version of exit critical + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortExitCriticalSafe(portMUX_TYPE *mux); -#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE -/* Calling port*_CRITICAL from ISR context would cause an assert failure. - * If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE +// ---------------------- Yielding ------------------------- + +/** + * @brief Perform a solicited context switch + * + * - Defined in portasm.S + * + * @note [refactor-todo] The rest of ESP-IDF should call taskYield() instead */ -#define portENTER_CRITICAL(mux) vPortEnterCriticalCompliance(mux) -#define portEXIT_CRITICAL(mux) vPortExitCriticalCompliance(mux) -#else -#define portENTER_CRITICAL(mux) vPortEnterCritical(mux) -#define portEXIT_CRITICAL(mux) vPortExitCritical(mux) -#endif +void vPortYield( void ); -#define portENTER_CRITICAL_ISR(mux) vPortEnterCritical(mux) -#define portEXIT_CRITICAL_ISR(mux) vPortExitCritical(mux) +/** + * @brief + * + * @note [refactor-todo] Refactor this to avoid va_args + * @param argc + * @param ... Variable arguments to allow for IDF prototype without arguments, and vanilla version WITH argument + */ +void vPortEvaluateYieldFromISR(int argc, ...); -static inline void __attribute__((always_inline)) vPortEnterCriticalSafe(portMUX_TYPE *mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(mux); - } else { - portENTER_CRITICAL(mux); - } -} +/** + * @brief Yields the other core + * + * - Send an interrupt to another core in order to make the task running on it yield for a higher-priority task. + * - Can be used to yield current core as well + * + * @note [refactor-todo] Put this into private macros as its only called from task.c and is not public API + * @param coreid ID of core to yield + */ +void vPortYieldOtherCore(BaseType_t coreid); -static inline void __attribute__((always_inline)) vPortExitCriticalSafe(portMUX_TYPE *mux) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(mux); - } else { - portEXIT_CRITICAL(mux); - } -} +/** + * @brief Checks if the current core can yield + * + * - A core cannot yield if its in an ISR or in a critical section + * + * @note [refactor-todo] See if this can be separated from port macro + * @return true Core can yield + * @return false Core cannot yield + */ +static inline bool IRAM_ATTR xPortCanYield(void); -#define portENTER_CRITICAL_SAFE(mux) vPortEnterCriticalSafe(mux) -#define portEXIT_CRITICAL_SAFE(mux) vPortExitCriticalSafe(mux) +// ------------------- Hook Functions ---------------------- -/* - * Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare - * *addr to 'compare'. If *addr == compare, *addr is set to *set. *set is updated with the previous - * value of *addr (either 'compare' or some other value.) +extern void esp_vApplicationIdleHook(void); /* Required by tasks.c */ +extern void esp_vApplicationTickHook(void); /* Required by tasks.c */ + +/** + * @brief Hook function called on entry to tickless idle + * + * - Implemented in pm_impl.c * - * Warning: From the ISA docs: in some (unspecified) cases, the s32c1i instruction may return the - * *bitwise inverse* of the old mem if the mem wasn't written. This doesn't seem to happen on the - * ESP32 (portMUX assertions would fail). + * @param xExpectedIdleTime Expected idle time */ -static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { - compare_and_set_native(addr, compare, set); -} +void vApplicationSleep(TickType_t xExpectedIdleTime); -// Critical section management. NW-TODO: replace XTOS_SET_INTLEVEL with more efficient version, if any? -// These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level. -// -// Only applies to one CPU. See notes above & below for reasons not to use these. -#define portDISABLE_INTERRUPTS() do { XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); } while (0) -#define portENABLE_INTERRUPTS() do { portbenchmarkINTERRUPT_RESTORE(0); XTOS_SET_INTLEVEL(0); } while (0) +// ----------------------- System -------------------------- +/** + * @brief Get the tick rate per second + * + * @note [refactor-todo] make this inline + * @return uint32_t Tick rate in Hz + */ +uint32_t xPortGetTickRateHz(void); -// These FreeRTOS versions are similar to the nested versions above -#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED() -#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state) +/** + * @brief Set a watchpoint to watch the last 32 bytes of the stack + * + * Callback to set a watchpoint on the end of the stack. Called every context switch to change the stack watchpoint + * around. + * + * @param pxStackStart Pointer to the start of the stack + */ +void vPortSetStackWatchpoint( void *pxStackStart ); -//Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force -//the stack memory to always be internal. -#define portTcbMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) -#define portStackMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) -#define pvPortMallocTcbMem(size) heap_caps_malloc(size, portTcbMemoryCaps) -#define pvPortMallocStackMem(size) heap_caps_malloc(size, portStackMemoryCaps) - -//xTaskCreateStatic uses these functions to check incoming memory. -#define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#ifdef CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY -#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr) -#else -#define portVALID_STACK_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#endif +/** + * @brief Get the current core's ID + * + * @note [refactor-todo] IDF should call a FreeRTOS like macro instead of port function directly + * @return BaseType_t Core ID + */ +static inline BaseType_t IRAM_ATTR xPortGetCoreID(void); -static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) -{ -#ifdef CONFIG_SPIRAM - compare_and_set_extram(addr, compare, set); -#endif -} +/* ------------------------------------------- FreeRTOS Porting Interface ---------------------------------------------- + * - Contains all the mappings of the macros required by FreeRTOS + * - Most come after forward declare as porting macros map to declared functions + * - Maps to forward declared functions + * ------------------------------------------------------------------------------------------------------------------ */ -/*-----------------------------------------------------------*/ +// ----------------------- Memory -------------------------- -/* Architecture specifics. */ -#define portSTACK_GROWTH ( -1 ) -#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) -#define portBYTE_ALIGNMENT 4 -#define portNOP() XT_NOP() -/*-----------------------------------------------------------*/ +/** + * @brief Task memory allocation macros + * + * @note Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force the stack + * memory to always be internal. + * @note [refactor-todo] Update portable.h to match v10.4.3 to use new malloc prototypes + */ +#define portTcbMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define portStackMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define pvPortMallocTcbMem(size) heap_caps_malloc(size, portTcbMemoryCaps) +#define pvPortMallocStackMem(size) heap_caps_malloc(size, portStackMemoryCaps) -/* Fine resolution time */ -#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount() -//ccount or esp_timer are initialized elsewhere -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() +// --------------------- Interrupts ------------------------ -#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER -/* Coarse resolution time (us) */ -#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0) -#endif +#define portEXIT_CRITICAL_NESTED(state) do { portbenchmarkINTERRUPT_RESTORE(state); XTOS_RESTORE_JUST_INTLEVEL(state); } while (0) -void vPortYield( void ); -void vPortEvaluateYieldFromISR(int argc, ...); -void _frxt_setup_switch( void ); +/** + * - Only applies to current core + * - These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level. + * + * @note [refactor-todo] replace XTOS_SET_INTLEVEL with more efficient version, if any? + */ +#define portDISABLE_INTERRUPTS() do { XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); } while (0) +#define portENABLE_INTERRUPTS() do { portbenchmarkINTERRUPT_RESTORE(0); XTOS_SET_INTLEVEL(0); } while (0) /** - * Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with, - * or without arguments. The macro counts only 0 or 1 arguments. + * ISR versions to enable/disable interrupts + */ +#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED() +#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state) + +#define portASSERT_IF_IN_ISR() vPortAssertIfInISR() + +// ------------------ Critical Sections -------------------- + +/** + * @brief FreeRTOS critical section macros * - * In the future, we want to switch to C++20. We also want to become compatible with clang. - * Hence, we provide two versions of the following macros which are using variadic arguments. - * The first one is using the GNU extension ##__VA_ARGS__. The second one is using the C++20 feature __VA_OPT__(,). - * This allows users to compile their code with standard C++20 enabled instead of the GNU extension. - * Below C++20, we haven't found any good alternative to using ##__VA_ARGS__. + * - Added a spinlock argument for SMP + * - Can be nested + * - Compliance versions will assert if regular critical section API is used in ISR context + * - Safe versions can be called from either contexts */ -#if defined(__cplusplus) && (__cplusplus > 201703L) -#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0 __VA_OPT__(,) __VA_ARGS__,1,0) +#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE +#define portENTER_CRITICAL(mux) vPortEnterCriticalCompliance(mux) +#define portEXIT_CRITICAL(mux) vPortExitCriticalCompliance(mux) #else -#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0, ##__VA_ARGS__,1,0) -#endif -#define portGET_ARGUMENT_COUNT_INNER(zero, one, count, ...) count +#define portENTER_CRITICAL(mux) vPortEnterCritical(mux) +#define portEXIT_CRITICAL(mux) vPortExitCritical(mux) +#endif /* CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE */ +#define portENTER_CRITICAL_ISR(mux) vPortEnterCritical(mux) +#define portEXIT_CRITICAL_ISR(mux) vPortExitCritical(mux) +#define portENTER_CRITICAL_SAFE(mux) vPortEnterCriticalSafe(mux) +#define portEXIT_CRITICAL_SAFE(mux) vPortExitCriticalSafe(mux) -_Static_assert(portGET_ARGUMENT_COUNT() == 0, "portGET_ARGUMENT_COUNT() result does not match for 0 arguments"); -_Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result does not match for 1 argument"); +// ---------------------- Yielding ------------------------- -#define portYIELD() vPortYield() +#define portYIELD() vPortYield() /** * @note The macro below could be used when passing a single argument, or without any argument, * it was developed to support both usages of portYIELD inside of an ISR. Any other usage form - * might result in undesired behaviour + * might result in undesired behavior + * + * @note [refactor-todo] Refactor this to avoid va_args */ #if defined(__cplusplus) && (__cplusplus > 201703L) #define portYIELD_FROM_ISR(...) vPortEvaluateYieldFromISR(portGET_ARGUMENT_COUNT(__VA_ARGS__) __VA_OPT__(,) __VA_ARGS__) @@ -351,121 +483,137 @@ _Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result */ #define portYIELD_WITHIN_API() esp_crosscore_int_send_yield(xPortGetCoreID()) -/*-----------------------------------------------------------*/ - -/* Task function macros as described on the FreeRTOS.org WEB site. */ -#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) -#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) - -// When coprocessors are defined, we to maintain a pointer to coprocessors area. -// We currently use a hack: redefine field xMPU_SETTINGS in TCB block as a structure that can hold: -// MPU wrappers, coprocessor area pointer, trace code structure, and more if needed. -// The field is normally used for memory protection. FreeRTOS should create another general purpose field. -typedef struct { - #if XCHAL_CP_NUM > 0 - volatile StackType_t* coproc_area; // Pointer to coprocessor save area; MUST BE FIRST - #endif - - #if portUSING_MPU_WRAPPERS - // Define here mpu_settings, which is port dependent - int mpu_setting; // Just a dummy example here; MPU not ported to Xtensa yet - #endif - - #if configUSE_TRACE_FACILITY_2 - struct { - // Cf. porttraceStamp() - int taskstamp; /* Stamp from inside task to see where we are */ - int taskstampcount; /* A counter usually incremented when we restart the task's loop */ - } porttrace; - #endif -} xMPU_SETTINGS; - -// Main hack to use MPU_wrappers even when no MPU is defined (warning: mpu_setting should not be accessed; otherwise move this above xMPU_SETTINGS) -#if (XCHAL_CP_NUM > 0 || configUSE_TRACE_FACILITY_2) && !portUSING_MPU_WRAPPERS // If MPU wrappers not used, we still need to allocate coproc area - #undef portUSING_MPU_WRAPPERS - #define portUSING_MPU_WRAPPERS 1 // Enable it to allocate coproc area - #define MPU_WRAPPERS_H // Override mpu_wrapper.h to disable unwanted code - #define PRIVILEGED_FUNCTION - #define PRIVILEGED_DATA -#endif - -extern void esp_vApplicationIdleHook( void ); -extern void esp_vApplicationTickHook( void ); +// ------------------- Hook Functions ---------------------- #ifndef CONFIG_FREERTOS_LEGACY_HOOKS -#define vApplicationIdleHook esp_vApplicationIdleHook -#define vApplicationTickHook esp_vApplicationTickHook +#define vApplicationIdleHook esp_vApplicationIdleHook +#define vApplicationTickHook esp_vApplicationTickHook #endif /* !CONFIG_FREERTOS_LEGACY_HOOKS */ -void vApplicationSleep( TickType_t xExpectedIdleTime ); +#define portSUPPRESS_TICKS_AND_SLEEP(idleTime) vApplicationSleep(idleTime) -#define portSUPPRESS_TICKS_AND_SLEEP( idleTime ) vApplicationSleep( idleTime ) +// ------------------- Run Time Stats ---------------------- -void _xt_coproc_release(volatile void * coproc_sa_base); +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() -/* Architecture specific optimisations. */ -#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 +/** + * - Fine resolution uses ccount + * - ALT is coarse and uses esp_timer + * @note [refactor-todo] Make fine and alt timers mutually exclusive + */ +#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount() +#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER +#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0) +#endif +// -------------- Optimized Task Selection ----------------- + +#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 /* Check the configuration. */ #if( configMAX_PRIORITIES > 32 ) - #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice. +#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice. #endif /* Store/clear the ready priorities in a bit map. */ #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) +#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __builtin_clz( ( uxReadyPriorities ) ) ) +#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ -/*-----------------------------------------------------------*/ -#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __builtin_clz( ( uxReadyPriorities ) ) ) -#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ +/* --------------------------------------------- Inline Implementations ------------------------------------------------ + * - Implementation of inline functions of the forward declares + * - Should come after forward declare and FreeRTOS Porting interface, as implementation may use both. + * - For implementation of non-inlined functions, see port.c + * ------------------------------------------------------------------------------------------------------------------ */ -/* - * Send an interrupt to another core in order to make the task running - * on it yield for a higher-priority task. - */ +// --------------------- Interrupts ------------------------ -void vPortYieldOtherCore( BaseType_t coreid) ; +static inline unsigned portENTER_CRITICAL_NESTED(void) +{ + unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); + portbenchmarkINTERRUPT_DISABLE(); + return state; +} -/* - Callback to set a watchpoint on the end of the stack. Called every context switch to change the stack - watchpoint around. - */ -void vPortSetStackWatchpoint( void* pxStackStart ); +// ---------------------- Spinlocks ------------------------ -/* - * Returns true if the current core is in ISR context; low prio ISR, med prio ISR or timer tick ISR. High prio ISRs - * aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. - */ -BaseType_t xPortInIsrContext(void); +static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux) +{ + spinlock_initialize(mux); +} -/* - * This function will be called in High prio ISRs. Returns true if the current core was in ISR context - * before calling into high prio ISR context. - */ -BaseType_t xPortInterruptedFromISRContext(void); +static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux) +{ + spinlock_acquire(mux, portMUX_NO_TIMEOUT); +} -/* - * The structures and methods of manipulating the MPU are contained within the - * port layer. - * - * Fills the xMPUSettings structure with the memory region information - * contained in xRegions. - */ -#if( portUSING_MPU_WRAPPERS == 1 ) - struct xMEMORY_REGION; - void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t usStackDepth ) PRIVILEGED_FUNCTION; - void vPortReleaseTaskMPUSettings( xMPU_SETTINGS *xMPUSettings ); +static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout) +{ + return (spinlock_acquire(mux, timeout)); +} + +static inline void __attribute__((always_inline)) vPortCPUReleaseMutex(portMUX_TYPE *mux) +{ + spinlock_release(mux); +} + +static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + compare_and_set_native(addr, compare, set); +} + +static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ +#ifdef CONFIG_SPIRAM + compare_and_set_extram(addr, compare, set); #endif +} -/* Multi-core: get current core ID */ -static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) { - return cpu_hal_get_core_id(); +// ------------------ Critical Sections -------------------- + +static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(portMUX_TYPE *mux) +{ + if (!xPortInIsrContext()) { + vPortEnterCritical(mux); + } else { + esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", + __FILE__, __LINE__, __FUNCTION__); + abort(); + } } -/* Get tick rate per second */ -uint32_t xPortGetTickRateHz(void); +static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(portMUX_TYPE *mux) +{ + if (!xPortInIsrContext()) { + vPortExitCritical(mux); + } else { + esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", + __FILE__, __LINE__, __FUNCTION__); + abort(); + } +} + +static inline void __attribute__((always_inline)) vPortEnterCriticalSafe(portMUX_TYPE *mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(mux); + } else { + portENTER_CRITICAL(mux); + } +} + +static inline void __attribute__((always_inline)) vPortExitCriticalSafe(portMUX_TYPE *mux) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(mux); + } else { + portEXIT_CRITICAL(mux); + } +} + +// ---------------------- Yielding ------------------------- static inline bool IRAM_ATTR xPortCanYield(void) { @@ -484,22 +632,115 @@ static inline bool IRAM_ATTR xPortCanYield(void) return ((ps_reg & PS_INTLEVEL_MASK) == 0); } -// porttrace -#if configUSE_TRACE_FACILITY_2 -#include "porttrace.h" +// ----------------------- System -------------------------- + +static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) +{ + return (uint32_t) cpu_hal_get_core_id(); +} + + + +/* ------------------------------------------------------ Misc --------------------------------------------------------- + * - Miscellaneous porting macros + * - These are not port of the FreeRTOS porting interface, but are used by other FreeRTOS dependent components + * - [refactor-todo] Remove dependency on MPU wrappers by modifying TCB + * ------------------------------------------------------------------------------------------------------------------ */ + +// -------------------- Co-Processor ----------------------- + +// When coprocessors are defined, we maintain a pointer to coprocessors area. +// We currently use a hack: redefine field xMPU_SETTINGS in TCB block as a structure that can hold: +// MPU wrappers, coprocessor area pointer, trace code structure, and more if needed. +// The field is normally used for memory protection. FreeRTOS should create another general purpose field. +typedef struct { +#if XCHAL_CP_NUM > 0 + volatile StackType_t *coproc_area; // Pointer to coprocessor save area; MUST BE FIRST +#endif + +#if portUSING_MPU_WRAPPERS + // Define here mpu_settings, which is port dependent + int mpu_setting; // Just a dummy example here; MPU not ported to Xtensa yet #endif +} xMPU_SETTINGS; -// configASSERT_2 if requested -#if configASSERT_2 -#include -void exit(int); -#define configASSERT( x ) if (!(x)) { porttracePrint(-1); printf("\nAssertion failed in %s:%d\n", __FILE__, __LINE__); exit(-1); } +// Main hack to use MPU_wrappers even when no MPU is defined (warning: mpu_setting should not be accessed; otherwise move this above xMPU_SETTINGS) +#if (XCHAL_CP_NUM > 0) && !portUSING_MPU_WRAPPERS // If MPU wrappers not used, we still need to allocate coproc area +#undef portUSING_MPU_WRAPPERS +#define portUSING_MPU_WRAPPERS 1 // Enable it to allocate coproc area +#define MPU_WRAPPERS_H // Override mpu_wrapper.h to disable unwanted code +#define PRIVILEGED_FUNCTION +#define PRIVILEGED_DATA #endif -#endif // __ASSEMBLER__ +void _xt_coproc_release(volatile void *coproc_sa_base); + +/* + * The structures and methods of manipulating the MPU are contained within the + * port layer. + * + * Fills the xMPUSettings structure with the memory region information + * contained in xRegions. + */ +#if( portUSING_MPU_WRAPPERS == 1 ) +struct xMEMORY_REGION; +void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION *const xRegions, StackType_t *pxBottomOfStack, uint32_t usStackDepth ) PRIVILEGED_FUNCTION; +void vPortReleaseTaskMPUSettings( xMPU_SETTINGS *xMPUSettings ); +#endif + +// -------------------- VA_ARGS Yield ---------------------- + +/** + * Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with, + * or without arguments. The macro counts only 0 or 1 arguments. + * + * In the future, we want to switch to C++20. We also want to become compatible with clang. + * Hence, we provide two versions of the following macros which are using variadic arguments. + * The first one is using the GNU extension ##__VA_ARGS__. The second one is using the C++20 feature __VA_OPT__(,). + * This allows users to compile their code with standard C++20 enabled instead of the GNU extension. + * Below C++20, we haven't found any good alternative to using ##__VA_ARGS__. + */ +#if defined(__cplusplus) && (__cplusplus > 201703L) +#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0 __VA_OPT__(,) __VA_ARGS__,1,0) +#else +#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0, ##__VA_ARGS__,1,0) +#endif +#define portGET_ARGUMENT_COUNT_INNER(zero, one, count, ...) count + +_Static_assert(portGET_ARGUMENT_COUNT() == 0, "portGET_ARGUMENT_COUNT() result does not match for 0 arguments"); +_Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result does not match for 1 argument"); + +// -------------------- Heap Related ----------------------- + +/** + * @brief Checks if a given piece of memory can be used to store a task's TCB + * + * - Defined in port_common.c + * + * @param ptr Pointer to memory + * @return true Memory can be used to store a TCB + * @return false Otherwise + */ +bool xPortCheckValidTCBMem(const void *ptr); + +/** + * @brief Checks if a given piece of memory can be used to store a task's stack + * + * - Defined in port_common.c + * + * @param ptr Pointer to memory + * @return true Memory can be used to store a task stack + * @return false Otherwise + */ +bool xPortcheckValidStackMem(const void *ptr); + +#define portVALID_TCB_MEM(ptr) xPortCheckValidTCBMem(ptr) +#define portVALID_STACK_MEM(ptr) xPortcheckValidStackMem(ptr) #ifdef __cplusplus } #endif +#endif // __ASSEMBLER__ + #endif /* PORTMACRO_H */ diff --git a/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro_priv.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro_priv.h deleted file mode 100644 index 843456b5aa8..00000000000 --- a/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro_priv.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that has become a de facto standard. * - * * - * Help yourself get started quickly and support the FreeRTOS * - * project by purchasing a FreeRTOS tutorial book, reference * - * manual, or both from: http://www.FreeRTOS.org/Documentation * - * * - * Thank you! * - * * - *************************************************************************** - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. - - >>! NOTE: The modification to the GPL is included to allow you to !<< - >>! distribute a combined work that includes FreeRTOS without being !<< - >>! obliged to provide the source code for proprietary components !<< - >>! outside of the FreeRTOS kernel. !<< - - FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. Full license text is available from the following - link: http://www.freertos.org/a00114.html - - 1 tab == 4 spaces! - - *************************************************************************** - * * - * Having a problem? Start by reading the FAQ "My application does * - * not run, what could be wrong?" * - * * - * http://www.FreeRTOS.org/FAQHelp.html * - * * - *************************************************************************** - - http://www.FreeRTOS.org - Documentation, books, training, latest versions, - license and Real Time Engineers Ltd. contact details. - - http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - including FreeRTOS+Trace - an indispensable productivity tool, a DOS - compatible FAT file system, and our tiny thread aware UDP/IP stack. - - http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High - Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and middleware. - - http://www.SafeRTOS.com - High Integrity Systems also provide a safety - engineered and independently SIL3 certified version for use in safety and - mission critical applications that require provable dependability. - - 1 tab == 4 spaces! -*/ - - -/* This header holds the macros for porting which should only be used inside FreeRTOS */ - -#pragma once -#include "soc/soc_memory_layout.h" - -//xTaskCreateStatic uses these functions to check incoming memory. -#define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#ifdef CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY -#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr) -#else -#define portVALID_STACK_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/i2s_hal.h b/tools/sdk/esp32/include/hal/include/hal/i2s_hal.h index a08813db808..037970fa2b3 100644 --- a/tools/sdk/esp32/include/hal/include/hal/i2s_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/i2s_hal.h @@ -1,16 +1,8 @@ -// Copyright 2020 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: 2020-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ /******************************************************************************* * NOTICE @@ -176,28 +168,28 @@ void i2s_hal_enable_slave_fd_mode(i2s_hal_context_t *hal); * * @param hal Context of the HAL layer */ -#define i2s_hal_start_tx(hal) i2s_ll_tx_start((hal)->dev) +void i2s_hal_start_tx(i2s_hal_context_t *hal); /** * @brief Start I2S rx * * @param hal Context of the HAL layer */ -#define i2s_hal_start_rx(hal) i2s_ll_rx_start((hal)->dev) +void i2s_hal_start_rx(i2s_hal_context_t *hal); /** * @brief Stop I2S tx * * @param hal Context of the HAL layer */ -#define i2s_hal_stop_tx(hal) i2s_ll_tx_stop((hal)->dev) +void i2s_hal_stop_tx(i2s_hal_context_t *hal); /** * @brief Stop I2S rx * * @param hal Context of the HAL layer */ -#define i2s_hal_stop_rx(hal) i2s_ll_rx_stop((hal)->dev) +void i2s_hal_stop_rx(i2s_hal_context_t *hal); /** * @brief Set the received data length to trigger `in_suc_eof` interrupt. diff --git a/tools/sdk/esp32/include/hal/include/hal/lcd_hal.h b/tools/sdk/esp32/include/hal/include/hal/lcd_hal.h index 76e28dda0e4..db255b3d1e4 100644 --- a/tools/sdk/esp32/include/hal/include/hal/lcd_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/lcd_hal.h @@ -1,22 +1,8 @@ -// Copyright 2021 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. - -/******************************************************************************* - * NOTICE - * The HAL is not public api, don't use in application code. - * See readme.md in soc/README.md - ******************************************************************************/ +/* + * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once diff --git a/tools/sdk/esp32/include/hal/include/hal/lcd_types.h b/tools/sdk/esp32/include/hal/include/hal/lcd_types.h index 69dab14801d..01e6d0c2949 100644 --- a/tools/sdk/esp32/include/hal/include/hal/lcd_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/lcd_types.h @@ -1,16 +1,8 @@ -// Copyright 2021 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: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -21,15 +13,12 @@ extern "C" { /** * @brief LCD clock source * @note User should select the clock source based on the real requirement: - * ╔═════════════════════╦══════════════════════════╦════════════════════════════╗ - * ║ LCD clock source ║ Features ║ Power Management ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_PLL160M ║ High resolution, fixed ║ ESP_PM_APB_FREQ_MAX lock ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_APLL ║ Configurable resolution ║ ESP_PM_NO_LIGHT_SLEEP lock ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_XTAL ║ Medium resolution, fixed ║ No PM lock ║ - * ╚═════════════════════╩══════════════════════════╩════════════════════════════╝ + * + * | LCD clock source | Features | Power Management | + * |---------------------|--------------------------|----------------------------| + * | LCD_CLK_SRC_PLL160M | High resolution, fixed | ESP_PM_APB_FREQ_MAX lock | + * | LCD_CLK_SRC_APLL | Configurable resolution | ESP_PM_NO_LIGHT_SLEEP lock | + * | LCD_CLK_SRC_XTAL | Medium resolution, fixed | No PM lock | */ typedef enum { LCD_CLK_SRC_PLL160M, /*!< Select PLL160M as the source clock */ diff --git a/tools/sdk/esp32/include/hal/include/hal/touch_sensor_types.h b/tools/sdk/esp32/include/hal/include/hal/touch_sensor_types.h index ec027bf8705..9085f5eecd8 100644 --- a/tools/sdk/esp32/include/hal/include/hal/touch_sensor_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/touch_sensor_types.h @@ -1,16 +1,8 @@ -// Copyright 2015-2020 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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -155,12 +147,23 @@ typedef enum { TOUCH_PAD_INTR_MASK_INACTIVE = BIT(2), /*! +#include +#include "sdkconfig.h" +#include "esp_err.h" #if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/spi_flash.h" #elif CONFIG_IDF_TARGET_ESP32S2 @@ -34,9 +40,9 @@ extern "C" { #endif /** - * @brief Register ROM functions and init flash device registers to make use of octal flash + * @brief To setup Flash chip */ -esp_err_t esp_opiflash_init(void); +esp_err_t spi_flash_init_chip_state(void); /** * @brief Make MSPI work under 20Mhz @@ -88,6 +94,12 @@ void spi_timing_get_flash_timing_param(spi_flash_hal_timing_config_t *out_timing */ bool spi_timine_config_flash_is_tuned(void); +/** + * @brief Set Flash chip specifically required MSPI register settings here + */ +void spi_flash_set_vendor_required_regs(void); + + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h b/tools/sdk/esp32/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h new file mode 100644 index 00000000000..4292213943f --- /dev/null +++ b/tools/sdk/esp32/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _ESP_MBO_H +#define _ESP_MBO_H + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * enum non_pref_chan_reason: Reason for non preference of channel + */ +enum non_pref_chan_reason { + NON_PREF_CHAN_REASON_UNSPECIFIED = 0, + NON_PREF_CHAN_REASON_RSSI = 1, + NON_PREF_CHAN_REASON_EXT_INTERFERENCE = 2, + NON_PREF_CHAN_REASON_INT_INTERFERENCE = 3, +}; + +/** + * @brief Channel structure for non preferred channel + * + * @param reason: enum non_pref_chan_reason + * @param oper_class: operating class for the channel + * @param chan: channel number + * @param preference: channel preference + */ +struct non_pref_chan { + enum non_pref_chan_reason reason; + uint8_t oper_class; + uint8_t chan; + uint8_t preference; +}; + +/** + * @brief Array structure for non preferred channel struct + * + * @param non_pref_chan_num: channel count + * @param chan: array of non_pref_chan type + */ +struct non_pref_chan_s { + size_t non_pref_chan_num; + struct non_pref_chan chan[]; +}; + +/** + * @brief Update channel preference for MBO IE + * + * @param non_pref_chan: Non preference channel list + * + * @return + * - 0: success else failure + */ +int esp_mbo_update_non_pref_chan(struct non_pref_chan_s *non_pref_chan); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/tools/sdk/esp32/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h b/tools/sdk/esp32/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h index a1dcfb655c5..4301385d2cf 100644 --- a/tools/sdk/esp32/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h +++ b/tools/sdk/esp32/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h @@ -1,17 +1,7 @@ -/** - * Copyright 2020 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 +/* + * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD * - * 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-License-Identifier: Apache-2.0 */ #ifndef _ESP_WNM_H @@ -29,11 +19,13 @@ enum btm_query_reason { REASON_UNSPECIFIED = 0, REASON_FRAME_LOSS = 1, REASON_DELAY = 2, - REASON_QOS_CAPACITY = 3, - REASON_FIRST_ASSOC = 4, - REASON_LOAD_BALALNCE = 5, - REASON_BETTER_AP = 6, - REASON_CURRENT_DEAUTH = 7, + REASON_BANDWIDTH = 3, + REASON_LOAD_BALANCE = 4, + REASON_RSSI = 5, + REASON_RETRANSMISSIONS = 6, + REASON_INTERFERENCE = 7, + REASON_GRAY_ZONE = 8, + REASON_PREMIUM_AP = 9, }; /** diff --git a/tools/sdk/esp32/ld/libcat_face_detect.a b/tools/sdk/esp32/ld/libcat_face_detect.a index 18bff9da4e2..804fea7893f 100644 Binary files a/tools/sdk/esp32/ld/libcat_face_detect.a and b/tools/sdk/esp32/ld/libcat_face_detect.a differ diff --git a/tools/sdk/esp32/ld/libdl.a b/tools/sdk/esp32/ld/libdl.a index 8840177a68b..6917a349872 100644 Binary files a/tools/sdk/esp32/ld/libdl.a and b/tools/sdk/esp32/ld/libdl.a differ diff --git a/tools/sdk/esp32/ld/libhuman_face_detect.a b/tools/sdk/esp32/ld/libhuman_face_detect.a index 8a6930968aa..8656df19de8 100644 Binary files a/tools/sdk/esp32/ld/libhuman_face_detect.a and b/tools/sdk/esp32/ld/libhuman_face_detect.a differ diff --git a/tools/sdk/esp32/ld/sections.ld b/tools/sdk/esp32/ld/sections.ld index 85a3a35947d..8e26933d350 100644 --- a/tools/sdk/esp32/ld/sections.ld +++ b/tools/sdk/esp32/ld/sections.ld @@ -323,7 +323,7 @@ SECTIONS *libesp_system.a:ubsan.*(.literal .literal.* .text .text.*) *libfreertos.a:(EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal.* EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text.*) *libfreertos.a:port.*(.literal.pxPortInitialiseStack .literal.unlikely.vPortEndScheduler .literal.vApplicationStackOverflowHook .literal.vPortAssertIfInISR .literal.vPortEnterCritical .literal.vPortExitCritical .literal.vPortReleaseTaskMPUSettings .literal.vPortSetStackWatchpoint .literal.vPortYieldOtherCore .literal.xPortInIsrContext .literal.xPortStartScheduler .text .text.pxPortInitialiseStack .text.unlikely.vPortEndScheduler .text.vApplicationStackOverflowHook .text.vPortAssertIfInISR .text.vPortEnterCritical .text.vPortExitCritical .text.vPortReleaseTaskMPUSettings .text.vPortSetStackWatchpoint .text.vPortStoreTaskMPUSettings .text.vPortYieldOtherCore .text.xPortGetTickRateHz .text.xPortInIsrContext .text.xPortStartScheduler) - *libfreertos.a:port_common.*(.literal.esp_startup_start_app_common .text .text.esp_startup_start_app_common) + *libfreertos.a:port_common.*(.literal.esp_startup_start_app_common .literal.xPortCheckValidTCBMem .literal.xPortcheckValidStackMem .text .text.esp_startup_start_app_common .text.xPortCheckValidTCBMem .text.xPortcheckValidStackMem) *libgcc.a:lib2funcs.*(.literal .literal.* .text .text.*) *libgcov.a:(.literal .literal.* .text .text.*) *libhal.a:cpu_hal.*(.literal .literal.* .text .text.*) diff --git a/tools/sdk/esp32/lib/libapp_trace.a b/tools/sdk/esp32/lib/libapp_trace.a index 457355a9cff..9e08a79c408 100644 Binary files a/tools/sdk/esp32/lib/libapp_trace.a and b/tools/sdk/esp32/lib/libapp_trace.a differ diff --git a/tools/sdk/esp32/lib/libapp_update.a b/tools/sdk/esp32/lib/libapp_update.a index 551bfb86cf9..654f1094989 100644 Binary files a/tools/sdk/esp32/lib/libapp_update.a and b/tools/sdk/esp32/lib/libapp_update.a differ diff --git a/tools/sdk/esp32/lib/libasio.a b/tools/sdk/esp32/lib/libasio.a index 69e072d1737..f70463d71dd 100644 Binary files a/tools/sdk/esp32/lib/libasio.a and b/tools/sdk/esp32/lib/libasio.a differ diff --git a/tools/sdk/esp32/lib/libbootloader_support.a b/tools/sdk/esp32/lib/libbootloader_support.a index db0df17b7a6..1247c3fe92d 100644 Binary files a/tools/sdk/esp32/lib/libbootloader_support.a and b/tools/sdk/esp32/lib/libbootloader_support.a differ diff --git a/tools/sdk/esp32/lib/libbt.a b/tools/sdk/esp32/lib/libbt.a index cf6f28abaf3..ae90c9430e0 100644 Binary files a/tools/sdk/esp32/lib/libbt.a and b/tools/sdk/esp32/lib/libbt.a differ diff --git a/tools/sdk/esp32/lib/libbutton.a b/tools/sdk/esp32/lib/libbutton.a index ee6935a6eaf..2c7a5c83979 100644 Binary files a/tools/sdk/esp32/lib/libbutton.a and b/tools/sdk/esp32/lib/libbutton.a differ diff --git a/tools/sdk/esp32/lib/libcoap.a b/tools/sdk/esp32/lib/libcoap.a index 475f344c21a..a49fbc832e6 100644 Binary files a/tools/sdk/esp32/lib/libcoap.a and b/tools/sdk/esp32/lib/libcoap.a differ diff --git a/tools/sdk/esp32/lib/libcoexist.a b/tools/sdk/esp32/lib/libcoexist.a index 6a07d9fab49..1c67ea32c12 100644 Binary files a/tools/sdk/esp32/lib/libcoexist.a and b/tools/sdk/esp32/lib/libcoexist.a differ diff --git a/tools/sdk/esp32/lib/libconsole.a b/tools/sdk/esp32/lib/libconsole.a index f711007592c..7d5c3fdac1b 100644 Binary files a/tools/sdk/esp32/lib/libconsole.a and b/tools/sdk/esp32/lib/libconsole.a differ diff --git a/tools/sdk/esp32/lib/libcore.a b/tools/sdk/esp32/lib/libcore.a index 5dfca587210..842c189cef0 100644 Binary files a/tools/sdk/esp32/lib/libcore.a and b/tools/sdk/esp32/lib/libcore.a differ diff --git a/tools/sdk/esp32/lib/libcxx.a b/tools/sdk/esp32/lib/libcxx.a index ef0e12ce41d..16162e67920 100644 Binary files a/tools/sdk/esp32/lib/libcxx.a and b/tools/sdk/esp32/lib/libcxx.a differ diff --git a/tools/sdk/esp32/lib/libdriver.a b/tools/sdk/esp32/lib/libdriver.a index f238bbb787e..57c332baf54 100644 Binary files a/tools/sdk/esp32/lib/libdriver.a and b/tools/sdk/esp32/lib/libdriver.a differ diff --git a/tools/sdk/esp32/lib/libefuse.a b/tools/sdk/esp32/lib/libefuse.a index 3f941fd6035..24dc6fb1504 100644 Binary files a/tools/sdk/esp32/lib/libefuse.a and b/tools/sdk/esp32/lib/libefuse.a differ diff --git a/tools/sdk/esp32/lib/libesp-dsp.a b/tools/sdk/esp32/lib/libesp-dsp.a index 49b548eaf7a..26e601eb8ac 100644 Binary files a/tools/sdk/esp32/lib/libesp-dsp.a and b/tools/sdk/esp32/lib/libesp-dsp.a differ diff --git a/tools/sdk/esp32/lib/libesp-tls.a b/tools/sdk/esp32/lib/libesp-tls.a index b68a26e8905..d9828365b69 100644 Binary files a/tools/sdk/esp32/lib/libesp-tls.a and b/tools/sdk/esp32/lib/libesp-tls.a differ diff --git a/tools/sdk/esp32/lib/libesp32-camera.a b/tools/sdk/esp32/lib/libesp32-camera.a index 0514d6ce494..d32a4f7cd10 100644 Binary files a/tools/sdk/esp32/lib/libesp32-camera.a and b/tools/sdk/esp32/lib/libesp32-camera.a differ diff --git a/tools/sdk/esp32/lib/libesp_common.a b/tools/sdk/esp32/lib/libesp_common.a index 55ad6397248..8376abc4c81 100644 Binary files a/tools/sdk/esp32/lib/libesp_common.a and b/tools/sdk/esp32/lib/libesp_common.a differ diff --git a/tools/sdk/esp32/lib/libesp_eth.a b/tools/sdk/esp32/lib/libesp_eth.a index b1929f1e507..2e6f5cd426e 100644 Binary files a/tools/sdk/esp32/lib/libesp_eth.a and b/tools/sdk/esp32/lib/libesp_eth.a differ diff --git a/tools/sdk/esp32/lib/libesp_event.a b/tools/sdk/esp32/lib/libesp_event.a index 553ea1c7aee..e77be44bce7 100644 Binary files a/tools/sdk/esp32/lib/libesp_event.a and b/tools/sdk/esp32/lib/libesp_event.a differ diff --git a/tools/sdk/esp32/lib/libesp_gdbstub.a b/tools/sdk/esp32/lib/libesp_gdbstub.a index 4532df2f78a..ebab7a300ff 100644 Binary files a/tools/sdk/esp32/lib/libesp_gdbstub.a and b/tools/sdk/esp32/lib/libesp_gdbstub.a differ diff --git a/tools/sdk/esp32/lib/libesp_hid.a b/tools/sdk/esp32/lib/libesp_hid.a index 81355c91e67..3c0e96ef5c1 100644 Binary files a/tools/sdk/esp32/lib/libesp_hid.a and b/tools/sdk/esp32/lib/libesp_hid.a differ diff --git a/tools/sdk/esp32/lib/libesp_http_client.a b/tools/sdk/esp32/lib/libesp_http_client.a index 9d084d94942..512bc3a9dcd 100644 Binary files a/tools/sdk/esp32/lib/libesp_http_client.a and b/tools/sdk/esp32/lib/libesp_http_client.a differ diff --git a/tools/sdk/esp32/lib/libesp_http_server.a b/tools/sdk/esp32/lib/libesp_http_server.a index f20074b7e94..d304e1e31b0 100644 Binary files a/tools/sdk/esp32/lib/libesp_http_server.a and b/tools/sdk/esp32/lib/libesp_http_server.a differ diff --git a/tools/sdk/esp32/lib/libesp_https_ota.a b/tools/sdk/esp32/lib/libesp_https_ota.a index c8f743f733a..16fd6ab15c7 100644 Binary files a/tools/sdk/esp32/lib/libesp_https_ota.a and b/tools/sdk/esp32/lib/libesp_https_ota.a differ diff --git a/tools/sdk/esp32/lib/libesp_hw_support.a b/tools/sdk/esp32/lib/libesp_hw_support.a index 8b318d6bfdb..36e6c9cfda8 100644 Binary files a/tools/sdk/esp32/lib/libesp_hw_support.a and b/tools/sdk/esp32/lib/libesp_hw_support.a differ diff --git a/tools/sdk/esp32/lib/libesp_ipc.a b/tools/sdk/esp32/lib/libesp_ipc.a index 8958f861427..3ccc4e9a5e4 100644 Binary files a/tools/sdk/esp32/lib/libesp_ipc.a and b/tools/sdk/esp32/lib/libesp_ipc.a differ diff --git a/tools/sdk/esp32/lib/libesp_lcd.a b/tools/sdk/esp32/lib/libesp_lcd.a index 1801d9b8755..8dda0d105bd 100644 Binary files a/tools/sdk/esp32/lib/libesp_lcd.a and b/tools/sdk/esp32/lib/libesp_lcd.a differ diff --git a/tools/sdk/esp32/lib/libesp_littlefs.a b/tools/sdk/esp32/lib/libesp_littlefs.a index 38290da68ae..b1cb9bf4003 100644 Binary files a/tools/sdk/esp32/lib/libesp_littlefs.a and b/tools/sdk/esp32/lib/libesp_littlefs.a differ diff --git a/tools/sdk/esp32/lib/libesp_local_ctrl.a b/tools/sdk/esp32/lib/libesp_local_ctrl.a index e1f10c0dffe..c082eae9d9b 100644 Binary files a/tools/sdk/esp32/lib/libesp_local_ctrl.a and b/tools/sdk/esp32/lib/libesp_local_ctrl.a differ diff --git a/tools/sdk/esp32/lib/libesp_netif.a b/tools/sdk/esp32/lib/libesp_netif.a index d606140499b..d9762dd28d4 100644 Binary files a/tools/sdk/esp32/lib/libesp_netif.a and b/tools/sdk/esp32/lib/libesp_netif.a differ diff --git a/tools/sdk/esp32/lib/libesp_phy.a b/tools/sdk/esp32/lib/libesp_phy.a index 3abd25f53b2..9681fab43cc 100644 Binary files a/tools/sdk/esp32/lib/libesp_phy.a and b/tools/sdk/esp32/lib/libesp_phy.a differ diff --git a/tools/sdk/esp32/lib/libesp_pm.a b/tools/sdk/esp32/lib/libesp_pm.a index 39cb0ce9527..9ef0b9ac522 100644 Binary files a/tools/sdk/esp32/lib/libesp_pm.a and b/tools/sdk/esp32/lib/libesp_pm.a differ diff --git a/tools/sdk/esp32/lib/libesp_rainmaker.a b/tools/sdk/esp32/lib/libesp_rainmaker.a index eb552bda46d..ab5ece21d76 100644 Binary files a/tools/sdk/esp32/lib/libesp_rainmaker.a and b/tools/sdk/esp32/lib/libesp_rainmaker.a differ diff --git a/tools/sdk/esp32/lib/libesp_ringbuf.a b/tools/sdk/esp32/lib/libesp_ringbuf.a index e3fe56d6590..68c6e93b0d9 100644 Binary files a/tools/sdk/esp32/lib/libesp_ringbuf.a and b/tools/sdk/esp32/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/esp32/lib/libesp_schedule.a b/tools/sdk/esp32/lib/libesp_schedule.a index 13d28e57465..c13fe9c30a5 100644 Binary files a/tools/sdk/esp32/lib/libesp_schedule.a and b/tools/sdk/esp32/lib/libesp_schedule.a differ diff --git a/tools/sdk/esp32/lib/libesp_serial_slave_link.a b/tools/sdk/esp32/lib/libesp_serial_slave_link.a index 0f49c488742..9dcff8989a6 100644 Binary files a/tools/sdk/esp32/lib/libesp_serial_slave_link.a and b/tools/sdk/esp32/lib/libesp_serial_slave_link.a differ diff --git a/tools/sdk/esp32/lib/libesp_system.a b/tools/sdk/esp32/lib/libesp_system.a index f50673a65c4..2cc68405c88 100644 Binary files a/tools/sdk/esp32/lib/libesp_system.a and b/tools/sdk/esp32/lib/libesp_system.a differ diff --git a/tools/sdk/esp32/lib/libesp_timer.a b/tools/sdk/esp32/lib/libesp_timer.a index 6dd4d143f6e..04672445255 100644 Binary files a/tools/sdk/esp32/lib/libesp_timer.a and b/tools/sdk/esp32/lib/libesp_timer.a differ diff --git a/tools/sdk/esp32/lib/libesp_websocket_client.a b/tools/sdk/esp32/lib/libesp_websocket_client.a index 4ea65a16e18..390bdc9b029 100644 Binary files a/tools/sdk/esp32/lib/libesp_websocket_client.a and b/tools/sdk/esp32/lib/libesp_websocket_client.a differ diff --git a/tools/sdk/esp32/lib/libesp_wifi.a b/tools/sdk/esp32/lib/libesp_wifi.a index 6d7bcc29315..7779a0a840a 100644 Binary files a/tools/sdk/esp32/lib/libesp_wifi.a and b/tools/sdk/esp32/lib/libesp_wifi.a differ diff --git a/tools/sdk/esp32/lib/libespcoredump.a b/tools/sdk/esp32/lib/libespcoredump.a index 25cd8820b99..c73df3b029d 100644 Binary files a/tools/sdk/esp32/lib/libespcoredump.a and b/tools/sdk/esp32/lib/libespcoredump.a differ diff --git a/tools/sdk/esp32/lib/libespnow.a b/tools/sdk/esp32/lib/libespnow.a index 9b53365726b..24169f6f0c2 100644 Binary files a/tools/sdk/esp32/lib/libespnow.a and b/tools/sdk/esp32/lib/libespnow.a differ diff --git a/tools/sdk/esp32/lib/libfatfs.a b/tools/sdk/esp32/lib/libfatfs.a index 4ee8d7990ed..a47df9006e2 100644 Binary files a/tools/sdk/esp32/lib/libfatfs.a and b/tools/sdk/esp32/lib/libfatfs.a differ diff --git a/tools/sdk/esp32/lib/libfreemodbus.a b/tools/sdk/esp32/lib/libfreemodbus.a index 66297b41164..f1ff8c861f8 100644 Binary files a/tools/sdk/esp32/lib/libfreemodbus.a and b/tools/sdk/esp32/lib/libfreemodbus.a differ diff --git a/tools/sdk/esp32/lib/libfreertos.a b/tools/sdk/esp32/lib/libfreertos.a index 310a0260efa..4951dc26239 100644 Binary files a/tools/sdk/esp32/lib/libfreertos.a and b/tools/sdk/esp32/lib/libfreertos.a differ diff --git a/tools/sdk/esp32/lib/libhal.a b/tools/sdk/esp32/lib/libhal.a index 1ec5baa88e8..f27a2354ee4 100644 Binary files a/tools/sdk/esp32/lib/libhal.a and b/tools/sdk/esp32/lib/libhal.a differ diff --git a/tools/sdk/esp32/lib/libheap.a b/tools/sdk/esp32/lib/libheap.a index 9c1f8d53e6e..e564f6767e2 100644 Binary files a/tools/sdk/esp32/lib/libheap.a and b/tools/sdk/esp32/lib/libheap.a differ diff --git a/tools/sdk/esp32/lib/liblog.a b/tools/sdk/esp32/lib/liblog.a index 32d9e92b187..120920f8dff 100644 Binary files a/tools/sdk/esp32/lib/liblog.a and b/tools/sdk/esp32/lib/liblog.a differ diff --git a/tools/sdk/esp32/lib/liblwip.a b/tools/sdk/esp32/lib/liblwip.a index ad6dcde9e98..2c7e5df5d35 100644 Binary files a/tools/sdk/esp32/lib/liblwip.a and b/tools/sdk/esp32/lib/liblwip.a differ diff --git a/tools/sdk/esp32/lib/libmbedcrypto.a b/tools/sdk/esp32/lib/libmbedcrypto.a index b63bf72ce9b..c0d35ee00ee 100644 Binary files a/tools/sdk/esp32/lib/libmbedcrypto.a and b/tools/sdk/esp32/lib/libmbedcrypto.a differ diff --git a/tools/sdk/esp32/lib/libmbedtls.a b/tools/sdk/esp32/lib/libmbedtls.a index 116564a2f60..44b1fdd7f73 100644 Binary files a/tools/sdk/esp32/lib/libmbedtls.a and b/tools/sdk/esp32/lib/libmbedtls.a differ diff --git a/tools/sdk/esp32/lib/libmdns.a b/tools/sdk/esp32/lib/libmdns.a index a07fbbd45ea..ce5e94a5b1e 100644 Binary files a/tools/sdk/esp32/lib/libmdns.a and b/tools/sdk/esp32/lib/libmdns.a differ diff --git a/tools/sdk/esp32/lib/libmesh.a b/tools/sdk/esp32/lib/libmesh.a index 9a32bef01fd..4796b538801 100644 Binary files a/tools/sdk/esp32/lib/libmesh.a and b/tools/sdk/esp32/lib/libmesh.a differ diff --git a/tools/sdk/esp32/lib/libmqtt.a b/tools/sdk/esp32/lib/libmqtt.a index 127053e6c78..39156994d7c 100644 Binary files a/tools/sdk/esp32/lib/libmqtt.a and b/tools/sdk/esp32/lib/libmqtt.a differ diff --git a/tools/sdk/esp32/lib/libnet80211.a b/tools/sdk/esp32/lib/libnet80211.a index 75b75922b13..dce7fceb9d6 100644 Binary files a/tools/sdk/esp32/lib/libnet80211.a and b/tools/sdk/esp32/lib/libnet80211.a differ diff --git a/tools/sdk/esp32/lib/libnewlib.a b/tools/sdk/esp32/lib/libnewlib.a index 0f96d134212..95712a71002 100644 Binary files a/tools/sdk/esp32/lib/libnewlib.a and b/tools/sdk/esp32/lib/libnewlib.a differ diff --git a/tools/sdk/esp32/lib/libnvs_flash.a b/tools/sdk/esp32/lib/libnvs_flash.a index 7ef82432abc..c3d40bbb2bc 100644 Binary files a/tools/sdk/esp32/lib/libnvs_flash.a and b/tools/sdk/esp32/lib/libnvs_flash.a differ diff --git a/tools/sdk/esp32/lib/libopenssl.a b/tools/sdk/esp32/lib/libopenssl.a index 1a87c1f7d05..fcae8b2b012 100644 Binary files a/tools/sdk/esp32/lib/libopenssl.a and b/tools/sdk/esp32/lib/libopenssl.a differ diff --git a/tools/sdk/esp32/lib/libpp.a b/tools/sdk/esp32/lib/libpp.a index 3ec218aa6f1..73458bfedf6 100644 Binary files a/tools/sdk/esp32/lib/libpp.a and b/tools/sdk/esp32/lib/libpp.a differ diff --git a/tools/sdk/esp32/lib/libprotocomm.a b/tools/sdk/esp32/lib/libprotocomm.a index 701acf9e584..666d3586672 100644 Binary files a/tools/sdk/esp32/lib/libprotocomm.a and b/tools/sdk/esp32/lib/libprotocomm.a differ diff --git a/tools/sdk/esp32/lib/libpthread.a b/tools/sdk/esp32/lib/libpthread.a index 1329ba601b3..cb1da0a5633 100644 Binary files a/tools/sdk/esp32/lib/libpthread.a and b/tools/sdk/esp32/lib/libpthread.a differ diff --git a/tools/sdk/esp32/lib/libsdmmc.a b/tools/sdk/esp32/lib/libsdmmc.a index 30b5bbaa4e5..09a42278610 100644 Binary files a/tools/sdk/esp32/lib/libsdmmc.a and b/tools/sdk/esp32/lib/libsdmmc.a differ diff --git a/tools/sdk/esp32/lib/libsmartconfig.a b/tools/sdk/esp32/lib/libsmartconfig.a index 2ae36360fa1..e5fb258bcbe 100644 Binary files a/tools/sdk/esp32/lib/libsmartconfig.a and b/tools/sdk/esp32/lib/libsmartconfig.a differ diff --git a/tools/sdk/esp32/lib/libsoc.a b/tools/sdk/esp32/lib/libsoc.a index 5b5287c04be..ad5bde888c3 100644 Binary files a/tools/sdk/esp32/lib/libsoc.a and b/tools/sdk/esp32/lib/libsoc.a differ diff --git a/tools/sdk/esp32/lib/libspi_flash.a b/tools/sdk/esp32/lib/libspi_flash.a index f9a11137071..7ba660971db 100644 Binary files a/tools/sdk/esp32/lib/libspi_flash.a and b/tools/sdk/esp32/lib/libspi_flash.a differ diff --git a/tools/sdk/esp32/lib/libspiffs.a b/tools/sdk/esp32/lib/libspiffs.a index 56eea5993cf..c3890f81830 100644 Binary files a/tools/sdk/esp32/lib/libspiffs.a and b/tools/sdk/esp32/lib/libspiffs.a differ diff --git a/tools/sdk/esp32/lib/libtcp_transport.a b/tools/sdk/esp32/lib/libtcp_transport.a index 83f2ad57d38..d26d2dc2277 100644 Binary files a/tools/sdk/esp32/lib/libtcp_transport.a and b/tools/sdk/esp32/lib/libtcp_transport.a differ diff --git a/tools/sdk/esp32/lib/libtcpip_adapter.a b/tools/sdk/esp32/lib/libtcpip_adapter.a index 20f3e0cb843..bcbad81866e 100644 Binary files a/tools/sdk/esp32/lib/libtcpip_adapter.a and b/tools/sdk/esp32/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/esp32/lib/libvfs.a b/tools/sdk/esp32/lib/libvfs.a index 51230fadaf3..3b6596e43be 100644 Binary files a/tools/sdk/esp32/lib/libvfs.a and b/tools/sdk/esp32/lib/libvfs.a differ diff --git a/tools/sdk/esp32/lib/libwapi.a b/tools/sdk/esp32/lib/libwapi.a index 4d0200ad4b0..53e0fe9d410 100644 Binary files a/tools/sdk/esp32/lib/libwapi.a and b/tools/sdk/esp32/lib/libwapi.a differ diff --git a/tools/sdk/esp32/lib/libwear_levelling.a b/tools/sdk/esp32/lib/libwear_levelling.a index e6793f3b3c9..1d853f8b096 100644 Binary files a/tools/sdk/esp32/lib/libwear_levelling.a and b/tools/sdk/esp32/lib/libwear_levelling.a differ diff --git a/tools/sdk/esp32/lib/libwifi_provisioning.a b/tools/sdk/esp32/lib/libwifi_provisioning.a index b0764129217..5ae2dd1647e 100644 Binary files a/tools/sdk/esp32/lib/libwifi_provisioning.a and b/tools/sdk/esp32/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/esp32/lib/libwpa_supplicant.a b/tools/sdk/esp32/lib/libwpa_supplicant.a index 011380db2c8..a65d59f66e6 100644 Binary files a/tools/sdk/esp32/lib/libwpa_supplicant.a and b/tools/sdk/esp32/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/esp32/lib/libxtensa.a b/tools/sdk/esp32/lib/libxtensa.a index 37ff7464dc0..2e9b6d979ce 100644 Binary files a/tools/sdk/esp32/lib/libxtensa.a and b/tools/sdk/esp32/lib/libxtensa.a differ diff --git a/tools/sdk/esp32/sdkconfig b/tools/sdk/esp32/sdkconfig index 79ed5b40ca2..20f7d268c66 100644 --- a/tools/sdk/esp32/sdkconfig +++ b/tools/sdk/esp32/sdkconfig @@ -83,6 +83,7 @@ CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set CONFIG_ESPTOOLPY_FLASHMODE_DIO=y # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" # CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set @@ -1026,6 +1027,7 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 # CONFIG_LWIP_DHCP_DOES_ARP_CHECK is not set # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 # # DHCP server @@ -1282,6 +1284,7 @@ CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 # CONFIG_MDNS_STRICT_MODE is not set CONFIG_MDNS_TIMER_PERIOD_MS=100 # CONFIG_MDNS_NETWORKING_SOCKET is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y # end of mDNS # @@ -1466,6 +1469,7 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# CONFIG_WIFI_PROV_BLE_BONDING is not set # end of Wi-Fi Provisioning Manager # diff --git a/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin b/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin index 78c947604fd..de9f4505aad 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_dio_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin b/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin index 5fdaf4eed6a..bf8998d52d3 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_dio_80m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin b/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin index e369d99e862..dfe29b31b31 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_dout_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin b/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin index 2b9800fc7e7..0534d487951 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_dout_80m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin b/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin index 22880d8cf71..d9b1d9e775a 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_qio_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin b/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin index d630c8774ee..f3ce6940c07 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_qio_80m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin b/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin index 9566026d6b4..960af55a46f 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin and b/tools/sdk/esp32c3/bin/bootloader_qout_40m.bin differ diff --git a/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin b/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin index d8a35e03d63..cdc77df22bb 100644 Binary files a/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin and b/tools/sdk/esp32c3/bin/bootloader_qout_80m.bin differ diff --git a/tools/sdk/esp32c3/include/asio/port/include/esp_asio_config.h b/tools/sdk/esp32c3/include/asio/port/include/esp_asio_config.h index cba316527e6..3f3a9b03ed4 100644 --- a/tools/sdk/esp32c3/include/asio/port/include/esp_asio_config.h +++ b/tools/sdk/esp32c3/include/asio/port/include/esp_asio_config.h @@ -18,6 +18,11 @@ # define ASIO_NO_TYPEID # endif // CONFIG_COMPILER_RTTI +// +// Supress OpenSSL deprecation warning, when building ASIO +// +#define ESP_OPENSSL_SUPPRESS_LEGACY_WARNING + // // LWIP compatibility inet and address macros/functions // diff --git a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_block_internal.h b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_block_internal.h index 9abe81557fa..b7ad0a554cc 100644 --- a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_block_internal.h +++ b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_block_internal.h @@ -191,6 +191,9 @@ int coap_handle_response_get_block(coap_context_t *context, void coap_block_delete_lg_xmit(coap_session_t *session, coap_lg_xmit_t *lg_xmit); +coap_tick_t coap_block_check_lg_xmit_timeouts(coap_session_t *session, + coap_tick_t now); + /** * The function that does all the work for the coap_add_data_large*() * functions. diff --git a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_dtls.h b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_dtls.h index cbd369dfce6..fc30445431d 100644 --- a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_dtls.h +++ b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_dtls.h @@ -27,6 +27,12 @@ typedef struct coap_dtls_pki_t coap_dtls_pki_t; #ifndef COAP_DTLS_HINT_LENGTH #define COAP_DTLS_HINT_LENGTH 128 #endif +#ifndef COAP_DTLS_MAX_PSK_IDENTITY +#define COAP_DTLS_MAX_PSK_IDENTITY 64 +#endif +#ifndef COAP_DTLS_MAX_PSK +#define COAP_DTLS_MAX_PSK 64 +#endif typedef enum coap_dtls_role_t { COAP_DTLS_ROLE_CLIENT, /**< Internal function invoked for client */ diff --git a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_event.h b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_event.h index 89b2a63967c..b6ea60524a2 100644 --- a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_event.h +++ b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_event.h @@ -24,34 +24,34 @@ * Scalar type to represent different events, e.g. DTLS events or * retransmission timeouts. */ - typedef unsigned int coap_event_t; - +typedef enum coap_event_t { /** * (D)TLS events for COAP_PROTO_DTLS and COAP_PROTO_TLS */ -#define COAP_EVENT_DTLS_CLOSED 0x0000 -#define COAP_EVENT_DTLS_CONNECTED 0x01DE -#define COAP_EVENT_DTLS_RENEGOTIATE 0x01DF -#define COAP_EVENT_DTLS_ERROR 0x0200 + COAP_EVENT_DTLS_CLOSED = 0x0000, + COAP_EVENT_DTLS_CONNECTED = 0x01DE, + COAP_EVENT_DTLS_RENEGOTIATE = 0x01DF, + COAP_EVENT_DTLS_ERROR = 0x0200, /** * TCP events for COAP_PROTO_TCP and COAP_PROTO_TLS */ -#define COAP_EVENT_TCP_CONNECTED 0x1001 -#define COAP_EVENT_TCP_CLOSED 0x1002 -#define COAP_EVENT_TCP_FAILED 0x1003 + COAP_EVENT_TCP_CONNECTED = 0x1001, + COAP_EVENT_TCP_CLOSED = 0x1002, + COAP_EVENT_TCP_FAILED = 0x1003, /** * CSM exchange events for reliable protocols only */ -#define COAP_EVENT_SESSION_CONNECTED 0x2001 -#define COAP_EVENT_SESSION_CLOSED 0x2002 -#define COAP_EVENT_SESSION_FAILED 0x2003 + COAP_EVENT_SESSION_CONNECTED = 0x2001, + COAP_EVENT_SESSION_CLOSED = 0x2002, + COAP_EVENT_SESSION_FAILED = 0x2003, /** - * BLOCK2 receive errors + * (Q-)BLOCK receive errors */ -#define COAP_EVENT_PARTIAL_BLOCK 0x3001 + COAP_EVENT_PARTIAL_BLOCK = 0x3001 +} coap_event_t; /** * Type for event handler functions that can be registered with a CoAP diff --git a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_time.h b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_time.h index baa8650eaff..99d117a4eb7 100644 --- a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_time.h +++ b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/coap_time.h @@ -88,7 +88,11 @@ COAP_STATIC_INLINE uint64_t coap_ticks_to_rt_us(coap_tick_t t) { #elif defined(RIOT_VERSION) #include +#ifdef XTIMER_HZ #define COAP_TICKS_PER_SECOND (XTIMER_HZ) +#else /* XTIMER_HZ */ +#define COAP_TICKS_PER_SECOND (XTIMER_HZ_BASE) +#endif /* XTIMER_HZ */ typedef uint64_t coap_tick_t; typedef int64_t coap_tick_diff_t; diff --git a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/net.h b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/net.h index 577a0b5d5a5..ea5a2cba1bb 100644 --- a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/net.h +++ b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/net.h @@ -15,6 +15,7 @@ #include #include #ifndef _WIN32 +#include #include #endif #include diff --git a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/pdu.h b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/pdu.h index a22869b69ed..8031a1c2c40 100644 --- a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/pdu.h +++ b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/pdu.h @@ -299,7 +299,6 @@ typedef enum coap_pdu_code_t { COAP_REQUEST_CODE_PATCH = COAP_REQUEST_PATCH, COAP_REQUEST_CODE_IPATCH = COAP_REQUEST_IPATCH, - COAP_RESPONSE_CODE_OK = COAP_RESPONSE_CODE(200), COAP_RESPONSE_CODE_CREATED = COAP_RESPONSE_CODE(201), COAP_RESPONSE_CODE_DELETED = COAP_RESPONSE_CODE(202), COAP_RESPONSE_CODE_VALID = COAP_RESPONSE_CODE(203), diff --git a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/resource.h b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/resource.h index 2cd9aea48fa..5cf7751f67e 100644 --- a/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/resource.h +++ b/tools/sdk/esp32c3/include/coap/libcoap/include/coap3/resource.h @@ -83,7 +83,8 @@ typedef void (*coap_method_handler_t) * variable of coap_str_const_t has to point to constant text, or point to data * within the allocated coap_str_const_t parameter. * - * @param uri_path The string URI path of the new resource. + * @param uri_path The string URI path of the new resource. The leading '/' is + * not normally required - e.g. just "full/path/for/resource". * @param flags Flags for memory management (in particular release of * memory). Possible values:@n * diff --git a/tools/sdk/esp32c3/include/config/sdkconfig.h b/tools/sdk/esp32c3/include/config/sdkconfig.h index f1f31fdfd3b..c07e2b52f40 100644 --- a/tools/sdk/esp32c3/include/config/sdkconfig.h +++ b/tools/sdk/esp32c3/include/config/sdkconfig.h @@ -29,6 +29,7 @@ #define CONFIG_BOOT_ROM_LOG_ALWAYS_ON 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 #define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1 +#define CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR 1 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_ESPTOOLPY_FLASHFREQ_80M 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "80m" @@ -340,6 +341,7 @@ #define CONFIG_LWIP_GARP_TMR_INTERVAL 60 #define CONFIG_LWIP_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1 +#define CONFIG_LWIP_DHCP_OPTIONS_LEN 68 #define CONFIG_LWIP_DHCPS 1 #define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 #define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 @@ -450,6 +452,7 @@ #define CONFIG_MDNS_TASK_AFFINITY 0x0 #define CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS 2000 #define CONFIG_MDNS_TIMER_PERIOD_MS 100 +#define CONFIG_MDNS_MULTIPLE_INSTANCE 1 #define CONFIG_MQTT_PROTOCOL_311 1 #define CONFIG_MQTT_TRANSPORT_SSL 1 #define CONFIG_MQTT_TRANSPORT_WEBSOCKET 1 @@ -622,5 +625,5 @@ #define CONFIG_TIMER_TASK_STACK_SIZE CONFIG_ESP_TIMER_TASK_STACK_SIZE #define CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX #define CONFIG_UDP_RECVMBOX_SIZE CONFIG_LWIP_UDP_RECVMBOX_SIZE -#define CONFIG_ARDUINO_IDF_COMMIT "3e370c4296" +#define CONFIG_ARDUINO_IDF_COMMIT "b86fe0c66c" #define CONFIG_ARDUINO_IDF_BRANCH "master" diff --git a/tools/sdk/esp32c3/include/driver/include/driver/rmt.h b/tools/sdk/esp32c3/include/driver/include/driver/rmt.h index a7e2aad5f24..bc07954a080 100644 --- a/tools/sdk/esp32c3/include/driver/include/driver/rmt.h +++ b/tools/sdk/esp32c3/include/driver/include/driver/rmt.h @@ -856,16 +856,35 @@ esp_err_t rmt_remove_channel_from_group(rmt_channel_t channel); #if SOC_RMT_SUPPORT_TX_LOOP_COUNT /** - * @brief Set loop count for RMT TX channel + * @brief Set loop count threshold value for RMT TX channel + * + * When tx loop count reaches this value, an ISR callback will notify user * * @param channel RMT channel - * @param count loop count + * @param count loop count, 1 ~ 1023 * @return * - ESP_ERR_INVALID_ARG Parameter error * - ESP_OK Success */ esp_err_t rmt_set_tx_loop_count(rmt_channel_t channel, uint32_t count); -#endif + +/** + * @brief Enable or disable the feature that when loop count reaches the threshold, RMT will stop transmitting. + * + * - When the loop auto-stop feature is enabled will halt RMT transmission after the loop count reaches a certain threshold + * - When disabled, the RMT transmission continue indefinitely until halted by the users + * + * @note The auto-stop feature is implemented in hardware on particular targets (i.e. those with SOC_RMT_SUPPORT_TX_LOOP_AUTOSTOP defined). + * Otherwise, the auto-stop feature is implemented in software via the interrupt. + * + * @param channel RMT channel + * @param en enable bit + * @return + * - ESP_ERR_INVALID_ARG Parameter error + * - ESP_OK Success + */ +esp_err_t rmt_enable_tx_loop_autostop(rmt_channel_t channel, bool en); +#endif // SOC_RMT_SUPPORT_TX_LOOP_COUNT /** * @brief Reset RMT TX/RX memory index. diff --git a/tools/sdk/esp32c3/include/esp-face/include/detect/dl_detect_define.hpp b/tools/sdk/esp32c3/include/esp-face/include/detect/dl_detect_define.hpp new file mode 100644 index 00000000000..cc53050cb9b --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/detect/dl_detect_define.hpp @@ -0,0 +1,17 @@ +#pragma once + +#include + +namespace dl +{ + namespace detect + { + typedef struct + { + int category; /* box; /* keypoint; /* +#include "sdkconfig.h" + +#define DL_LOG_LATENCY_UNIT 0 /* (high)) ? (high) : (x)) +#endif + +#ifndef DL_ABS +#define DL_ABS(x) ((x) < 0 ? (-(x)) : (x)) +#endif + +#ifndef DL_RIGHT_SHIFT +#define DL_RIGHT_SHIFT(x, shift) ((shift) > 0) ? ((x) >> (shift)) : ((x) << -(shift)) +#endif + +#ifndef DL_LEFT_SHIFT +#define DL_LEFT_SHIFT(x, shift) ((shift) > 0) ? ((x) << (shift)) : ((x) >> -(shift)) +#endif + +namespace dl +{ + typedef enum + { + Linear, /**/ + ReLU, /**/ + LeakyReLU, /**/ + PReLU, /**/ + // TODO: Sigmoid, /**/ + // TODO: Softmax, /**/ + PADDING_SAME_BEGIN, /**/ + PADDING_SAME_END, /**/ + } padding_type_t; + + typedef enum + { + CONSTANT, + EDGE, + REFLECT, + SYMMETRIC, + } padding_mode_t; +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/image/dl_image.hpp b/tools/sdk/esp32c3/include/esp-face/include/image/dl_image.hpp new file mode 100644 index 00000000000..4a974df063a --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/image/dl_image.hpp @@ -0,0 +1,439 @@ +#pragma once + +#include +#include +#include +#include +#include "dl_define.hpp" +#include "dl_variable.hpp" +#include "dl_math_matrix.hpp" + +namespace dl +{ + namespace image + { + typedef enum + { + IMAGE_RESIZE_BILINEAR = 0, /*> 7; + return DL_CLIP(temp, 0, 255); + } + + /** + * @brief Convert RGB565 pixel to RGB888. + * + * @tparam T supports all integer types + * @param input pixel value in RGB565 + * @param output pixel value in RGB888 + */ + template + inline void convert_pixel_rgb565_to_rgb888(uint16_t input, T *output) + { + output[0] = (input & 0x1F00) >> 5; // blue + output[1] = ((input & 0x7) << 5) | ((input & 0xE000) >> 11); // green + output[2] = input & 0xF8; // red + } + + /** + * @brief Convert RGB565 pixel to Gray. + * + * @param input pixel value in RGB565 + * @return pixel value in Gray + */ + inline uint8_t convert_pixel_rgb565_to_gray(uint16_t input) + { + int blue = (input & 0x1F00) >> 5; // blue + int green = ((input & 0x7) << 5) | ((input & 0xE000) >> 11); // green + int red = input & 0xF8; // red + + return convert_pixel_rgb888_to_gray(red, green, blue); + } + + /** + * @brief Crop a patch from image and resize and store to destination image. + * If the cropping box is out of image, destination image will be padded with edge. + * + * The outer rectangle is the entire output image. + * The inner rectangle is where the resized image will be stored. + * In other world, this function could help you do padding while resize image. + * ___________________________(dst_w)__________________ + * | ___________________________ | + * | |(x_start, y_start) | | + * | | | | + * | | | | + * (dst_h)| | | | + * | | | | + * | | | | + * | |___________________________|(x_end, y_end) | + * |____________________________________________________| + * + * @tparam T suppot all integer types + * @param dst_image pointer of destination(output) image + * @param dst_width destination image width + * @param dst_channel destination image channel number + * @param dst_y_start start y of resized image in destination image + * @param dst_y_end end y of resized image in destination image + * @param dst_x_start start x of resized image in destination image + * @param dst_x_end end x of resized image in destination image + * @param src_image pointer of source image + * @param src_height source image height + * @param src_width source image width + * @param src_channel source image channel + * @param src_y_start start y of resized image in source image + * @param src_y_end end y of resized image in source image + * @param src_x_start start x of resized image in source image + * @param src_x_end end x of resized image in source image + * @param resize_type one of IMAGE_RESIZE_BILINEAR or IMAGE_RESIZE_MEAN or IMAGE_RESIZE_NEAREST + * @param shift_left bit left shift number implemented on output + */ + template + void crop_and_resize(T *dst_image, + int dst_width, + int dst_channel, + int dst_y_start, int dst_y_end, + int dst_x_start, int dst_x_end, + uint16_t *src_image, + int src_height, + int src_width, + int src_channel, + int src_y_start, int src_y_end, + int src_x_start, int src_x_end, + resize_type_t resize_type = IMAGE_RESIZE_NEAREST, + int shift_left = 0); + + /** + * @brief Crop a patch from image and resize and store to destination image. + * If the cropping box is out of image, destination image will be padded with edge. + * + * The outer rectangle is the entire output image. + * The inner rectangle is where the resized image will be stored. + * In other world, this function could help you do padding while resize image. + * ___________________________(dst_w)__________________ + * | ___________________________ | + * | |(x_start, y_start) | | + * | | | | + * | | | | + * (dst_h)| | | | + * | | | | + * | | | | + * | |___________________________|(x_end, y_end) | + * |____________________________________________________| + * + * @tparam T suppot all integer types + * @param dst_image pointer of destination(output) image + * @param dst_width destination image width + * @param dst_channel destination image channel number + * @param dst_y_start start y of resized image in destination image + * @param dst_y_end end y of resized image in destination image + * @param dst_x_start start x of resized image in destination image + * @param dst_x_end end x of resized image in destination image + * @param src_image pointer of source image + * @param src_height source image height + * @param src_width source image width + * @param src_channel source image channel + * @param src_y_start start y of resized image in source image + * @param src_y_end end y of resized image in source image + * @param src_x_start start x of resized image in source image + * @param src_x_end end x of resized image in source image + * @param resize_type one of IMAGE_RESIZE_BILINEAR or IMAGE_RESIZE_MEAN or IMAGE_RESIZE_NEAREST + * @param shift_left bit left shift number implemented on output + */ + template + void crop_and_resize(T *dst_image, + int dst_width, + int dst_channel, + int dst_y_start, int dst_y_end, + int dst_x_start, int dst_x_end, + uint8_t *src_image, + int src_height, + int src_width, + int src_channel, + int src_y_start, int src_y_end, + int src_x_start, int src_x_end, + resize_type_t resize_type = IMAGE_RESIZE_NEAREST, + int shift_left = 0); + + /** + * @brief Draw a filled rectangle on RGB888 image. + * + * @param image pointer of input image + * @param image_height height of input image + * @param image_width width of input image + * @param x1 left up corner x + * @param y1 left up corner y + * @param x2 right bottom corner x + * @param y2 right bottom corner y + * @param color 0x 00| 00| 00| 00 + * reserved|channel 0|channel 1|channel 2 + */ + void draw_filled_rectangle(uint8_t *image, const uint32_t image_height, const uint32_t image_width, + uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, + const uint32_t color = 0x00FF0000); + + /** + * @brief Draw a filled rectangle on RGB565 image. + * + * @param image pointer of input image + * @param image_height height of input image + * @param image_width width of input image + * @param x1 left up corner x + * @param y1 left up corner y + * @param x2 right bottom corner x + * @param y2 right bottom corner y + * @param color 0b 000| 00000| 00000| 000 + * channel 1[2:0]|channel 0|channel 2|channel 1[5:3] + */ + void draw_filled_rectangle(uint16_t *image, const uint32_t image_height, const uint32_t image_width, + uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, + const uint16_t color = 0b0001111100000000); + + /** + * @brief Draw a point on RGB888 image. + * + * @param image pointer of input image + * @param image_height height of input image + * @param image_width width of input image + * @param x point x + * @param y point y + * @param size size of point + * @param color 0x 00| 00| 00| 00 + * reserved|channel 0|channel 1|channel 2 + */ + void draw_point(uint8_t *image, const uint32_t image_height, const uint32_t image_width, + const uint32_t x, const uint32_t y, const uint32_t size, + const uint32_t color = 0x00FF0000); + + /** + * @brief Draw a point on RGB565 image. + * + * @param image pointer of input image + * @param image_height height of input image + * @param image_width width of input image + * @param x point x + * @param y point y + * @param size size of point + * @param color 0b 000| 00000| 00000| 000 + * channel 1[2:0]|channel 0|channel 2|channel 1[5:3] + */ + void draw_point(uint16_t *image, const uint32_t image_height, const uint32_t image_width, + const uint32_t x, const uint32_t y, const uint32_t size, + uint16_t color = 0b0001111100000000); + + /** + * @brief Draw a hollow rectangle on RGB888 image. + * + * @param image pointer of input image + * @param image_height height of input image + * @param image_width width of input image + * @param x1 left up corner x + * @param y1 left up corner y + * @param x2 right bottom corner x + * @param y2 right bottom corner y + * @param color 0x 00| 00| 00| 00 + * reserved|channel 0|channel 1|channel 2 + */ + void draw_hollow_rectangle(uint8_t *image, const uint32_t image_height, const uint32_t image_width, + uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, + uint32_t color = 0x00FF0000); + + /** + * @brief Draw a hollow rectangle on RGB565 image. + * + * @param image pointer of input image + * @param image_height height of input image + * @param image_width width of input image + * @param x1 left up corner x + * @param y1 left up corner y + * @param x2 right bottom corner x + * @param y2 right bottom corner y + * @param color 0b 000| 00000| 00000| 000 + * channel 1[2:0]|channel 0|channel 2|channel 1[5:3] + */ + void draw_hollow_rectangle(uint16_t *image, const uint32_t image_height, const uint32_t image_width, + uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, + const uint16_t color = 0b0001111100000000); + + /** + * @brief Detect target moving by activated detection point number. Each cross in the figure below is a detection point. + * Once abs(frame_1_detection_point[i] - frame_2_detection_point[i]) > threshold, this detection point is activated. + * This function will return the number of activated detection point. + * + * __stride__________________________ + * | | | | | + * stride | | | | | + * | | | | | + * |________|________|________| | + * | | | | | + * | | | | | + * | | | | | + * |________|________|________| height + * | | | | | + * | | | | | + * | | | | | + * |________|________|________| | + * | | | | | + * | | | | | + * | | | | | + * |________|________|________|___|___ + * | | + * |__________width___________| + * | | + * + * Time consumption: + * Frame shape = (240, 240) + * Both frame are in PSRAM + * On ESP32-S3 with CPU 240MHz, QSPI 80MHz + * + * stride latency + * 1 28316us + * 2 8770us + * 4 3622us + * 8 1990us + * 16 880us + * 32 260us + * + * + * In a application, outside this function, threshold of activated detection point number is needed. + * Once activated detection point number > number_threshold, this two frame are judged target moved. + * How to determine the number_threshold? + * Let's assume that the minimize shape of target is (target_min_height, target_max_width). + * Then, the number_threshold = [target_min_height / stride] * [target_max_width / stride] * ratio, + * where ratio is in (0, 1), the smaller the ratio is, the more sensitive the detector is, the more false detected. + * + * + * @param f1 one frame in RGB565 + * @param f2 another frame in RGB565 + * @param height height of frame + * @param width width of frame + * @param stride stride of detection point, the smaller the stride is, the more reliable the detector is. + * @param threshold activation threshold of each detection point + * @return activated detection point number + */ + uint32_t get_moving_point_number(uint16_t *f1, uint16_t *f2, const uint32_t height, const uint32_t width, const uint32_t stride, const uint32_t threshold = 5); + + /** + * @brief Detect target moving by activated detection point number. Each cross in the figure below is a detection point. + * Once abs(frame_1_detection_point[i] - frame_2_detection_point[i]) > threshold, this detection point is activated. + * This function will return the number of activated detection point. + * + * __stride__________________________ + * | | | | | + * stride | | | | | + * | | | | | + * |________|________|________| | + * | | | | | + * | | | | | + * | | | | | + * |________|________|________| height + * | | | | | + * | | | | | + * | | | | | + * |________|________|________| | + * | | | | | + * | | | | | + * | | | | | + * |________|________|________|___|___ + * | | + * |__________width___________| + * | | + * + * + * In a application, outside this function, threshold of activated detection point number is needed. + * Once activated detection point number > number_threshold, this two frame are judged target moved. + * How to determine the number_threshold? + * Let's assume that the minimize shape of target is (target_min_height, target_max_width). + * Then, the number_threshold = [target_min_height / stride] * [target_max_width / stride] * ratio, + * where ratio is in (0, 1), the smaller the ratio is, the more sensitive the detector is, the more false detected. + * + * + * @param f1 one frame in RGB888 + * @param f2 another frame in RGB888 + * @param height height of frame + * @param width width of frame + * @param stride stride of detection point, the smaller the stride is, the more reliable the detector is. + * @param threshold activation threshold of each detection point + * @return activated detection point number + */ + uint32_t get_moving_point_number(uint8_t *f1, uint8_t *f2, const uint32_t height, const uint32_t width, const uint32_t stride, const uint32_t threshold = 5); + + /** + * @brief Apply an affine transformation to an image. + * + * @tparam T + * @param input the input image. + * @param output the output image. + * @param M_inv the inverse transformation matrix. + */ + template + void warp_affine(dl::Tensor *input, dl::Tensor *output, dl::math::Matrix *M_inv); + + /** + * @brief Apply an affine transformation to an image. + * + * @tparam T + * @param input the pointer of the input image. + * @param shape the shape of the input image. + * @param output the output image. + * @param M_inv the inverse transformation matrix. + */ + template + void warp_affine(uint16_t *input, std::vector shape, dl::Tensor *output, dl::math::Matrix *M_inv); + + /** + * @brief Get the otsu thresh object. + * + * @param image the gray image. + * @return uint8_t the otsu thresh. + */ + uint8_t get_otsu_thresh(Tensor &image); + + /** + * @brief Convert RGB image to gray image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @return Tensor* output image in gray format + */ + Tensor *rgb2gray(Tensor &image, bool bgr = false); + + /** + * @brief Convert RGB image to LAB image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @param fast true: use the fast alogrithm, but the accuracy will be reduced + * false: do not use the fast alogrithm + * @return Tensor* output image in LAB foramt + */ + Tensor *rgb2lab(Tensor &image, bool bgr = false, bool fast = true); + + /** + * @brief Convert RGB image to HSV image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @param fast true: use the fast alogrithm, but the accuracy will be reduced + * false: do not use the fast alogrithm + * @return Tensor* output image in HSV format + */ + Tensor *rgb2hsv(Tensor &image, bool bgr = false, bool fast = true); + + } // namespace image +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_add2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_add2d.hpp new file mode 100644 index 00000000000..c43282b42de --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_add2d.hpp @@ -0,0 +1,145 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_add2d.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(Add2D(input0, input1)). + * NOTE: addition is element-wise, i.e., output[i,j,k] = input0[i,j,k] + input1[i,j,k] + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Add2D : public Layer + { + private: + const Activation *activation; /**/ + const int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new Add2D object. + * + * @param output_exponent exponent of output + * @param activation activation of add2d, if you don't specify anything, no activation is applied + * @param name name of add2d + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Add2D(const int output_exponent, const Activation *activation = NULL, const char *name = "Add2D", bool inplace = false) : Layer(name), + activation(activation), + output_exponent(output_exponent), + output(NULL), + inplace(inplace), + output_shape({}) {} + + /** + * @brief Destroy the Add2D object + */ + ~Add2D() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * NOTE: input0.shape must equal to input1.shape. + * + * @param input0 as one input + * @param input1 as another input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input0, Tensor &input1, bool print_shape = false) + { + assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; + + if (!this->inplace) + { + if (this->output == NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(input0.shape); + this->output->free_element(); + } + else + { + this->output = &input0; + } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Add2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Add2D operation. + * + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @return Tensor& added result + */ + Tensor &call(Tensor &input0, Tensor &input1, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::add2d(*this->output, input0, input1, this->activation, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "add2d"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::add2d(*this->output, input0, input1, this->activation, assign_core, this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "add2d"); + } + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp new file mode 100644 index 00000000000..8a9aaa8dfbe --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp @@ -0,0 +1,161 @@ +#pragma once + +#include +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_avg_pool2d.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief AvgPool2D(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class AvgPool2D : public Layer + { + private: + const int output_exponent; /**/ + std::vector filter_shape; /**/ + const int stride_y; /**/ + const int stride_x; /**/ + const padding_type_t padding_type; /**/ + std::vector padding; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new AvgPool2D object. + * + * @param output_exponent exponent of output + * @param filter_shape filter shape in [filter_height, filter_width] + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, + * - PADDING_VALID means no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] + * @param stride_y stride in height + * @param stride_x stride in width + * @param name name of layer + */ + AvgPool2D(const int output_exponent, + const std::vector filter_shape, + const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, + const int stride_y = 1, + const int stride_x = 1, + const char *name = "AvgPool2D") : Layer(name), + output_exponent(output_exponent), + filter_shape(filter_shape), + padding_type(padding_type), + padding(padding), + stride_y(stride_y), + stride_x(stride_x), + output_shape({}) + { + this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } + } + + /** + * @brief Destroy the AvgPool2D object. + * + */ + ~AvgPool2D() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output shape and padding. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(input.shape[0] > 0); + assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + + this->output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); + } + + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& AvgPool2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call AvgPool2D operation + * + * @param input as an input + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @return AvgPool2D result + */ + Tensor &call(Tensor &input, uint8_t autoload_enable = 0) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::avg_pool2d(*this->output, input, this->padding, this->filter_shape, this->stride_y, this->stride_x); + DL_LOG_LAYER_LATENCY_END(this->name, "avg_pool2d"); + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_base.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_base.hpp new file mode 100644 index 00000000000..b265b454538 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_base.hpp @@ -0,0 +1,56 @@ +#pragma once +#include "dl_tool.hpp" +#include "dl_tool_cache.hpp" +#include + +namespace dl +{ + namespace layer + { + /** + * @brief Base class for layer. + * + */ + class Layer + { + public: + char *name; /**/ + + /** + * @brief Construct a new Layer object. + * + * @param name name of layer. + */ + Layer(const char *name = NULL); + + /** + * @brief Destroy the Layer object. Return resource. + * + */ + ~Layer(); + }; + } // namespace layer +} // namespace dl + +#if DL_LOG_LAYER_LATENCY +/** + * @brief Initialize. + */ +#define DL_LOG_LAYER_LATENCY_INIT() dl::tool::Latency latency + +/** + * @brief Time starts. + */ +#define DL_LOG_LAYER_LATENCY_START() latency.start() + +/** + * @brief Time ends and printed. + */ +#define DL_LOG_LAYER_LATENCY_END(prefix, key) \ + latency.end(); \ + latency.print(prefix, key) +#else +#define DL_LOG_LAYER_LATENCY_INIT() +#define DL_LOG_LAYER_LATENCY_START() +#define DL_LOG_LAYER_LATENCY_END(prefix, key) +#endif diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_concat.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_concat.hpp new file mode 100644 index 00000000000..35ebe652e53 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_concat.hpp @@ -0,0 +1,139 @@ +#pragma once + +#include +#include + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" +#include "dl_nn_concat.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Concat(input1, input2, input3, ...). + * + * @tparam feature_t support all kinds of integer and float data type + */ + template + class Concat : Layer + { + private: + int output_exponent; /**/ + int axis; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Concat object. + * + * @param name name of layer + * @param axis The axis along which the Tensor will be concatenated. + */ + Concat(int axis, const char *name = "Concat") : Layer(name), axis(axis), output_shape({}) + { + this->output = new Tensor; + } + + /** + * @brief Destroy the Concat object + */ + ~Concat() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Collect inputs' channel and memory offset, called in Model.build(). + * + * @param args pointers of concatenated Tensor + * @param print_shape whether to print the output shape. + */ + void build(std::vector *> args, bool print_shape = false) + { + assert(args.size() > 1); + int shape_size = args[0]->shape.size(); + + if (this->axis < 0) + { + this->axis = shape_size + this->axis; + } + assert((this->axis < shape_size) && (this->axis > -1)); + + int output_shape_axis = args[0]->shape[this->axis]; + + for (int i = 1; i < args.size(); i++) + { + assert(shape_size == args[i]->shape.size()); + assert(args[i]->exponent == args[i - 1]->exponent); + output_shape_axis += args[i]->shape[this->axis]; + + for (int j = 0; j < shape_size; j++) + { + if (j != this->axis) + { + assert(args[i]->shape[j] == args[i - 1]->shape[j]); + } + } + } + + this->output_exponent = args[0]->exponent; + this->output_shape = args[0]->shape; + this->output_shape[this->axis] = output_shape_axis; + + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Call Concat operation + * + * @param inputs the pointers of inputs + * @param free_inputs true: free the inputs after call + * false: do not free inputs + * @return Tensor& concat result + */ + Tensor &call(std::vector *> inputs, bool free_inputs = false) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::concat(*this->output, inputs, this->axis, free_inputs); + DL_LOG_LAYER_LATENCY_END(this->name, "concat"); + return *this->output; + } + + /** + * @brief Get the output + * + * @return Tensor& Concat result + */ + Tensor &get_output() + { + return *this->output; + } + }; + } // namespace layer +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_concat2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_concat2d.hpp new file mode 100644 index 00000000000..a086f1ccfde --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_concat2d.hpp @@ -0,0 +1,179 @@ +#pragma once + +#include +#include + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Concat2D(input1, input2, input3, ...). + * + * @tparam feature_t support all kinds of integer and float data type + */ + template + class Concat2D : Layer + { + private: + std::vector *> output_vec; /**/ + std::vector offset; /**/ + std::vector channel; /**/ + Tensor *output; /**/ + int output_exponent; /**/ + public: + + /** + * @brief Construct a new Concat2D object. + * + * @param name name of layer + */ + Concat2D(const char *name = NULL) : Layer(name) { + this->output = new Tensor; + } + + /** + * @brief Destroy the Concat2D object + */ + ~Concat2D() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Collect inputs' channel and memory offset, called in Model.build(). + * + * @param args pointers of concatenated Tensor + */ + void build(std::vector *> args) + { + assert(args.size() > 0); + + this->output_vec = args; + + this->offset = std::vector(args.size()); + this->channel = std::vector(args.size()); + + this->output_exponent = args[0]->exponent; + this->offset[0] = 0; + this->channel[0] = args[0]->shape[2]; + std::vector output_shape = args[0]->shape; + + for (int i = 1; i < args.size(); i++) + { + assert(output_shape[0] == args[i]->shape[0]); // height + assert(output_shape[1] == args[i]->shape[1]); // width + // assert(this->output_exponent == args[i]->exponent); // exponent + + this->offset[i] = output_shape[2]; + this->channel[i] = args[i]->shape[2]; + output_shape[2] += args[i]->shape[2]; + } + this->output->set_shape(output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + } + + /** + * @brief Get the output + * + * @return Tensor& Concat2d result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Get the maximum padding among inputs and output-> Then, set to this->output. Called at the end of Model.build(). + * NOTE: Some special situations like C = Concat2D_1(A, B), E = Concat2D_2(C, D), where A, B, C, D, E are Tensor. + * For avoiding memory copy, we apply an entire element for E, and take it apart for A, B, D. + * A, B, C, D and E will become other layer's inputs so that result different size of padding. + * For get the maximum padding, we should call at the end of Model.build(), + * Concat2D_1.backward(); // max_padding_temp = get_max_padding(A, B, C), padding of A, B and C are set to max_padding_temp. + * Concat2D_2.backward(); // max_padding = get_max_padding(max_padding_temp, get_max_padding(D, E)) , padding of C, D and E are set to max_padding. + * However, padding of A and B is still max_padding_temp. + * Concat2D_1.backward(); // padding of A and B are set to max_padding. + * Or, + * Concat2D_2.backward(); + * Concat2D_1.backward(); + * Concat2D_2.backward(); + */ + void backward() + { + std::vector max_padding = this->output->padding; + int max_channel_with_padding = this->output->shape_with_padding[2]; + for (int i = 0; i < this->output_vec.size(); i++) + { + for (int j = 0; j < max_padding.size(); j++) + { + max_padding[j] = DL_MAX(max_padding[j], this->output_vec[i]->padding[j]); + } + max_channel_with_padding = DL_MAX(max_channel_with_padding, this->output_vec[i]->shape_with_padding[2]); + } + + this->output->set_padding_size(max_padding); + this->output->shape_with_padding[2] = max_channel_with_padding; + for (int i = 0; i < this->output_vec.size(); i++) + { + this->output_vec[i]->set_padding_size(max_padding); + this->output_vec[i]->shape_with_padding[2] = max_channel_with_padding; +#if CONFIG_DEBUG_MODE + assert(this->output->shape_with_padding[0] == this->output_vec[i]->shape_with_padding[0]); + assert(this->output->shape_with_padding[1] == this->output_vec[i]->shape_with_padding[1]); + assert(this->output->shape_with_padding[2] == this->output_vec[i]->shape_with_padding[2]); +#endif + } + } + + /** + * @brief Calloc an entire element for concatnate result. Take the entire element apart and deliver element pointers to concatenated layer. + * NOTE: For example, C = Concat2D(A, B). We apply an entire element for C and deliver two element pointers to A and B. + * Let's assume that A result is produced first. We should call Concat2D.calloc_element() just before A result is produced + * to make sure the element of A is ready and could be filled. + */ + void calloc_element() + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + this->output->calloc_element(); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + for (int i = 0; i < this->offset.size(); i++) + { + this->output_vec[i]->element = this->output->element + this->offset[i]; + this->output_vec[i]->set_auto_free(false); + } + DL_LOG_LAYER_LATENCY_END(this->name, "deliver"); + } + + void apply_element() + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + this->output->apply_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + for (int i = 0; i < this->offset.size(); i++) + { + this->output_vec[i]->element = this->output->element + this->offset[i]; + this->output_vec[i]->set_auto_free(false); + } + DL_LOG_LAYER_LATENCY_END(this->name, "deliver"); + } + }; + } // namespace layer +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_conv2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_conv2d.hpp new file mode 100644 index 00000000000..038dd6cd79f --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_conv2d.hpp @@ -0,0 +1,186 @@ +#pragma once + +#include "dl_nn_conv2d.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(Conv2D(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization + */ + template + class Conv2D : public Layer + { + private: + const int output_exponent; /**/ + const Filter *filter; /**/ + const int stride_y; /**/ + const int stride_x; /**/ + const padding_type_t padding_type; /**/ + const Bias *bias; /**/ + const Activation *activation; /**/ + std::vector padding; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new Conv2D object. + * + * @param output_exponent exponent of output + * @param filter filter of Conv2D + * @param bias bias of Conv2D, if you don't specify anything, no bias is added + * @param activation activation of Conv2D, if you don't specify anything, no activation is applied + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, + * - PADDING_VALID means no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] + * @param stride_y stride in height + * @param stride_x stride in width + * @param name name of layer + */ + Conv2D(const int output_exponent, + const Filter *filter, + const Bias *bias = NULL, + const Activation *activation = NULL, + const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, + const int stride_y = 1, + const int stride_x = 1, + const char *name = "Conv2D") : Layer(name), + output_exponent(output_exponent), + filter(filter), + stride_y(stride_y), + stride_x(stride_x), + padding_type(padding_type), + bias(bias), + activation(activation), + padding(padding), + output_shape({}) + { + this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } + } + + /** + * @brief Destroy the Conv2D object. + * + */ + ~Conv2D() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output padding and input padding. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(input.shape[0] > 0); + assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + assert(this->filter->shape.size() == 4); + assert(input.shape[2] == this->filter->shape[2]); + + this->output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, true, this->padding); + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Conv2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Conv2D operation + * + * @param input as an input. + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return Conv2D result + */ + Tensor &call(Tensor &input, bool autoload_enable = false, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::conv2d(*this->output, input, this->padding, *(this->filter), this->stride_y, this->stride_x, this->bias, this->activation, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "conv2d"); + return *this->output; + } + + /** + * @brief Preload the filter to Cache. + * NOTE: Call this layer's preload() before previous layer's call() such that filter could be loaded while previous layer is doing calculation. + */ + void preload() + { + size_t size = sizeof(feature_t); + int shape_size = this->filter->shape.size(); + for (int i = 0; i < shape_size; ++i) + { + size *= filter->shape[i]; + } + dl::tool::cache::preload_func((uint32_t)(this->filter->element), size); + } + }; + + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp new file mode 100644 index 00000000000..30b2c2a6c77 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp @@ -0,0 +1,188 @@ +#pragma once + +#include "dl_nn_depthwise_conv2d.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(DepthwiseConv2D(filter, input) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization + */ + template + class DepthwiseConv2D : public Layer + { + private: + const int output_exponent; /**/ + const Filter *filter; /**/ + const int stride_y; /**/ + const int stride_x; /**/ + const padding_type_t padding_type; /**/ + const Bias *bias; /**/ + const Activation *activation; /**/ + std::vector padding; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new DepthwiseConv2D object. + * + * @param output_exponent exponent of output + * @param filter filter of DepthwiseConv2D + * @param bias bias of DepthwiseConv2D, if you don't specify anything, no bias is added + * @param activation activation of DepthwiseConv2D, if you don't specify anything, no activation is applied + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, + * - PADDING_VALID means no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] + * @param stride_y - stride in height + * @param stride_x - stride in width + * @param name name of layer + */ + DepthwiseConv2D(const int output_exponent, + const Filter *filter, + const Bias *bias = NULL, + const Activation *activation = NULL, + const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, + const int stride_y = 1, + const int stride_x = 1, + const char *name = "DepthwiseConv2D") : Layer(name), + output_exponent(output_exponent), + filter(filter), + stride_y(stride_y), + stride_x(stride_x), + padding_type(padding_type), + bias(bias), + activation(activation), + padding(padding), + output_shape({}) + { + this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } + } + + /** + * @brief Destroy the DepthwiseConv2D object. + * + */ + ~DepthwiseConv2D() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output shape and padding. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(input.shape[0] > 0); + assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + assert(this->filter->shape.size() == 4); + assert(input.shape[2] == this->filter->shape[2]); + + this->output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); + } + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& DepthwiseConv2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call DepthwiseConv2D operation. + * + * @param input as an input + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return DepthwiseConv2D result + */ + Tensor &call(Tensor &input, bool autoload_enable = false, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::depthwise_conv2d(*this->output, input, this->padding, *(this->filter), this->stride_y, this->stride_x, this->bias, this->activation, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "depthwise_conv2d"); + + return *this->output; + } + + /** + * @brief Preload the filter to Cache. + * NOTE: Call this layer's preload() before previous layer's call() such that filter could be loaded while previous layer is calculating. + */ + void preload() + { + size_t size = sizeof(feature_t); + int shape_size = this->filter->shape.size(); + for (int i = 0; i < shape_size; ++i) + { + size *= filter->shape[i]; + } + dl::tool::cache::preload_func((uint32_t)(this->filter->element), size); + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_expand_dims.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_expand_dims.hpp new file mode 100644 index 00000000000..a59bed183fb --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_expand_dims.hpp @@ -0,0 +1,128 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class ExpandDims : public Layer + { + private: + std::vector output_shape; /**/ + std::vector axis; /**/ + Tensor *output; /**/ + bool inplace; /**/ + + public: + int output_exponent; + + /** + * @brief Construct a new ExpandDims object + * + * @param axis position where the new axis is placed. + * @param name name of layer + * @param inplace true: the output will store to input + * false: the output will store to a separate memory + */ + ExpandDims(std::vector axis, const char *name = "ExpandDims", bool inplace = false) : Layer(name), + axis(axis), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the ExpandDims object + * + */ + ~ExpandDims() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * + * @param input as an input. + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->expand_dims(this->axis); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + this->output->expand_dims(this->axis); + } + this->output_shape = this->output->shape; + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& ExpandDims result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief call ExpandDims opeartion + * + * @param input + * @return Tensor& ExpandDims result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "ExpandDims"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_shape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "ExpandDims"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_flatten.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_flatten.hpp new file mode 100644 index 00000000000..70ae483a07f --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_flatten.hpp @@ -0,0 +1,120 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Flatten : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new Flatten object + * + * @param name name of layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Flatten(const char *name = "Flatten", bool inplace = false) : Layer(name), inplace(inplace), output_shape({}) + {} + + /** + * @brief Destroy the Flatten object + * + */ + ~Flatten() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + this->output_shape = {input.get_size()}; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Flatten result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Flatten operation. + * + * @param input as an input + * @return Tensor& Flatten result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->flatten(); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "flatten"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->flatten(); + DL_LOG_LAYER_LATENCY_END(this->name, "flatten"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_fullyconnected.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_fullyconnected.hpp new file mode 100644 index 00000000000..afa7e5befba --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_fullyconnected.hpp @@ -0,0 +1,167 @@ +#pragma once + +#include "dl_nn_fully_connected.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(FullyConnected(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization + */ + template + class FullyConnected : public Layer + { + private: + const int output_exponent; /**/ + const bool flatten; /**/ + const Filter *filter; /**/ + const Bias *bias; /**/ + const Activation *activation; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new FullyConnected object. + * + * @param output_exponent exponent of output + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param name name of layer + */ + FullyConnected(const int output_exponent, + const Filter *filter, + const Bias *bias = NULL, + const Activation *activation = NULL, + const bool flatten = true, + const char *name = "FullyConnected") : Layer(name), + output_exponent(output_exponent), + flatten(flatten), + filter(filter), + bias(bias), + activation(activation), + output_shape({}) + { + this->output = new Tensor; + } + + /** + * @brief Destroy the FullyConnected object. + * + */ + ~FullyConnected() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output padding and input padding. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(this->filter->shape.size() == 4); + assert(this->filter->shape[0] == 1); + assert(this->filter->shape[1] == 1); + if (this->flatten) + { + assert(input.get_size() == this->filter->shape[2]); + this->output_shape = {this->filter->shape[3]}; + } + else + { + assert(input.shape.back() == this->filter->shape[2]); + this->output_shape = input.shape; + this->output_shape[this->output_shape.size() - 1] = this->filter->shape[3]; + } + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& FullyConnected result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call FullyConnected operation + * + * @param input as an input. + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return FullyConnected result + */ + Tensor &call(Tensor &input, bool autoload_enable = false, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::fully_connected(*this->output, input, *(this->filter), this->bias, this->activation, this->flatten, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "fully_connected"); + return *this->output; + } + + /** + * @brief Preload the filter to Cache. + * NOTE: Call this layer's preload() before previous layer's call() such that filter could be loaded while previous layer is doing calculation. + */ + void preload() + { + size_t size = sizeof(feature_t); + int shape_size = this->filter->shape.size(); + for (int i = 0; i < shape_size; ++i) + { + size *= filter->shape[i]; + } + dl::tool::cache::preload_func((uint32_t)(this->filter->element), size); + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp new file mode 100644 index 00000000000..93f2d30ac89 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp @@ -0,0 +1,126 @@ +#pragma once + +#include +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_global_avg_pool2d.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief GlobalAveragePool2D(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class GlobalAveragePool2D : public Layer + { + private: + const int output_exponent; /**/ + std::vector output_shape; /**/ + Tensor *output; /**/ + public: + /** + * @brief Construct a new GlobalAveragePool2D object. + * + * @param output_exponent exponent of output + * @param name name of layer + */ + GlobalAveragePool2D(const int output_exponent, const char *name = "GlobalAveragePool2D") : Layer(name), + output_exponent(output_exponent), + output_shape({}) + + { + this->output = new Tensor; + } + + /** + * @brief Destroy the GlobalAveragePool2D object. + * + */ + ~GlobalAveragePool2D() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(input.shape[0] > 0); + assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + + std::vector output_shape(input.shape.size(), 1); + output_shape[2] = input.shape[2]; + this->output_shape = output_shape; + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& GlobalAveragePool2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call GlobalAveragePool2D operation + * + * @param input as an input + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return GlobalAveragePool2D result + */ + Tensor &call(Tensor &input, uint8_t autoload_enable = 0) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::global_avg_pool2d(*this->output, input); + DL_LOG_LAYER_LATENCY_END(this->name, "global_avg_pool2d"); + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp new file mode 100644 index 00000000000..f9b7f73ff8c --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp @@ -0,0 +1,121 @@ +#pragma once + +#include +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_global_max_pool2d.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief GlobalMaxPool2D(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class GlobalMaxPool2D : public Layer + { + private: + Tensor *output; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new GlobalMaxPool2D object. + * + * @param name name of layer + */ + GlobalMaxPool2D(const char *name = "GlobalMaxPool2D") : Layer(name), output_shape({}) + { + this->output = new Tensor; + } + + /** + * @brief Destroy the GlobalMaxPool2D object. + * + */ + ~GlobalMaxPool2D() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(input.shape[0] > 0); + assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + this->output->set_exponent(input.exponent); + + std::vector output_shape(input.shape.size(), 1); + output_shape[2] = input.shape[2]; + this->output_shape = output_shape; + this->output->set_shape(this->output_shape); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& GlobalMaxPool2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call GlobalMaxPool2D operation + * + * @param input as an input + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return GlobalMaxPool2D result + */ + Tensor &call(Tensor &input, uint8_t autoload_enable = 0) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(input.exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::global_max_pool2d(*this->output, input); + DL_LOG_LAYER_LATENCY_END(this->name, "global_max_pool2d"); + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_leakyrelu.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_leakyrelu.hpp new file mode 100644 index 00000000000..a972e135006 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_leakyrelu.hpp @@ -0,0 +1,141 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_leakyrelu.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief LeakyReLU(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class LeakyReLU : public Layer + { + private: + feature_t activation_alpha; /**/ + int activation_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new LeakyReLU object + * + * @param activation_alpha quantized alpha + * @param activation_exponent exponent of quantized alpha + * @param name name of leakyrelu + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + LeakyReLU(const int activation_alpha, const int activation_exponent, const char *name = "LeakyReLU", bool inplace = false) : Layer(name), output(NULL), output_shape({}) + { + this->activation_alpha = activation_alpha; + this->activation_exponent = activation_exponent; + this->inplace = inplace; + } + + /** + * @brief Destroy the LeakyReLU object + * + */ + ~LeakyReLU() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_shape = input.shape; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_shape(this->output_shape); + this->output->set_exponent(input.exponent); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& LeakyReLU result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call LeakyReLU operation. + * + * @param input as an input + * @param assign_core not effective yet + * @return LeakyReLU result + */ + Tensor &call(Tensor &input, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(input.exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::leakyrelu(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::leakyrelu(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); + } + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_max2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_max2d.hpp new file mode 100644 index 00000000000..93bc5899443 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_max2d.hpp @@ -0,0 +1,143 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_nn_max2d.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Max2D(input0, input1). + * NOTE: maximum is element-wise, i.e., output[i,j,k] = max(input0[i,j,k], input1[i,j,k]) + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Max2D : public Layer + { + private: + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Max2D object. + * + * @param name name of max2d + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Max2D(const char *name = "Max2D", bool inplace = false) : Layer(name), + output(NULL), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Max2D object + * + */ + ~Max2D() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * NOTE: input0.shape must equal to input1.shape. + * input0.exponent must equal to input1.exponent. + * + * @param input0 as one input + * @param input1 as another input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input0, Tensor &input1, bool print_shape = false) + { + assert(input0.is_same_shape(input1)); + assert(input0.exponent == input1.exponent); + this->output_shape = input0.shape; + + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Max2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Max2D operation. + * + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @return Max2D result + */ + Tensor &call(Tensor &input0, Tensor &input1, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(input0.exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::max2d(*this->output, input0, input1, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "max2d"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::max2d(*this->output, input0, input1, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "max2d"); + } + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_max_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_max_pool2d.hpp new file mode 100644 index 00000000000..629aa87f515 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_max_pool2d.hpp @@ -0,0 +1,157 @@ +#pragma once + +#include +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_max_pool2d.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief MaxPool2D(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class MaxPool2D : public Layer + { + private: + std::vector filter_shape; /**/ + const int stride_y; /**/ + const int stride_x; /**/ + const padding_type_t padding_type; /**/ + std::vector padding; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new MaxPool2D object. + * + * @param filter_shape filter shape in [filter_height, filter_width] + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, + * - PADDING_VALID means no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] + * @param stride_y stride in height + * @param stride_x stride in width + * @param name name of layer + */ + MaxPool2D(const std::vector filter_shape, + const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, + const int stride_y = 1, + const int stride_x = 1, + const char *name = "MaxPool2D") : Layer(name), + filter_shape(filter_shape), + padding_type(padding_type), + padding(padding), + stride_y(stride_y), + stride_x(stride_x), + output_shape({}) + { + this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } + } + + /** + * @brief Destroy the MaxPool2D object. + * + */ + ~MaxPool2D() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output shape and padding. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(input.shape[0] > 0); + assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + + this->output->set_exponent(input.exponent); + this->output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); + + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); + } + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& MaxPool2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call MaxPool2D operation + * + * @param input as an input + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return MaxPool2D result + */ + Tensor &call(Tensor &input, uint8_t autoload_enable = 0) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(input.exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::max_pool2d(*this->output, input, this->padding, this->filter_shape, this->stride_y, this->stride_x); + DL_LOG_LAYER_LATENCY_END(this->name, "max_pool2d"); + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_min2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_min2d.hpp new file mode 100644 index 00000000000..e38fbf3d0d2 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_min2d.hpp @@ -0,0 +1,143 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_nn_min2d.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Min2D(input0, input1). + * NOTE: minimum is element-wise, i.e., output[i,j,k] = min(input0[i,j,k], input1[i,j,k]) + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Min2D : public Layer + { + private: + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Min2D object + * + * @param name name of min2d + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Min2D(const char *name = "Min2D", bool inplace = false) : Layer(name), + output(NULL), + inplace(inplace), + output_shape({}) {} + + /** + * @brief Destroy the Min2D object + * + */ + ~Min2D() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * NOTE: input0.shape must equal to input1.shape. + * input0.exponent must equal to input1.exponent. + * + * @param input0 as one input + * @param input1 as another input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input0, Tensor &input1, bool print_shape = false) + { + assert(input0.is_same_shape(input1)); + assert(input0.exponent == input1.exponent); + this->output_shape = input0.shape; + + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_shape(this->output_shape); + this->output->set_exponent(input0.exponent); + this->output->free_element(); + } + else + { + this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Min2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Min2D operation + * + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @return Min2D result + */ + Tensor &call(Tensor &input0, Tensor &input1, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(input0.exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::min2d(*this->output, input0, input1, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "min2d"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::min2d(*this->output, input0, input1, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "min2d"); + } + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_model.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_model.hpp new file mode 100644 index 00000000000..2064ef2d33a --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_model.hpp @@ -0,0 +1,52 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Neural Network Model. + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Model + { + private: + std::vector input_shape; /**/ + + public: + /** + * @brief Destroy the Model object. + * + */ + virtual ~Model() {} + + /** + * @brief Build a model including update output shape and input padding of each layer. + * + * @param input as an input + */ + virtual void build(Tensor &input) = 0; + + /** + * @brief Call the model layer by layer. + * + * @param input as an input. + */ + virtual void call(Tensor &input) = 0; + + /** + * @brief If input.shape changes, call Model.build(), otherwise, do not. Then call Model.call(). + * + * @param input as an input + */ + void forward(Tensor &input); + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_mul2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_mul2d.hpp new file mode 100644 index 00000000000..21bcca7a81e --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_mul2d.hpp @@ -0,0 +1,151 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_mul2d.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(Multiply2D(input0, input1)). + * NOTE: multiplication is element-wise, i.e., output[i,j,k] = input0[i,j,k] * input1[i,j,k] + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Mul2D : public Layer + { + private: + const int output_exponent; /**/ + const Activation *activation; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Mul2D object. + * + * @param output_exponent exponent of output + * @param activation activation of Mul2D, if you don't specify anything, no activation is applied + * @param name name of layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Mul2D(const int output_exponent, + const Activation *activation = NULL, + const char *name = "Mul2D", + bool inplace = false) : Layer(name), + output_exponent(output_exponent), + activation(activation), + output(NULL), + inplace(inplace), + output_shape({}) + { + } + + /** + * @brief Destroy the Multiply2D object. + */ + ~Mul2D() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * NOTE: input0.shape must equal to input1.shape. + * + * @param input0 as one input + * @param input1 as another input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input0, Tensor &input1, bool print_shape = false) + { + assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; + + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + + else + { + this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Mul2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Mul2D operation. + * + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @return Mul2D result + */ + Tensor &call(Tensor &input0, Tensor &input1, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::mul2d(*this->output, input0, input1, this->activation, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "mul2d"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::mul2d(*this->output, input0, input1, this->activation, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "mul2d"); + } + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_prelu.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_prelu.hpp new file mode 100644 index 00000000000..96168a783b1 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_prelu.hpp @@ -0,0 +1,145 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_prelu.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief PReLU(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class PReLU : public Layer + { + private: + feature_t *activation_element; /**/ + int activation_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new PReLU object + * + * @param activation_element quantized alpha elements along channel axis + * @param activation_exponent exponent of quantized alpha elements + * @param name name of prelu + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + PReLU(const feature_t *activation_element, + const int activation_exponent = 0, + const char *name = NULL, + bool inplace = "PReLU") : Layer(name), + activation_element(activation_element), + activation_exponent(activation_exponent), + output(NULL), + inplace(inplace), + output_shape({}) + { + } + + /** + * @brief Destroy the PReLU object + * + */ + ~PReLU() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_shape = input.shape; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& PReLU result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call PReLU operation. + * + * @param input as an input + * @param assign_core not effective yet + * @return PReLU result + */ + Tensor &call(Tensor &input, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->set_exponent(input.exponent); + this->output->malloc_element(); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::prelu(*this->output, input, this->activation_element, this->activation_exponent, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::prelu(*this->output, input, this->activation_element, this->activation_exponent, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); + } + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_relu.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_relu.hpp new file mode 100644 index 00000000000..7dd29d4a178 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_relu.hpp @@ -0,0 +1,135 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_nn_relu.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief ReLU(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class ReLU : public Layer + { + private: + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new ReLU object + * + * @param name name of relu + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + ReLU(const char *name = "ReLU", bool inplace = false) : Layer(name), + output(NULL), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the ReLU object + * + */ + ~ReLU() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_shape = input.shape; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& ReLU result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call ReLU operation. + * + * @param input as an input + * @param assign_core not effective yet + * @return ReLU result + */ + Tensor &call(Tensor &input, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(input.exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::relu(*this->output, input, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "relu"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::relu(*this->output, input, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "relu"); + } + + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_reshape.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_reshape.hpp new file mode 100644 index 00000000000..3f2ed72b6e0 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_reshape.hpp @@ -0,0 +1,124 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Reshape(input) + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Reshape : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Reshape object + * + * @param shape the target shape + * @param name name of Reshape layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Reshape(std::vector shape, const char *name = "Reshape", bool inplace = false) : Layer(name), + output_shape(shape), inplace(inplace) + { + } + + /** + * @brief Destroy the Reshape object + * + */ + ~Reshape() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Reshape result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Reshape operation. + * + * @param input as an input + * @return Tensor& Reshape result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->reshape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "reshape"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->reshape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "reshape"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_squeeze.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_squeeze.hpp new file mode 100644 index 00000000000..cee92f22764 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_squeeze.hpp @@ -0,0 +1,127 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Squeeze : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + int axis; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Squeeze object + * + * @param axis the dim to to be remove. make sure the length of the dim is equal to 1. + * if axis == INT32_MAX, all the dims with length==1 will be removed. + * @param name name of Squeeze layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Squeeze(int axis = INT32_MAX, const char *name = "Squeeze", bool inplace = false) : Layer(name), axis(axis), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Squeeze object + * + */ + ~Squeeze() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(input.shape); + this->output->squeeze(this->axis); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(input.shape); + this->output->squeeze(this->axis); + } + this->output_shape = this->output->shape; + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Squeeze result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Squeeze operation. + * + * @param input as an input + * @return Tensor& Squeeze result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "Squeeze"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_shape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "Squeeze"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_sub2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_sub2d.hpp new file mode 100644 index 00000000000..da03b4aad85 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_sub2d.hpp @@ -0,0 +1,141 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn_sub2d.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(Sub2D(input0, input1)). + * NOTE: subtraction is element-wise, i.e., output[i,j,k] = input0[i,j,k] - input1[i,j,k] + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Sub2D : public Layer + { + private: + const int output_exponent; /**/ + const Activation *activation; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Sub2D object. + * + * @param output_exponent exponent of output + * @param activation activation of Mul2D, if you don't specify anything, no activation is applied + * @param name name of layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Sub2D(const int output_exponent, const Activation *activation = NULL, const char *name = "Sub2D", bool inplace = false) : Layer(name), + output_exponent(output_exponent), activation(activation), output(NULL), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Sub2D object. + */ + ~Sub2D() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * NOTE: input0.shape must equal to input1.shape. + * + * @param input0 as one input + * @param input1 as another input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input0, Tensor &input1, bool print_shape = false) + { + assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Sub2D result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Sub2D operation. + * + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @return Sub2D result + */ + Tensor &call(Tensor &input0, Tensor &input1, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output.malloc_element(); + this->output->set_exponent(input0.exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::sub2d(this->output, input0, input1, this->activation, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "sub2d"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + nn::sub2d(this->output, input0, input1, this->activation, assign_core, this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "sub2d"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_transpose.hpp b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_transpose.hpp new file mode 100644 index 00000000000..d89ba8daed5 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/layer/dl_layer_transpose.hpp @@ -0,0 +1,126 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Transpose : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector perm; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Transpose object + * + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @param name name of Transpose layer + * @param inplace true: the output will store to input + * false: the output will store to a separate memory + */ + Transpose(std::vector perm = {}, const char *name = "Transpose", bool inplace = false) : Layer(name), perm(perm), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Transpose object + * + */ + ~Transpose() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + this->output_shape = input.shape; + for (int i = 0; i < this->perm.size(); i++) + { + this->output_shape[i] = input.shape[this->perm[i]]; + } + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Transpose result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Transpose operation. + * + * @param input as an input. + * @return Tensor& Transpose result. + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->transpose(input, this->perm); + DL_LOG_LAYER_LATENCY_END(this->name, "transpose"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->transpose(this->perm); + DL_LOG_LAYER_LATENCY_END(this->name, "transpose"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/math/dl_math.hpp b/tools/sdk/esp32c3/include/esp-face/include/math/dl_math.hpp new file mode 100644 index 00000000000..d3f2b94d3de --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/math/dl_math.hpp @@ -0,0 +1,188 @@ +#pragma once + +#include "dl_define.hpp" + +namespace dl +{ + namespace math + { + /** + * @brief x^a. + * + * @param x as a base + * @param a as an exponent + * @return x^a + */ + inline float power(float x, int a) + { + if (a > 0) + { + return x * power(x, a - 1); + } + else if (a < 0) + { + return 1 / (x * power(x, -a - 1)); + } + else + { + return 1.f; + } + } + + /** + * @brief sqrt(x). + * + * @param x as a base + * @return sqrt(x) + */ + inline float sqrt_quick(float x) + { + const int result = 0x1fbb4000 + (*(int *)&x >> 1); + return *(float *)&result; + } + + /** + * @brief 1/sqrt(x). + * + * @param x as a base + * @return 1/sqrt(x) + */ + inline float sqrt_reciprocal_quick(float x) + { + float xhalf = 0.5f * x; + int i = *(int *)&x; // get bits for floating value + i = 0x5f375a86 - (i >> 1); // gives initial guess y0 + x = *(float *)&i; // convert bits back to float + x = x * (1.5f - xhalf * x * x); // Newton step, repeating increases accuracy + return x; + } + + static const float EN = 0.00001f; + + /** + * @brief sqrt(x). + * + * @param x as a base + * @return sqrt(x) + */ + inline float sqrt_newton(float x) + { + /** + * Use Newton iteration method to find the square root + * */ + if (x == 0.f) + return 0.f; + float result = x; + float last_value; + do + { + last_value = result; + result = (last_value + x / last_value) * 0.5; + } while (DL_ABS(result - last_value) > EN); + return result; + } + + /** + * @brief n-th root of x. + * + * @param x as a base + * @param n root times + * @return n-th root of x + */ + inline float root_newton(float x, int n) + { + if (n == 2) + return sqrt_newton(x); + if (n == 0) + return 1.f; + if (n == 1) + return x; + if (x == 0.f) + return 0.f; + float result = x; + float last_value; + float _n = (float)((n - 1) * n); + do + { + last_value = result; + result = _n * last_value + x / (n * power(last_value, n - 1)); + } while (DL_ABS(result - last_value) > EN); + return result; + } + + /** + * @brief atan(x). + * + * @param x as an input + * @return atan(x) in range [-pi/2, pi/2] + */ + inline float atan(float x) + { + return x * (0.78539816 - (DL_ABS(x) - 1) * (0.2447 + 0.0663 * DL_ABS(x))); + // float s = x*x; + // return ((-0.0464964749 * s + 0.15931422) * s - 0.327622764) * s * x + x; + } + + // TODO:@yuanjiong + /** + * @brief + * + * @param x + * @param y + * @return in range [-pi, pi] + */ + inline float atan2(float x, float y) + { + float ax = DL_ABS(x); + float ay = DL_ABS(y); + float eps = 1e-8; + float a = DL_MIN(ax, ay) / (DL_MAX(ax, ay) + eps); + float r = atan(a); //[0, pi/2] + if (ay > ax) + r = 1.57079633 - r; + if (x < 0) + r = 3.14159265 - r; + if (y < 0) + r = -r; + + return r; + } + + /** + * @brief acos(x). + * + * @param x as an input + * @return acos(x) in range [-pi/2, pi/2] + */ + inline float acos(float x) + { + return atan2(x, sqrt_newton(1.0 - x * x)); + } + + /** + * @brief asin(x). + * + * @param x as an input + * @return asin(x) in range [0, pi] + */ + inline float asin(float x) + { + return atan2(sqrt_newton(1.0 - x * x), x); + } + + /** + * @brief e^x + * + * @param x exponent + * @param steps iteration steps + * @return e^x + */ + inline float exp_fast(double x, int steps) + { + x = 1.0 + x / (1 << steps); + for (int i = 0; i < steps; i++) + x *= x; + return x; + } + } +} \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/math/dl_math_matrix.hpp b/tools/sdk/esp32c3/include/esp-face/include/math/dl_math_matrix.hpp new file mode 100644 index 00000000000..30718f85c32 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/math/dl_math_matrix.hpp @@ -0,0 +1,397 @@ +#pragma once + +#include +#include +#include +#include +#include "dl_define.hpp" +#include "dl_tool.hpp" +#include "dl_variable.hpp" +#include "esp_timer.h" + +namespace dl +{ + namespace math + { + /** + * @brief the Matrix class + * + * @tparam T + */ + template + class Matrix + { + public: + T **array; + int h; + int w; + Matrix() : h(0), w(0) + { + this->array = NULL; + } + + Matrix(int h, int w) : h(h), w(w) + { + this->calloc_element(); + } + + Matrix(int h, int w, T s) : h(h), w(w) + { + this->calloc_element(); + this->set_value(s); + } + + Matrix(const Matrix &mat) : h(mat.h), w(mat.w) + { + this->calloc_element(); + this->set_value(mat); + } + virtual ~Matrix() + { + if (this->array != NULL) + { + for (int i = 0; i < this->h; i++) + { + free(this->array[i]); + } + free(this->array); + this->array = NULL; + } + } + + /** + * @brief calloc the matrix element + * + */ + void calloc_element() + { + if ((this->h > 0) && (this->w > 0)) + { + this->array = (T **)calloc(this->h, sizeof(T *)); + for (int i = 0; i < this->h; i++) + { + this->array[i] = (T *)calloc(this->w, sizeof(T)); + } + } + else + { + this->array = NULL; + } + } + + /** + * @brief Set the matrix element to random number. + * + * @param thresh the max abs value of the element. + */ + void set_random(T thresh = 1) + { + unsigned int seed = esp_timer_get_time(); + srand(seed); + for (int i = 0; i < this->h; i++) + { + for (int j = 0; j < this->w; j++) + { + this->array[i][j] = ((T)rand()) / (T)(RAND_MAX)*thresh; + } + } + } + + /** + * @brief Set the small value to zero + * + * @param thresh the threshold of small value + */ + void set_zero(T thresh = 1e-8) + { + for (int i = 0; i < this->h; i++) + { + for (int j = 0; j < this->w; j++) + { + if (DL_ABS(this->array[i][j]) < thresh) + { + this->array[i][j] = 0; + } + } + } + } + + /** + * @brief Set the matrix value from a vector + * + * @tparam TT + * @param mat the input vector + */ + template + void set_value(std::vector mat) + { + int area = this->w * this->h; + assert(area == mat.size()); + int index = 0; + for (int i = 0; i < this->h; i++) + { + for (int j = 0; j < this->w; j++) + { + this->array[i][j] = (T)(mat[index++]); + } + } + } + + /** + * @brief Set the matrix value from another matrix. + * + * @tparam TT + * @param mat the input matrix. + */ + template + void set_value(const Matrix &mat) + { + assert((this->h == mat.h) && (this->w == mat.w)); + for (int i = 0; i < this->h; i++) + { + for (int j = 0; j < this->w; j++) + { + this->array[i][j] = (T)(mat.array[i][j]); + } + } + } + + /** + * @brief Set a part of the matrix value from another matrix. + * + * @param h_start the start index of height + * @param h_end the end index of height + * @param w_start the start index of width + * @param w_end the end index of width + * @param mat the input matrix + */ + void set_value(int h_start, int h_end, int w_start, int w_end, const Matrix &mat) + { + int h = h_end - h_start; + int w = w_end - w_start; + + assert((h == mat.h) && (w == mat.w)); + assert((h_end <= this->h) && (w_end <= this->w) && (h_start >= 0) && (w_start >= 0)); + for (int i = 0; i < h; i++) + { + for (int j = 0; j < w; j++) + { + this->array[i + h_start][j + w_start] = mat.array[i][j]; + } + } + } + + /** + * @brief Set the matrix value to a constant. + * + * @tparam TT + * @param s the input value. + */ + template + void set_value(TT s) + { + for (int i = 0; i < this->h; i++) + { + for (int j = 0; j < this->w; j++) + { + this->array[i][j] = (T)s; + } + } + } + + /** + * @brief print the matrix element. + * + */ + void print_value() const + { + printf("h: %d, w: %d\n", this->h, this->w); + for (int i = 0; i < this->h; i++) + { + for (int j = 0; j < this->w; j++) + { + printf("%f ", (float)(this->array[i][j])); + } + printf("\n"); + } + } + + /** + * @brief do matrix multiply + * + * @param input the input matrix + * @return Matrix the output matrix + */ + Matrix matmul(const Matrix &input) const; + + /** + * @brief transpose the matrix + * + * @return Matrix the transposed matrix + */ + Matrix transpose() const; + + /** + * @brief get the inverse matrix + * + * @return Matrix the output matrix + */ + Matrix inverse() const; + + /** + * @brief get the diagonal of the matrix + * + * @return Matrix the diagonal + */ + Matrix diagonal() const; + + /** + * @brief slice the matrix + * + * @param h_start the start index of height + * @param h_end the end index of height + * @param w_start the start index of width + * @param w_end the end index of width + * @return Matrix the output. + */ + Matrix slice(int h_start, int h_end, int w_start, int w_end) const; + + /** + * @brief get an identity matrix + * + * @param n the dim of the identity matrix + * @return Matrix the output + */ + static Matrix identity(int n) + { + Matrix A(n, n); + for (int i = 0; i < n; ++i) + { + A.array[i][i] = 1; + } + return A; + } + + /** + * @brief get a diag matrix + * + * @param d the diagonal value. + * @return Matrix the output + */ + static Matrix diag(const Matrix &d) + { + assert(d.h == 1); + Matrix A(d.w, d.w); + for (int i = 0; i < d.w; ++i) + { + A.array[i][i] = d.array[0][i]; + } + return A; + } + + + static Matrix arange(uint32_t n) + { + Matrix A(1, n); + for (int i = 0; i < n; ++i) + { + A.array[0][i] = i; + } + return A; + } + + static Matrix arange(uint32_t n1, uint32_t n2) + { + int len = n2 - n1; + assert(len > 0); + Matrix A(1, len); + for (int i = 0; i < len; ++i) + { + A.array[0][i] = n1 + i; + } + + return A; + } + + /** + * @brief get the F_norm of the matrix + * + * @return T the output F_norm + */ + T F_norm() const + { + T f_n = 0.0; + for (int i = 0; i < this->h; ++i) + { + for (int j = 0; j < this->w; ++j) + { + f_n += (this->array[i][j] * this->array[i][j]); + } + } + f_n = sqrt_newton(f_n); + return f_n; + } + + Matrix &operator=(const Matrix &A) + { + if ((A.h == this->h) && (A.w == this->w)) + { + for (int i = 0; i < A.h; ++i) + { + for (int j = 0; j < A.w; ++j) + { + this->array[i][j] = A.array[i][j]; + } + } + } + else + { + if (this->array != NULL) + { + for (int i = 0; i < this->h; ++i) + { + free(this->array[i]); + } + free(this->array); + this->array = NULL; + } + this->h = A.h; + this->w = A.w; + if ((A.h > 0) && (A.w > 0)) + { + this->calloc_element(); + this->set_value(A); + } + } + return *this; + } + }; + + /** + * @brief Get the affine transform matrix + * + * @param source_coord the source coordinates + * @param dest_coord the target coordinates + * @return Matrix the output matrix + */ + Matrix get_affine_transform(Matrix &source_coord, Matrix &dest_coord); + + /** + * @brief Get the similarity transform matrix + * + * @param source_coord the source coordinates + * @param dest_coord the target coordinates + * @return Matrix the output matrix + */ + Matrix get_similarity_transform(Matrix &source_coord, Matrix &dest_coord); + + /** + * @brief Get the perspective transform matrix + * + * @param source_coord the source coordinates + * @param dest_coord the target coordinates + * @return Matrix the output matrix + */ + Matrix get_perspective_transform(Matrix &source_coord, Matrix &dest_coord); + } // namespace math +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/cat_face_detect_mn03.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/cat_face_detect_mn03.hpp new file mode 100644 index 00000000000..6d952dc44ab --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/cat_face_detect_mn03.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include +#include "dl_detect_define.hpp" + +/** + * @brief Hardware Requirement. + * - flash 310kB + */ + +class CatFaceDetectMN03 +{ +private: + void *model; + +public: + /** + * @brief Construct a new Cat Face Detect MN03 object. + * + * @param score_threshold predicted boxes with score lower than the threshold will be filtered out + * @param nms_threshold predicted boxes with IoU higher than the threshold will be filtered out + * @param top_k first k highest score boxes will be remained + * @param resize_scale resize scale to implement on input image + */ + CatFaceDetectMN03(const float score_threshold, const float nms_threshold, const int top_k, const float resize_scale); + + /** + * @brief Destroy the Cat Face Detect MN03 object. + * + */ + ~CatFaceDetectMN03(); + + /** + * @brief Inference. + * + * @tparam T supports uint8_t and uint16_t + * - uint8_t: input image is RGB888 + * - uint16_t: input image is RGB565 + * @param input_element pointer of input image + * @param input_shape shape of input image + * @return detection result + */ + template + std::list &infer(T *input_element, std::vector input_shape); +}; diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/color_detector.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/color_detector.hpp new file mode 100644 index 00000000000..063ab20b34a --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/color_detector.hpp @@ -0,0 +1,68 @@ +#pragma once + +#include "dl_image.hpp" + +typedef struct +{ + int area; /*!< Area of connected domains >*/ + std::vector center; /**/ + std::vector box; /**/ +} components_stats_t; + +class ColorDetector +{ +private: + std::vector> results; /*!< detection results >*/ + +public: + std::vector> color_thresh; /*!< threshold of colors, The threshold of each color is composed of 6 numbers >*/ + std::vector area_thresh; /*!< the area threshold of each color, + the area that is smaller than the threshold is filtered >*/ + bool bgr; /*!< true: the input image is in BGR format + false: the input image is in RGB format >*/ + + /** + * @brief get the color threshold of rectangular region in the image + * + * @param image the input image + * @param box the coordinates of the rectanglar region : [left_up_x, left_up_y, right_down_x, right_down_y] + * @return std::vector the threshold. + */ + std::vector cal_color_thresh(dl::Tensor &image, std::vector box); + + /** + * @brief detect the colors based on the color thresholds + * + * @param image the input image. + * @return std::vector>& detection result. + */ + std::vector> &detect(dl::Tensor &image); + + /** + * @brief Construct a new Color Detector object + * + * @param color_thresh threshold of colors, The threshold of each color is composed of 6 numbers + * @param area_thresh the area threshold of each color,the area that is smaller than the threshold is filtered + * @param bgr true: the input image is in BGR format + * false: the input image is in RGB format + */ + ColorDetector(std::vector> color_thresh, std::vector area_thresh, bool bgr = false) : color_thresh(color_thresh), area_thresh(area_thresh), bgr(bgr) + { + } + + /** + * @brief Destroy the Color Detector object + * + */ + ~ColorDetector() {} + + /** + * @brief Get the results object + * + * @return std::vector>& the detection result. + */ + std::vector> &get_results() + { + return this->results; + } +}; \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_112_v1_s16.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_112_v1_s16.hpp new file mode 100644 index 00000000000..91f7747fe3f --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_112_v1_s16.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "dl_variable.hpp" +#include "face_recognition_tool.hpp" +#include "face_recognizer.hpp" +#include + +using namespace dl; + +/** + * @brief face recognition model v1 + * input size: 112 x 112 x 3 + * quantization mode: S16 + * + */ +class FaceRecognition112V1S16 : public FaceRecognizer +{ + public: + /** + * @brief Construct a new Face_Recognition_112_V1_S16 object + * + */ + FaceRecognition112V1S16(); + + /** + * @brief Destroy the Face_Recognition_112_V1_S16 object + * + */ + ~FaceRecognition112V1S16(); +}; \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_112_v1_s8.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_112_v1_s8.hpp new file mode 100644 index 00000000000..ba377713ca2 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_112_v1_s8.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "dl_variable.hpp" +#include "face_recognition_tool.hpp" +#include "face_recognizer.hpp" +#include + +using namespace dl; + +/** + * @brief face recognition model v1 + * input size: 112 x 112 x 3 + * quantization mode: S8 + * + */ +class FaceRecognition112V1S8 : public FaceRecognizer +{ + public: + /** + * @brief Construct a new Face_Recognition_112_V1_S8 object + * + */ + FaceRecognition112V1S8(); + + /** + * @brief Destroy the Face Recognition_112_V1_S8 object + * + */ + ~FaceRecognition112V1S8(); +}; \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_tool.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_tool.hpp new file mode 100644 index 00000000000..2226d32daf9 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognition_tool.hpp @@ -0,0 +1,162 @@ +#pragma once + +#include "dl_variable.hpp" +#include "dl_define.hpp" +#include "dl_tool.hpp" +#include "dl_math.hpp" +#include "dl_math_matrix.hpp" +#include +#include +#include +#include +#include + +/** + * @brief struct of face similarity + * + */ +typedef struct +{ + int id; + std::string name; + float similarity; +} face_info_t; + + +/** + * @brief Face ID + * + * @tparam feature_t + */ +template +class FaceID +{ +public: + int id; /**/ + dl::Tensor id_emb; /**/ + std::string name; /**/ + + /** + * @brief Construct a new Face ID object + * + * @param id id index + * @param id_emb id embedding + * @param name id name + */ + FaceID(int id, dl::Tensor &id_emb, std::string name = ""); + + /** + * @brief Destroy the Face ID object + * + */ + ~FaceID() {} + + /** + * @brief print the face id information + * + */ + void print(); +}; + +namespace face_recognition_tool +{ + /** + * @brief l2 normalize the feautre + * + * @param feature + */ + void l2_norm(dl::Tensor &feature); + + /** + * @brief calculate the cosine distance of the input ids + * + * @param id_1 id 1 + * @param id_2 id 2 + * @param normalized_ids true: the input ids have been normalized. + * false: the input ids have not been normlized + * @param type 0: cos dist: [-1, 1] + * 1: normalzied cos dist: [0, 1] + * @return float the cosine distance + */ + float cos_distance(dl::Tensor &id_1, dl::Tensor &id_2, bool normalized_ids = true, int8_t type = 0); + + /** + * @brief transform the image to the input of a mfn model + * + * @tparam T + * @param image the input image. + * @param free_input true: free the input image. + * false: do not free the input image. + * @param do_padding true: pad the result. + * false: do not pad the result. + * @return dl::Tensor* + */ + template + dl::Tensor *transform_mfn_input(dl::Tensor &image, bool free_input = false); + + /** + * @brief transform the image to the input of a mfn model + * + * @tparam T + * @param image the input image. + * @param output the preprocessed image. + * @param free_input true: free the input image. + * false: do not free the input image. + * @param do_padding true: pad the result. + * false: do not pad the result + */ + template + void transform_mfn_input(dl::Tensor &image, dl::Tensor &output, bool free_input = false); + + /** + * @brief transform the mfn output embedding to a floating embedding + * + * @tparam T + * @param input the input embedding. + * @param norm true: normalize the output embedding. + * false: do not normalize the output embedding. + * @param free_input true: free the input embedding. + * false: do not free the input embedding. + * @return dl::Tensor* + */ + template + dl::Tensor *transform_mfn_output(dl::Tensor &input, bool norm = true, bool free_input = false); + + /** + * @brief transform the mfn output embedding to a floating embedding + * + * @tparam T + * @param input the input embedding. + * @param output the output embedding. + * @param norm true: normalize the output embedding. + * false: do not normalize the output embedding. + * @param free_input true: free the input embedding. + * false: do not free the input embedding. + */ + template + void transform_mfn_output(dl::Tensor &input, dl::Tensor &output, bool norm = true, bool free_input = false); + + /** + * @brief get the aligned face. + * + * @tparam T + * @param input input tensor + * @param output the output aligned face. + * @param landmarks the landmarks of the face. + */ + template + void align_face(dl::Tensor *input, dl::Tensor *output, std::vector &landmarks); + + /** + * @brief get the aligned face. + * + * @tparam T + * @param input input image with rgb565 format. + * @param shape the shape of the input image. + * @param output the output aligned face. + * @param landmarks the landmarks of the face. + */ + template + void align_face(uint16_t *input, std::vector shape, dl::Tensor *output, std::vector &landmarks); + +} // namespace face_recognition_tool diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognizer.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognizer.hpp new file mode 100644 index 00000000000..864881c984a --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/face_recognizer.hpp @@ -0,0 +1,220 @@ +#pragma once + +#include "dl_variable.hpp" +#include "face_recognition_tool.hpp" +#include + +using namespace dl; + +/** + * @brief + * + * @tparam feature_t + */ +template +class FaceRecognizer +{ + public: + /** + * @brief Construct a new Face Recognizer object + * + */ + FaceRecognizer(); + + /** + * @brief Destroy the Face Recognizer object + * + */ + virtual ~FaceRecognizer(); + + void *model; + + /** + * @brief Set the face recognition threshold [-1, 1], default thresh: 0.55 + * Note: If the similarity of two faces is greater than the threshold, they will be judged as the same person + * + * @param thresh + */ + void set_thresh(float thresh); + + /** + * @brief Get the current threshold of recognizer. + * + * @return float current threshold. + */ + float get_thresh(); + + /** + * @brief Get the input shape of the recognizer. + * + * @return std::vector the input shape of the recognizer. + */ + std::vector get_input_shape(); + + /** + * @brief do forward + * + * @param model_input the input data of the face recognition model. + * Note: the input data should have been preprocessed. + * @return Tensor& the output of the face recognition model. + */ + Tensor &forward(Tensor &model_input); + + /** + * @brief recognize face + * + * @param image_input the pointer of the input image with format bgr565. + * @param shape the shape of the input image + * @param landmarks face landmarks coordinates + * @return face_info_t the recognition result. + */ + face_info_t recognize(uint16_t *image_input, std::vector shape, std::vector &landmarks); + + /** + * @brief recognize face + * + * @param image_input the pointer of the input image with format bgr565. + * @param shape the shape of the input image + * @param aligned_face the Tensor to store the intermeidate aligned face. + * @param landmarks face landmarks coordinates + * @return face_info_t the recognition result. + */ + face_info_t recognize(uint16_t *image_input, std::vector shape, Tensor &aligned_face, std::vector &landmarks); + + /** + * @brief recognize face + * + * @param image_input the Tensor of input image with format bgr888. + * @param landmarks face landmarks coordinates + * @return face_info_t the recognition result. + */ + face_info_t recognize(Tensor &image_input, std::vector &landmarks); + + /** + * @brief recognize face + * + * @param image_input the Tensor of input image with format bgr888. + * @param aligned_face the Tensor to store the intermeidate aligned face. + * @param landmarks face landmarks coordinates + * @return face_info_t the recognition result. + */ + face_info_t recognize(Tensor &image_input, Tensor &aligned_face, std::vector &landmarks); + + /** + * @brief recognize face + * + * @param aligned_face the Tensor of the input aligned face with format bgr888. + * @return face_info_t the recognition result. + */ + face_info_t recognize(Tensor &aligned_face); + + /** + * @brief recognize the face embedding. + * + * @param emb the normalized face embbeding. + * @return face_info_t the recognition result. + */ + face_info_t recognize(Tensor &emb); + + /** + * @brief Get the index of the enrolled ids + * + * @return std::vector a vector of face ids index + */ + std::vector get_enrolled_ids(); + + /** + * @brief Get the face embedding + * + * @param id the face id index + * @return Tensor the face embedding of the face id index. + * if there is no matched id return the embedding of last input image. + */ + Tensor &get_face_emb(int id=-1); + + /** + * @brief Get the number of enrolled id + * + * @return int the number of enrolled id + */ + int get_enrolled_id_num(); + + /** + * @brief enroll face id + * + * @param image_input the pointer of the input image with format bgr565. + * @param shape the shape of the input image + * @param landmarks face landmarks coordinates + * @param name name of the face id. + * @return int the face id index of the enrolled embedding. + */ + int enroll_id(uint16_t *image_input, std::vector shape, std::vector &landmarks, std::string name=""); + + /** + * @brief enroll face id + * + * @param image_input the pointer of the input image with format bgr565. + * @param shape the shape of the input image + * @param aligned_face the Tensor to store the intermeidate aligned face. + * @param landmarks face landmarks coordinates + * @param name name of the face id. + * @return int the face id index of the enrolled embedding. + */ + int enroll_id(uint16_t *image_input, std::vector shape, Tensor &aligned_face, std::vector &landmarks, std::string name=""); + + /** + * @brief enroll face id + * + * @param image_input the Tensor of input image with format bgr888. + * @param landmarks face landmarks coordinates + * @param name name of the face id. + * @return int the face id index of the enrolled embedding. + */ + int enroll_id(Tensor &image_input, std::vector &landmarks, std::string name=""); + + /** + * @brief enroll face id + * + * @param image_input the Tensor of input image with format bgr888. + * @param aligned_face the Tensor to store the intermeidate aligned face. + * @param landmarks face landmarks coordinates + * @param name name of the face id. + * @return int the face id index of the enrolled embedding. + */ + int enroll_id(Tensor &image_input, Tensor &aligned_face, std::vector &landmarks, std::string name=""); + + /** + * @brief enroll face id + * + * @param aligned_face the Tensor of the input aligned face with format bgr888. + * @param name name of the face id. + * @return int the face id index of the enrolled embedding. + */ + int enroll_id(Tensor &aligned_face, std::string name=""); + + /** + * @brief enroll the normalzied face embedding. + * + * @param emb the normalized face embbeding. + * @param name name of the face id. + * @return int the face id index of the enrolled embedding. + */ + int enroll_id(Tensor &emb, std::string name=""); + + /** + * @brief delete the last enrolled face id. + * + * @return int the number of remained face ids. + * if the face ids list is empty, return -1 + */ + int delete_id(); + + /** + * @brief delete the face id with id index. + * + * @param id face id index. + * @return int the number of remained face ids. + * if there is no matched id return -1 + */ + int delete_id(int id); +}; \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/human_face_detect_mnp01.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/human_face_detect_mnp01.hpp new file mode 100644 index 00000000000..62a25f0350c --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/human_face_detect_mnp01.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include "dl_detect_define.hpp" + +class HumanFaceDetectMNP01 +{ +private: + void *model; + +public: + /** + * @brief Construct a new Human Face Detect MNP01 object. + * + * @param score_threshold predicted boxes with score lower than the threshold will be filtered out + * @param nms_threshold predicted boxes with IoU higher than the threshold will be filtered out + * @param top_k first k highest score boxes will be remained + */ + HumanFaceDetectMNP01(const float score_threshold, const float nms_threshold, const int top_k); + + /** + * @brief Destroy the Human Face Detect MNP01 object. + * + */ + ~HumanFaceDetectMNP01(); + + /** + * @brief Inference. + * + * @tparam T supports uint16_t and uint8_t, + * - uint16_t: input image is RGB565 + * - uint8_t: input image is RGB888 + * @param input_element pointer of input image + * @param input_shape shape of input image + * @param candidates candidate boxes on input image + * @return detection result + */ + template + std::list &infer(T *input_element, std::vector input_shape, std::list &candidates); +}; diff --git a/tools/sdk/esp32c3/include/esp-face/include/model_zoo/human_face_detect_msr01.hpp b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/human_face_detect_msr01.hpp new file mode 100644 index 00000000000..94ba6ac909a --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/model_zoo/human_face_detect_msr01.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include "dl_detect_define.hpp" + +class HumanFaceDetectMSR01 +{ +private: + void *model; + +public: + /** + * @brief Construct a new Human Face Detect MSR01 object + * + * @param score_threshold predicted boxes with score lower than the threshold will be filtered out + * @param nms_threshold predicted boxes with IoU higher than the threshold will be filtered out + * @param top_k first k highest score boxes will be remained + * @param resize_scale resize scale to implement on input image + */ + HumanFaceDetectMSR01(const float score_threshold, const float nms_threshold, const int top_k, float resize_scale); + + /** + * @brief Destroy the Human Face Detect MSR01 object + */ + ~HumanFaceDetectMSR01(); + + /** + * @brief Inference. + * + * @tparam T supports uint8_t and uint16_t + * - uint8_t: input image is RGB888 + * - uint16_t: input image is RGB565 + * @param input_element pointer of input image + * @param input_shape shape of input image + * @return detection result + */ + template + std::list &infer(T *input_element, std::vector input_shape); +}; diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn.hpp new file mode 100644 index 00000000000..6c737c1d341 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn.hpp @@ -0,0 +1,61 @@ +#pragma once +#include +#include "dl_define.hpp" +#include "dl_tool.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief Get the output shape object + * + * @param input_shape input shape + * @param filter_shape filter shape with dilation + * @param stride_y stride in height + * @param stride_x stride in width + * @param pad_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN + * @param is_conv2d one of true or false, + * - true: serve for Conv2D + * - false: serve for other operations + * @return std::vector + */ + std::vector get_output_shape(const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t pad_type, const bool is_conv2d = false, std::vector padding = {}); + + /** + * @brief Get the pad size object + * + * @param output_shape output shape + * @param input_shape input shape + * @param filter_shape filter shape with dilation + * @param stride_y stride in height + * @param stride_x stride in width + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN + * @return padding size + */ + std::vector get_pad_size(const std::vector &output_shape, const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t padding_type); + } // namespace nn +} // namespace dl + +#if DL_LOG_NN_LATENCY +/** + * @brief Initialize. + */ +#define DL_LOG_NN_LATENCY_INIT() dl::tool::Latency latency + +/** + * @brief Time starts. + */ +#define DL_LOG_NN_LATENCY_START() latency.start() + +/** + * @brief Time ends and printed. + */ +#define DL_LOG_NN_LATENCY_END(key) \ + latency.end(); \ + latency.print("nn", key) +#else +#define DL_LOG_NN_LATENCY_INIT() +#define DL_LOG_NN_LATENCY_START() +#define DL_LOG_NN_LATENCY_END(key) +#endif diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_add2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_add2d.hpp new file mode 100644 index 00000000000..4d4daaaef05 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_add2d.hpp @@ -0,0 +1,91 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activation(add2d(input0, input1)). + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of add2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @param output_exponent exponent of output, only and must specify if inplace operation happens + */ + void add2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); + + /** + * @brief activation(add2d(input0, input1)). + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of add2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @param output_exponent exponent of output, only and must specify if inplace operation happens + */ + void add2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, const int output_exponent = INT_MIN); + + /** + * @brief activation(add2d(input0, input1)) + * + * @tparam inplace: whether directly store the output to input0 + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of add2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @param inplace whether directly store the output to input0 + * @return add2d result or no return(result store to input0) + */ + template + auto add2d(const int output_exponent, + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + assert(input0.is_same_shape(input1)); + + DL_LOG_NN_LATENCY_INIT(); + + Tensor output; + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + add2d(output, input0, input1, activation, assign_core); + DL_LOG_NN_LATENCY_END("add2d"); + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + add2d(input0, input0, input1, activation, assign_core, output_exponent); + input0.set_exponent(output_exponent); + DL_LOG_NN_LATENCY_END("add2d"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp new file mode 100644 index 00000000000..6e7db6ed0e0 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp @@ -0,0 +1,102 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" +#include + +namespace dl +{ + namespace nn + { + /** + * @brief avg_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter_shape filter_shape in [filter_height, filter_width] + * @param stride_y stride in height + * @param stride_x stride in width + * @param assign_core not effective yet + */ + void avg_pool2d(Tensor &output, + Tensor &input, + std::vector &padding, + std::vector &filter_shape, + const int stride_y, + const int stride_x, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief avg_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter_shape filter_shape in [filter_height, filter_width] + * @param stride_y stride in height + * @param stride_x stride in width + * @param assign_core not effective yet + */ + void avg_pool2d(Tensor &output, + Tensor &input, + std::vector &padding, + std::vector &filter_shape, + const int stride_y, + const int stride_x, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief avg_pool2d(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input as an input + * @param filter_shape filter_shape in [filter_height, filter_width] + * @param stride_y stride in height + * @param stride_x stride in width + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, + * - PADDING_VALID: no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * @param assign_core not effective yet + * @return avg_pool2d result + */ + template + Tensor avg_pool2d(const int output_exponent, + Tensor &input, + std::vector filter_shape, + const int stride_y, + const int stride_x, + const padding_type_t padding_type, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + std::vector output_shape = get_output_shape(input.shape, filter_shape, stride_y, stride_x, padding_type); + Tensor output; + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); + + DL_LOG_NN_LATENCY_START(); + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) + { + padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); + } + DL_LOG_NN_LATENCY_END("padding"); + + DL_LOG_NN_LATENCY_START(); + avg_pool2d(output, input, padding, filter_shape, stride_y, stride_x, assign_core); + DL_LOG_NN_LATENCY_END("avg_pool2d"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_concat.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_concat.hpp new file mode 100644 index 00000000000..73ed1aae905 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_concat.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + template + void concat(Tensor &output, std::vector *> &inputs, int axis, bool free_inputs = false); + + template + Tensor concat(std::vector *> &inputs, int axis, bool free_inputs = false) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + assert(inputs.size() > 1); + int shape_size = inputs[0]->shape.size(); + + if (axis < 0) + { + axis = shape_size + axis; + } + + assert((axis < shape_size) && (axis > -1)); + + int output_shape_axis = inputs[0]->shape[axis]; + + for (int i = 1; i < inputs.size(); i++) + { + assert(shape_size == inputs[i]->shape.size()); + assert(inputs[i]->exponent == inputs[i - 1]->exponent); + output_shape_axis += inputs[i]->shape[axis]; + + for (int j = 0; j < shape_size; j++) + { + if (j != axis) + { + assert(inputs[i]->shape[j] == inputs[i - 1]->shape[j]); + } + } + } + DL_LOG_NN_LATENCY_END("assert"); + + DL_LOG_NN_LATENCY_START(); + Tensor output; + std::vector output_shape = inputs[0]->shape; + output_shape[axis] = output_shape_axis; + output.set_shape(output_shape); + output.set_exponent(inputs[0]->exponent); + output.malloc_element(); + DL_LOG_NN_LATENCY_END("malloc"); + + DL_LOG_NN_LATENCY_START(); + concat(output, inputs, axis, free_inputs); + DL_LOG_NN_LATENCY_END("concat"); + return output; + } + } // namespace nn +} // namespace dl diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_concat2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_concat2d.hpp new file mode 100644 index 00000000000..adcae1e7a7d --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_concat2d.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include +#include "dl_variable.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief concat2d(input_1, input_2, ...) + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output as an output + * @param inputs a bundle of inputs to be concatenated + */ + template + void concat2d(Tensor &output, std::vector> inputs); + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_conv2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_conv2d.hpp new file mode 100644 index 00000000000..27ba0372730 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_conv2d.hpp @@ -0,0 +1,136 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activation(conv2d(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter filter of conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of conv2d, if you don't specify anything, no bias is added + * @param activation activation of conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(conv2d(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter filter of conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of conv2d, if you don't specify anything, no bias is added + * @param activation activation of conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(conv2d(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter filter of conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of conv2d, if you don't specify anything, no bias is added + * @param activation activation of conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(conv2d(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input as an input + * @param filter Filter of conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, + * - PADDING_VALID: no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * @param bias bias of conv2d, if you don't specify anything, no bias is added + * @param activation activation of conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @return conv2d result + */ + template + Tensor conv2d(const int output_exponent, + Tensor &input, + const Filter &filter, + const int stride_y, + const int stride_x, + const padding_type_t padding_type, + const Bias *bias, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + std::vector output_shape = get_output_shape(input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type, true); + Tensor output; + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + std::vector padding(4, 0); + DL_LOG_NN_LATENCY_START(); + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) + { + padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); + } + DL_LOG_NN_LATENCY_END("padding"); + + DL_LOG_NN_LATENCY_START(); + conv2d(output, input, padding, filter, stride_y, stride_x, bias, activation, assign_core); + DL_LOG_NN_LATENCY_END("conv2d"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp new file mode 100644 index 00000000000..135815a65cb --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp @@ -0,0 +1,137 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activate(depthwise_conv2d(input, filter) + bias) + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter Filter of depthwise_conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added + * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void depthwise_conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *bias = NULL, + const Activation *activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activate(depthwise_conv2d(input, filter) + bias) + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter filter of depthwise_conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added + * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void depthwise_conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *bias = NULL, + const Activation *activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activate(depthwise_conv2d(input, filter) + bias) + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter Filter of depthwise_conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added + * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void depthwise_conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *bias = NULL, + const Activation *activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(depthwise_conv2d(input, filter) + bias) + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input as an input + * @param filter filter of depthwise_conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param pad_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, + * - PADDING_VALID means no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added + * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @return depthwise_conv2d result + */ + template + Tensor depthwise_conv2d(const int output_exponent, + Tensor &input, + const Filter &filter, + const int stride_y, + const int stride_x, + const padding_type_t padding_type, + const Bias *bias, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + std::vector output_shape = get_output_shape(input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); + Tensor output; + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + std::vector padding(4, 0); + + DL_LOG_NN_LATENCY_START(); + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) + { + padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); + } + DL_LOG_NN_LATENCY_END("padding"); + + DL_LOG_NN_LATENCY_START(); + depthwise_conv2d(output, input, padding, filter, stride_y, stride_x, bias, activation, assign_core); + DL_LOG_NN_LATENCY_END("depthwise_conv2d"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_fully_connected.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_fully_connected.hpp new file mode 100644 index 00000000000..372c84825fd --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_fully_connected.hpp @@ -0,0 +1,126 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input as an input + * @param filter Filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + * @return FullyConnected result + */ + template + Tensor fully_connected(const int output_exponent, + Tensor &input, + const Filter &filter, + const Bias *bias, + const Activation *activation, + const bool flatten, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + assert(filter.shape.size() == 4); + assert(filter.shape[0] == 1); + assert(filter.shape[1] == 1); + + std::vector output_shape; + if (flatten) + { + assert(input.get_size() == filter.shape[2]); + output_shape = {filter.shape.back()}; + } + else + { + assert(input.shape.back() == filter->shape[2]); + output_shape = input.shape; + output_shape[output_shape.size() - 1] = filter.shape.back(); + } + Tensor output; + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + fully_connected(output, input, filter, bias, activation, flatten, assign_core); + DL_LOG_NN_LATENCY_END("fully_connected"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp new file mode 100644 index 00000000000..724d3ca0952 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" +#include + +namespace dl +{ + namespace nn + { + /** + * @brief global_avg_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param assign_core not effective yet + */ + void global_avg_pool2d(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief global_avg_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param assign_core not effective yet + */ + void global_avg_pool2d(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief global_avg_pool2d(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input as an input + * @param assign_core not effective yet + * @return global_avg_pool2d result + */ + template + Tensor global_avg_pool2d(const int output_exponent, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + std::vector output_shape(input.shape.size(), 1); + output_shape[2] = input.shape[2]; + Tensor output; + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + global_avg_pool2d(output, input, assign_core); + DL_LOG_NN_LATENCY_END("global_avg_pool2d"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp new file mode 100644 index 00000000000..f6f15e91bd3 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp @@ -0,0 +1,64 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" +#include + +namespace dl +{ + namespace nn + { + /** + * @brief global_max_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param assign_core not effective yet + */ + void global_max_pool2d(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief global_max_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param assign_core not effective yet + */ + void global_max_pool2d(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief global_max_pool2d(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param input as an input + * @param assign_core not effective yet + * @return global_max_pool2d result + */ + template + Tensor global_max_pool2d(Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + std::vector output_shape(input.shape.size(), 1); + output_shape[2] = input.shape[2]; + Tensor output; + output.set_exponent(input.exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + global_max_pool2d(output, input, assign_core); + DL_LOG_NN_LATENCY_END("global_max_pool2d"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_leakyrelu.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_leakyrelu.hpp new file mode 100644 index 00000000000..c41728b1ad5 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_leakyrelu.hpp @@ -0,0 +1,82 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief leakyrelu(input). + * + * @param output as an output + * @param input as an input + * @param activation_alpha quantized alpha + * @param activation_exponent exponent of quantized alpha + * @param assign_core not effective yet + */ + void leakyrelu(Tensor &output, + Tensor &input, + const int16_t activation_alpha, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief leakyrelu(input). + * + * @param output as an output + * @param input as an input + * @param activation_alpha quantized alpha + * @param activation_exponent exponent of quantized alpha + * @param assign_core not effective yet + */ + void leakyrelu(Tensor &output, + Tensor &input, + const int8_t activation_alpha, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief leakyrelu(input) + * + * @tparam inplace: whether directly store the output to input + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param input as an input + * @param activation_alpha quantized alpha + * @param activation_exponent exponent of quantized alpha + * @param assign_core not effective yet + * @return leakyrelu result or no return(result store to input) + */ + template + auto leakyrelu(Tensor &input, + const int activation_alpha, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + DL_LOG_NN_LATENCY_INIT(); + Tensor output; + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + leakyrelu(output, input, activation_alpha, activation_exponent, assign_core); + DL_LOG_NN_LATENCY_END("leakyrelu"); + + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + leakyrelu(input, input, activation_alpha, activation_exponent, assign_core); + DL_LOG_NN_LATENCY_END("leakyrelu"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_max2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_max2d.hpp new file mode 100644 index 00000000000..466089bc386 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_max2d.hpp @@ -0,0 +1,81 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief max2d(input0, input1) + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + */ + void max2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief max2d(input0, input1) + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @param output_exponent exponent of output, only and must specify if inplace operation happens + */ + void max2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief max2d(input0, input1) + * + * @tparam inplace: whether directly store the output to input0 + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @return max2d result or no return(result store to input0) + */ + template + auto max2d(Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + assert(input0.is_same_shape(input1)); + assert(input0.exponent == input1.exponent); + + DL_LOG_NN_LATENCY_INIT(); + Tensor output; + + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(input0.exponent).set_shape(input0.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + max2d(output, input0, input1, assign_core); + DL_LOG_NN_LATENCY_END("max2d"); + + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + max2d(input0, input0, input1, assign_core); + DL_LOG_NN_LATENCY_END("max2d"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_max_pool2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_max_pool2d.hpp new file mode 100644 index 00000000000..50d51728ce0 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_max_pool2d.hpp @@ -0,0 +1,101 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" +#include + +namespace dl +{ + namespace nn + { + /** + * @brief max_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter_shape filter shape in [filter_height, filter_width] + * @param stride_y stride in height + * @param stride_x stride in width + * @param assign_core not effective yet + */ + void max_pool2d(Tensor &output, + Tensor &input, + std::vector &padding, + std::vector &filter_shape, + const int stride_y, + const int stride_x, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief max_pool2d(input). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter_shape filter shape in [filter_height, filter_width] + * @param stride_y stride in height + * @param stride_x stride in width + * @param assign_core not effective yet + */ + void max_pool2d(Tensor &output, + Tensor &input, + std::vector &padding, + std::vector &filter_shape, + const int stride_y, + const int stride_x, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief max_pool2d(input). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param input as an input + * @param filter_shape filter shape in [filter_height, filter_width] + * @param stride_y stride in height + * @param stride_x stride in width + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, + * - PADDING_VALID: no padding + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * @param assign_core not effective yet + * @return max_pool2d result + */ + template + Tensor max_pool2d(Tensor &input, + std::vector filter_shape, + const int stride_y, + const int stride_x, + const padding_type_t padding_type, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + std::vector output_shape = get_output_shape(input.shape, filter_shape, stride_y, stride_x, padding_type); + Tensor output; + output.set_exponent(input.exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + std::vector padding(4, 0); + + DL_LOG_NN_LATENCY_START(); + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) + { + padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); + } + DL_LOG_NN_LATENCY_END("padding"); + + DL_LOG_NN_LATENCY_START(); + max_pool2d(output, input, padding, filter_shape, stride_y, stride_x, assign_core); + DL_LOG_NN_LATENCY_END("max_pool2d"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_min2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_min2d.hpp new file mode 100644 index 00000000000..8faddf3c228 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_min2d.hpp @@ -0,0 +1,80 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief min2d(input0, input1) + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param assign_core + */ + void min2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief min2d(input0, input1) + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param assign_core + */ + void min2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief min2d(input0, input1) + * + * @tparam inplace: whether directly store the output to input0 + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param input0 as one input + * @param input1 as another input + * @param assign_core not effective yet + * @return min2d result or no return(result store to input0) + */ + template + auto min2d(Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + assert(input0.is_same_shape(input1)); + assert(input0.exponent == input1.exponent); + + DL_LOG_NN_LATENCY_INIT(); + Tensor output; + + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(input0.exponent).set_shape(input0.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + min2d(output, input0, input1, assign_core); + DL_LOG_NN_LATENCY_END("min2d"); + + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + min2d(input0, input0, input1, assign_core); + DL_LOG_NN_LATENCY_END("min2d"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_mul2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_mul2d.hpp new file mode 100644 index 00000000000..909619a8767 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_mul2d.hpp @@ -0,0 +1,91 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activation(mul2d(input0, input1)). + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of mul2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @param output_exponent exponent of output, only and must specify if inplace operation happens + */ + void mul2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); + + /** + * @brief activation(mul2d(input0, input1)). + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of mul2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @param output_exponent exponent of output, only and must specify if inplace operation happens + */ + void mul2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); + + /** + * @brief activation(mul2d(input0, input1)). + * + * @tparam inplace: whether directly store the output to input0 + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of mul2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @return mul2d result or no return(result store to input0) + */ + template + auto mul2d(const int output_exponent, + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + assert(input0.is_same_shape(input1)); + + DL_LOG_NN_LATENCY_INIT(); + Tensor output; + + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + mul2d(output, input0, input1, activation, assign_core); + DL_LOG_NN_LATENCY_END("mul2d"); + + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + mul2d(input0, input0, input1, activation, assign_core, output_exponent); + DL_LOG_NN_LATENCY_END("mul2d"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_prelu.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_prelu.hpp new file mode 100644 index 00000000000..e83e8975604 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_prelu.hpp @@ -0,0 +1,82 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief prelu(input). + * + * @param output as an output + * @param input as an input + * @param activation_element quantized alpha elements along channel axis + * @param activation_exponent exponent of quantized alpha elements + * @param assign_core not effective yet + */ + void prelu(Tensor &output, + Tensor &input, + const int16_t *activation_element, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief prelu(input). + * + * @param output as an output + * @param input as an input + * @param activation_element quantized alpha elements along channel axis + * @param activation_exponent exponent of quantized alpha elements + * @param assign_core not effective yet + */ + void prelu(Tensor &output, + Tensor &input, + const int8_t *activation_element, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief prelu(input) + * + * @tparam inplace: whether directly store the output to input + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param input as an input + * @param activation_element quantized alpha elements along channel axis + * @param activation_exponent exponent of quantized alpha elements + * @param assign_core not effective yet + * @return prelu result or no return(result store to input) + */ + template + auto prelu(Tensor &input, + const feature_t *activation_element, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + DL_LOG_NN_LATENCY_INIT(); + Tensor output; + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + prelu(output, input, activation_element, activation_exponent, assign_core); + DL_LOG_NN_LATENCY_END("prelu"); + + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + prelu(input, input, activation_element, activation_exponent, assign_core); + DL_LOG_NN_LATENCY_END("prelu"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_relu.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_relu.hpp new file mode 100644 index 00000000000..308492dfe4b --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_relu.hpp @@ -0,0 +1,70 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief relu(input). + * + * @param output as an output + * @param input as an input + * @param assign_core not effective yet + */ + void relu(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief relu(input). + * + * @param output as an output + * @param input as an input + * @param assign_core not effective yet + */ + void relu(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief relu(input) + * + * @tparam inplace: whether directly store the output to input + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param input as an input + * @param assign_core not effective yet + * @return relu result or no return(result store to input) + */ + template + auto relu(Tensor &input, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + DL_LOG_NN_LATENCY_INIT(); + Tensor output; + + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + relu(output, input, assign_core); + DL_LOG_NN_LATENCY_END("relu"); + + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + relu(input, input, assign_core); + DL_LOG_NN_LATENCY_END("relu"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_sub2d.hpp b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_sub2d.hpp new file mode 100644 index 00000000000..5bbd4940b10 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/nn/dl_nn_sub2d.hpp @@ -0,0 +1,90 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activation(sub2d(input0, input1)). + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of sub2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @param output_exponent exponent of output, only and must specify if inplace operation happens + */ + void sub2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); + + /** + * @brief activation(sub2d(input0, input1)). + * + * @param output as an output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of sub2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @param output_exponent exponent of output, only and must specify if inplace operation happens + */ + void sub2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); + + /** + * @brief activation(sub2d(input0, input1)). + * + * @tparam inplace: whether directly store the output to input0 + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input0 as one input + * @param input1 as another input + * @param activation activation of sub2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + * @return sub2d result or no return(result store to input0) + */ + template + auto sub2d(const int output_exponent, + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + { + assert(input0.is_same_shape(input1)); + + DL_LOG_NN_LATENCY_INIT(); + Tensor output; + if constexpr (!inplace) + { + DL_LOG_NN_LATENCY_START(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + sub2d(output, input0, input1, activation, assign_core); + DL_LOG_NN_LATENCY_END("sub2d"); + + return output; + } + else + { + DL_LOG_NN_LATENCY_START(); + sub2d(input0, input0, input1, activation, assign_core, output_exponent); + DL_LOG_NN_LATENCY_END("sub2d"); + } + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/tool/dl_tool.hpp b/tools/sdk/esp32c3/include/esp-face/include/tool/dl_tool.hpp new file mode 100644 index 00000000000..e5490e073d1 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/tool/dl_tool.hpp @@ -0,0 +1,427 @@ +#pragma once + +#include +#include +#include +#include + +#include "esp_system.h" +#include "esp_timer.h" +#include "freertos/FreeRTOS.h" + +#include "dl_define.hpp" + +extern "C" +{ +#if CONFIG_TIE728_BOOST + void dl_tie728_memset_8b(void *ptr, const int value, const int n); + void dl_tie728_memset_16b(void *ptr, const int value, const int n); + void dl_tie728_memset_32b(void *ptr, const int value, const int n); +#endif +} + +namespace dl +{ + namespace tool + { + /** + * @brief Set memory zero. + * + * @param ptr pointer of memory + * @param n byte number + */ + void set_zero(void *ptr, const int n); + + /** + * @brief Set array value. + * + * @tparam T supports all data type, sizeof(T) equals to 1, 2 and 4 will boost by instruction + * @param ptr pointer of array + * @param value value to set + * @param len length of array + */ + template + void set_value(T *ptr, const T value, const int len) + { +#if CONFIG_TIE728_BOOST + int *temp = (int *)&value; + if (sizeof(T) == 1) + dl_tie728_memset_8b(ptr, *temp, len); + else if (sizeof(T) == 2) + dl_tie728_memset_16b(ptr, *temp, len); + else if (sizeof(T) == 4) + dl_tie728_memset_32b(ptr, *temp, len); + else +#endif + for (size_t i = 0; i < len; i++) + ptr[i] = value; + } + + /** + * @brief Copy memory. + * + * @param dst pointer of destination + * @param src pointer of source + * @param n byte number + */ + void copy_memory(void *dst, void *src, const int n); + + /** + * @brief Apply memory without initialized. Can use free_aligned() to free the memory. + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *malloc_aligned(int number, int size, int align = 4) + { + assert((align > 0) && (((align & (align-1)) == 0))); + int total_size = number * size; + + void *res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); +#if DL_SPIRAM_SUPPORT + if (NULL == res) + res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_SPIRAM); +#endif + if (NULL == res) + { + printf("Fail to malloc %d bytes from DRAM(%d bytyes) and PSRAM(%d bytes), PSRAM is %s.\n", + total_size, + heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL), + heap_caps_get_free_size(MALLOC_CAP_SPIRAM), + DL_SPIRAM_SUPPORT ? "on" : "off"); + return NULL; + } + + return (void *)res; + } + + /** + * @brief Apply memory with zero-initialized. Can use free_aligned() to free the memory. + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *calloc_aligned(int number, int size, int align = 4) + { + + void *aligned = malloc_aligned(number, size, align); + set_zero(aligned, number * size); + + return (void *)aligned; + } + + /** + * @brief Free the calloc_aligned() and malloc_aligned() memory + * + * @param address pointer of memory to free + */ + inline void free_aligned(void *address) + { + if (NULL == address) + return; + + heap_caps_free(address); + } + + /** + * @brief Apply memory without initialized in preference order: internal aligned, internal, external aligned + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *malloc_aligned_prefer(int number, int size, int align = 4) + { + assert((align > 0) && (((align & (align-1)) == 0))); + int total_size = number * size; + void *res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); + if (NULL == res){ + res = heap_caps_malloc(total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); + } +#if DL_SPIRAM_SUPPORT + if (NULL == res){ + res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_SPIRAM); + } +#endif + if (NULL == res) + { + printf("Fail to malloc %d bytes from DRAM(%d bytyes) and PSRAM(%d bytes), PSRAM is %s.\n", + total_size, + heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL), + heap_caps_get_free_size(MALLOC_CAP_SPIRAM), + DL_SPIRAM_SUPPORT ? "on" : "off"); + return NULL; + } + + return res; + } + + /** + * @brief Apply memory with zero-initialized in preference order: internal aligned, internal, external aligned + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *calloc_aligned_prefer(int number, int size, int align = 4) + { + void *res = malloc_aligned_prefer(number, size, align); + set_zero(res, number * size); + + return (void *)res; + } + + /** + * @brief Free the calloc_aligned_prefer() and malloc_aligned_prefer() memory + * + * @param address pointer of memory to free + */ + inline void free_aligned_prefer(void *address) + { + if (NULL == address) + return; + + heap_caps_free(address); + } + + /** + * @brief Truncate the input into int8_t range. + * + * @tparam T supports all integer types + * @param output as an output + * @param input as an input + */ + template + void truncate(int8_t &output, T input) + { + if (input >= DL_Q8_MAX) + output = DL_Q8_MAX; + else if (input <= DL_Q8_MIN) + output = DL_Q8_MIN; + else + output = input; + } + + /** + * @brief Truncate the input into int16_t range. + * + * @tparam T supports all integer types + * @param output as an output + * @param input as an input + */ + template + void truncate(int16_t &output, T input) + { + if (input >= DL_Q16_MAX) + output = DL_Q16_MAX; + else if (input <= DL_Q16_MIN) + output = DL_Q16_MIN; + else + output = input; + } + + /** + * @brief Calculate the exponent of quantizing 1/n into max_value range. + * + * @param n 1/n: value to be quantized + * @param max_value the max_range + */ + inline int calculate_exponent(int n, int max_value) + { + int exp = 0; + int tmp = 1 / n; + while (tmp < max_value) + { + exp += 1; + tmp = (1 << exp) / n; + } + exp -= 1; + + return exp; + } + + /** + * @brief Print vector in format "[x1, x2, ...]\n". + * + * @param array to print + */ + inline void print_vector(std::vector &array, const char *message = NULL) + { + if (message) + printf("%s: ", message); + + printf("["); + for (int i = 0; i < array.size(); i++) + { + printf(", %d" + (i ? 0 : 2), array[i]); + } + printf("]\n"); + } + + /** + * @brief Get the cycle object + * + * @return cycle count + */ + inline uint32_t get_cycle() + { + uint32_t ccount; + __asm__ __volatile__("rsr %0, ccount" + : "=a"(ccount) + : + : "memory"); + return ccount; + } + + class Latency + { + private: + const uint32_t size; /**/ + + public: + /** + * @brief Construct a new Latency object. + * + * @param size + */ + Latency(const uint32_t size = 1) : size(size), + period(0), + sum(0), + count(0), + next(0) + { + this->queue = (this->size > 1) ? (uint32_t *)calloc(this->size, sizeof(uint32_t)) : NULL; + } + + /** + * @brief Destroy the Latency object. + * + */ + ~Latency() + { + if (this->queue) + free(this->queue); + } + + /** + * @brief Record the start timestamp. + * + */ + void start() + { +#if DL_LOG_LATENCY_UNIT + this->timestamp = get_cycle(); +#else + this->timestamp = esp_timer_get_time(); +#endif + } + + /** + * @brief Record the period. + * + */ + void end() + { +#if DL_LOG_LATENCY_UNIT + this->period = get_cycle() - this->timestamp; +#else + this->period = esp_timer_get_time() - this->timestamp; +#endif + if (this->queue) + { + this->sum -= this->queue[this->next]; + this->queue[this->next] = this->period; + this->sum += this->queue[this->next]; + this->next++; + this->next = this->next % this->size; + if (this->count < this->size) + { + this->count++; + } + } + } + + /** + * @brief Return the period. + * + * @return this->timestamp_end - this->timestamp + */ + uint32_t get_period() + { + return this->period; + } + + /** + * @brief Get the average period. + * + * @return average latency + */ + uint32_t get_average_period() + { + return this->queue ? (this->sum / this->count) : this->period; + } + + /** + * @brief Clear the period + * + */ + void clear_period() + { + this->period = 0; + } + + /** + * @brief Print in format "latency: {this->period} {unit}\n". + */ + void print() + { +#if DL_LOG_LATENCY_UNIT + printf("latency: %15u cycle\n", this->get_average_period()); +#else + printf("latency: %15u us\n", this->get_average_period()); +#endif + } + + /** + * @brief Print in format "{message}: {this->period} {unit}\n". + * + * @param message message of print + */ + void print(const char *message) + { +#if DL_LOG_LATENCY_UNIT + printf("%s: %15u cycle\n", message, this->get_average_period()); +#else + printf("%s: %15u us\n", message, this->get_average_period()); +#endif + } + + /** + * @brief Print in format "{prefix}::{key}: {this->period} {unit}\n". + * + * @param prefix prefix of print + * @param key key of print + */ + void print(const char *prefix, const char *key) + { +#if DL_LOG_LATENCY_UNIT + printf("%s::%s: %u cycle\n", prefix, key, this->get_average_period()); +#else + printf("%s::%s: %u us\n", prefix, key, this->get_average_period()); +#endif + } + }; + } // namespace tool +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/tool/dl_tool_cache.hpp b/tools/sdk/esp32c3/include/esp-face/include/tool/dl_tool_cache.hpp new file mode 100644 index 00000000000..74c81717a58 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/tool/dl_tool_cache.hpp @@ -0,0 +1,74 @@ +#pragma once + +#include + +#if CONFIG_IDF_TARGET_ESP32S3 +#include "esp32s3/rom/cache.h" +#include "soc/extmem_reg.h" +#endif + +namespace dl +{ + namespace tool + { + namespace cache + { + /** + * @brief Initialize preload. + * + * @param preload One of 1 or 0, + * - 1: turn on the preload + * - 0: turn off the preload + * @return + * - 1: Initialize successfully + * - 0: Initialize successfully, autoload has been turned off + * - -1: Initialize failed, the chip does not support preload + */ + int8_t preload_init(uint8_t preload = 1); + + /** + * @brief Preload memory. + * + * @param addr the start address of data to be preloaded + * @param size the size of the data in byte to be preloaded + */ + void preload_func(uint32_t addr, uint32_t size); + + /** + * @brief Initialize autoload. + * + * @param autoload One of 1 or 0, + * - 1: turn on the autoload + * - 0: turn off the autoload + * @param trigger One of 0 or 1 or 2, + * - 0: miss, TODO:@yuanjiong + * - 1: hit, TODO:@yuanjiong + * - 2: both,TODO:@yuanjiong + * @param line_size the number of cache lines to be autoloaded + * @return status, + * - 1: Initialize sucessfully + * - 0: Initialize suceesfully, preload has been turned off + * - -1: Initialize failed, the chip does not support autoload + */ + int8_t autoload_init(uint8_t autoload = 1, uint8_t trigger = 2, uint8_t line_size = 0); + + /** + * @brief Autoload memory. + * + * @param addr1 the start address of data1 to be autoloaded + * @param size1 the size of the data1 in byte to be preloaded + * @param addr2 the start address of data2 to be autoloaded + * @param size2 the size of the data2 in byte to be preloaded + */ + void autoload_func(uint32_t addr1, uint32_t size1, uint32_t addr2, uint32_t size2); + + /** + * @brief Autoload memory. + * + * @param addr1 the start address of data1 to be autoloaded + * @param size1 the size of the data1 in byte to be preloaded + */ + void autoload_func(uint32_t addr1, uint32_t size1); + } + } // namespace tool +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/typedef/dl_constant.hpp b/tools/sdk/esp32c3/include/esp-face/include/typedef/dl_constant.hpp new file mode 100644 index 00000000000..07b2dd24ee1 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/typedef/dl_constant.hpp @@ -0,0 +1,129 @@ +#pragma once + +#include "dl_define.hpp" +#include + +namespace dl +{ + /** + * @brief Base class of Filter, Bias, Activation. + * + * @tparam T supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize, + * - int8_t: stands for operation in int8_t quantize. + */ + template + class Constant + { + public: + const T *element; /**/ + const int exponent; /**/ + const std::vector shape; /**/ + + /** + * @brief Construct a new Constant object. + * + * @param element point to element. + * @param exponent exponent of element. + * @param shape shape of Constant. + */ + Constant(const T *element, const int exponent, const std::vector shape); + }; + + /** + * @brief Filter. + * NOTE: The shape format of filter is fixed, but the element sequence depands on optimization method. + * - 1D: reserved + * - 2D: shape format is [filter_height, filter_width, input_channel, output_channel]. dilation format is [height, width] + * + * @tparam T supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize, + * - int8_t: stands for operation in int8_t quantize. + */ + template + class Filter : public Constant + { + public: + const std::vector dilation; /**/ + /**/ + std::vector shape_with_dilation; /**/ + /**/ + std::vector channel_exponent; /**/ + + /** + * @brief Construct a new Filter object. + * + * @param element point to element + * @param exponent exponent of element + * @param shape shape of Filter, + * - 1D: reserved + * - 2D: for convolution is [filter_height, filter_width, input_channel, output_channel], + * for depthwise convolution is [filter_height, filter_width, input_channel, 1] + * @param dilation dilation of Filter + * - 1D: reserved + * - 2D: [dilation_in_height, dilation_in_width] + */ + Filter(const T *element, const int exponent, const std::vector shape, const std::vector dilation = {1, 1}); + + /** + * @brief Construct a new Filter object. + * + * @param element point to element + * @param channel_exponent exponent for per-channel + * @param shape shape of element + * @param dilation dilation of Filter + * - 1D: reserved + * - 2D: [dilation_in_height, dilation_in_width] + */ + Filter(const T *element, const std::vector channel_exponent, const std::vector shape, const std::vector dilation = {1, 1}); + + /** + * @brief Print the n-th filter. + * + * @param n index of output_channel + * @param message to print + */ + void print2d_n(const int n, const char *message) const; + }; + + /** + * @brief Bias. + * + * @tparam T supports int16_t and int8_t + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Bias : public Constant + { + public: + using Constant::Constant; + std::vector channel_exponent; /**/ + + Bias(const T *element, const std::vector channel_exponent, const std::vector shape); + }; + + /** + * @brief Activation. + * + * @tparam T supports int16_t and int8_t + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Activation : public Constant + { + public: + const activation_type_t type; /* shape = {0}); + }; +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp-face/include/typedef/dl_variable.hpp b/tools/sdk/esp32c3/include/esp-face/include/typedef/dl_variable.hpp new file mode 100644 index 00000000000..18cbe9707e9 --- /dev/null +++ b/tools/sdk/esp32c3/include/esp-face/include/typedef/dl_variable.hpp @@ -0,0 +1,495 @@ +#pragma once + +#include +#include +#include +#include + +#include "dl_tool.hpp" + +namespace dl +{ + /** + * @brief Tensor + * + * @tparam T support uint8_t, int8_t, int16_t and float. + */ + template + class Tensor + { + private: + int size; /* axis_offset; /* shape; /*set_shape({0}); } + + /** + * @brief Construct a new Tensor object by copying from input. + * + * @param input an input Tensor + * @param deep one of true or false + * - true: apply a new memory, copy value from input.element to this new memory + * - false: take over input.element to this->element + */ + Tensor(Tensor &input, bool deep) : size(input.size), + auto_free(input.auto_free), + exponent(input.exponent) + { + this->set_shape(input.shape); + if (deep && (input.element != NULL)) + { + int size_real = input.get_size(); + T *new_element = (T *)tool::calloc_aligned_prefer(size_real, sizeof(T), 16); + tool::copy_memory(new_element, input.element, size_real * sizeof(T)); + this->element = new_element; + } + else + { + this->element = input.element; + this->auto_free = false; + } + } + + /** + * @brief Destroy the Tensor object + * + */ + ~Tensor() + { + if (this->auto_free) + this->free_element(); + } + + /** + * @brief + * + * @param input an input Tensor + * @param deep one of true or false + * - true: apply a new memory, copy value from input.element to this new memory + * - false: take over input.element to this->element + * @return Tensor& self + */ + Tensor ©_element(Tensor &input, bool deep) + { + assert(this->get_size() == input.get_size()); + assert(input.element != NULL); + + this->malloc_element(); + if (deep) + { + tool::copy_memory(this->element, input.element, this->get_size() * sizeof(T)); + } + else + { + this->element = input.element; + this->auto_free = false; + } + return *this; + } + + /** + * @brief Set the auto free object. + * + * @param auto_free one of true or false + * - true: free element when object destroyed + * - false: do not + * @return self + */ + Tensor &set_auto_free(const bool auto_free) + { + this->auto_free = auto_free; + return *this; + } + + /** + * @brief Set the element. + * + * @param element point to element memory + * @return self + */ + Tensor &set_element(T *element, const bool auto_free = false) + { + assert(this->element == NULL); + this->element = element; + this->auto_free = auto_free; + + return *this; + } + + /** + * @brief Set the exponent. + * + * @param exponent exponent of element + * @return self + */ + Tensor &set_exponent(const int exponent) + { + this->exponent = exponent; + + return *this; + } + + /** + * @brief Set the shape of Tensor. + * + * @param shape the target shape + * + * @return self + */ + Tensor &set_shape(const std::vector shape); + + /** + * @brief print the shape of the Tensor + * + */ + void print_shape() + { + if (this->shape.size()) + { + printf("shape = ("); + for (int i = 0; i < this->shape.size() - 1; i++) + { + printf("%d, ", this->shape[i]); + } + printf("%d)\n", this->shape.back()); + } + else + { + printf("shape = ()\n"); + } + } + + /** + * @brief flatten the Tensor + * + * @return Tensor& self + */ + Tensor &flatten(); + + /** + * @brief Change a new shape to the Tensor without changing its data. + * + * @param shape the target shape + * @return Tensor& self + */ + Tensor &reshape(std::vector shape); + + /** + * @brief Remove dims with length==1 from Tensor + * + * @param axis the dim to to be remove. make sure the length of the dim is equal to 1. + * if axis == INT32_MAX, all the dims with length==1 will be removed. + * @return Tensor& self + */ + Tensor &squeeze(int axis = INT32_MAX); + + /** + * @brief Insert a new dim that will appear at the axis position in the expanded Tensor shape. + * + * @param axis the dim to be inserted + * @return Tensor& self + */ + Tensor &expand_dims(int axis); + + /** + * @brief Insert a new dim that will appear at the axis position in the expanded Tensor shape. + * + * @param axis the dim to be inserted + * @return Tensor& self + */ + Tensor &expand_dims(std::vector axis); + + /** + * @brief Reverse or permute the axes of the Tensor + * + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @return Tensor& self + */ + Tensor &transpose(std::vector perm = {}); + + /** + * @brief Reverse or permute the axes of the input Tensor + * + * @param input the input Tensor + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @return Tensor& self + */ + Tensor &transpose(Tensor &input, std::vector perm = {}); + + /** + * @brief Get the element pointer. + * + * @return pointer to memory + */ + T *get_element_ptr() + { + return this->element; + } + + /** + * @brief Get the element value. + * + * @param index the index of each dim. + * @return T element value + */ + T get_element_value(const std::vector index) + { + return this->element[this->get_element_index(index)]; + } + + /** + * @brief Get the element value. + * + * @param index the index of the element. + * @return T element value + */ + T get_element_value(int index) + { + return this->element[index]; + } + + /** + * @brief Get the size of Tensor. + * + * @return the size of Tensor. + */ + int get_size() + { + return this->size; + } + + /** + * @brief Get the axis offset + * + * @return std::vector the axis offset + */ + std::vector get_axis_offset() + { + return this->axis_offset; + } + + /** + * @brief Apply memory with zero-initialized only if this->element is NULL. + * + * @param auto_free one of true or false + * - true: free element when object destroyed + * - false: do not + * @return + * - true: on success + * - false: if applying failed + */ + bool calloc_element(const bool auto_free = true) + { + if (this->element != NULL) + return false; + + this->element = (T *)dl::tool::calloc_aligned_prefer(this->get_size(), sizeof(T), 16); + this->auto_free = auto_free; + + return true; + } + + /** + * @brief Apply memory without initialized only if this->element is NULL. + * + * @param auto_free one of true or false + * - true: free element when object destroyed + * - false: do not + * @return + * - true: on success + * - false: if applying failed + */ + bool malloc_element(const bool auto_free = true) + { + if (this->element != NULL) + return false; + + this->element = (T *)tool::malloc_aligned_prefer(this->get_size(), sizeof(T), 16); + this->auto_free = auto_free; + + return true; + } + + /** + * @brief free element only if this->element != NULL + * set this->element to NULL, after free + * @brief Free element if this->element is not NULL. + */ + void free_element() + { + if (this->auto_free && this->element) + { + tool::free_aligned_prefer(this->element); + this->element = NULL; + } + } + + /** + * @brief print the element of the tensor + * + * @param axis_index_range the element range of each dims to be print. if axis_index_range == {}, all the element will be print. + * @param message to print + */ + void print(std::vector axis_index_range = {}, const char *message = ""); + + /** + * @brief print all the element of the Tensor. + * + * @param message to print + * @param with_padding one of true or false, + * - true: the padding element will also be ed + * - false: the padding element will not be ed + */ + void print_all(const char *message = "") + { + std::cout << "\n" + << message << " | "; + this->print_shape(); + + for (int i = 0; i < this->get_size(); i++) + { + std::cout << this->element[i] << " "; + } + std::cout << "\n"; + return; + } + + /** + * @brief Get the index of each dims + * + * @param element_index the index of the element + * @return std::vector the index of each dims + */ + std::vector get_axis_index(int element_index); + + /** + * @brief Get the index of element + * + * @param axis_index the index of each dims + * @return int the index of element + */ + int get_element_index(const std::vector axis_index); + + /** + * @brief Check the element value with input ground-truth. + * + * @param gt_element ground-truth value of element + * @param bias permissible error + * @param info one of true or false + * - true: shape and result + * - false: do not + * @param failed_number maximum number of wrong element that will be printed + * + * @return + * - true: in permissible error + * - false: not + */ + bool check_element(T *gt_element, int bias = 2, bool info = true, int failed_number = 0) + { + int count = 0; + if (info) + this->print_shape(); + int size = this->get_size(); + for (int i = 0; i < size; i++) + { + if (DL_ABS(this->element[i] - gt_element[i]) > bias) + { + std::vector index = get_axis_index(i); + std::cout << "element["; + for (int j = 0; j < index.size() - 1; j++) + { + std::cout << index[j] << ", "; + } + std::cout << index.back() << "]: "; + std::cout << +this->element[i] << " v.s. " << +gt_element[i] << "\n"; + count++; + if (count > failed_number) + return false; + } + } + if (count) + return false; + + if (info) + printf("PASS\n"); + + return true; + } + + /** + * @brief Check the shape is the same as the shape of input. + * + * @param input an input tensor + * @return + * - true: same shape + * - false: not + */ + bool is_same_shape(Tensor &input) + { + if (input.shape.size() != this->shape.size()) + { + return false; + } + for (int i = 0; i < this->shape.size(); i++) + { + if (input.shape[i] != this->shape[i]) + { + return false; + } + } + return true; + } + + Tensor &operator=(const Tensor &input) + { + this->auto_free = input.auto_free; + this->exponent = input.exponent; + int size_real_tmp = this->size; + int size_input_real = input.size; + this->set_shape(input.shape); + if (input.element) + { + if (this->element) + { + if (size_real_tmp != size_input_real) + { + tool::free_aligned_prefer(this->element); + T *new_element = (T *)tool::malloc_aligned_prefer(size_input_real, sizeof(T), 16); + tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); + this->element = new_element; + } + else + { + tool::copy_memory(this->element, input.element, size_input_real * sizeof(T)); + } + } + else + { + T *new_element = (T *)tool::malloc_aligned_prefer(size_input_real, sizeof(T), 16); + tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); + this->element = new_element; + } + return *this; + } + else + { + if (this->element) + { + tool::free_aligned_prefer(this->element); + this->element = NULL; + } + return *this; + } + } + }; +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32c3/include/esp_https_server/include/esp_https_server.h b/tools/sdk/esp32c3/include/esp_https_server/include/esp_https_server.h index 00565a963ad..efe726e9e70 100644 --- a/tools/sdk/esp32c3/include/esp_https_server/include/esp_https_server.h +++ b/tools/sdk/esp32c3/include/esp_https_server/include/esp_https_server.h @@ -10,6 +10,7 @@ #include #include "esp_err.h" #include "esp_http_server.h" +#include "esp_tls.h" #ifdef __cplusplus extern "C" { @@ -20,6 +21,22 @@ typedef enum { HTTPD_SSL_TRANSPORT_INSECURE // SSL disabled } httpd_ssl_transport_mode_t; +/** + * @brief Callback data struct, contains the ESP-TLS connection handle + */ +typedef struct esp_https_server_user_cb_arg { + const esp_tls_t *tls; +} esp_https_server_user_cb_arg_t; + +/** + * @brief Callback function prototype + * Can be used to get connection or client information (SSL context) + * E.g. Client certificate, Socket FD, Connection state, etc. + * + * @param user_cb Callback data struct + */ +typedef void esp_https_server_user_cb(esp_https_server_user_cb_arg_t *user_cb); + /** * HTTPS server config struct * @@ -66,6 +83,9 @@ struct httpd_ssl_config { /** Enable tls session tickets */ bool session_tickets; + + /** User callback for esp_https_server */ + esp_https_server_user_cb *user_cb; }; typedef struct httpd_ssl_config httpd_ssl_config_t; @@ -113,6 +133,7 @@ typedef struct httpd_ssl_config httpd_ssl_config_t; .port_secure = 443, \ .port_insecure = 80, \ .session_tickets = false, \ + .user_cb = NULL, \ } /** diff --git a/tools/sdk/esp32c3/include/esp_hw_support/include/esp_sleep.h b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_sleep.h index cfdfbc04186..75d2f9726c3 100644 --- a/tools/sdk/esp32c3/include/esp_hw_support/include/esp_sleep.h +++ b/tools/sdk/esp32c3/include/esp_hw_support/include/esp_sleep.h @@ -44,6 +44,7 @@ typedef enum { #if SOC_PM_SUPPORT_CPU_PD ESP_PD_DOMAIN_CPU, //!< CPU core #endif + ESP_PD_DOMAIN_RTC8M, //!< Internal 8M oscillator ESP_PD_DOMAIN_VDDSDIO, //!< VDD_SDIO ESP_PD_DOMAIN_MAX //!< Number of domains } esp_sleep_pd_domain_t; diff --git a/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_io.h b/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_io.h index eebcabf42b4..330f4d9a165 100644 --- a/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_io.h +++ b/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_io.h @@ -65,6 +65,22 @@ esp_err_t esp_lcd_panel_io_tx_color(esp_lcd_panel_io_handle_t io, int lcd_cmd, c */ esp_err_t esp_lcd_panel_io_del(esp_lcd_panel_io_handle_t io); +/** + * @brief Type of LCD panel IO event data + */ +typedef struct { +} esp_lcd_panel_io_event_data_t; + +/** + * @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data + * + * @param[in] panel_io LCD panel IO handle, which is created by factory API like `esp_lcd_new_panel_io_spi()` + * @param[in] edata Panel IO event data, fed by driver + * @param[in] user_ctx User data, passed from `esp_lcd_panel_io_xxx_config_t` + * @return Whether a high priority task has been waken up by this function + */ +typedef bool (*esp_lcd_panel_io_color_trans_done_cb_t)(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx); + /** * @brief Panel IO configuration structure, for SPI interface */ @@ -74,8 +90,8 @@ typedef struct { int spi_mode; /*!< Traditional SPI mode (0~3) */ unsigned int pclk_hz; /*!< Frequency of pixel clock */ size_t trans_queue_depth; /*!< Size of internal transaction queue */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */ - void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ int lcd_param_bits; /*!< Bit-width of LCD parameter */ struct { @@ -100,8 +116,8 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p typedef struct { uint32_t dev_addr; /*!< I2C device address */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */ - void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ size_t control_phase_bytes; /*!< I2C LCD panel will encode control information (e.g. D/C seclection) into control phase, in several bytes */ unsigned int dc_bit_offset; /*!< Offset of the D/C selection bit in control phase */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ @@ -168,8 +184,8 @@ typedef struct { int cs_gpio_num; /*!< GPIO used for CS line, set to -1 will declaim exclusively use of I80 bus */ unsigned int pclk_hz; /*!< Frequency of pixel clock */ size_t trans_queue_depth; /*!< Transaction queue size, larger queue, higher throughput */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data was tranferred done */ - void *user_data; /*!< User private data, passed directly to on_trans_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data was tranferred done */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ int lcd_param_bits; /*!< Bit-width of LCD parameter */ struct { diff --git a/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_rgb.h b/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_rgb.h index 2ddd2b6b9a6..1368bb787f6 100644 --- a/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_rgb.h +++ b/tools/sdk/esp32c3/include/esp_lcd/include/esp_lcd_panel_rgb.h @@ -18,6 +18,37 @@ extern "C" { #if SOC_LCD_RGB_SUPPORTED /** * @brief LCD RGB timing structure + * + * Total Width + * <---------------------------------------------------> + * Hsync width HBP Active Width HFP + * <---><--><--------------------------------------><---> + * ____ ____|_______________________________________|____| + * |___| | | | + * | | | + * __| | | | + * /|\ /|\ | | | | + * | VSYNC| | | | | + * |Width\|/ |__ | | | + * | /|\ | | | | + * | VBP | | | | | + * | \|/_____|_________|_______________________________________| | + * | /|\ | | / / / / / / / / / / / / / / / / / / / | | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * Total | | | |/ / / / / / / / / / / / / / / / / / / /| | + * Heigh | | | |/ / / / / / / / / / / / / / / / / / / /| | + * |Active| | |/ / / / / / / / / / / / / / / / / / / /| | + * |Heigh | | |/ / / / / / Active Display Area / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | \|/_____|_________|_______________________________________| | + * | /|\ | | + * | VFP | | | + * \|/ \|/_____|______________________________________________________| + * */ typedef struct { unsigned int pclk_hz; /*!< Frequency of pixel clock */ @@ -38,6 +69,22 @@ typedef struct { } flags; } esp_lcd_rgb_timing_t; +/** + * @brief Type of RGB LCD panel event data + */ +typedef struct { +} esp_lcd_rgb_panel_event_data_t; + +/** + * @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data + * + * @param[in] panel LCD panel handle, returned from `esp_lcd_new_rgb_panel` + * @param[in] edata Panel event data, fed by driver + * @param[in] user_ctx User data, passed from `esp_lcd_rgb_panel_config_t` + * @return Whether a high priority task has been waken up by this function + */ +typedef bool (*esp_lcd_rgb_panel_frame_trans_done_cb_t)(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx); + /** * @brief LCD RGB panel configuration structure */ @@ -51,8 +98,8 @@ typedef struct { int pclk_gpio_num; /*!< GPIO used for PCLK signal */ int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; /*!< GPIOs used for data lines */ int disp_gpio_num; /*!< GPIO used for display control signal, set to -1 if it's not used */ - bool (*on_frame_trans_done)(esp_lcd_panel_handle_t panel, void *user_data); /*!< Callback, invoked when one frame buffer has transferred done */ - void *user_data; /*!< User data which would be passed to on_frame_trans_done's user_data */ + esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; /*!< Callback invoked when one frame buffer has transferred done */ + void *user_ctx; /*!< User data which would be passed to on_frame_trans_done's user_ctx */ 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) */ diff --git a/tools/sdk/esp32c3/include/esp_littlefs/include/esp_littlefs.h b/tools/sdk/esp32c3/include/esp_littlefs/include/esp_littlefs.h index dbb1028790d..7b5abe9248f 100644 --- a/tools/sdk/esp32c3/include/esp_littlefs/include/esp_littlefs.h +++ b/tools/sdk/esp32c3/include/esp_littlefs/include/esp_littlefs.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include "sdkconfig.h" diff --git a/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist.h b/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist.h index 1ff624d9b55..14b7c9aa506 100644 --- a/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist.h +++ b/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist.h @@ -1,16 +1,8 @@ -// Copyright 2015-2018 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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_COEXIST_H__ #define __ESP_COEXIST_H__ @@ -32,6 +24,13 @@ typedef enum { ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */ } esp_coex_prefer_t; +typedef enum { + EXTERN_COEX_WIRE_1 = 0, + EXTERN_COEX_WIRE_2, + EXTERN_COEX_WIRE_3, + EXTERN_COEX_WIRE_NUM, +} external_coex_wire_t; + /** * @brief coex status type */ @@ -41,6 +40,36 @@ typedef enum { ESP_COEX_ST_TYPE_BT, } esp_coex_status_type_t; +/** + * @brief external coex gpio pti + */ +typedef struct { + int32_t in_pin0; + int32_t in_pin1; + int32_t out_pin0; +} esp_external_coex_gpio_set_t; + +/** + * @brief external coex pti level + */ +typedef enum { + EXTERN_COEX_PTI_MID = 0, + EXTERN_COEX_PTI_HIGH, + EXTERN_COEX_PTI_NUM, +} esp_coex_pti_level_t; + +/** + * @brief external coex pti + */ +typedef struct { + uint32_t in_pti1; + uint32_t in_pti2; + uint32_t in_pti3; + uint32_t out_pti1; + uint32_t out_pti2; + uint32_t out_pti3; +} esp_external_coex_pti_set_t; + #define ESP_COEX_BLE_ST_MESH_CONFIG 0x08 #define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10 #define ESP_COEX_BLE_ST_MESH_STANDBY 0x20 @@ -84,6 +113,18 @@ esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status); */ esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status); +#if CONFIG_EXTERNAL_COEX_ENABLE +/** + * @brief Setup gpio pin and corresponding pti level, start external coex. + * @param wire_type : to select the whole external coex gpio number. + * @param gpio_pin : gpio pin number to choose. + * @return : ESP_OK - success, other - failed + */ +esp_err_t esp_enable_extern_coex_gpio_pin(external_coex_wire_t wire_type, + esp_external_coex_gpio_set_t gpio_pin); + +esp_err_t esp_disable_extern_coex_gpio_pin(); +#endif #ifdef __cplusplus } diff --git a/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist_internal.h b/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist_internal.h index 3501f0da6fb..7ba06d4c690 100644 --- a/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist_internal.h +++ b/tools/sdk/esp32c3/include/esp_wifi/include/esp_coexist_internal.h @@ -1,21 +1,14 @@ -// Copyright 2018-2018 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: 2018-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_COEXIST_INTERNAL_H__ #define __ESP_COEXIST_INTERNAL_H__ #include +#include "esp_coexist.h" #include "esp_coexist_adapter.h" #ifdef __cplusplus @@ -210,6 +203,29 @@ int coex_schm_curr_phase_idx_get(void); */ esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs); +#if CONFIG_EXTERNAL_COEX_ENABLE +/** + * @brief Set external coexistence pti level and enable it. + * + * @param level1 external coex low pti + * @param level2 external coex mid pti + * @param level3 external coex high pti + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_coex_external_set(esp_coex_pti_level_t level1, + esp_coex_pti_level_t level2, esp_coex_pti_level_t level3); + +/** + * @brief Disable external coexist + * + * @return + * - ESP_OK: succeed + */ +void esp_coex_external_stop(void); +#endif /*External Coex*/ + /** * @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library * diff --git a/tools/sdk/esp32c3/include/esp_wifi/include/esp_wifi_types.h b/tools/sdk/esp32c3/include/esp_wifi/include/esp_wifi_types.h index 503e8d7bb05..cee23f3fafc 100644 --- a/tools/sdk/esp32c3/include/esp_wifi/include/esp_wifi_types.h +++ b/tools/sdk/esp32c3/include/esp_wifi/include/esp_wifi_types.h @@ -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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_WIFI_TYPES_H__ @@ -80,6 +72,7 @@ typedef enum { WIFI_REASON_ASSOC_NOT_AUTHED = 9, WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11, + WIFI_REASON_BSS_TRANSITION_DISASSOC = 12, WIFI_REASON_IE_INVALID = 13, WIFI_REASON_MIC_FAILURE = 14, WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, @@ -250,7 +243,8 @@ typedef struct { wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame. Will be advertized in RSN Capabilities in RSN IE. */ uint32_t rm_enabled:1; /**< Whether Radio Measurements are enabled for the connection */ uint32_t btm_enabled:1; /**< Whether BSS Transition Management is enabled for the connection */ - uint32_t reserved:30; /**< Reserved for future feature set */ + uint32_t mbo_enabled:1; /**< Whether MBO is enabled for the connection */ + uint32_t reserved:29; /**< Reserved for future feature set */ } wifi_sta_config_t; /** @brief Configuration data for ESP32 AP or STA. diff --git a/tools/sdk/esp32c3/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h b/tools/sdk/esp32c3/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h index a01a56e9fd4..675af141ebc 100644 --- a/tools/sdk/esp32c3/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h +++ b/tools/sdk/esp32c3/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h @@ -90,7 +90,6 @@ #define portNUM_PROCESSORS 1 #endif -#define configASSERT_2 0 #define portUSING_MPU_WRAPPERS 0 #define configUSE_MUTEX 1 @@ -206,7 +205,6 @@ #define configGENERATE_RUN_TIME_STATS 1 /* Used by vTaskGetRunTimeStats() */ #endif -#define configUSE_TRACE_FACILITY_2 0 #define configBENCHMARK 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 0 @@ -306,4 +304,9 @@ extern void vPortCleanUpTCB ( void *pxTCB ); #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1 +// backward compatibility for 4.4 +#define xTaskRemoveFromUnorderedEventList vTaskRemoveFromUnorderedEventList + +#define configNUM_CORES portNUM_PROCESSORS + #endif /* FREERTOS_CONFIG_H */ diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/event_groups.h b/tools/sdk/esp32c3/include/freertos/include/freertos/event_groups.h index 84505ddaaa0..9792296e566 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/event_groups.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/event_groups.h @@ -64,7 +64,7 @@ * used to create a synchronisation point between multiple tasks (a * 'rendezvous'). * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventGroup EventGroup * @endcond */ @@ -78,7 +78,7 @@ * xEventGroupCreate() returns an EventGroupHandle_t variable that can then * be used as a parameter to other event group functions. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventGroupHandle_t EventGroupHandle_t * @endcond * \ingroup EventGroup @@ -94,7 +94,7 @@ typedef struct EventGroupDef_t * EventGroupHandle_t; * number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1, * 32 bits if set to 0. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventBits_t EventBits_t * @endcond * \ingroup EventGroup @@ -102,7 +102,7 @@ typedef struct EventGroupDef_t * EventGroupHandle_t; typedef TickType_t EventBits_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventGroupHandle_t xEventGroupCreate( void ); @@ -152,7 +152,7 @@ typedef TickType_t EventBits_t; * // The event group was created. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupCreate xEventGroupCreate * @endcond * \ingroup EventGroup @@ -162,7 +162,7 @@ typedef TickType_t EventBits_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventGroupHandle_t xEventGroupCreateStatic( EventGroupHandle_t * pxEventGroupBuffer ); @@ -217,7 +217,7 @@ typedef TickType_t EventBits_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, @@ -307,7 +307,7 @@ typedef TickType_t EventBits_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupWaitBits xEventGroupWaitBits * @endcond * \ingroup EventGroup @@ -319,7 +319,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ); @@ -372,7 +372,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupClearBits xEventGroupClearBits * @endcond * \ingroup EventGroup @@ -381,7 +381,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); @@ -432,7 +432,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR * @endcond * \ingroup EventGroup @@ -446,7 +446,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); @@ -516,7 +516,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSetBits xEventGroupSetBits * @endcond * \ingroup EventGroup @@ -525,7 +525,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ); @@ -595,7 +595,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR * @endcond * \ingroup EventGroup @@ -610,7 +610,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, @@ -732,7 +732,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSync xEventGroupSync * @endcond * \ingroup EventGroup @@ -744,7 +744,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup ); @@ -758,7 +758,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, * * @return The event group bits at the time xEventGroupGetBits() was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupGetBits xEventGroupGetBits * @endcond * \ingroup EventGroup @@ -766,7 +766,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, #define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( xEventGroup, 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ); @@ -779,7 +779,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, * * @return The event group bits at the time xEventGroupGetBitsFromISR() was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR * @endcond * \ingroup EventGroup @@ -787,7 +787,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * void xEventGroupDelete( EventGroupHandle_t xEventGroup ); @@ -802,7 +802,7 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEG */ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* For internal use only. */ void vEventGroupSetBitsCallback( void * pvEventGroup, diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/message_buffer.h b/tools/sdk/esp32c3/include/freertos/include/freertos/message_buffer.h index e57c589fbac..af5c3290b7c 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/message_buffer.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/message_buffer.h @@ -85,7 +85,7 @@ typedef void * MessageBufferHandle_t; /*-----------------------------------------------------------*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -139,7 +139,7 @@ typedef void * MessageBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferCreate xMessageBufferCreate * @endcond * \ingroup MessageBufferManagement @@ -148,7 +148,7 @@ typedef void * MessageBufferHandle_t; ( MessageBufferHandle_t ) xStreamBufferGenericCreate( xBufferSizeBytes, ( size_t ) 0, pdTRUE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -210,7 +210,7 @@ typedef void * MessageBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferCreateStatic xMessageBufferCreateStatic * @endcond * \ingroup MessageBufferManagement @@ -219,7 +219,7 @@ typedef void * MessageBufferHandle_t; ( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -314,7 +314,7 @@ typedef void * MessageBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSend xMessageBufferSend * @endcond * \ingroup MessageBufferManagement @@ -323,7 +323,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSend( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -423,7 +423,7 @@ typedef void * MessageBufferHandle_t; * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSendFromISR xMessageBufferSendFromISR * @endcond * \ingroup MessageBufferManagement @@ -432,7 +432,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSendFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -516,7 +516,7 @@ typedef void * MessageBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceive xMessageBufferReceive * @endcond * \ingroup MessageBufferManagement @@ -526,7 +526,7 @@ typedef void * MessageBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -622,7 +622,7 @@ typedef void * MessageBufferHandle_t; * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceiveFromISR xMessageBufferReceiveFromISR * @endcond * \ingroup MessageBufferManagement @@ -631,7 +631,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferReceiveFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -654,7 +654,7 @@ typedef void * MessageBufferHandle_t; vStreamBufferDelete( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferIsFull( MessageBufferHandle_t xMessageBuffer ) ); @@ -674,7 +674,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferIsFull( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferIsEmpty( MessageBufferHandle_t xMessageBuffer ) ); @@ -693,7 +693,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferIsEmpty( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferReset( MessageBufferHandle_t xMessageBuffer ); @@ -712,7 +712,7 @@ typedef void * MessageBufferHandle_t; * the message queue to wait for space to become available, or to wait for a * a message to be available, then pdFAIL is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReset xMessageBufferReset * @endcond * \ingroup MessageBufferManagement @@ -722,7 +722,7 @@ typedef void * MessageBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * size_t xMessageBufferSpaceAvailable( MessageBufferHandle_t xMessageBuffer ) ); @@ -740,7 +740,7 @@ typedef void * MessageBufferHandle_t; * architecture, so if xMessageBufferSpacesAvailable() returns 10, then the size * of the largest message that can be written to the message buffer is 6 bytes. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSpaceAvailable xMessageBufferSpaceAvailable * @endcond * \ingroup MessageBufferManagement @@ -751,7 +751,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSpacesAvailable( ( StreamBufferHandle_t ) xMessageBuffer ) /* Corrects typo in original macro name. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * size_t xMessageBufferNextLengthBytes( MessageBufferHandle_t xMessageBuffer ) ); @@ -767,7 +767,7 @@ typedef void * MessageBufferHandle_t; * @return The length (in bytes) of the next message in the message buffer, or 0 * if the message buffer is empty. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferNextLengthBytes xMessageBufferNextLengthBytes * @endcond * \ingroup MessageBufferManagement @@ -776,7 +776,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferNextMessageLengthBytes( ( StreamBufferHandle_t ) xMessageBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -811,7 +811,7 @@ typedef void * MessageBufferHandle_t; * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSendCompletedFromISR xMessageBufferSendCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -820,7 +820,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSendCompletedFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -856,7 +856,7 @@ typedef void * MessageBufferHandle_t; * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceiveCompletedFromISR xMessageBufferReceiveCompletedFromISR * @endcond * \ingroup StreamBufferManagement diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/queue.h b/tools/sdk/esp32c3/include/freertos/include/freertos/queue.h index 81cccc05df3..05ca7de4546 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/queue.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/queue.h @@ -62,7 +62,7 @@ typedef struct QueueDefinition * QueueSetHandle_t; */ typedef struct QueueDefinition * QueueSetMemberHandle_t; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* For internal use only. */ #define queueSEND_TO_BACK ( ( BaseType_t ) 0 ) @@ -80,7 +80,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * QueueHandle_t xQueueCreate( @@ -146,7 +146,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueCreate xQueueCreate * @endcond * \ingroup QueueManagement @@ -156,7 +156,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * QueueHandle_t xQueueCreateStatic( @@ -235,7 +235,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueCreateStatic xQueueCreateStatic * @endcond * \ingroup QueueManagement @@ -245,7 +245,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToToFront( @@ -321,7 +321,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -330,7 +330,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToBack( @@ -408,7 +408,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -417,7 +417,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSend( @@ -497,7 +497,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -506,7 +506,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueOverwrite( @@ -585,7 +585,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueOverwrite xQueueOverwrite * @endcond * \ingroup QueueManagement @@ -595,7 +595,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueGenericSend( @@ -678,7 +678,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -689,7 +689,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueuePeek( @@ -780,7 +780,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueuePeek xQueuePeek * @endcond * \ingroup QueueManagement @@ -790,7 +790,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueuePeekFromISR( @@ -820,7 +820,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, * @return pdTRUE if an item was successfully received from the queue, * otherwise pdFALSE. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueuePeekFromISR xQueuePeekFromISR * @endcond * \ingroup QueueManagement @@ -829,7 +829,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueReceive( @@ -917,7 +917,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueReceive xQueueReceive * @endcond * \ingroup QueueManagement @@ -927,7 +927,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ); @@ -940,7 +940,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, * * @return The number of messages available in the queue. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * @endcond * \ingroup QueueManagement @@ -948,7 +948,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ); @@ -963,7 +963,7 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNC * * @return The number of spaces available in the queue. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * @endcond * \ingroup QueueManagement @@ -971,7 +971,7 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNC UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * void vQueueDelete( QueueHandle_t xQueue ); @@ -983,7 +983,7 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNC * * @param xQueue A handle to the queue to be deleted. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vQueueDelete vQueueDelete * @endcond * \ingroup QueueManagement @@ -991,7 +991,7 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNC void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToFrontFromISR( @@ -1057,7 +1057,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1067,7 +1067,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToBackFromISR( @@ -1133,7 +1133,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1142,7 +1142,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueOverwriteFromISR( @@ -1225,7 +1225,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueOverwriteFromISR xQueueOverwriteFromISR * @endcond * \ingroup QueueManagement @@ -1234,7 +1234,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueOVERWRITE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendFromISR( @@ -1304,7 +1304,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1312,10 +1312,10 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; #define xQueueSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \ xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK ) -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /**@{*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueGenericSendFromISR( @@ -1402,7 +1402,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueReceiveFromISR( @@ -1487,7 +1487,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR * @endcond * \ingroup QueueManagement @@ -1504,7 +1504,7 @@ BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FU BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * The functions defined above are for passing data to and from tasks. The * functions below are the equivalents for passing data to and from @@ -1778,7 +1778,7 @@ QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, */ QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* Not public API functions. */ void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/semphr.h b/tools/sdk/esp32c3/include/freertos/include/freertos/semphr.h index 7e99c0b396c..2041641b91d 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/semphr.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/semphr.h @@ -39,7 +39,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U ) #define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U ) -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** * semphr. h * @code{c} @@ -88,7 +88,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary * @endcond * \ingroup Semaphores @@ -106,7 +106,7 @@ typedef QueueHandle_t SemaphoreHandle_t; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateBinary( void ); @@ -163,7 +163,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateBinary xSemaphoreCreateBinary * @endcond * \ingroup Semaphores @@ -173,7 +173,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateBinaryStatic( StaticSemaphore_t *pxSemaphoreBuffer ); @@ -229,7 +229,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // Rest of task code goes here. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateBinaryStatic xSemaphoreCreateBinaryStatic * @endcond * \ingroup Semaphores @@ -239,7 +239,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTake( @@ -304,7 +304,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreTake xSemaphoreTake * @endcond * \ingroup Semaphores @@ -312,7 +312,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueSemaphoreTake( ( xSemaphore ), ( xBlockTime ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTakeRecursive( @@ -403,7 +403,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive * @endcond * \ingroup Semaphores @@ -465,7 +465,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGive xSemaphoreGive * @endcond * \ingroup Semaphores @@ -473,7 +473,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex ); @@ -555,7 +555,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive * @endcond * \ingroup Semaphores @@ -641,7 +641,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR * @endcond * \ingroup Semaphores @@ -649,7 +649,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGiveFromISR( ( QueueHandle_t ) ( xSemaphore ), ( pxHigherPriorityTaskWoken ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTakeFromISR( @@ -686,7 +686,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateMutex( void ); @@ -741,7 +741,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex * @endcond * \ingroup Semaphores @@ -751,7 +751,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateMutexStatic( StaticSemaphore_t *pxMutexBuffer ); @@ -808,7 +808,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // so there is no need to check it. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic * @endcond * \ingroup Semaphores @@ -951,7 +951,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount ); @@ -1027,7 +1027,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting * @endcond * \ingroup Semaphores @@ -1037,7 +1037,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateCountingStatic( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount, StaticSemaphore_t *pxSemaphoreBuffer ); @@ -1118,7 +1118,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // is no need to check its value. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateCountingStatic xSemaphoreCreateCountingStatic * @endcond * \ingroup Semaphores @@ -1128,7 +1128,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * void vSemaphoreDelete( SemaphoreHandle_t xSemaphore ); @@ -1140,7 +1140,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * * @param xSemaphore A handle to the semaphore to be deleted. * - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * \defgroup vSemaphoreDelete vSemaphoreDelete * @endcond * \ingroup Semaphores @@ -1148,7 +1148,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex ); @@ -1167,7 +1167,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * TaskHandle_t xSemaphoreGetMutexHolderFromISR( SemaphoreHandle_t xMutex ); @@ -1182,7 +1182,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * UBaseType_t uxSemaphoreGetCount( SemaphoreHandle_t xSemaphore ); diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/stream_buffer.h b/tools/sdk/esp32c3/include/freertos/include/freertos/stream_buffer.h index 9e58cff120c..a20dcf0375e 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/stream_buffer.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/stream_buffer.h @@ -71,7 +71,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -134,7 +134,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferCreate xStreamBufferCreate * @endcond * \ingroup StreamBufferManagement @@ -142,7 +142,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; #define xStreamBufferCreate( xBufferSizeBytes, xTriggerLevelBytes ) xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -220,7 +220,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferCreateStatic xStreamBufferCreateStatic * @endcond * \ingroup StreamBufferManagement @@ -229,7 +229,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, pucStreamBufferStorageArea, pxStaticStreamBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -319,7 +319,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSend xStreamBufferSend * @endcond * \ingroup StreamBufferManagement @@ -330,7 +330,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -424,7 +424,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, * taskYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSendFromISR xStreamBufferSendFromISR * @endcond * \ingroup StreamBufferManagement @@ -435,7 +435,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -517,7 +517,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceive xStreamBufferReceive * @endcond * \ingroup StreamBufferManagement @@ -528,7 +528,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -607,7 +607,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, * taskYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceiveFromISR xStreamBufferReceiveFromISR * @endcond * \ingroup StreamBufferManagement @@ -618,7 +618,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -636,7 +636,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, * * @param xStreamBuffer The handle of the stream buffer to be deleted. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vStreamBufferDelete vStreamBufferDelete * @endcond * \ingroup StreamBufferManagement @@ -644,7 +644,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -660,7 +660,7 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTI * @return If the stream buffer is full then pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferIsFull xStreamBufferIsFull * @endcond * \ingroup StreamBufferManagement @@ -668,7 +668,7 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTI BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -684,7 +684,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_ * @return If the stream buffer is empty then pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferIsEmpty xStreamBufferIsEmpty * @endcond * \ingroup StreamBufferManagement @@ -692,7 +692,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -711,7 +711,7 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED * a task blocked waiting to send to or read from the stream buffer then the * stream buffer is not reset and pdFAIL is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReset xStreamBufferReset * @endcond * \ingroup StreamBufferManagement @@ -719,7 +719,7 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -736,7 +736,7 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_F * @return The number of bytes that can be written to the stream buffer before * the stream buffer would be full. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSpacesAvailable xStreamBufferSpacesAvailable * @endcond * \ingroup StreamBufferManagement @@ -744,7 +744,7 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_F size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -761,7 +761,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVIL * @return The number of bytes that can be read from the stream buffer before * the stream buffer would be empty. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferBytesAvailable xStreamBufferBytesAvailable * @endcond * \ingroup StreamBufferManagement @@ -769,7 +769,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVIL size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -802,7 +802,7 @@ size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILE * then the trigger level will be updated and pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSetTriggerLevel xStreamBufferSetTriggerLevel * @endcond * \ingroup StreamBufferManagement @@ -811,7 +811,7 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -846,7 +846,7 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSendCompletedFromISR xStreamBufferSendCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -855,7 +855,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -891,7 +891,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceiveCompletedFromISR xStreamBufferReceiveCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -899,7 +899,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* Functions below here are not part of the public API. */ StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/task.h b/tools/sdk/esp32c3/include/freertos/include/freertos/task.h index 9135b76f014..125a924d061 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/task.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/task.h @@ -76,7 +76,7 @@ * returns (via a pointer parameter) an TaskHandle_t variable that can then * be used as a parameter to vTaskDelete to delete the task. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup TaskHandle_t TaskHandle_t * @endcond * \ingroup Tasks @@ -114,7 +114,7 @@ typedef enum eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */ } eNotifyAction; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** * Used internally only. */ @@ -189,11 +189,13 @@ typedef enum #define tskIDLE_PRIORITY ( ( UBaseType_t ) 0U ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro for forcing a context switch. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskYIELD taskYIELD * @endcond * \ingroup SchedulerControl @@ -201,7 +203,9 @@ typedef enum #define taskYIELD() portYIELD() /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to mark the start of a critical code region. Preemptive context * switches cannot occur when in a critical region. @@ -209,7 +213,7 @@ typedef enum * @note This may alter the stack (depending on the portable implementation) * so must be used with care! * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskENTER_CRITICAL taskENTER_CRITICAL * @endcond * \ingroup SchedulerControl @@ -228,7 +232,9 @@ typedef enum #endif // ESP_PLATFORM /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to mark the end of a critical code region. Preemptive context * switches cannot occur when in a critical region. @@ -236,7 +242,7 @@ typedef enum * @note This may alter the stack (depending on the portable implementation) * so must be used with care! * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskEXIT_CRITICAL taskEXIT_CRITICAL * @endcond * \ingroup SchedulerControl @@ -255,11 +261,13 @@ typedef enum #define taskEXIT_CRITICAL_ISR( ) portEXIT_CRITICAL_ISR( ) #endif // ESP_PLATFORM /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to disable all maskable interrupts. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS * @endcond * \ingroup SchedulerControl @@ -267,11 +275,13 @@ typedef enum #define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS() /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to enable microcontroller interrupts. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskENABLE_INTERRUPTS taskENABLE_INTERRUPTS * @endcond * \ingroup SchedulerControl @@ -422,7 +432,7 @@ typedef enum * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreate xTaskCreate * @endcond * \ingroup Tasks @@ -430,14 +440,14 @@ typedef enum #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) static inline IRAM_ATTR BaseType_t xTaskCreate( - TaskFunction_t pvTaskCode, - const char * const pcName, - const uint32_t usStackDepth, - void * const pvParameters, - UBaseType_t uxPriority, - TaskHandle_t * const pvCreatedTask) + TaskFunction_t pvTaskCode, + const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + const uint32_t usStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + TaskHandle_t * const pxCreatedTask) PRIVILEGED_FUNCTION { - return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, tskNO_AFFINITY ); + return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, tskNO_AFFINITY ); } #endif @@ -599,20 +609,20 @@ typedef enum #if( configSUPPORT_STATIC_ALLOCATION == 1 ) static inline IRAM_ATTR TaskHandle_t xTaskCreateStatic( - TaskFunction_t pvTaskCode, - const char * const pcName, - const uint32_t ulStackDepth, - void * const pvParameters, - UBaseType_t uxPriority, - StackType_t * const pxStackBuffer, - StaticTask_t * const pxTaskBuffer) + TaskFunction_t pvTaskCode, + const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + const uint32_t ulStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + StackType_t * const puxStackBuffer, + StaticTask_t * const pxTaskBuffer) PRIVILEGED_FUNCTION { - return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, pxStackBuffer, pxTaskBuffer, tskNO_AFFINITY ); + return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, tskNO_AFFINITY ); } #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskCreateRestricted( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask ); @@ -683,18 +693,18 @@ typedef enum * for( ;; ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestricted xTaskCreateRestricted * @endcond * \ingroup Tasks */ #if ( portUSING_MPU_WRAPPERS == 1 ) BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, - TaskHandle_t * pxCreatedTask ); + TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskCreateRestrictedStatic( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask ); @@ -777,7 +787,7 @@ typedef enum * for( ;; ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestrictedStatic xTaskCreateRestrictedStatic * @endcond * \ingroup Tasks @@ -788,7 +798,7 @@ typedef enum #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ); @@ -833,7 +843,7 @@ typedef enum * // defined or shared regions have been declared elsewhere). * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestricted xTaskCreateRestricted * @endcond * \ingroup Tasks @@ -842,7 +852,7 @@ void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskDelete( TaskHandle_t xTask ); @@ -881,7 +891,7 @@ void vTaskAllocateMPURegions( TaskHandle_t xTask, * vTaskDelete( xHandle ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskDelete vTaskDelete * @endcond * \ingroup Tasks @@ -893,10 +903,12 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; *----------------------------------------------------------*/ /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskDelay( const TickType_t xTicksToDelay ); * @endcode + * @endcond * * Delay a task for a given number of ticks. The actual time that the * task remains blocked depends on the tick rate. The constant @@ -938,7 +950,7 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskDelay vTaskDelay * @endcond * \ingroup TaskCtrl @@ -946,10 +958,12 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION; /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement ); * @endcode + * @endcond * * INCLUDE_xTaskDelayUntil must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -1007,7 +1021,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskDelayUntil xTaskDelayUntil * @endcond * \ingroup TaskCtrl @@ -1026,7 +1040,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskAbortDelay( TaskHandle_t xTask ); @@ -1054,7 +1068,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, * @return If the task referenced by xTask was not in the Blocked state then * pdFAIL is returned. Otherwise pdPASS is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskAbortDelay xTaskAbortDelay * @endcond * \ingroup TaskCtrl @@ -1062,7 +1076,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ); @@ -1107,7 +1121,7 @@ BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxTaskPriorityGet uxTaskPriorityGet * @endcond * \ingroup TaskCtrl @@ -1115,7 +1129,7 @@ BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ); @@ -1127,7 +1141,7 @@ UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * eTaskState eTaskGetState( TaskHandle_t xTask ); @@ -1149,7 +1163,7 @@ UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNC eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ); @@ -1203,7 +1217,7 @@ eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; * eInvalid ); // Include the task state in xTaskDetails. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskGetInfo vTaskGetInfo * @endcond * \ingroup TaskCtrl @@ -1214,7 +1228,7 @@ void vTaskGetInfo( TaskHandle_t xTask, eTaskState eState ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ); @@ -1254,7 +1268,7 @@ void vTaskGetInfo( TaskHandle_t xTask, * vTaskPrioritySet( NULL, tskIDLE_PRIORITY + 1 ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskPrioritySet vTaskPrioritySet * @endcond * \ingroup TaskCtrl @@ -1263,7 +1277,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskSuspend( TaskHandle_t xTaskToSuspend ); @@ -1312,7 +1326,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, * // with our handle as the parameter. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskSuspend vTaskSuspend * @endcond * \ingroup TaskCtrl @@ -1320,7 +1334,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskResume( TaskHandle_t xTaskToResume ); @@ -1367,7 +1381,7 @@ void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; * // time in accordance with its priority within the system. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskResume vTaskResume * @endcond * \ingroup TaskCtrl @@ -1375,7 +1389,7 @@ void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void xTaskResumeFromISR( TaskHandle_t xTaskToResume ); @@ -1402,7 +1416,7 @@ void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; * otherwise pdFALSE. This is used by the ISR to determine if a context switch * may be required following the ISR. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskResumeFromISR vTaskResumeFromISR * @endcond * \ingroup TaskCtrl @@ -1412,9 +1426,9 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * SCHEDULER CONTROL *----------------------------------------------------------*/ -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskStartScheduler( void ); @@ -1445,7 +1459,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskStartScheduler vTaskStartScheduler * @endcond * \ingroup SchedulerControl @@ -1453,7 +1467,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskEndScheduler( void ); @@ -1507,7 +1521,7 @@ void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskEndScheduler vTaskEndScheduler * @endcond * \ingroup SchedulerControl @@ -1517,7 +1531,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskSuspendAll( void ); @@ -1566,7 +1580,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskSuspendAll vTaskSuspendAll * @endcond * \ingroup SchedulerControl @@ -1574,7 +1588,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskResumeAll( void ); @@ -1626,7 +1640,7 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskResumeAll xTaskResumeAll * @endcond * \ingroup SchedulerControl @@ -1638,7 +1652,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; *----------------------------------------------------------*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TickType_t xTaskGetTickCount( void ); @@ -1647,7 +1661,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; * * @return The count of ticks since vTaskStartScheduler was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskGetTickCount xTaskGetTickCount * @endcond * \ingroup TaskUtils @@ -1655,7 +1669,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TickType_t xTaskGetTickCountFromISR( void ); @@ -1669,7 +1683,7 @@ TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; * microcontroller being used or interrupt nesting is either not supported or * not being used. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR * @endcond * \ingroup TaskUtils @@ -1677,7 +1691,7 @@ TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint16_t uxTaskGetNumberOfTasks( void ); @@ -1689,7 +1703,7 @@ TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; * has been deleted but not yet freed by the idle task will also be * included in the count. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks * @endcond * \ingroup TaskUtils @@ -1697,7 +1711,7 @@ TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * char *pcTaskGetName( TaskHandle_t xTaskToQuery ); @@ -1708,7 +1722,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; * xTaskToQuery. A task can query its own name by either passing in its own * handle, or by setting xTaskToQuery to NULL. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup pcTaskGetName pcTaskGetName * @endcond * \ingroup TaskUtils @@ -1716,7 +1730,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ); @@ -1730,7 +1744,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lin * NULL is returned if no matching name is found. INCLUDE_xTaskGetHandle * must be set to 1 in FreeRTOSConfig.h for pcTaskGetHandle() to be available. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup pcTaskGetHandle pcTaskGetHandle * @endcond * \ingroup TaskUtils @@ -1813,7 +1827,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #ifdef configUSE_APPLICATION_TASK_TAG #if configUSE_APPLICATION_TASK_TAG == 1 /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ); @@ -1830,7 +1844,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; TaskHookFunction_t pxHookFunction ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void xTaskGetApplicationTaskTag( TaskHandle_t xTask ); @@ -1844,7 +1858,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ); @@ -1932,7 +1946,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName); @@ -1952,7 +1966,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configUSE_TICK_HOOK > 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationTickHook( void ); @@ -1967,7 +1981,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) @@ -1986,7 +2000,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ); @@ -2155,7 +2169,7 @@ UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, * enough to contain the generated report. Approximately 40 bytes per * task should be sufficient. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskList vTaskList * @endcond * \ingroup TaskUtils @@ -2210,7 +2224,7 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unq * contain the generated report. Approximately 40 bytes per task should * be sufficient. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskGetRunTimeStats vTaskGetRunTimeStats * @endcond * \ingroup TaskUtils @@ -2218,7 +2232,7 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unq void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code * uint32_t ulTaskGetIdleRunTimeCounter( void ); @@ -2246,7 +2260,7 @@ void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lin * frequency configured using the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and * portGET_RUN_TIME_COUNTER_VALUE() macros. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter * @endcond * \ingroup TaskUtils @@ -2254,11 +2268,13 @@ void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lin uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction ); * BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2359,7 +2375,9 @@ uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; * @return Dependent on the value of eAction. See the description of the * eAction parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyIndexed xTaskNotifyIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, @@ -2373,11 +2391,13 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), NULL ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyAndQueryIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue ); * BaseType_t xTaskNotifyAndQuery( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2393,7 +2413,9 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, * than when the function returns) in the additional pulPreviousNotifyValue * parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyAndQueryIndexed xTaskNotifyAndQueryIndexed + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyAndQuery( xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue ) \ @@ -2402,11 +2424,13 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ); * BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2511,7 +2535,9 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, * @return Dependent on the value of eAction. See the description of the * eAction parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyIndexedFromISR xTaskNotifyIndexedFromISR + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, @@ -2526,11 +2552,13 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyAndQueryIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ); * BaseType_t xTaskNotifyAndQueryFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2546,7 +2574,9 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, * function is called rather than at the time the function returns) in the * additional pulPreviousNotifyValue parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyAndQueryIndexedFromISR xTaskNotifyAndQueryIndexedFromISR + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyAndQueryIndexedFromISR( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) \ @@ -2555,12 +2585,14 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( tskDEFAULT_INDEX_TO_NOTIFY ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyWaitIndexed( UBaseType_t uxIndexToWaitOn, uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); * * BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); * @endcode + * @endcond * * Waits for a direct to task notification to be pending at a given index within * an array of direct to task notifications. @@ -2655,7 +2687,9 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, * already pending when xTaskNotifyWait was called) then pdPASS is * returned. Otherwise pdFAIL is returned. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyWaitIndexed xTaskNotifyWaitIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, @@ -2669,11 +2703,13 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, xTaskGenericNotifyWait( ( uxIndexToWaitOn ), ( ulBitsToClearOnEntry ), ( ulBitsToClearOnExit ), ( pulNotificationValue ), ( xTicksToWait ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyGiveIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify ); * BaseType_t xTaskNotifyGive( TaskHandle_t xTaskToNotify ); * @endcode + * @endcond * * Sends a direct to task notification to a particular index in the target * task's notification array in a manner similar to giving a counting semaphore. @@ -2737,7 +2773,9 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, * @return xTaskNotifyGive() is a macro that calls xTaskNotify() with the * eAction parameter set to eIncrement - so pdPASS is always returned. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyGiveIndexed xTaskNotifyGiveIndexed + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyGive( xTaskToNotify ) \ @@ -2746,11 +2784,13 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( 0 ), eIncrement, NULL ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskNotifyGiveIndexedFromISR( TaskHandle_t xTaskHandle, UBaseType_t uxIndexToNotify, BaseType_t *pxHigherPriorityTaskWoken ); * void vTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * A version of xTaskNotifyGiveIndexed() that can be called from an interrupt * service routine (ISR). @@ -2821,7 +2861,9 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, * requested from an ISR is dependent on the port - see the documentation page * for the port in use. * + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskNotifyGiveIndexedFromISR vTaskNotifyGiveIndexedFromISR + * @endcond * \ingroup TaskNotifications */ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, @@ -2833,12 +2875,14 @@ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, vTaskGenericNotifyGiveFromISR( ( xTaskToNotify ), ( uxIndexToNotify ), ( pxHigherPriorityTaskWoken ) ); /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint32_t ulTaskNotifyTakeIndexed( UBaseType_t uxIndexToWaitOn, BaseType_t xClearCountOnExit, TickType_t xTicksToWait ); * * uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ); * @endcode + * @endcond * * Waits for a direct to task notification on a particular index in the calling * task's notification array in a manner similar to taking a counting semaphore. @@ -2927,7 +2971,9 @@ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, * @return The task's notification count before it is either cleared to zero or * decremented (see the xClearCountOnExit parameter). * + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskNotifyTakeIndexed ulTaskNotifyTakeIndexed + * @endcond * \ingroup TaskNotifications */ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, @@ -2939,12 +2985,14 @@ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, ulTaskGenericNotifyTake( ( uxIndexToWaitOn ), ( xClearCountOnExit ), ( xTicksToWait ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyStateClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToCLear ); * * BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2992,7 +3040,9 @@ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, * @return pdTRUE if the task's notification state was set to * eNotWaitingNotification, otherwise pdFALSE. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyStateClearIndexed xTaskNotifyStateClearIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, @@ -3003,12 +3053,14 @@ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, xTaskGenericNotifyStateClear( ( xTask ), ( uxIndexToClear ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint32_t ulTaskNotifyValueClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToClear, uint32_t ulBitsToClear ); * * uint32_t ulTaskNotifyValueClear( TaskHandle_t xTask, uint32_t ulBitsToClear ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -3057,7 +3109,9 @@ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, * * @return The value of the target task's notification value before the bits * specified by ulBitsToClear were cleared. + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskNotifyValueClear ulTaskNotifyValueClear + * @endcond * \ingroup TaskNotifications */ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, @@ -3069,7 +3123,7 @@ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, ulTaskGenericNotifyValueClear( ( xTask ), ( uxIndexToClear ), ( ulBitsToClear ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ); @@ -3082,14 +3136,14 @@ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, * is to be captured. The captured time includes the tick count and the number * of times the tick count has overflowed since the system first booted. * \defgroup vTaskSetTimeOutState vTaskSetTimeOutState - * @cond + * @cond !DOC_SINGLE_GROUP * \ingroup TaskCtrl * @endcond */ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code * BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ); @@ -3170,7 +3224,7 @@ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; * return uxReceived; * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCheckForTimeOut xTaskCheckForTimeOut * @endcond * \ingroup TaskCtrl @@ -3179,7 +3233,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ); @@ -3204,7 +3258,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, * blocked state and a context switch being performed. Otherwise pdFALSE. * * \defgroup xTaskCatchUpTicks xTaskCatchUpTicks - * @cond + * @cond !DOC_SINGLE_GROUP * \ingroup TaskCtrl * @endcond */ @@ -3214,7 +3268,7 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES *----------------------------------------------------------*/ -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * Return the handle of the task running on a certain CPU. Because of * the nature of SMP processing, there is no guarantee that this @@ -3335,8 +3389,8 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, * making the call, otherwise pdFALSE. */ BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION; -BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, - const TickType_t xItemValue ) PRIVILEGED_FUNCTION; +void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, + const TickType_t xItemValue ) PRIVILEGED_FUNCTION; /* * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY @@ -3399,11 +3453,6 @@ void vTaskPriorityDisinheritAfterTimeout( TaskHandle_t const pxMutexHolder, */ UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; -/* - * Get the current core affinity of a task - */ -BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; - /* * Set the uxTaskNumber of the task referenced by the xTask parameter to * uxHandle. diff --git a/tools/sdk/esp32c3/include/freertos/include/freertos/timers.h b/tools/sdk/esp32c3/include/freertos/include/freertos/timers.h index a8bc4f38c78..af6dcb23501 100644 --- a/tools/sdk/esp32c3/include/freertos/include/freertos/timers.h +++ b/tools/sdk/esp32c3/include/freertos/include/freertos/timers.h @@ -450,7 +450,7 @@ void vTimerSetTimerID( TimerHandle_t xTimer, BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * @endcond * @@ -1315,7 +1315,7 @@ TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; */ TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * Functions beyond this part are not part of the public API and are intended @@ -1339,7 +1339,7 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) diff --git a/tools/sdk/esp32c3/include/freertos/port/riscv/include/freertos/portmacro.h b/tools/sdk/esp32c3/include/freertos/port/riscv/include/freertos/portmacro.h index cb58b422658..8c09ba7df2f 100644 --- a/tools/sdk/esp32c3/include/freertos/port/riscv/include/freertos/portmacro.h +++ b/tools/sdk/esp32c3/include/freertos/port/riscv/include/freertos/portmacro.h @@ -24,178 +24,419 @@ * * 1 tab == 4 spaces! */ + #ifndef PORTMACRO_H #define PORTMACRO_H -#ifdef __cplusplus -extern "C" { -#endif - #ifndef __ASSEMBLER__ +#include "sdkconfig.h" #include #include #include #include -#include -#include "esp_timer.h" /* required for FreeRTOS run time stats */ - -#include "sdkconfig.h" +#include "soc/spinlock.h" +#include "soc/interrupt_core0_reg.h" +#include "soc/cpu.h" #include "esp_attr.h" +#include "esp_rom_sys.h" +#include "esp_timer.h" /* required for FreeRTOS run time stats */ #include "esp_heap_caps.h" +#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */ +#include "esp_newlib.h" +#include "portbenchmark.h" + +/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */ +#include #ifdef CONFIG_LEGACY_INCLUDE_COMMON_HEADERS #include "soc/soc_memory_layout.h" #endif -#include "soc/spinlock.h" -#include "soc/interrupt_core0_reg.h" -#include "esp_rom_sys.h" -#include "soc/cpu.h" -#include "esp_system.h" -#include "esp_newlib.h" -/*----------------------------------------------------------- - * Port specific definitions. - * - * The settings in this file configure FreeRTOS correctly for the - * given hardware and compiler. - * - * These settings should not be altered. - *----------------------------------------------------------- - */ +#ifdef __cplusplus +extern "C" { +#endif -/* Type definitions. */ -#define portCHAR uint8_t -#define portFLOAT float -#define portDOUBLE double -#define portLONG int32_t -#define portSHORT int16_t -#define portSTACK_TYPE uint8_t -#define portBASE_TYPE int -// interrupt module will mask interrupt with priority less than threshold -#define RVHAL_EXCM_LEVEL 4 -typedef portSTACK_TYPE StackType_t; -typedef portBASE_TYPE BaseType_t; -typedef unsigned portBASE_TYPE UBaseType_t; -#if( configUSE_16_BIT_TICKS == 1 ) - typedef uint16_t TickType_t; - #define portMAX_DELAY ( TickType_t ) 0xffff +/* --------------------------------------------------- Port Types ------------------------------------------------------ + * - Port specific types. + * - The settings in this file configure FreeRTOS correctly for the given hardware and compiler. + * - These settings should not be altered. + * - The port types must come first as they are used further down in this file + * ------------------------------------------------------------------------------------------------------------------ */ + +#define portCHAR uint8_t +#define portFLOAT float +#define portDOUBLE double +#define portLONG int32_t +#define portSHORT int16_t +#define portSTACK_TYPE uint8_t +#define portBASE_TYPE int + +typedef portSTACK_TYPE StackType_t; +typedef portBASE_TYPE BaseType_t; +typedef unsigned portBASE_TYPE UBaseType_t; + +#if (configUSE_16_BIT_TICKS == 1) +typedef uint16_t TickType_t; +#define portMAX_DELAY (TickType_t) 0xffff #else - typedef uint32_t TickType_t; - #define portMAX_DELAY ( TickType_t ) 0xffffffffUL +typedef uint32_t TickType_t; +#define portMAX_DELAY (TickType_t) 0xffffffffUL #endif -/*------------------------------------------------------*/ -/* Architecture specifics. */ -#define portSTACK_GROWTH ( -1 ) -#define portTICK_PERIOD_MS ( ( TickType_t ) (1000 / configTICK_RATE_HZ) ) -#define portBYTE_ALIGNMENT 16 -/*-----------------------------------------------------------*/ -#include "portbenchmark.h" +/* Task function macros as described on the FreeRTOS.org WEB site. */ +#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters) +#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters) -static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) { - return cpu_hal_get_core_id(); -} +// interrupt module will mask interrupt with priority less than threshold +#define RVHAL_EXCM_LEVEL 4 -static inline bool IRAM_ATTR xPortCanYield(void) -{ - uint32_t threshold = REG_READ(INTERRUPT_CORE0_CPU_INT_THRESH_REG); - /* when enter critical code, freertos will mask threshold to RVHAL_EXCM_LEVEL - * and exit critical code, will recover threshold value (1). so threshold <= 1 - * means not in critical code - */ - return (threshold <= 1); -} +/* ----------------------------------------------- Port Configurations ------------------------------------------------- + * - Configurations values supplied by each port + * - Required by FreeRTOS + * ------------------------------------------------------------------------------------------------------------------ */ -static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) -{ -#if defined(CONFIG_SPIRAM) - compare_and_set_extram(addr, compare, set); -#endif -} +#define portCRITICAL_NESTING_IN_TCB 0 +#define portSTACK_GROWTH (-1) +#define portTICK_PERIOD_MS ((TickType_t) (1000 / configTICK_RATE_HZ)) +#define portBYTE_ALIGNMENT 16 +#define portNOP() __asm volatile (" nop ") -static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { - compare_and_set_native(addr, compare, set); -} -#define portCRITICAL_NESTING_IN_TCB 0 -/* - * Send an interrupt to another core in order to make the task running - * on it yield for a higher-priority task. - */ -void vPortYieldOtherCore( BaseType_t coreid); +/* ---------------------------------------------- Forward Declarations ------------------------------------------------- + * - Forward declarations of all the port functions and macros need to implement the FreeRTOS porting interface + * - These must come before definition/declaration of the FreeRTOS porting interface + * ------------------------------------------------------------------------------------------------------------------ */ -/* - Callback to set a watchpoint on the end of the stack. Called every context switch to change the stack - watchpoint around. - */ -void vPortSetStackWatchpoint( void* pxStackStart ); +// --------------------- Interrupts ------------------------ -/* - * Returns true if the current core is in ISR context; low prio ISR, med prio ISR or timer tick ISR. High prio ISRs - * aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. +/** + * @brief Checks if the current core is in an ISR context + * + * - ISR context consist of Low/Mid priority ISR, or time tick ISR + * - High priority ISRs aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. + * + * @note [refactor-todo] Check if this should be inlined + * @return + * - pdTRUE if in ISR + * - pdFALSE otherwise */ BaseType_t xPortInIsrContext(void); -/* - * This function will be called in High prio ISRs. Returns true if the current core was in ISR context - * before calling into high prio ISR context. +/** + * @brief Check if in ISR context from High priority ISRs + * + * - Called from High priority ISR + * - Checks if the previous context (before high priority interrupt) was in ISR context (meaning low/med priority) + * + * @note [refactor-todo] Check if this should be inlined + * @return + * - pdTRUE if in previous in ISR context + * - pdFALSE otherwise */ BaseType_t xPortInterruptedFromISRContext(void); -/* "mux" data structure (spinlock) */ +/** + * @brief Disable interrupts in a nested manner + * + * - Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. + * - They can be called from interrupts too. + * - WARNING Only applies to current CPU. + * + * @note [refactor-todo] Define this as portSET_INTERRUPT_MASK_FROM_ISR() instead + * @return unsigned Previous interrupt state + */ +static inline unsigned portENTER_CRITICAL_NESTED(void); + +/* ---------------------- Spinlocks ------------------------ + - Spinlocks added to match API with SMP FreeRTOS. Single core RISC-V does not need spin locks + - Because single core does not have a primitive spinlock data type, we have to implement one here + * @note [refactor-todo] Refactor critical section API so that this is no longer required + * ------------------------------------------------------ */ + +/** + * @brief Spinlock object + * Owner: + * - Set to 0 if uninitialized + * - Set to portMUX_FREE_VAL when free + * - Set to CORE_ID_REGVAL_PRO or CORE_ID_REGVAL_AP when locked + * - Any other value indicates corruption + * Count: + * - 0 if unlocked + * - Recursive count if locked + * + * @note Not a true spinlock as single core RISC-V does not have atomic compare and set instruction + * @note Keep portMUX_INITIALIZER_UNLOCKED in sync with this struct + */ typedef struct { - /* owner field values: - * 0 - Uninitialized (invalid) - * portMUX_FREE_VAL - Mux is free, can be locked by either CPU - * CORE_ID_REGVAL_PRO / CORE_ID_REGVAL_APP - Mux is locked to the particular core - * - * - * Any value other than portMUX_FREE_VAL, CORE_ID_REGVAL_PRO, CORE_ID_REGVAL_APP indicates corruption - */ - uint32_t owner; - /* count field: - * If mux is unlocked, count should be zero. - * If mux is locked, count is non-zero & represents the number of recursive locks on the mux. - */ - uint32_t count; + uint32_t owner; + uint32_t count; #ifdef CONFIG_FREERTOS_PORTMUX_DEBUG - const char *lastLockedFn; - int lastLockedLine; + const char *lastLockedFn; + int lastLockedLine; #endif } portMUX_TYPE; +/**< Spinlock initializer */ +#ifndef CONFIG_FREERTOS_PORTMUX_DEBUG +#define portMUX_INITIALIZER_UNLOCKED { \ + .owner = portMUX_FREE_VAL, \ + .count = 0, \ + } +#else +#define portMUX_INITIALIZER_UNLOCKED { \ + .owner = portMUX_FREE_VAL, \ + .count = 0, \ + .lastLockedFn = "(never locked)", \ + .lastLockedLine = -1 \ + } +#endif /* CONFIG_FREERTOS_PORTMUX_DEBUG */ +#define portMUX_FREE_VAL SPINLOCK_FREE /**< Spinlock is free. [refactor-todo] check if this is still required */ +#define portMUX_NO_TIMEOUT SPINLOCK_WAIT_FOREVER /**< When passed for 'timeout_cycles', spin forever if necessary. [refactor-todo] check if this is still required */ +#define portMUX_TRY_LOCK SPINLOCK_NO_WAIT /**< Try to acquire the spinlock a single time only. [refactor-todo] check if this is still required */ + +/** + * @brief Initialize a spinlock + * + * - Initializes a spinlock that is used by FreeRTOS SMP critical sections + * + * @note [refactor-todo] We can make this inline or consider making it a macro + * @param[in] mux Spinlock + */ +void vPortCPUInitializeMutex(portMUX_TYPE *mux); -#define portMUX_FREE_VAL SPINLOCK_FREE +/** + * @brief Acquire a spinlock + * + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this should be inlined + * @param[in] mux Spinlock + */ +void vPortCPUAcquireMutex(portMUX_TYPE *mux); -/* Special constants for vPortCPUAcquireMutexTimeout() */ -#define portMUX_NO_TIMEOUT SPINLOCK_WAIT_FOREVER /* When passed for 'timeout_cycles', spin forever if necessary */ -#define portMUX_TRY_LOCK SPINLOCK_NO_WAIT /* Try to acquire the spinlock a single time only */ +/** + * @brief Acquire a spinlock but with a specified timeout + * + * @note [refactor-todo] Check if we still need this + * @note [refactor-todo] Check if this should be inlined + * @note [refactor-todo] Check if this function should be renamed (due to bool return type) + * @param[in] mux Spinlock + * @param[in] timeout Timeout in number of CPU cycles + * @return true Spinlock acquired + * @return false Timed out + */ +bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout_cycles); -// Keep this in sync with the portMUX_TYPE struct definition please. -#ifndef CONFIG_FREERTOS_PORTMUX_DEBUG -#define portMUX_INITIALIZER_UNLOCKED { \ - .owner = portMUX_FREE_VAL, \ - .count = 0, \ - } -#else -#define portMUX_INITIALIZER_UNLOCKED { \ - .owner = portMUX_FREE_VAL, \ - .count = 0, \ - .lastLockedFn = "(never locked)", \ - .lastLockedLine = -1 \ - } -#endif +/** + * @brief Release a spinlock + * + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this should be inlined + * @param[in] mux Spinlock + */ +void vPortCPUReleaseMutex(portMUX_TYPE *mux); -/* Scheduler utilities. */ -extern void vPortYield( void ); -extern void vPortYieldFromISR( void ); +/** + * @brief Wrapper for atomic compare-and-set instruction + * + * @note Isn't a real atomic CAS. + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this function should be renamed (due to void return type) + * + * @param[inout] addr Pointer to target address + * @param[in] compare Compare value + * @param[inout] set Pointer to set value + */ +static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set); -#define portYIELD() vPortYield() -#define portYIELD_FROM_ISR() vPortYieldFromISR() +/** + * @brief Wrapper for atomic compare-and-set instruction in external RAM + * + * @note Isn't a real atomic CAS. + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this function should be renamed (due to void return type) + * + * @param[inout] addr Pointer to target address + * @param[in] compare Compare value + * @param[inout] set Pointer to set value + */ +static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set); + +// ------------------ Critical Sections -------------------- + +/** + * @brief Enter a critical section + * + * - Simply disable interrupts + * - Can be nested + */ +void vPortEnterCritical(void); + +/** + * @brief Exit a critical section + * + * - Reenables interrupts + * - Can be nested + */ +void vPortExitCritical(void); + +// ---------------------- Yielding ------------------------- +/** + * @brief Set interrupt mask and return current interrupt enable register + * + * @note [refactor-todo] Check if this function should be renamed (due to int return type) + * @return int Current interrupt enable register before set + */ +int vPortSetInterruptMask(void); + +/** + * @brief Clear current interrupt mask and set given mask + * + * @param mask Interrupt mask + */ +void vPortClearInterruptMask(int mask); + +/** + * @brief Perform a context switch from a task + * + * @note [refactor-todo] The rest of ESP-IDF should call taskYield() instead + */ +void vPortYield(void); + +/** + * @brief Perform a context switch from an ISR + */ +void vPortYieldFromISR(void); + +/** + * @brief Yields the other core + * + * @note Added to be compatible with SMP API + * @note [refactor-todo] Put this into private macros as its only called from task.c and is not public API + * @param coreid ID of core to yield + */ +void vPortYieldOtherCore(BaseType_t coreid); + +/** + * @brief Checks if the current core can yield + * + * - A core cannot yield if its in an ISR or in a critical section + * + * @note [refactor-todo] See if this can be separated from port macro + * @note [refactor-todo] Check if this function should be renamed (due to bool return type) + * @return true Core can yield + * @return false Core cannot yield + */ +static inline bool IRAM_ATTR xPortCanYield(void); + +// ------------------- Hook Functions ---------------------- + +extern void esp_vApplicationIdleHook(void); +extern void esp_vApplicationTickHook(void); + +/** + * @brief Hook function called on entry to tickless idle + * + * - Implemented in pm_impl.c + * + * @param xExpectedIdleTime Expected idle time + */ +void vApplicationSleep(TickType_t xExpectedIdleTime); + +// ----------------------- System -------------------------- + +/** + * @brief Get the tick rate per second + * + * @note [refactor-todo] make this inline + * @note [refactor-todo] Check if this function should be renamed (due to uint return type) + * @return uint32_t Tick rate in Hz + */ +uint32_t xPortGetTickRateHz(void); + +/** + * @brief Set a watchpoint to watch the last 32 bytes of the stack + * + * Callback to set a watchpoint on the end of the stack. Called every context switch to change the stack watchpoint + * around. + * + * @param pxStackStart Pointer to the start of the stack + */ +void vPortSetStackWatchpoint(void *pxStackStart); + +/** + * @brief Get the current core's ID + * + * @note Added to be compatible with SMP API + * @note [refactor-todo] IDF should call a FreeRTOS like macro instead of port function directly + * @return BaseType_t Core ID + */ +static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) +{ + return (uint32_t) cpu_hal_get_core_id(); +} + + + +/* ------------------------------------------- FreeRTOS Porting Interface ---------------------------------------------- + * - Contains all the mappings of the macros required by FreeRTOS + * - Most come after forward declare as porting macros map to declared functions + * - Maps to forward declared functions + * ------------------------------------------------------------------------------------------------------------------ */ + +// ----------------------- Memory -------------------------- + +/** + * @brief Task memory allocation macros + * + * @note Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force the stack + * memory to always be internal. + * @note [refactor-todo] Update portable.h to match v10.4.3 to use new malloc prototypes + */ +#define portTcbMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define portStackMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define pvPortMallocTcbMem(size) pvPortMalloc(size) +#define pvPortMallocStackMem(size) pvPortMalloc(size) + +// --------------------- Interrupts ------------------------ + +#define portEXIT_CRITICAL_NESTED(state) do { portCLEAR_INTERRUPT_MASK_FROM_ISR(state);} while(0); +#define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK_FROM_ISR() +#define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK_FROM_ISR(1) +#define portSET_INTERRUPT_MASK_FROM_ISR() vPortSetInterruptMask() +#define portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedStatusValue) vPortClearInterruptMask(uxSavedStatusValue) + +// ------------------ Critical Sections -------------------- + +#define portENTER_CRITICAL(mux) {(void)mux; vPortEnterCritical();} +#define portEXIT_CRITICAL(mux) {(void)mux; vPortExitCritical();} +//In single-core RISC-V, we can use the same critical section API +#define portENTER_CRITICAL_ISR(mux) portENTER_CRITICAL(mux) +#define portEXIT_CRITICAL_ISR(mux) portEXIT_CRITICAL(mux) +/* [refactor-todo] on RISC-V, both ISR and non-ISR cases result in the same call. We can redefine this macro */ +#define portENTER_CRITICAL_SAFE(mux) ({ \ + if (xPortInIsrContext()) { \ + portENTER_CRITICAL_ISR(mux); \ + } else { \ + portENTER_CRITICAL(mux); \ + } \ +}) +#define portEXIT_CRITICAL_SAFE(mux) ({ \ + if (xPortInIsrContext()) { \ + portEXIT_CRITICAL_ISR(mux); \ + } else { \ + portEXIT_CRITICAL(mux); \ + } \ +}) + +// ---------------------- Yielding ------------------------- + +#define portYIELD() vPortYield() +#define portYIELD_FROM_ISR() vPortYieldFromISR() +#define portEND_SWITCHING_ISR(xSwitchRequired) if(xSwitchRequired) vPortYield() /* Yielding within an API call (when interrupts are off), means the yield should be delayed until interrupts are re-enabled. To do this, we use the "cross-core" interrupt as a trigger to yield on this core when interrupts are re-enabled.This @@ -203,112 +444,104 @@ extern void vPortYieldFromISR( void ); happening on the same CPU. */ #define portYIELD_WITHIN_API() portYIELD() -/*-----------------------------------------------------------*/ - -/* Critical section management. */ -extern int vPortSetInterruptMask(void); -extern void vPortClearInterruptMask( int ); - -void vPortCPUInitializeMutex(portMUX_TYPE *mux); -void vPortCPUAcquireMutex(portMUX_TYPE *mux); -bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout_cycles); -void vPortCPUReleaseMutex(portMUX_TYPE *mux); -extern void vPortEnterCritical( void ); -extern void vPortExitCritical( void ); - -#define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK_FROM_ISR() -#define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK_FROM_ISR(1) - -#define portENTER_CRITICAL(mux) {(void)mux; vPortEnterCritical();} -#define portEXIT_CRITICAL(mux) {(void)mux; vPortExitCritical();} - -#define portENTER_CRITICAL_ISR(mux) portENTER_CRITICAL(mux) -#define portEXIT_CRITICAL_ISR(mux) portEXIT_CRITICAL(mux) - -#define portENTER_CRITICAL_SAFE(mux) do { \ - if (xPortInIsrContext()) { \ - portENTER_CRITICAL_ISR(mux); \ - } else { \ - portENTER_CRITICAL(mux); \ - } \ - } while(0) - -#define portEXIT_CRITICAL_SAFE(mux) do { \ - if (xPortInIsrContext()) { \ - portEXIT_CRITICAL_ISR(mux); \ - } else { \ - portEXIT_CRITICAL(mux); \ - } \ - } while(0) - -/*------------------------------------------------------------*/ -#define portSET_INTERRUPT_MASK_FROM_ISR() vPortSetInterruptMask() -#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) vPortClearInterruptMask( uxSavedStatusValue ) -#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYield() - -// Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. -// They can be called from interrupts too. -static inline unsigned portENTER_CRITICAL_NESTED(void) { - unsigned state = portSET_INTERRUPT_MASK_FROM_ISR(); - return state; -} +// ------------------- Hook Functions ---------------------- -#define portEXIT_CRITICAL_NESTED(state) do { portCLEAR_INTERRUPT_MASK_FROM_ISR( state );} while(0); -/*-----------------------------------------------------------*/ - -//Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force -//the stack memory to always be internal. -#define portTcbMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) -#define portStackMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#ifndef CONFIG_FREERTOS_LEGACY_HOOKS +#define vApplicationIdleHook esp_vApplicationIdleHook +#define vApplicationTickHook esp_vApplicationTickHook +#endif /* !CONFIG_FREERTOS_LEGACY_HOOKS */ +#define portSUPPRESS_TICKS_AND_SLEEP(idleTime) vApplicationSleep(idleTime) -#define pvPortMallocTcbMem(size) pvPortMalloc(size) -#define pvPortMallocStackMem(size) pvPortMalloc(size) +// ------------------- Run Time Stats ---------------------- -/* Fine resolution time */ -#define portGET_RUN_TIME_COUNTER_VALUE() 0 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() - +#define portGET_RUN_TIME_COUNTER_VALUE() 0 #ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER /* Coarse resolution time (us) */ #define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0) #endif -extern void esp_vApplicationIdleHook( void ); -extern void esp_vApplicationTickHook( void ); -#ifndef CONFIG_FREERTOS_LEGACY_HOOKS -#define vApplicationIdleHook esp_vApplicationIdleHook -#define vApplicationTickHook esp_vApplicationTickHook -#endif /* !CONFIG_FREERTOS_LEGACY_HOOKS */ -/* Task function macros as described on the FreeRTOS.org WEB site. */ -#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) -#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) +/* --------------------------------------------- Inline Implementations ------------------------------------------------ + * - Implementation of inline functions of the forward declares + * - Should come after forward declare and FreeRTOS Porting interface, as implementation may use both. + * - For implementation of non-inlined functions, see port.c, port_common.c, or other assembly files + * ------------------------------------------------------------------------------------------------------------------ */ -void vApplicationSleep( TickType_t xExpectedIdleTime ); -#define portSUPPRESS_TICKS_AND_SLEEP( idleTime ) vApplicationSleep( idleTime ) +// --------------------- Interrupts ------------------------ -#define portNOP() __asm volatile ( " nop " ) +static inline unsigned portENTER_CRITICAL_NESTED(void) +{ + unsigned state = portSET_INTERRUPT_MASK_FROM_ISR(); + return state; +} -#define portVALID_TCB_MEM(ptr) esp_ptr_byte_accessible(ptr) -#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr) +// ---------------------- Spinlocks ------------------------ -/* Get tick rate per second */ -uint32_t xPortGetTickRateHz(void); +static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + compare_and_set_native(addr, compare, set); +} -// configASSERT_2 if requested -#if configASSERT_2 -#include -void exit(int); -#define configASSERT( x ) if (!(x)) { porttracePrint(-1); printf("\nAssertion failed in %s:%d\n", __FILE__, __LINE__); exit(-1); } +static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ +#if defined(CONFIG_SPIRAM) + compare_and_set_extram(addr, compare, set); #endif +} +// ---------------------- Yielding ------------------------- -#endif //__ASSEMBLER__ +static inline bool IRAM_ATTR xPortCanYield(void) +{ + uint32_t threshold = REG_READ(INTERRUPT_CORE0_CPU_INT_THRESH_REG); + /* when enter critical code, FreeRTOS will mask threshold to RVHAL_EXCM_LEVEL + * and exit critical code, will recover threshold value (1). so threshold <= 1 + * means not in critical code + */ + return (threshold <= 1); +} + + + +/* ------------------------------------------------------ Misc --------------------------------------------------------- + * - Miscellaneous porting macros + * - These are not port of the FreeRTOS porting interface, but are used by other FreeRTOS dependent components + * ------------------------------------------------------------------------------------------------------------------ */ + +// -------------------- Heap Related ----------------------- + +/** + * @brief Checks if a given piece of memory can be used to store a task's TCB + * + * - Defined in port_common.c + * + * @param ptr Pointer to memory + * @return true Memory can be used to store a TCB + * @return false Otherwise + */ +bool xPortCheckValidTCBMem(const void *ptr); + +/** + * @brief Checks if a given piece of memory can be used to store a task's stack + * + * - Defined in port_common.c + * + * @param ptr Pointer to memory + * @return true Memory can be used to store a task stack + * @return false Otherwise + */ +bool xPortcheckValidStackMem(const void *ptr); + +#define portVALID_TCB_MEM(ptr) xPortCheckValidTCBMem(ptr) +#define portVALID_STACK_MEM(ptr) xPortcheckValidStackMem(ptr) #ifdef __cplusplus } #endif +#endif //__ASSEMBLER__ + #endif /* PORTMACRO_H */ diff --git a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2s_ll.h b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2s_ll.h index 670db91616b..0cfb05a266a 100644 --- a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2s_ll.h +++ b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/i2s_ll.h @@ -1,16 +1,8 @@ -// Copyright 2021 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: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ // The LL layer for I2S register operations /******************************************************************************* @@ -86,6 +78,26 @@ static inline void i2s_ll_rx_enable_clock(i2s_dev_t *hw) hw->rx_clkm_conf.rx_clk_active = 1; } +/** + * @brief Disable I2S tx module clock + * + * @param hw Peripheral I2S hardware instance address. + */ +static inline void i2s_ll_tx_disable_clock(i2s_dev_t *hw) +{ + hw->tx_clkm_conf.tx_clk_active = 0; +} + +/** + * @brief Disable I2S rx module clock + * + * @param hw Peripheral I2S hardware instance address. + */ +static inline void i2s_ll_rx_disable_clock(i2s_dev_t *hw) +{ + hw->rx_clkm_conf.rx_clk_active = 0; +} + /** * @brief I2S mclk use tx module clock * diff --git a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/rmt_ll.h b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/rmt_ll.h index 0f703aebc75..662e63f784e 100644 --- a/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/rmt_ll.h +++ b/tools/sdk/esp32c3/include/hal/esp32c3/include/hal/rmt_ll.h @@ -1,16 +1,9 @@ -// Copyright 2020 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: 2020-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + #pragma once #include @@ -23,6 +16,9 @@ extern "C" { #endif + +#define RMT_LL_MAX_LOOP_COUNT (1023)/*!< Max loop count that hardware is supported */ + #define RMT_LL_HW_BASE (&RMT) #define RMT_LL_MEM_BASE (&RMTMEM) diff --git a/tools/sdk/esp32c3/include/hal/include/hal/i2s_hal.h b/tools/sdk/esp32c3/include/hal/include/hal/i2s_hal.h index a08813db808..037970fa2b3 100644 --- a/tools/sdk/esp32c3/include/hal/include/hal/i2s_hal.h +++ b/tools/sdk/esp32c3/include/hal/include/hal/i2s_hal.h @@ -1,16 +1,8 @@ -// Copyright 2020 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: 2020-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ /******************************************************************************* * NOTICE @@ -176,28 +168,28 @@ void i2s_hal_enable_slave_fd_mode(i2s_hal_context_t *hal); * * @param hal Context of the HAL layer */ -#define i2s_hal_start_tx(hal) i2s_ll_tx_start((hal)->dev) +void i2s_hal_start_tx(i2s_hal_context_t *hal); /** * @brief Start I2S rx * * @param hal Context of the HAL layer */ -#define i2s_hal_start_rx(hal) i2s_ll_rx_start((hal)->dev) +void i2s_hal_start_rx(i2s_hal_context_t *hal); /** * @brief Stop I2S tx * * @param hal Context of the HAL layer */ -#define i2s_hal_stop_tx(hal) i2s_ll_tx_stop((hal)->dev) +void i2s_hal_stop_tx(i2s_hal_context_t *hal); /** * @brief Stop I2S rx * * @param hal Context of the HAL layer */ -#define i2s_hal_stop_rx(hal) i2s_ll_rx_stop((hal)->dev) +void i2s_hal_stop_rx(i2s_hal_context_t *hal); /** * @brief Set the received data length to trigger `in_suc_eof` interrupt. diff --git a/tools/sdk/esp32c3/include/hal/include/hal/lcd_hal.h b/tools/sdk/esp32c3/include/hal/include/hal/lcd_hal.h index 76e28dda0e4..db255b3d1e4 100644 --- a/tools/sdk/esp32c3/include/hal/include/hal/lcd_hal.h +++ b/tools/sdk/esp32c3/include/hal/include/hal/lcd_hal.h @@ -1,22 +1,8 @@ -// Copyright 2021 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. - -/******************************************************************************* - * NOTICE - * The HAL is not public api, don't use in application code. - * See readme.md in soc/README.md - ******************************************************************************/ +/* + * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once diff --git a/tools/sdk/esp32c3/include/hal/include/hal/lcd_types.h b/tools/sdk/esp32c3/include/hal/include/hal/lcd_types.h index 69dab14801d..01e6d0c2949 100644 --- a/tools/sdk/esp32c3/include/hal/include/hal/lcd_types.h +++ b/tools/sdk/esp32c3/include/hal/include/hal/lcd_types.h @@ -1,16 +1,8 @@ -// Copyright 2021 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: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -21,15 +13,12 @@ extern "C" { /** * @brief LCD clock source * @note User should select the clock source based on the real requirement: - * ╔═════════════════════╦══════════════════════════╦════════════════════════════╗ - * ║ LCD clock source ║ Features ║ Power Management ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_PLL160M ║ High resolution, fixed ║ ESP_PM_APB_FREQ_MAX lock ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_APLL ║ Configurable resolution ║ ESP_PM_NO_LIGHT_SLEEP lock ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_XTAL ║ Medium resolution, fixed ║ No PM lock ║ - * ╚═════════════════════╩══════════════════════════╩════════════════════════════╝ + * + * | LCD clock source | Features | Power Management | + * |---------------------|--------------------------|----------------------------| + * | LCD_CLK_SRC_PLL160M | High resolution, fixed | ESP_PM_APB_FREQ_MAX lock | + * | LCD_CLK_SRC_APLL | Configurable resolution | ESP_PM_NO_LIGHT_SLEEP lock | + * | LCD_CLK_SRC_XTAL | Medium resolution, fixed | No PM lock | */ typedef enum { LCD_CLK_SRC_PLL160M, /*!< Select PLL160M as the source clock */ diff --git a/tools/sdk/esp32c3/include/hal/include/hal/touch_sensor_types.h b/tools/sdk/esp32c3/include/hal/include/hal/touch_sensor_types.h index ec027bf8705..9085f5eecd8 100644 --- a/tools/sdk/esp32c3/include/hal/include/hal/touch_sensor_types.h +++ b/tools/sdk/esp32c3/include/hal/include/hal/touch_sensor_types.h @@ -1,16 +1,8 @@ -// Copyright 2015-2020 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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -155,12 +147,23 @@ typedef enum { TOUCH_PAD_INTR_MASK_INACTIVE = BIT(2), /*! +#include +#include "sdkconfig.h" +#include "esp_err.h" #if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/spi_flash.h" #elif CONFIG_IDF_TARGET_ESP32S2 @@ -34,9 +40,9 @@ extern "C" { #endif /** - * @brief Register ROM functions and init flash device registers to make use of octal flash + * @brief To setup Flash chip */ -esp_err_t esp_opiflash_init(void); +esp_err_t spi_flash_init_chip_state(void); /** * @brief Make MSPI work under 20Mhz @@ -88,6 +94,12 @@ void spi_timing_get_flash_timing_param(spi_flash_hal_timing_config_t *out_timing */ bool spi_timine_config_flash_is_tuned(void); +/** + * @brief Set Flash chip specifically required MSPI register settings here + */ +void spi_flash_set_vendor_required_regs(void); + + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32c3/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h b/tools/sdk/esp32c3/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h new file mode 100644 index 00000000000..4292213943f --- /dev/null +++ b/tools/sdk/esp32c3/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _ESP_MBO_H +#define _ESP_MBO_H + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * enum non_pref_chan_reason: Reason for non preference of channel + */ +enum non_pref_chan_reason { + NON_PREF_CHAN_REASON_UNSPECIFIED = 0, + NON_PREF_CHAN_REASON_RSSI = 1, + NON_PREF_CHAN_REASON_EXT_INTERFERENCE = 2, + NON_PREF_CHAN_REASON_INT_INTERFERENCE = 3, +}; + +/** + * @brief Channel structure for non preferred channel + * + * @param reason: enum non_pref_chan_reason + * @param oper_class: operating class for the channel + * @param chan: channel number + * @param preference: channel preference + */ +struct non_pref_chan { + enum non_pref_chan_reason reason; + uint8_t oper_class; + uint8_t chan; + uint8_t preference; +}; + +/** + * @brief Array structure for non preferred channel struct + * + * @param non_pref_chan_num: channel count + * @param chan: array of non_pref_chan type + */ +struct non_pref_chan_s { + size_t non_pref_chan_num; + struct non_pref_chan chan[]; +}; + +/** + * @brief Update channel preference for MBO IE + * + * @param non_pref_chan: Non preference channel list + * + * @return + * - 0: success else failure + */ +int esp_mbo_update_non_pref_chan(struct non_pref_chan_s *non_pref_chan); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/tools/sdk/esp32c3/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h b/tools/sdk/esp32c3/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h index a1dcfb655c5..4301385d2cf 100644 --- a/tools/sdk/esp32c3/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h +++ b/tools/sdk/esp32c3/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h @@ -1,17 +1,7 @@ -/** - * Copyright 2020 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 +/* + * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD * - * 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-License-Identifier: Apache-2.0 */ #ifndef _ESP_WNM_H @@ -29,11 +19,13 @@ enum btm_query_reason { REASON_UNSPECIFIED = 0, REASON_FRAME_LOSS = 1, REASON_DELAY = 2, - REASON_QOS_CAPACITY = 3, - REASON_FIRST_ASSOC = 4, - REASON_LOAD_BALALNCE = 5, - REASON_BETTER_AP = 6, - REASON_CURRENT_DEAUTH = 7, + REASON_BANDWIDTH = 3, + REASON_LOAD_BALANCE = 4, + REASON_RSSI = 5, + REASON_RETRANSMISSIONS = 6, + REASON_INTERFERENCE = 7, + REASON_GRAY_ZONE = 8, + REASON_PREMIUM_AP = 9, }; /** diff --git a/tools/sdk/esp32c3/ld/libcat_face_detect.a b/tools/sdk/esp32c3/ld/libcat_face_detect.a new file mode 100644 index 00000000000..7a747df92d8 Binary files /dev/null and b/tools/sdk/esp32c3/ld/libcat_face_detect.a differ diff --git a/tools/sdk/esp32c3/ld/libdl.a b/tools/sdk/esp32c3/ld/libdl.a new file mode 100644 index 00000000000..266d5b7036e Binary files /dev/null and b/tools/sdk/esp32c3/ld/libdl.a differ diff --git a/tools/sdk/esp32c3/ld/libhuman_face_detect.a b/tools/sdk/esp32c3/ld/libhuman_face_detect.a new file mode 100644 index 00000000000..cd08ef9b491 Binary files /dev/null and b/tools/sdk/esp32c3/ld/libhuman_face_detect.a differ diff --git a/tools/sdk/esp32c3/ld/sections.ld b/tools/sdk/esp32c3/ld/sections.ld index 2338ee8b467..692ccf1f130 100644 --- a/tools/sdk/esp32c3/ld/sections.ld +++ b/tools/sdk/esp32c3/ld/sections.ld @@ -164,7 +164,7 @@ SECTIONS *libesp_system.a:ubsan.*(.literal .literal.* .text .text.*) *libfreertos.a:(EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal.* EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text.*) *libfreertos.a:port.*(.text .text.prvTaskExitError .text.pxPortInitialiseStack .text.vApplicationStackOverflowHook .text.vPortCPUAcquireMutex .text.vPortCPUAcquireMutexTimeout .text.vPortCPUInitializeMutex .text.vPortCPUReleaseMutex .text.vPortClearInterruptMask .text.vPortEndScheduler .text.vPortEnterCritical .text.vPortExitCritical .text.vPortSetInterruptMask .text.vPortSetStackWatchpoint .text.vPortYield .text.vPortYieldFromISR .text.vPortYieldOtherCore .text.xPortGetTickRateHz .text.xPortInIsrContext .text.xPortStartScheduler) - *libfreertos.a:port_common.*(.text .text.esp_startup_start_app_common) + *libfreertos.a:port_common.*(.text .text.esp_startup_start_app_common .text.xPortCheckValidTCBMem .text.xPortcheckValidStackMem) *libgcc.a:_divsf3.*(.literal .literal.* .text .text.*) *libgcc.a:lib2funcs.*(.literal .literal.* .text .text.*) *libgcov.a:(.literal .literal.* .text .text.*) @@ -311,8 +311,8 @@ SECTIONS _bss_start = ABSOLUTE(.); *(.bss .bss.*) - *(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem) *(.ext_ram.bss .ext_ram.bss.*) + *(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem) *(COMMON) _bt_bss_start = ABSOLUTE(.); *libbt.a:(.bss .bss.* COMMON) diff --git a/tools/sdk/esp32c3/lib/libapp_trace.a b/tools/sdk/esp32c3/lib/libapp_trace.a index f41ecffbefc..05a6e036ee3 100644 Binary files a/tools/sdk/esp32c3/lib/libapp_trace.a and b/tools/sdk/esp32c3/lib/libapp_trace.a differ diff --git a/tools/sdk/esp32c3/lib/libapp_update.a b/tools/sdk/esp32c3/lib/libapp_update.a index a76a5a0d19e..240e222f54d 100644 Binary files a/tools/sdk/esp32c3/lib/libapp_update.a and b/tools/sdk/esp32c3/lib/libapp_update.a differ diff --git a/tools/sdk/esp32c3/lib/libbootloader_support.a b/tools/sdk/esp32c3/lib/libbootloader_support.a index 8dee3407a13..3d1b9717628 100644 Binary files a/tools/sdk/esp32c3/lib/libbootloader_support.a and b/tools/sdk/esp32c3/lib/libbootloader_support.a differ diff --git a/tools/sdk/esp32c3/lib/libbt.a b/tools/sdk/esp32c3/lib/libbt.a index 97808822530..c40b123135d 100644 Binary files a/tools/sdk/esp32c3/lib/libbt.a and b/tools/sdk/esp32c3/lib/libbt.a differ diff --git a/tools/sdk/esp32c3/lib/libcoap.a b/tools/sdk/esp32c3/lib/libcoap.a index 407310ba1cb..96337f123e7 100644 Binary files a/tools/sdk/esp32c3/lib/libcoap.a and b/tools/sdk/esp32c3/lib/libcoap.a differ diff --git a/tools/sdk/esp32c3/lib/libcoexist.a b/tools/sdk/esp32c3/lib/libcoexist.a index 6f03cab0b8e..de5915cbc2d 100644 Binary files a/tools/sdk/esp32c3/lib/libcoexist.a and b/tools/sdk/esp32c3/lib/libcoexist.a differ diff --git a/tools/sdk/esp32c3/lib/libconsole.a b/tools/sdk/esp32c3/lib/libconsole.a index 91bd32add2d..6ce07b6431b 100644 Binary files a/tools/sdk/esp32c3/lib/libconsole.a and b/tools/sdk/esp32c3/lib/libconsole.a differ diff --git a/tools/sdk/esp32c3/lib/libcore.a b/tools/sdk/esp32c3/lib/libcore.a index 10e7ca5a83b..38e7e437963 100644 Binary files a/tools/sdk/esp32c3/lib/libcore.a and b/tools/sdk/esp32c3/lib/libcore.a differ diff --git a/tools/sdk/esp32c3/lib/libcxx.a b/tools/sdk/esp32c3/lib/libcxx.a index 9617dd86b74..235bc776b7a 100644 Binary files a/tools/sdk/esp32c3/lib/libcxx.a and b/tools/sdk/esp32c3/lib/libcxx.a differ diff --git a/tools/sdk/esp32c3/lib/libdriver.a b/tools/sdk/esp32c3/lib/libdriver.a index 71809d7ec58..9f9222d7812 100644 Binary files a/tools/sdk/esp32c3/lib/libdriver.a and b/tools/sdk/esp32c3/lib/libdriver.a differ diff --git a/tools/sdk/esp32c3/lib/libefuse.a b/tools/sdk/esp32c3/lib/libefuse.a index f4bb53d7dae..99ee734cff0 100644 Binary files a/tools/sdk/esp32c3/lib/libefuse.a and b/tools/sdk/esp32c3/lib/libefuse.a differ diff --git a/tools/sdk/esp32c3/lib/libesp-tls.a b/tools/sdk/esp32c3/lib/libesp-tls.a index 4e304a6646f..f493374d2c5 100644 Binary files a/tools/sdk/esp32c3/lib/libesp-tls.a and b/tools/sdk/esp32c3/lib/libesp-tls.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_common.a b/tools/sdk/esp32c3/lib/libesp_common.a index 577a8884b7f..c789ccd4d02 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_common.a and b/tools/sdk/esp32c3/lib/libesp_common.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_eth.a b/tools/sdk/esp32c3/lib/libesp_eth.a index 457368b2747..5e6eae54ae7 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_eth.a and b/tools/sdk/esp32c3/lib/libesp_eth.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_event.a b/tools/sdk/esp32c3/lib/libesp_event.a index eb12ef2bb70..7e12d28723a 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_event.a and b/tools/sdk/esp32c3/lib/libesp_event.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_hid.a b/tools/sdk/esp32c3/lib/libesp_hid.a index f976d5ab228..ed01f19522e 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_hid.a and b/tools/sdk/esp32c3/lib/libesp_hid.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_http_client.a b/tools/sdk/esp32c3/lib/libesp_http_client.a index f82ad10086d..355edfdbd75 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_http_client.a and b/tools/sdk/esp32c3/lib/libesp_http_client.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_http_server.a b/tools/sdk/esp32c3/lib/libesp_http_server.a index 78a0206aab2..862a0c58399 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_http_server.a and b/tools/sdk/esp32c3/lib/libesp_http_server.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_https_ota.a b/tools/sdk/esp32c3/lib/libesp_https_ota.a index e1702191f75..ad874bcf2a4 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_https_ota.a and b/tools/sdk/esp32c3/lib/libesp_https_ota.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_https_server.a b/tools/sdk/esp32c3/lib/libesp_https_server.a index 41c852b2f76..18fc0f04916 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_https_server.a and b/tools/sdk/esp32c3/lib/libesp_https_server.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_hw_support.a b/tools/sdk/esp32c3/lib/libesp_hw_support.a index 441d8231622..8689cdc3f30 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_hw_support.a and b/tools/sdk/esp32c3/lib/libesp_hw_support.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_lcd.a b/tools/sdk/esp32c3/lib/libesp_lcd.a index d5f9a5d15a7..e627bdf82f6 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_lcd.a and b/tools/sdk/esp32c3/lib/libesp_lcd.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_littlefs.a b/tools/sdk/esp32c3/lib/libesp_littlefs.a index 10ece18e6f5..195f8c5f210 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_littlefs.a and b/tools/sdk/esp32c3/lib/libesp_littlefs.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_local_ctrl.a b/tools/sdk/esp32c3/lib/libesp_local_ctrl.a index 79208e5d357..9df0a6ca3e6 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_local_ctrl.a and b/tools/sdk/esp32c3/lib/libesp_local_ctrl.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_netif.a b/tools/sdk/esp32c3/lib/libesp_netif.a index 3deef9ca7dc..697c3645d07 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_netif.a and b/tools/sdk/esp32c3/lib/libesp_netif.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_phy.a b/tools/sdk/esp32c3/lib/libesp_phy.a index b2b9885f59f..dc237e13710 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_phy.a and b/tools/sdk/esp32c3/lib/libesp_phy.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_pm.a b/tools/sdk/esp32c3/lib/libesp_pm.a index f32146b8ca0..ee647250ec2 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_pm.a and b/tools/sdk/esp32c3/lib/libesp_pm.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_ringbuf.a b/tools/sdk/esp32c3/lib/libesp_ringbuf.a index d08c234dc5b..ccd9d1a1f27 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_ringbuf.a and b/tools/sdk/esp32c3/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a b/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a index 3a5cbd2b6ad..c5740f366be 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a and b/tools/sdk/esp32c3/lib/libesp_serial_slave_link.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_system.a b/tools/sdk/esp32c3/lib/libesp_system.a index f8421329011..0ad8107ddb9 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_system.a and b/tools/sdk/esp32c3/lib/libesp_system.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_timer.a b/tools/sdk/esp32c3/lib/libesp_timer.a index d74a2ac003b..29d0ea65fbc 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_timer.a and b/tools/sdk/esp32c3/lib/libesp_timer.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_websocket_client.a b/tools/sdk/esp32c3/lib/libesp_websocket_client.a index d02f65a06fa..ea296d2c774 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_websocket_client.a and b/tools/sdk/esp32c3/lib/libesp_websocket_client.a differ diff --git a/tools/sdk/esp32c3/lib/libesp_wifi.a b/tools/sdk/esp32c3/lib/libesp_wifi.a index 3a89f878c94..4c73f013066 100644 Binary files a/tools/sdk/esp32c3/lib/libesp_wifi.a and b/tools/sdk/esp32c3/lib/libesp_wifi.a differ diff --git a/tools/sdk/esp32c3/lib/libespcoredump.a b/tools/sdk/esp32c3/lib/libespcoredump.a index 4af35b8b809..80c3fc77e9e 100644 Binary files a/tools/sdk/esp32c3/lib/libespcoredump.a and b/tools/sdk/esp32c3/lib/libespcoredump.a differ diff --git a/tools/sdk/esp32c3/lib/libespnow.a b/tools/sdk/esp32c3/lib/libespnow.a index 0d53db2568a..8c792259076 100644 Binary files a/tools/sdk/esp32c3/lib/libespnow.a and b/tools/sdk/esp32c3/lib/libespnow.a differ diff --git a/tools/sdk/esp32c3/lib/libfatfs.a b/tools/sdk/esp32c3/lib/libfatfs.a index 86f197e368c..f06478f76d1 100644 Binary files a/tools/sdk/esp32c3/lib/libfatfs.a and b/tools/sdk/esp32c3/lib/libfatfs.a differ diff --git a/tools/sdk/esp32c3/lib/libfreemodbus.a b/tools/sdk/esp32c3/lib/libfreemodbus.a index b46ecaac145..9ae7d61005f 100644 Binary files a/tools/sdk/esp32c3/lib/libfreemodbus.a and b/tools/sdk/esp32c3/lib/libfreemodbus.a differ diff --git a/tools/sdk/esp32c3/lib/libfreertos.a b/tools/sdk/esp32c3/lib/libfreertos.a index ac3c0fd50d1..acd068a9e05 100644 Binary files a/tools/sdk/esp32c3/lib/libfreertos.a and b/tools/sdk/esp32c3/lib/libfreertos.a differ diff --git a/tools/sdk/esp32c3/lib/libhal.a b/tools/sdk/esp32c3/lib/libhal.a index 12ad247f09c..ed34868e2e8 100644 Binary files a/tools/sdk/esp32c3/lib/libhal.a and b/tools/sdk/esp32c3/lib/libhal.a differ diff --git a/tools/sdk/esp32c3/lib/libheap.a b/tools/sdk/esp32c3/lib/libheap.a index 240bbab74e0..0ae3c7e01af 100644 Binary files a/tools/sdk/esp32c3/lib/libheap.a and b/tools/sdk/esp32c3/lib/libheap.a differ diff --git a/tools/sdk/esp32c3/lib/liblog.a b/tools/sdk/esp32c3/lib/liblog.a index 4be299b20b5..93460d356de 100644 Binary files a/tools/sdk/esp32c3/lib/liblog.a and b/tools/sdk/esp32c3/lib/liblog.a differ diff --git a/tools/sdk/esp32c3/lib/liblwip.a b/tools/sdk/esp32c3/lib/liblwip.a index 668266754ba..1051575b7bb 100644 Binary files a/tools/sdk/esp32c3/lib/liblwip.a and b/tools/sdk/esp32c3/lib/liblwip.a differ diff --git a/tools/sdk/esp32c3/lib/libmbedcrypto.a b/tools/sdk/esp32c3/lib/libmbedcrypto.a index b1cb253b4d7..3f13e9da4cb 100644 Binary files a/tools/sdk/esp32c3/lib/libmbedcrypto.a and b/tools/sdk/esp32c3/lib/libmbedcrypto.a differ diff --git a/tools/sdk/esp32c3/lib/libmdns.a b/tools/sdk/esp32c3/lib/libmdns.a index b3df4d78b13..49de62082ea 100644 Binary files a/tools/sdk/esp32c3/lib/libmdns.a and b/tools/sdk/esp32c3/lib/libmdns.a differ diff --git a/tools/sdk/esp32c3/lib/libmesh.a b/tools/sdk/esp32c3/lib/libmesh.a index ac0bceb375b..caf1f0c2200 100644 Binary files a/tools/sdk/esp32c3/lib/libmesh.a and b/tools/sdk/esp32c3/lib/libmesh.a differ diff --git a/tools/sdk/esp32c3/lib/libmqtt.a b/tools/sdk/esp32c3/lib/libmqtt.a index 7b2acfde2a4..a0b3d873517 100644 Binary files a/tools/sdk/esp32c3/lib/libmqtt.a and b/tools/sdk/esp32c3/lib/libmqtt.a differ diff --git a/tools/sdk/esp32c3/lib/libnet80211.a b/tools/sdk/esp32c3/lib/libnet80211.a index 79f91f7f17d..659d0c256b4 100644 Binary files a/tools/sdk/esp32c3/lib/libnet80211.a and b/tools/sdk/esp32c3/lib/libnet80211.a differ diff --git a/tools/sdk/esp32c3/lib/libnewlib.a b/tools/sdk/esp32c3/lib/libnewlib.a index e0ebeacbfd1..d11f7b0890e 100644 Binary files a/tools/sdk/esp32c3/lib/libnewlib.a and b/tools/sdk/esp32c3/lib/libnewlib.a differ diff --git a/tools/sdk/esp32c3/lib/libnvs_flash.a b/tools/sdk/esp32c3/lib/libnvs_flash.a index 72bb887799b..9d11816f2be 100644 Binary files a/tools/sdk/esp32c3/lib/libnvs_flash.a and b/tools/sdk/esp32c3/lib/libnvs_flash.a differ diff --git a/tools/sdk/esp32c3/lib/libopenssl.a b/tools/sdk/esp32c3/lib/libopenssl.a index 4019e41f7a4..a3187965100 100644 Binary files a/tools/sdk/esp32c3/lib/libopenssl.a and b/tools/sdk/esp32c3/lib/libopenssl.a differ diff --git a/tools/sdk/esp32c3/lib/libpp.a b/tools/sdk/esp32c3/lib/libpp.a index 4891f8b5c92..0da117ad274 100644 Binary files a/tools/sdk/esp32c3/lib/libpp.a and b/tools/sdk/esp32c3/lib/libpp.a differ diff --git a/tools/sdk/esp32c3/lib/libprotocomm.a b/tools/sdk/esp32c3/lib/libprotocomm.a index b604bd05cd1..c21544bf740 100644 Binary files a/tools/sdk/esp32c3/lib/libprotocomm.a and b/tools/sdk/esp32c3/lib/libprotocomm.a differ diff --git a/tools/sdk/esp32c3/lib/libpthread.a b/tools/sdk/esp32c3/lib/libpthread.a index b16b6ff4e64..4a83fa2779a 100644 Binary files a/tools/sdk/esp32c3/lib/libpthread.a and b/tools/sdk/esp32c3/lib/libpthread.a differ diff --git a/tools/sdk/esp32c3/lib/libsdmmc.a b/tools/sdk/esp32c3/lib/libsdmmc.a index 04cbb827fc5..8dd26b634d1 100644 Binary files a/tools/sdk/esp32c3/lib/libsdmmc.a and b/tools/sdk/esp32c3/lib/libsdmmc.a differ diff --git a/tools/sdk/esp32c3/lib/libsmartconfig.a b/tools/sdk/esp32c3/lib/libsmartconfig.a index bd9cc0d4cee..bf215058c15 100644 Binary files a/tools/sdk/esp32c3/lib/libsmartconfig.a and b/tools/sdk/esp32c3/lib/libsmartconfig.a differ diff --git a/tools/sdk/esp32c3/lib/libspi_flash.a b/tools/sdk/esp32c3/lib/libspi_flash.a index ac3b0ee32af..111a88afcc9 100644 Binary files a/tools/sdk/esp32c3/lib/libspi_flash.a and b/tools/sdk/esp32c3/lib/libspi_flash.a differ diff --git a/tools/sdk/esp32c3/lib/libspiffs.a b/tools/sdk/esp32c3/lib/libspiffs.a index 120571b2b86..0cc5fc8f091 100644 Binary files a/tools/sdk/esp32c3/lib/libspiffs.a and b/tools/sdk/esp32c3/lib/libspiffs.a differ diff --git a/tools/sdk/esp32c3/lib/libtcp_transport.a b/tools/sdk/esp32c3/lib/libtcp_transport.a index 42d386c8e1a..8ed74692157 100644 Binary files a/tools/sdk/esp32c3/lib/libtcp_transport.a and b/tools/sdk/esp32c3/lib/libtcp_transport.a differ diff --git a/tools/sdk/esp32c3/lib/libtcpip_adapter.a b/tools/sdk/esp32c3/lib/libtcpip_adapter.a index 316d8562b49..fd243c03dbc 100644 Binary files a/tools/sdk/esp32c3/lib/libtcpip_adapter.a and b/tools/sdk/esp32c3/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/esp32c3/lib/libvfs.a b/tools/sdk/esp32c3/lib/libvfs.a index 4b644d301c0..bd784ad9cbb 100644 Binary files a/tools/sdk/esp32c3/lib/libvfs.a and b/tools/sdk/esp32c3/lib/libvfs.a differ diff --git a/tools/sdk/esp32c3/lib/libwapi.a b/tools/sdk/esp32c3/lib/libwapi.a index 549b78aad96..7fe0160c721 100644 Binary files a/tools/sdk/esp32c3/lib/libwapi.a and b/tools/sdk/esp32c3/lib/libwapi.a differ diff --git a/tools/sdk/esp32c3/lib/libwear_levelling.a b/tools/sdk/esp32c3/lib/libwear_levelling.a index 8e320e50db7..4001b7a1319 100644 Binary files a/tools/sdk/esp32c3/lib/libwear_levelling.a and b/tools/sdk/esp32c3/lib/libwear_levelling.a differ diff --git a/tools/sdk/esp32c3/lib/libwifi_provisioning.a b/tools/sdk/esp32c3/lib/libwifi_provisioning.a index 08e7562e415..41243a30389 100644 Binary files a/tools/sdk/esp32c3/lib/libwifi_provisioning.a and b/tools/sdk/esp32c3/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/esp32c3/lib/libwpa_supplicant.a b/tools/sdk/esp32c3/lib/libwpa_supplicant.a index 60617dc9981..2191f1ee02b 100644 Binary files a/tools/sdk/esp32c3/lib/libwpa_supplicant.a and b/tools/sdk/esp32c3/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/esp32c3/sdkconfig b/tools/sdk/esp32c3/sdkconfig index 85edbebed07..fac95fd42fb 100644 --- a/tools/sdk/esp32c3/sdkconfig +++ b/tools/sdk/esp32c3/sdkconfig @@ -92,6 +92,7 @@ CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set CONFIG_ESPTOOLPY_FLASHMODE_DIO=y # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" # CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set CONFIG_ESPTOOLPY_FLASHFREQ_80M=y @@ -1044,6 +1045,7 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 # # DHCP server @@ -1291,6 +1293,7 @@ CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 # CONFIG_MDNS_STRICT_MODE is not set CONFIG_MDNS_TIMER_PERIOD_MS=100 # CONFIG_MDNS_NETWORKING_SOCKET is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y # end of mDNS # @@ -1475,6 +1478,7 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# CONFIG_WIFI_PROV_BLE_BONDING is not set # end of Wi-Fi Provisioning Manager # diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/include/tusb_config.h b/tools/sdk/esp32s2/include/arduino_tinyusb/include/tusb_config.h index a119e4d81c3..a5a0afd32dc 100755 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/include/tusb_config.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/include/tusb_config.h @@ -52,6 +52,10 @@ extern "C" { # define CONFIG_TINYUSB_MIDI_ENABLED 0 #endif +#ifndef CONFIG_TINYUSB_VIDEO_ENABLED +# define CONFIG_TINYUSB_VIDEO_ENABLED 0 +#endif + #ifndef CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED # define CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 0 #endif @@ -99,6 +103,7 @@ extern "C" { #define CFG_TUD_MSC CONFIG_TINYUSB_MSC_ENABLED #define CFG_TUD_HID CONFIG_TINYUSB_HID_ENABLED #define CFG_TUD_MIDI CONFIG_TINYUSB_MIDI_ENABLED +#define CFG_TUD_VIDEO CONFIG_TINYUSB_VIDEO_ENABLED #define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED #define CFG_TUD_DFU_RUNTIME CONFIG_TINYUSB_DFU_RT_ENABLED #define CFG_TUD_VENDOR CONFIG_TINYUSB_VENDOR_ENABLED @@ -117,6 +122,10 @@ extern "C" { #define CFG_TUD_MIDI_RX_BUFSIZE CONFIG_TINYUSB_MIDI_RX_BUFSIZE #define CFG_TUD_MIDI_TX_BUFSIZE CONFIG_TINYUSB_MIDI_TX_BUFSIZE +// The number of video streaming interfaces and endpoint size +#define CFG_TUD_VIDEO_STREAMING CONFIG_TINYUSB_VIDEO_STREAMING_IFS +#define CFG_TUD_VIDEO_STREAMING_EP_BUFSIZE CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE + // VENDOR FIFO size of TX and RX #define CFG_TUD_VENDOR_RX_BUFSIZE CONFIG_TINYUSB_VENDOR_RX_BUFSIZE #define CFG_TUD_VENDOR_TX_BUFSIZE CONFIG_TINYUSB_VENDOR_TX_BUFSIZE diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h index f99061eaec6..6f9c1a6b582 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/audio/audio.h @@ -494,18 +494,6 @@ typedef enum /// All remaining definitions are taken from the descriptor descriptions in the UAC2 main specification -/// Isochronous End Point Attributes -typedef enum -{ - TUSB_ISO_EP_ATT_NO_SYNC = 0x00, - TUSB_ISO_EP_ATT_ASYNCHRONOUS = 0x04, - TUSB_ISO_EP_ATT_ADAPTIVE = 0x08, - TUSB_ISO_EP_ATT_SYNCHRONOUS = 0x0C, - TUSB_ISO_EP_ATT_DATA = 0x00, ///< Data End Point - TUSB_ISO_EP_ATT_EXPLICIT_FB = 0x10, ///< Feedback End Point - TUSB_ISO_EP_ATT_IMPLICIT_FB = 0x20, ///< Data endpoint that also serves as an implicit feedback -} tusb_iso_ep_attribute_t; - /// Audio Class-Control Values UAC2 typedef enum { diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc.h index 5df47f70b4a..e345139eab0 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc.h @@ -58,31 +58,32 @@ typedef enum /// Communication Interface Subclass Codes typedef enum { - CDC_COMM_SUBCLASS_DIRECT_LINE_CONTROL_MODEL = 0x01 , ///< Direct Line Control Model [USBPSTN1.2] - CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL , ///< Abstract Control Model [USBPSTN1.2] - CDC_COMM_SUBCLASS_TELEPHONE_CONTROL_MODEL , ///< Telephone Control Model [USBPSTN1.2] - CDC_COMM_SUBCLASS_MULTICHANNEL_CONTROL_MODEL , ///< Multi-Channel Control Model [USBISDN1.2] - CDC_COMM_SUBCLASS_CAPI_CONTROL_MODEL , ///< CAPI Control Model [USBISDN1.2] - CDC_COMM_SUBCLASS_ETHERNET_CONTROL_MODEL , ///< Ethernet Networking Control Model [USBECM1.2] - CDC_COMM_SUBCLASS_ATM_NETWORKING_CONTROL_MODEL , ///< ATM Networking Control Model [USBATM1.2] - CDC_COMM_SUBCLASS_WIRELESS_HANDSET_CONTROL_MODEL , ///< Wireless Handset Control Model [USBWMC1.1] - CDC_COMM_SUBCLASS_DEVICE_MANAGEMENT , ///< Device Management [USBWMC1.1] - CDC_COMM_SUBCLASS_MOBILE_DIRECT_LINE_MODEL , ///< Mobile Direct Line Model [USBWMC1.1] - CDC_COMM_SUBCLASS_OBEX , ///< OBEX [USBWMC1.1] - CDC_COMM_SUBCLASS_ETHERNET_EMULATION_MODEL ///< Ethernet Emulation Model [USBEEM1.0] + CDC_COMM_SUBCLASS_DIRECT_LINE_CONTROL_MODEL = 0x01 , ///< Direct Line Control Model [USBPSTN1.2] + CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL = 0x02 , ///< Abstract Control Model [USBPSTN1.2] + CDC_COMM_SUBCLASS_TELEPHONE_CONTROL_MODEL = 0x03 , ///< Telephone Control Model [USBPSTN1.2] + CDC_COMM_SUBCLASS_MULTICHANNEL_CONTROL_MODEL = 0x04 , ///< Multi-Channel Control Model [USBISDN1.2] + CDC_COMM_SUBCLASS_CAPI_CONTROL_MODEL = 0x05 , ///< CAPI Control Model [USBISDN1.2] + CDC_COMM_SUBCLASS_ETHERNET_CONTROL_MODEL = 0x06 , ///< Ethernet Networking Control Model [USBECM1.2] + CDC_COMM_SUBCLASS_ATM_NETWORKING_CONTROL_MODEL = 0x07 , ///< ATM Networking Control Model [USBATM1.2] + CDC_COMM_SUBCLASS_WIRELESS_HANDSET_CONTROL_MODEL = 0x08 , ///< Wireless Handset Control Model [USBWMC1.1] + CDC_COMM_SUBCLASS_DEVICE_MANAGEMENT = 0x09 , ///< Device Management [USBWMC1.1] + CDC_COMM_SUBCLASS_MOBILE_DIRECT_LINE_MODEL = 0x0A , ///< Mobile Direct Line Model [USBWMC1.1] + CDC_COMM_SUBCLASS_OBEX = 0x0B , ///< OBEX [USBWMC1.1] + CDC_COMM_SUBCLASS_ETHERNET_EMULATION_MODEL = 0x0C , ///< Ethernet Emulation Model [USBEEM1.0] + CDC_COMM_SUBCLASS_NETWORK_CONTROL_MODEL = 0x0D ///< Network Control Model [USBNCM1.0] } cdc_comm_sublcass_type_t; /// Communication Interface Protocol Codes typedef enum { - CDC_COMM_PROTOCOL_NONE = 0x00 , ///< No specific protocol - CDC_COMM_PROTOCOL_ATCOMMAND , ///< AT Commands: V.250 etc - CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101 , ///< AT Commands defined by PCCA-101 - CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101_AND_ANNEXO , ///< AT Commands defined by PCCA-101 & Annex O - CDC_COMM_PROTOCOL_ATCOMMAND_GSM_707 , ///< AT Commands defined by GSM 07.07 - CDC_COMM_PROTOCOL_ATCOMMAND_3GPP_27007 , ///< AT Commands defined by 3GPP 27.007 - CDC_COMM_PROTOCOL_ATCOMMAND_CDMA , ///< AT Commands defined by TIA for CDMA - CDC_COMM_PROTOCOL_ETHERNET_EMULATION_MODEL ///< Ethernet Emulation Model + CDC_COMM_PROTOCOL_NONE = 0x00 , ///< No specific protocol + CDC_COMM_PROTOCOL_ATCOMMAND = 0x01 , ///< AT Commands: V.250 etc + CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101 = 0x02 , ///< AT Commands defined by PCCA-101 + CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101_AND_ANNEXO = 0x03 , ///< AT Commands defined by PCCA-101 & Annex O + CDC_COMM_PROTOCOL_ATCOMMAND_GSM_707 = 0x04 , ///< AT Commands defined by GSM 07.07 + CDC_COMM_PROTOCOL_ATCOMMAND_3GPP_27007 = 0x05 , ///< AT Commands defined by 3GPP 27.007 + CDC_COMM_PROTOCOL_ATCOMMAND_CDMA = 0x06 , ///< AT Commands defined by TIA for CDMA + CDC_COMM_PROTOCOL_ETHERNET_EMULATION_MODEL = 0x07 ///< Ethernet Emulation Model } cdc_comm_protocol_type_t; //------------- SubType Descriptor in COMM Functional Descriptor -------------// @@ -114,7 +115,8 @@ typedef enum CDC_FUNC_DESC_COMMAND_SET = 0x16 , ///< Command Set Functional Descriptor CDC_FUNC_DESC_COMMAND_SET_DETAIL = 0x17 , ///< Command Set Detail Functional Descriptor CDC_FUNC_DESC_TELEPHONE_CONTROL_MODEL = 0x18 , ///< Telephone Control Model Functional Descriptor - CDC_FUNC_DESC_OBEX_SERVICE_IDENTIFIER = 0x19 ///< OBEX Service Identifier Functional Descriptor + CDC_FUNC_DESC_OBEX_SERVICE_IDENTIFIER = 0x19 , ///< OBEX Service Identifier Functional Descriptor + CDC_FUNC_DESC_NCM = 0x1A , ///< NCM Functional Descriptor }cdc_func_desc_type_t; //--------------------------------------------------------------------+ @@ -122,7 +124,8 @@ typedef enum //--------------------------------------------------------------------+ // SUBCLASS code of Data Interface is not used and should/must be zero -/// Data Interface Protocol Codes + +// Data Interface Protocol Codes typedef enum{ CDC_DATA_PROTOCOL_ISDN_BRI = 0x30, ///< Physical interface protocol for ISDN BRI CDC_DATA_PROTOCOL_HDLC = 0x31, ///< HDLC @@ -147,7 +150,6 @@ typedef enum { CDC_REQUEST_SEND_ENCAPSULATED_COMMAND = 0x00, ///< is used to issue a command in the format of the supported control protocol of the Communications Class interface CDC_REQUEST_GET_ENCAPSULATED_RESPONSE = 0x01, ///< is used to request a response in the format of the supported control protocol of the Communications Class interface. - CDC_REQUEST_SET_COMM_FEATURE = 0x02, CDC_REQUEST_GET_COMM_FEATURE = 0x03, CDC_REQUEST_CLEAR_COMM_FEATURE = 0x04, @@ -194,21 +196,18 @@ typedef enum // Management Elemenent Notification (Notification Endpoint) //--------------------------------------------------------------------+ -/// Communication Interface Management Element Notification Codes +/// 6.3 Notification Codes typedef enum { - NETWORK_CONNECTION = 0x00, ///< This notification allows the device to notify the host about network connection status. - RESPONSE_AVAILABLE = 0x01, ///< This notification allows the device to notify the hostthat a response is available. This response can be retrieved with a subsequent \ref CDC_REQUEST_GET_ENCAPSULATED_RESPONSE request. - - AUX_JACK_HOOK_STATE = 0x08, - RING_DETECT = 0x09, - - SERIAL_STATE = 0x20, - - CALL_STATE_CHANGE = 0x28, - LINE_STATE_CHANGE = 0x29, - CONNECTION_SPEED_CHANGE = 0x2A, ///< This notification allows the device to inform the host-networking driver that a change in either the upstream or the downstream bit rate of the connection has occurred - MDLM_SEMANTIC_MODEL_NOTIFICATION = 0x40, + CDC_NOTIF_NETWORK_CONNECTION = 0x00, ///< This notification allows the device to notify the host about network connection status. + CDC_NOTIF_RESPONSE_AVAILABLE = 0x01, ///< This notification allows the device to notify the hostthat a response is available. This response can be retrieved with a subsequent \ref CDC_REQUEST_GET_ENCAPSULATED_RESPONSE request. + CDC_NOTIF_AUX_JACK_HOOK_STATE = 0x08, + CDC_NOTIF_RING_DETECT = 0x09, + CDC_NOTIF_SERIAL_STATE = 0x20, + CDC_NOTIF_CALL_STATE_CHANGE = 0x28, + CDC_NOTIF_LINE_STATE_CHANGE = 0x29, + CDC_NOTIF_CONNECTION_SPEED_CHANGE = 0x2A, ///< This notification allows the device to inform the host-networking driver that a change in either the upstream or the downstream bit rate of the connection has occurred + CDC_NOTIF_MDLM_SEMANTIC_MODEL_NOTIFICATION = 0x40, }cdc_notification_request_t; //--------------------------------------------------------------------+ diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc_device.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc_device.h index 7ff757addd6..fbc7162a366 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc_device.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc_device.h @@ -82,7 +82,7 @@ int32_t tud_cdc_n_read_char (uint8_t itf); void tud_cdc_n_read_flush (uint8_t itf); // Get a byte from FIFO at the specified position without removing it -bool tud_cdc_n_peek (uint8_t itf, uint8_t* u8); +bool tud_cdc_n_peek (uint8_t itf, uint8_t* ui8); // Write bytes to TX FIFO, data may remain in the FIFO for a while uint32_t tud_cdc_n_write (uint8_t itf, void const* buffer, uint32_t bufsize); @@ -116,7 +116,7 @@ static inline uint32_t tud_cdc_available (void); static inline int32_t tud_cdc_read_char (void); static inline uint32_t tud_cdc_read (void* buffer, uint32_t bufsize); static inline void tud_cdc_read_flush (void); -static inline bool tud_cdc_peek (uint8_t* u8); +static inline bool tud_cdc_peek (uint8_t* ui8); static inline uint32_t tud_cdc_write_char (char ch); static inline uint32_t tud_cdc_write (void const* buffer, uint32_t bufsize); @@ -206,9 +206,9 @@ static inline void tud_cdc_read_flush (void) tud_cdc_n_read_flush(0); } -static inline bool tud_cdc_peek (uint8_t* u8) +static inline bool tud_cdc_peek (uint8_t* ui8) { - return tud_cdc_n_peek(0, u8); + return tud_cdc_n_peek(0, ui8); } static inline uint32_t tud_cdc_write_char (char ch) diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/net/ncm.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/net/ncm.h new file mode 100644 index 00000000000..96ba11fbc5c --- /dev/null +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/net/ncm.h @@ -0,0 +1,69 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2021, Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ + + +#ifndef _TUSB_NCM_H_ +#define _TUSB_NCM_H_ + +#include "common/tusb_common.h" + +#ifdef __cplusplus + extern "C" { +#endif + +// Table 4.3 Data Class Interface Protocol Codes +typedef enum +{ + NCM_DATA_PROTOCOL_NETWORK_TRANSFER_BLOCK = 0x01 +} ncm_data_interface_protocol_code_t; + + +// Table 6.2 Class-Specific Request Codes for Network Control Model subclass +typedef enum +{ + NCM_SET_ETHERNET_MULTICAST_FILTERS = 0x40, + NCM_SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER = 0x41, + NCM_GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER = 0x42, + NCM_SET_ETHERNET_PACKET_FILTER = 0x43, + NCM_GET_ETHERNET_STATISTIC = 0x44, + NCM_GET_NTB_PARAMETERS = 0x80, + NCM_GET_NET_ADDRESS = 0x81, + NCM_SET_NET_ADDRESS = 0x82, + NCM_GET_NTB_FORMAT = 0x83, + NCM_SET_NTB_FORMAT = 0x84, + NCM_GET_NTB_INPUT_SIZE = 0x85, + NCM_SET_NTB_INPUT_SIZE = 0x86, + NCM_GET_MAX_DATAGRAM_SIZE = 0x87, + NCM_SET_MAX_DATAGRAM_SIZE = 0x88, + NCM_GET_CRC_MODE = 0x89, + NCM_SET_CRC_MODE = 0x8A, +} ncm_request_code_t; + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/net/net_device.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/net/net_device.h index f030f3077ac..6e294465b28 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/net/net_device.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/net/net_device.h @@ -30,14 +30,36 @@ #include "class/cdc/cdc.h" +#if CFG_TUD_ECM_RNDIS && CFG_TUD_NCM +#error "Cannot enable both ECM_RNDIS and NCM network drivers" +#endif + +#include "ncm.h" + /* declared here, NOT in usb_descriptors.c, so that the driver can intelligently ZLP as needed */ #define CFG_TUD_NET_ENDPOINT_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) -/* Maximum Tranmission Unit (in bytes) of the network, including Ethernet header */ +/* Maximum Transmission Unit (in bytes) of the network, including Ethernet header */ #ifndef CFG_TUD_NET_MTU #define CFG_TUD_NET_MTU 1514 #endif +#ifndef CFG_TUD_NCM_IN_NTB_MAX_SIZE +#define CFG_TUD_NCM_IN_NTB_MAX_SIZE 3200 +#endif + +#ifndef CFG_TUD_NCM_OUT_NTB_MAX_SIZE +#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE 3200 +#endif + +#ifndef CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB +#define CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB 8 +#endif + +#ifndef CFG_TUD_NCM_ALIGNMENT +#define CFG_TUD_NCM_ALIGNMENT 4 +#endif + #ifdef __cplusplus extern "C" { #endif @@ -46,8 +68,18 @@ // Application API //--------------------------------------------------------------------+ -// client must provide this: initialize any network state back to the beginning -void tud_network_init_cb(void); +// indicate to network driver that client has finished with the packet provided to network_recv_cb() +void tud_network_recv_renew(void); + +// poll network driver for its ability to accept another packet to transmit +bool tud_network_can_xmit(uint16_t size); + +// if network_can_xmit() returns true, network_xmit() can be called once +void tud_network_xmit(void *ref, uint16_t arg); + +//--------------------------------------------------------------------+ +// Application Callbacks (WEAK is optional) +//--------------------------------------------------------------------+ // client must provide this: return false if the packet buffer was not accepted bool tud_network_recv_cb(const uint8_t *src, uint16_t size); @@ -55,18 +87,19 @@ bool tud_network_recv_cb(const uint8_t *src, uint16_t size); // client must provide this: copy from network stack packet pointer to dst uint16_t tud_network_xmit_cb(uint8_t *dst, void *ref, uint16_t arg); +//------------- ECM/RNDIS -------------// + +// client must provide this: initialize any network state back to the beginning +void tud_network_init_cb(void); + // client must provide this: 48-bit MAC address // TODO removed later since it is not part of tinyusb stack extern const uint8_t tud_network_mac_address[6]; -// indicate to network driver that client has finished with the packet provided to network_recv_cb() -void tud_network_recv_renew(void); - -// poll network driver for its ability to accept another packet to transmit -bool tud_network_can_xmit(void); +//------------- NCM -------------// -// if network_can_xmit() returns true, network_xmit() can be called once -void tud_network_xmit(void *ref, uint16_t arg); +// callback to client providing optional indication of internal state of network driver +void tud_network_link_state_cb(bool state); //--------------------------------------------------------------------+ // INTERNAL USBD-CLASS DRIVER API diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/vendor/vendor_device.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/vendor/vendor_device.h index 844693c68b7..d71c2a3e911 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/vendor/vendor_device.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/vendor/vendor_device.h @@ -44,7 +44,7 @@ bool tud_vendor_n_mounted (uint8_t itf); uint32_t tud_vendor_n_available (uint8_t itf); uint32_t tud_vendor_n_read (uint8_t itf, void* buffer, uint32_t bufsize); -bool tud_vendor_n_peek (uint8_t itf, uint8_t* u8); +bool tud_vendor_n_peek (uint8_t itf, uint8_t* ui8); void tud_vendor_n_read_flush (uint8_t itf); uint32_t tud_vendor_n_write (uint8_t itf, void const* buffer, uint32_t bufsize); @@ -59,7 +59,7 @@ uint32_t tud_vendor_n_write_str (uint8_t itf, char const* str); static inline bool tud_vendor_mounted (void); static inline uint32_t tud_vendor_available (void); static inline uint32_t tud_vendor_read (void* buffer, uint32_t bufsize); -static inline bool tud_vendor_peek (uint8_t* u8); +static inline bool tud_vendor_peek (uint8_t* ui8); static inline void tud_vendor_read_flush (void); static inline uint32_t tud_vendor_write (void const* buffer, uint32_t bufsize); static inline uint32_t tud_vendor_write_str (char const* str); @@ -96,9 +96,9 @@ static inline uint32_t tud_vendor_read (void* buffer, uint32_t bufsize) return tud_vendor_n_read(0, buffer, bufsize); } -static inline bool tud_vendor_peek (uint8_t* u8) +static inline bool tud_vendor_peek (uint8_t* ui8) { - return tud_vendor_n_peek(0, u8); + return tud_vendor_n_peek(0, ui8); } static inline void tud_vendor_read_flush(void) diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/video/video.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/video/video.h new file mode 100644 index 00000000000..b24eb0bcc00 --- /dev/null +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/video/video.h @@ -0,0 +1,472 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2021 Koji KITAYAMA + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ + +#ifndef TUSB_VIDEO_H_ +#define TUSB_VIDEO_H_ + +#include "common/tusb_common.h" + +// Table 3-19 Color Matching Descriptor +typedef enum { + VIDEO_COLOR_PRIMARIES_UNDEFINED = 0x00, + VIDEO_COLOR_PRIMARIES_BT709, // sRGB (default) + VIDEO_COLOR_PRIMARIES_BT470_2M, + VIDEO_COLOR_PRIMARIES_BT470_2BG, + VIDEO_COLOR_PRIMARIES_SMPTE170M, + VIDEO_COLOR_PRIMARIES_SMPTE240M, +} video_color_primaries_t; + +// Table 3-19 Color Matching Descriptor +typedef enum { + VIDEO_COLOR_XFER_CH_UNDEFINED = 0x00, + VIDEO_COLOR_XFER_CH_BT709, // default + VIDEO_COLOR_XFER_CH_BT470_2M, + VIDEO_COLOR_XFER_CH_BT470_2BG, + VIDEO_COLOR_XFER_CH_SMPTE170M, + VIDEO_COLOR_XFER_CH_SMPTE240M, + VIDEO_COLOR_XFER_CH_LINEAR, + VIDEO_COLOR_XFER_CH_SRGB, +} video_color_transfer_characteristics_t; + +// Table 3-19 Color Matching Descriptor +typedef enum { + VIDEO_COLOR_COEF_UNDEFINED = 0x00, + VIDEO_COLOR_COEF_BT709, + VIDEO_COLOR_COEF_FCC, + VIDEO_COLOR_COEF_BT470_2BG, + VIDEO_COLOR_COEF_SMPTE170M, // BT.601 default + VIDEO_COLOR_COEF_SMPTE240M, +} video_color_matrix_coefficients_t; + +/* 4.2.1.2 Request Error Code Control */ +typedef enum { + VIDEO_ERROR_NONE = 0, /* The request succeeded. */ + VIDEO_ERROR_NOT_READY, + VIDEO_ERROR_WRONG_STATE, + VIDEO_ERROR_POWER, + VIDEO_ERROR_OUT_OF_RANGE, + VIDEO_ERROR_INVALID_UNIT, + VIDEO_ERROR_INVALID_CONTROL, + VIDEO_ERROR_INVALID_REQUEST, + VIDEO_ERROR_INVALID_VALUE_WITHIN_RANGE, + VIDEO_ERROR_UNKNOWN = 0xFF, +} video_error_code_t; + +/* A.2 Interface Subclass */ +typedef enum { + VIDEO_SUBCLASS_UNDEFINED = 0x00, + VIDEO_SUBCLASS_CONTROL, + VIDEO_SUBCLASS_STREAMING, + VIDEO_SUBCLASS_INTERFACE_COLLECTION, +} video_subclass_type_t; + +/* A.3 Interface Protocol */ +typedef enum { + VIDEO_ITF_PROTOCOL_UNDEFINED = 0x00, + VIDEO_ITF_PROTOCOL_15, +} video_interface_protocol_code_t; + +/* A.5 Class-Specific VideoControl Interface Descriptor Subtypes */ +typedef enum { + VIDEO_CS_ITF_VC_UNDEFINED = 0x00, + VIDEO_CS_ITF_VC_HEADER, + VIDEO_CS_ITF_VC_INPUT_TERMINAL, + VIDEO_CS_ITF_VC_OUTPUT_TERMINAL, + VIDEO_CS_ITF_VC_SELECTOR_UNIT, + VIDEO_CS_ITF_VC_PROCESSING_UNIT, + VIDEO_CS_ITF_VC_EXTENSION_UNIT, + VIDEO_CS_ITF_VC_ENCODING_UNIT, + VIDEO_CS_ITF_VC_MAX, +} video_cs_vc_interface_subtype_t; + +/* A.6 Class-Specific VideoStreaming Interface Descriptor Subtypes */ +typedef enum { + VIDEO_CS_ITF_VS_UNDEFINED = 0x00, + VIDEO_CS_ITF_VS_INPUT_HEADER = 0x01, + VIDEO_CS_ITF_VS_OUTPUT_HEADER = 0x02, + VIDEO_CS_ITF_VS_STILL_IMAGE_FRAME = 0x03, + VIDEO_CS_ITF_VS_FORMAT_UNCOMPRESSED = 0x04, + VIDEO_CS_ITF_VS_FRAME_UNCOMPRESSED = 0x05, + VIDEO_CS_ITF_VS_FORMAT_MJPEG = 0x06, + VIDEO_CS_ITF_VS_FRAME_MJPEG = 0x07, + VIDEO_CS_ITF_VS_FORMAT_MPEG2TS = 0x0A, + VIDEO_CS_ITF_VS_FORMAT_DV = 0x0C, + VIDEO_CS_ITF_VS_COLORFORMAT = 0x0D, + VIDEO_CS_ITF_VS_FORMAT_FRAME_BASED = 0x10, + VIDEO_CS_ITF_VS_FRAME_FRAME_BASED = 0x11, + VIDEO_CS_ITF_VS_FORMAT_STREAM_BASED = 0x12, + VIDEO_CS_ITF_VS_FORMAT_H264 = 0x13, + VIDEO_CS_ITF_VS_FRAME_H264 = 0x14, + VIDEO_CS_ITF_VS_FORMAT_H264_SIMULCAST = 0x15, + VIDEO_CS_ITF_VS_FORMAT_VP8 = 0x16, + VIDEO_CS_ITF_VS_FRAME_VP8 = 0x17, + VIDEO_CS_ITF_VS_FORMAT_VP8_SIMULCAST = 0x18, +} video_cs_vs_interface_subtype_t; + +/* A.7. Class-Specific Endpoint Descriptor Subtypes */ +typedef enum { + VIDEO_CS_EP_UNDEFINED = 0x00, + VIDEO_CS_EP_GENERAL, + VIDEO_CS_EP_ENDPOINT, + VIDEO_CS_EP_INTERRUPT +} video_cs_ep_subtype_t; + +/* A.8 Class-Specific Request Codes */ +typedef enum { + VIDEO_REQUEST_UNDEFINED = 0x00, + VIDEO_REQUEST_SET_CUR = 0x01, + VIDEO_REQUEST_SET_CUR_ALL = 0x11, + VIDEO_REQUEST_GET_CUR = 0x81, + VIDEO_REQUEST_GET_MIN = 0x82, + VIDEO_REQUEST_GET_MAX = 0x83, + VIDEO_REQUEST_GET_RES = 0x84, + VIDEO_REQUEST_GET_LEN = 0x85, + VIDEO_REQUEST_GET_INFO = 0x86, + VIDEO_REQUEST_GET_DEF = 0x87, + VIDEO_REQUEST_GET_CUR_ALL = 0x91, + VIDEO_REQUEST_GET_MIN_ALL = 0x92, + VIDEO_REQUEST_GET_MAX_ALL = 0x93, + VIDEO_REQUEST_GET_RES_ALL = 0x94, + VIDEO_REQUEST_GET_DEF_ALL = 0x97 +} video_control_request_t; + +/* A.9.1 VideoControl Interface Control Selectors */ +typedef enum { + VIDEO_VC_CTL_UNDEFINED = 0x00, + VIDEO_VC_CTL_VIDEO_POWER_MODE, + VIDEO_VC_CTL_REQUEST_ERROR_CODE, +} video_interface_control_selector_t; + +/* A.9.8 VideoStreaming Interface Control Selectors */ +typedef enum { + VIDEO_VS_CTL_UNDEFINED = 0x00, + VIDEO_VS_CTL_PROBE, + VIDEO_VS_CTL_COMMIT, + VIDEO_VS_CTL_STILL_PROBE, + VIDEO_VS_CTL_STILL_COMMIT, + VIDEO_VS_CTL_STILL_IMAGE_TRIGGER, + VIDEO_VS_CTL_STREAM_ERROR_CODE, + VIDEO_VS_CTL_GENERATE_KEY_FRAME, + VIDEO_VS_CTL_UPDATE_FRAME_SEGMENT, + VIDEO_VS_CTL_SYNCH_DELAY_CONTROL, +} video_interface_streaming_selector_t; + +/* B. Terminal Types */ +typedef enum { + // Terminal + VIDEO_TT_VENDOR_SPECIFIC = 0x0100, + VIDEO_TT_STREAMING = 0x0101, + + // Input + VIDEO_ITT_VENDOR_SPECIFIC = 0x0200, + VIDEO_ITT_CAMERA = 0x0201, + VIDEO_ITT_MEDIA_TRANSPORT_INPUT = 0x0202, + + // Output + VIDEO_OTT_VENDOR_SPECIFIC = 0x0300, + VIDEO_OTT_DISPLAY = 0x0301, + VIDEO_OTT_MEDIA_TRANSPORT_OUTPUT = 0x0302, + + // External + VIDEO_ETT_VENDOR_SPEIFIC = 0x0400, + VIDEO_ETT_COMPOSITE_CONNECTOR = 0x0401, + VIDEO_ETT_SVIDEO_CONNECTOR = 0x0402, + VIDEO_ETT_COMPONENT_CONNECTOR = 0x0403, +} video_terminal_type_t; + +//--------------------------------------------------------------------+ +// Descriptors +//--------------------------------------------------------------------+ + +/* 2.3.4.2 */ +typedef struct TU_ATTR_PACKED { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubType; + uint16_t bcdUVC; + uint16_t wTotalLength; + uint32_t dwClockFrequency; + uint8_t bInCollection; + uint8_t baInterfaceNr[]; +} tusb_desc_cs_video_ctl_itf_hdr_t; + +/* 2.4.3.3 */ +typedef struct TU_ATTR_PACKED { + uint8_t bHeaderLength; + union { + uint8_t bmHeaderInfo; + struct { + uint8_t FrameID: 1; + uint8_t EndOfFrame: 1; + uint8_t PresentationTime: 1; + uint8_t SourceClockReference: 1; + uint8_t PayloadSpecific: 1; + uint8_t StillImage: 1; + uint8_t Error: 1; + uint8_t EndOfHeader: 1; + }; + }; +} tusb_video_payload_header_t; + +/* 3.9.2.1 */ +typedef struct TU_ATTR_PACKED { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubType; + uint8_t bNumFormats; + uint16_t wTotalLength; + uint8_t bEndpointAddress; + uint8_t bmInfo; + uint8_t bTerminalLink; + uint8_t bStillCaptureMethod; + uint8_t bTriggerSupport; + uint8_t bTriggerUsage; + uint8_t bControlSize; + uint8_t bmaControls[]; +} tusb_desc_cs_video_stm_itf_in_hdr_t; + +/* 3.9.2.2 */ +typedef struct TU_ATTR_PACKED { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubType; + uint8_t bNumFormats; + uint16_t wTotalLength; + uint8_t bEndpointAddress; + uint8_t bTerminalLink; + uint8_t bControlSize; + uint8_t bmaControls[]; +} tusb_desc_cs_video_stm_itf_out_hdr_t; + +typedef struct TU_ATTR_PACKED { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubType; + uint8_t bNumFormats; + uint16_t wTotalLength; + uint8_t bEndpointAddress; + union { + struct { + uint8_t bmInfo; + uint8_t bTerminalLink; + uint8_t bStillCaptureMethod; + uint8_t bTriggerSupport; + uint8_t bTriggerUsage; + uint8_t bControlSize; + uint8_t bmaControls[]; + } input; + struct { + uint8_t bEndpointAddress; + uint8_t bTerminalLink; + uint8_t bControlSize; + uint8_t bmaControls[]; + } output; + }; +} tusb_desc_cs_video_stm_itf_hdr_t; + +typedef struct TU_ATTR_PACKED { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubType; + uint8_t bFormatIndex; + uint8_t bNumFrameDescriptors; + uint8_t guidFormat[16]; + uint8_t bBitsPerPixel; + uint8_t bDefaultFrameIndex; + uint8_t bAspectRatioX; + uint8_t bAspectRatioY; + uint8_t bmInterlaceFlags; + uint8_t bCopyProtect; +} tusb_desc_cs_video_fmt_uncompressed_t; + +typedef struct TU_ATTR_PACKED { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubType; + uint8_t bFrameIndex; + uint8_t bmCapabilities; + uint16_t wWidth; + uint16_t wHeight; + uint32_t dwMinBitRate; + uint32_t dwMaxBitRate; + uint32_t dwMaxVideoFrameBufferSize; /* deprecated */ + uint32_t dwDefaultFrameInterval; + uint8_t bFrameIntervalType; + uint32_t dwFrameInterval[]; +} tusb_desc_cs_video_frm_uncompressed_t; + +//--------------------------------------------------------------------+ +// Requests +//--------------------------------------------------------------------+ + +/* 4.3.1.1 */ +typedef struct TU_ATTR_PACKED { + union { + uint8_t bmHint; + struct TU_ATTR_PACKED { + uint16_t dwFrameInterval: 1; + uint16_t wKeyFrameRatel : 1; + uint16_t wPFrameRate : 1; + uint16_t wCompQuality : 1; + uint16_t wCompWindowSize: 1; + uint16_t : 0; + } Hint; + }; + uint8_t bFormatIndex; + uint8_t bFrameIndex; + uint32_t dwFrameInterval; + uint16_t wKeyFrameRate; + uint16_t wPFrameRate; + uint16_t wCompQuality; + uint16_t wCompWindowSize; + uint16_t wDelay; + uint32_t dwMaxVideoFrameSize; + uint32_t dwMaxPayloadTransferSize; + uint32_t dwClockFrequency; + union { + uint8_t bmFramingInfo; + struct TU_ATTR_PACKED { + uint8_t FrameID : 1; + uint8_t EndOfFrame: 1; + uint8_t EndOfSlice: 1; + uint8_t : 0; + } FramingInfo; + }; + uint8_t bPreferedVersion; + uint8_t bMinVersion; + uint8_t bMaxVersion; + uint8_t bUsage; + uint8_t bBitDepthLuma; + uint8_t bmSettings; + uint8_t bMaxNumberOfRefFramesPlus1; + uint16_t bmRateControlModes; + uint64_t bmLayoutPerStream; +} video_probe_and_commit_control_t; + +TU_VERIFY_STATIC( sizeof(video_probe_and_commit_control_t) == 48, "size is not correct"); + +#define TUD_VIDEO_DESC_IAD_LEN 8 +#define TUD_VIDEO_DESC_STD_VC_LEN 9 +#define TUD_VIDEO_DESC_CS_VC_LEN 12 +#define TUD_VIDEO_DESC_INPUT_TERM_LEN 8 +#define TUD_VIDEO_DESC_OUTPUT_TERM_LEN 9 +#define TUD_VIDEO_DESC_STD_VS_LEN 9 +#define TUD_VIDEO_DESC_CS_VS_IN_LEN 13 +#define TUD_VIDEO_DESC_CS_VS_OUT_LEN 9 +#define TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR_LEN 27 +#define TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT_LEN 38 +#define TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_DISC_LEN 26 +#define TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING_LEN 6 + +/* 2.2 compression formats */ +#define TUD_VIDEO_GUID_YUY2 0x59,0x55,0x59,0x32,0x00,0x00,0x10,0x00,0x00,0x80,0x71,0x9B,0x38,0x00,0xAA,0x00 +#define TUD_VIDEO_GUID_NV12 0x4E,0x56,0x31,0x32,0x00,0x00,0x10,0x00,0x00,0x80,0x71,0x9B,0x38,0x00,0xAA,0x00 +#define TUD_VIDEO_GUID_M420 0x4D,0x34,0x32,0x30,0x00,0x00,0x10,0x00,0x00,0x80,0x71,0x9B,0x38,0x00,0xAA,0x00 +#define TUD_VIDEO_GUID_I420 0x49,0x34,0x32,0x30,0x00,0x00,0x10,0x00,0x00,0x80,0x71,0x9B,0x38,0x00,0xAA,0x00 + +#define TUD_VIDEO_DESC_IAD(_firstitfs, _nitfs, _stridx) \ + TUD_VIDEO_DESC_IAD_LEN, TUSB_DESC_INTERFACE_ASSOCIATION, \ + _firstitfs, _nitfs, TUSB_CLASS_VIDEO, VIDEO_SUBCLASS_INTERFACE_COLLECTION, \ + VIDEO_ITF_PROTOCOL_UNDEFINED, _stridx + +#define TUD_VIDEO_DESC_STD_VC(_itfnum, _nEPs, _stridx) \ + TUD_VIDEO_DESC_STD_VC_LEN, TUSB_DESC_INTERFACE, _itfnum, /* fixed to zero */ 0x00, \ + _nEPs, TUSB_CLASS_VIDEO, VIDEO_SUBCLASS_CONTROL, VIDEO_ITF_PROTOCOL_15, _stridx + +/* 3.7.2 */ +#define TUD_VIDEO_DESC_CS_VC(_bcdUVC, _totallen, _clkfreq, ...) \ + TUD_VIDEO_DESC_CS_VC_LEN + (TU_ARGS_NUM(__VA_ARGS__)), TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VC_HEADER, \ + U16_TO_U8S_LE(_bcdUVC), U16_TO_U8S_LE((_totallen) + TUD_VIDEO_DESC_CS_VC_LEN + (TU_ARGS_NUM(__VA_ARGS__))), \ + U32_TO_U8S_LE(_clkfreq), TU_ARGS_NUM(__VA_ARGS__), __VA_ARGS__ + +/* 3.7.2.1 */ +#define TUD_VIDEO_DESC_INPUT_TERM(_tid, _tt, _at, _stridx) \ + TUD_VIDEO_DESC_INPUT_TERM_LEN, TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VC_INPUT_TERMINAL, \ + _tid, U16_TO_U8S_LE(_tt), _at, _stridx + +/* 3.7.2.2 */ +#define TUD_VIDEO_DESC_OUTPUT_TERM(_tid, _tt, _at, _srcid, _stridx) \ + TUD_VIDEO_DESC_OUTPUT_TERM_LEN, TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VC_OUTPUT_TERMINAL, \ + _tid, U16_TO_U8S_LE(_tt), _at, _srcid, _stridx + +/* 3.9.1 */ +#define TUD_VIDEO_DESC_STD_VS(_itfnum, _alt, _epn, _stridx) \ + TUD_VIDEO_DESC_STD_VS_LEN, TUSB_DESC_INTERFACE, _itfnum, _alt, \ + _epn, TUSB_CLASS_VIDEO, VIDEO_SUBCLASS_STREAMING, VIDEO_ITF_PROTOCOL_15, _stridx + +/* 3.9.2.1 */ +#define TUD_VIDEO_DESC_CS_VS_INPUT(_numfmt, _totallen, _ep, _inf, _termlnk, _sticaptmeth, _trgspt, _trgusg, ...) \ + TUD_VIDEO_DESC_CS_VS_IN_LEN + (_numfmt) * (TU_ARGS_NUM(__VA_ARGS__)), TUSB_DESC_CS_INTERFACE, \ + VIDEO_CS_ITF_VS_INPUT_HEADER, _numfmt, \ + U16_TO_U8S_LE((_totallen) + TUD_VIDEO_DESC_CS_VS_IN_LEN + (_numfmt) * (TU_ARGS_NUM(__VA_ARGS__))), \ + _ep, _inf, _termlnk, _sticaptmeth, _trgspt, _trgusg, (TU_ARGS_NUM(__VA_ARGS__)), __VA_ARGS__ + +/* 3.9.2.2 */ +#define TUD_VIDEO_DESC_CS_VS_OUTPUT(_numfmt, _totallen, _ep, _inf, _termlnk, ...) \ + TUD_VIDEO_DESC_CS_VS_OUT_LEN + (_numfmt) * (TU_ARGS_NUM(__VA_ARGS__)), TUSB_DESC_CS_INTERFACE, \ + VIDEO_CS_ITF_VS_OUTPUT_HEADER, _numfmt, \ + U16_TO_U8S_LE((_totallen) + TUD_VIDEO_DESC_CS_VS_OUT_LEN + (_numfmt) * (TU_ARGS_NUM(__VA_ARGS__))), \ + _ep, _inf, _termlnk, (TU_ARGS_NUM(__VA_ARGS__)), __VA_ARGS__ + +/* Uncompressed 3.1.1 */ +#define TUD_VIDEO_GUID(_g0,_g1,_g2,_g3,_g4,_g5,_g6,_g7,_g8,_g9,_g10,_g11,_g12,_g13,_g14,_g15) _g0,_g1,_g2,_g3,_g4,_g5,_g6,_g7,_g8,_g9,_g10,_g11,_g12,_g13,_g14,_g15 + +#define TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR(_fmtidx, _numfrmdesc, \ + _guid, _bitsperpix, _frmidx, _asrx, _asry, _interlace, _cp) \ + TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR_LEN, TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VS_FORMAT_UNCOMPRESSED, \ + _fmtidx, _numfrmdesc, TUD_VIDEO_GUID(_guid), \ + _bitsperpix, _frmidx, _asrx, _asry, _interlace, _cp + +/* Uncompressed 3.1.2 Table 3-3 */ +#define TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT(_frmidx, _cap, _width, _height, _minbr, _maxbr, _maxfrmbufsz, _frminterval, _minfrminterval, _maxfrminterval, _frmintervalstep) \ + TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT_LEN, TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VS_FRAME_UNCOMPRESSED, \ + _frmidx, _cap, U16_TO_U8S_LE(_width), U16_TO_U8S_LE(_height), U32_TO_U8S_LE(_minbr), U32_TO_U8S_LE(_maxbr), \ + U32_TO_U8S_LE(_maxfrmbufsz), U32_TO_U8S_LE(_frminterval), 0, \ + U32_TO_U8S_LE(_minfrminterval), U32_TO_U8S_LE(_maxfrminterval), U32_TO_U8S_LE(_frmintervalstep) + +/* Uncompressed 3.1.2 Table 3-4 */ +#define TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_DISC(_frmidx, _cap, _width, _height, _minbr, _maxbr, _maxfrmbufsz, _frminterval, ...) \ + TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_DISC_LEN + (TU_ARGS_NUM(__VA_ARGS__)) * 4, \ + TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VS_FRAME_UNCOMPRESSED, \ + _frmidx, _cap, U16_TO_U8S_LE(_width), U16_TO_U8S_LE(_height), U32_TO_U8S_LE(_minbr), U32_TO_U8S_LE(_maxbr), \ + U32_TO_U8S_LE(_maxfrmbufsz), U32_TO_U8S_LE(_frminterval), (TU_ARGS_NUM(__VA_ARGS__)), __VA_ARGS__ + +/* 3.9.2.6 */ +#define TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING(_color, _trns, _mat) \ + TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING_LEN, \ + TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VS_COLORFORMAT, \ + _color, _trns, _mat + +/* 3.10.1.1 */ +#define TUD_VIDEO_DESC_EP_ISO(_ep, _epsize, _ep_interval) \ + 7, TUSB_DESC_ENDPOINT, _ep, TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS,\ + U16_TO_U8S_LE(_epsize), _ep_interval + +/* 3.10.1.2 */ +#define TUD_VIDEO_DESC_EP_BULK(_ep, _epsize, _ep_interval) \ + 7, TUSB_DESC_ENDPOINT, _ep, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), _ep_interval + +#endif diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/video/video_device.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/video/video_device.h new file mode 100644 index 00000000000..ee2fcb9d513 --- /dev/null +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/video/video_device.h @@ -0,0 +1,97 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach (tinyusb.org) + * Copyright (c) 2021 Koji KITAYAMA + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ + +#ifndef TUSB_VIDEO_DEVICE_H_ +#define TUSB_VIDEO_DEVICE_H_ + +#include "common/tusb_common.h" +#include "video.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//--------------------------------------------------------------------+ +// Application API (Multiple Ports) +// CFG_TUD_VIDEO > 1 +//--------------------------------------------------------------------+ + +/** Return true if streaming + * + * @param[in] ctl_idx Destination control interface index + * @param[in] stm_idx Destination streaming interface index */ +bool tud_video_n_streaming(uint_fast8_t ctl_idx, uint_fast8_t stm_idx); + +/** Transfer a frame + * + * @param[in] ctl_idx Destination control interface index + * @param[in] stm_idx Destination streaming interface index + * @param[in] buffer Frame buffer. The caller must not use this buffer until the operation is completed. + * @param[in] bufsize Byte size of the frame buffer */ +bool tud_video_n_frame_xfer(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, void *buffer, size_t bufsize); + +/*------------- Optional callbacks -------------*/ +/** Invoked when compeletion of a frame transfer + * + * @param[in] ctl_idx Destination control interface index + * @param[in] stm_idx Destination streaming interface index */ +TU_ATTR_WEAK void tud_video_frame_xfer_complete_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx); + +//--------------------------------------------------------------------+ +// Application Callback API (weak is optional) +//--------------------------------------------------------------------+ + +/** Invoked when SET_POWER_MODE request received + * + * @param[in] ctl_idx Destination control interface index + * @param[in] stm_idx Destination streaming interface index + * @return video_error_code_t */ +TU_ATTR_WEAK int tud_video_power_mode_cb(uint_fast8_t ctl_idx, uint8_t power_mod); + +/** Invoked when VS_COMMIT_CONTROL(SET_CUR) request received + * + * @param[in] ctl_idx Destination control interface index + * @param[in] stm_idx Destination streaming interface index + * @param[in] parameters Video streaming parameters + * @return video_error_code_t */ +TU_ATTR_WEAK int tud_video_commit_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, + video_probe_and_commit_control_t const *parameters); + +//--------------------------------------------------------------------+ +// INTERNAL USBD-CLASS DRIVER API +//--------------------------------------------------------------------+ +void videod_init (void); +void videod_reset (uint8_t rhport); +uint16_t videod_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool videod_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); +bool videod_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_common.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_common.h index 1899b35cc3d..fc4d3bc62d3 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_common.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_common.h @@ -38,18 +38,18 @@ #define TU_MIN(_x, _y) ( ( (_x) < (_y) ) ? (_x) : (_y) ) #define TU_MAX(_x, _y) ( ( (_x) > (_y) ) ? (_x) : (_y) ) -#define TU_U16_HIGH(u16) ((uint8_t) (((u16) >> 8) & 0x00ff)) -#define TU_U16_LOW(u16) ((uint8_t) ((u16) & 0x00ff)) -#define U16_TO_U8S_BE(u16) TU_U16_HIGH(u16), TU_U16_LOW(u16) -#define U16_TO_U8S_LE(u16) TU_U16_LOW(u16), TU_U16_HIGH(u16) +#define TU_U16_HIGH(_u16) ((uint8_t) (((_u16) >> 8) & 0x00ff)) +#define TU_U16_LOW(_u16) ((uint8_t) ((_u16) & 0x00ff)) +#define U16_TO_U8S_BE(_u16) TU_U16_HIGH(_u16), TU_U16_LOW(_u16) +#define U16_TO_U8S_LE(_u16) TU_U16_LOW(_u16), TU_U16_HIGH(_u16) -#define TU_U32_BYTE3(u32) ((uint8_t) ((((uint32_t) u32) >> 24) & 0x000000ff)) // MSB -#define TU_U32_BYTE2(u32) ((uint8_t) ((((uint32_t) u32) >> 16) & 0x000000ff)) -#define TU_U32_BYTE1(u32) ((uint8_t) ((((uint32_t) u32) >> 8) & 0x000000ff)) -#define TU_U32_BYTE0(u32) ((uint8_t) (((uint32_t) u32) & 0x000000ff)) // LSB +#define TU_U32_BYTE3(_u32) ((uint8_t) ((((uint32_t) _u32) >> 24) & 0x000000ff)) // MSB +#define TU_U32_BYTE2(_u32) ((uint8_t) ((((uint32_t) _u32) >> 16) & 0x000000ff)) +#define TU_U32_BYTE1(_u32) ((uint8_t) ((((uint32_t) _u32) >> 8) & 0x000000ff)) +#define TU_U32_BYTE0(_u32) ((uint8_t) (((uint32_t) _u32) & 0x000000ff)) // LSB -#define U32_TO_U8S_BE(u32) TU_U32_BYTE3(u32), TU_U32_BYTE2(u32), TU_U32_BYTE1(u32), TU_U32_BYTE0(u32) -#define U32_TO_U8S_LE(u32) TU_U32_BYTE0(u32), TU_U32_BYTE1(u32), TU_U32_BYTE2(u32), TU_U32_BYTE3(u32) +#define U32_TO_U8S_BE(_u32) TU_U32_BYTE3(_u32), TU_U32_BYTE2(_u32), TU_U32_BYTE1(_u32), TU_U32_BYTE0(_u32) +#define U32_TO_U8S_LE(_u32) TU_U32_BYTE0(_u32), TU_U32_BYTE1(_u32), TU_U32_BYTE2(_u32), TU_U32_BYTE3(_u32) #define TU_BIT(n) (1UL << (n)) @@ -105,16 +105,13 @@ TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_u16(uint8_t high, uint8_t low) return (uint16_t) ((((uint16_t) high) << 8) | low); } -TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte3(uint32_t u32) { return TU_U32_BYTE3(u32); } -TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte2(uint32_t u32) { return TU_U32_BYTE2(u32); } -TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte1(uint32_t u32) { return TU_U32_BYTE1(u32); } -TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte0(uint32_t u32) { return TU_U32_BYTE0(u32); } +TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte3(uint32_t ui32) { return TU_U32_BYTE3(ui32); } +TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte2(uint32_t ui32) { return TU_U32_BYTE2(ui32); } +TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte1(uint32_t ui32) { return TU_U32_BYTE1(ui32); } +TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte0(uint32_t ui32) { return TU_U32_BYTE0(ui32); } -TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_u32_high16(uint32_t u32) { return (uint16_t) (u32 >> 16); } -TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_u32_low16 (uint32_t u32) { return (uint16_t) (u32 & 0x0000ffffu); } - -TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u16_high(uint16_t u16) { return TU_U16_HIGH(u16); } -TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u16_low (uint16_t u16) { return TU_U16_LOW(u16); } +TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u16_high(uint16_t ui16) { return TU_U16_HIGH(ui16); } +TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u16_low (uint16_t ui16) { return TU_U16_LOW(ui16); } //------------- Bits -------------// TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_bit_set (uint32_t value, uint8_t pos) { return value | TU_BIT(pos); } diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_types.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_types.h index f26983a7483..897e89b3943 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_types.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_types.h @@ -69,6 +69,18 @@ typedef enum TUSB_DIR_IN_MASK = 0x80 }tusb_dir_t; +/// Isochronous End Point Attributes +typedef enum +{ + TUSB_ISO_EP_ATT_NO_SYNC = 0x00, + TUSB_ISO_EP_ATT_ASYNCHRONOUS = 0x04, + TUSB_ISO_EP_ATT_ADAPTIVE = 0x08, + TUSB_ISO_EP_ATT_SYNCHRONOUS = 0x0C, + TUSB_ISO_EP_ATT_DATA = 0x00, ///< Data End Point + TUSB_ISO_EP_ATT_EXPLICIT_FB = 0x10, ///< Feedback End Point + TUSB_ISO_EP_ATT_IMPLICIT_FB = 0x20, ///< Data endpoint that also serves as an implicit feedback +}tusb_iso_ep_attribute_t; + /// USB Descriptor Types typedef enum { diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd_attr.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd_attr.h index a35fc0ac502..44f2cc1d6d0 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd_attr.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/dcd_attr.h @@ -63,6 +63,9 @@ #elif TU_CHECK_MCU(MKL25ZXX) || TU_CHECK_MCU(K32L2BXX) #define DCD_ATTR_ENDPOINT_MAX 16 +#elif TU_CHECK_MCU(MM32F327X) + #define DCD_ATTR_ENDPOINT_MAX 16 + //------------- Nordic -------------// #elif TU_CHECK_MCU(NRF5X) // 8 CBI + 1 ISO diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h index 638d9309470..8d02de1ff1f 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h @@ -178,17 +178,18 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F //--------------------------------------------------------------------+ -// Configuration & Interface Descriptor Templates +// Configuration Descriptor Templates //--------------------------------------------------------------------+ -//------------- Configuration -------------// #define TUD_CONFIG_DESC_LEN (9) // Config number, interface count, string index, total length, attribute, power in mA #define TUD_CONFIG_DESCRIPTOR(config_num, _itfcount, _stridx, _total_len, _attribute, _power_ma) \ 9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, config_num, _stridx, TU_BIT(7) | _attribute, (_power_ma)/2 -//------------- CDC -------------// +//--------------------------------------------------------------------+ +// CDC Descriptor Templates +//--------------------------------------------------------------------+ // Length of template descriptor: 66 bytes #define TUD_CDC_DESC_LEN (8+9+5+5+4+5+7+9+7+7) @@ -217,7 +218,9 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Endpoint In */\ 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0 -//------------- MSC -------------// +//--------------------------------------------------------------------+ +// MSC Descriptor Templates +//--------------------------------------------------------------------+ // Length of template descriptor: 23 bytes #define TUD_MSC_DESC_LEN (9 + 7 + 7) @@ -231,7 +234,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Endpoint In */\ 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0 -//------------- HID -------------// + +//--------------------------------------------------------------------+ +// HID Descriptor Templates +//--------------------------------------------------------------------+ // Length of template descriptor: 25 bytes #define TUD_HID_DESC_LEN (9 + 9 + 7) @@ -261,8 +267,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Endpoint In */\ 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval -//------------- MIDI -------------// -// MIDI v1.0 is based on Audio v1.0 +//--------------------------------------------------------------------+ +// MIDI Descriptor Templates +// Note: MIDI v1.0 is based on Audio v1.0 +//--------------------------------------------------------------------+ #define TUD_MIDI_DESC_HEAD_LEN (9 + 9 + 9 + 7) #define TUD_MIDI_DESC_HEAD(_itfnum, _stridx, _numcables) \ @@ -319,7 +327,9 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb TUD_MIDI_DESC_EP(_epin, _epsize, 1),\ TUD_MIDI_JACKID_OUT_EMB(1) -//------------- AUDIO -------------// +//--------------------------------------------------------------------+ +// Audio v2.0 Descriptor Templates +//--------------------------------------------------------------------+ /* Standard Interface Association Descriptor (IAD) */ #define TUD_AUDIO_DESC_IAD_LEN 8 @@ -551,7 +561,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb ((((_maxFrequency + ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 7999 : 999)) / ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 8000 : 1000)) + 1) * _nBytesPerSample * _nChannels) -//------------- TUD_USBTMC/USB488 -------------// +//--------------------------------------------------------------------+ +// USBTMC/USB488 Descriptor Templates +//--------------------------------------------------------------------+ + #define TUD_USBTMC_APP_CLASS (TUSB_CLASS_APPLICATION_SPECIFIC) #define TUD_USBTMC_APP_SUBCLASS 0x03u @@ -581,8 +594,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb #define TUD_USBTMC_INT_DESCRIPTOR_LEN (7u) +//--------------------------------------------------------------------+ +// Vendor Descriptor Templates +//--------------------------------------------------------------------+ -//------------- Vendor -------------// #define TUD_VENDOR_DESC_LEN (9+7+7) // Interface number, string index, EP Out & IN address, EP size @@ -594,7 +609,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Endpoint In */\ 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0 -//------------- DFU Runtime -------------// +//--------------------------------------------------------------------+ +// DFU Runtime Descriptor Templates +//--------------------------------------------------------------------+ + #define TUD_DFU_APP_CLASS (TUSB_CLASS_APPLICATION_SPECIFIC) #define TUD_DFU_APP_SUBCLASS (APP_SUBCLASS_DFU_RUNTIME) @@ -609,6 +627,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Function */ \ 9, DFU_DESC_FUNCTIONAL, _attr, U16_TO_U8S_LE(_timeout), U16_TO_U8S_LE(_xfer_size), U16_TO_U8S_LE(0x0101) +//--------------------------------------------------------------------+ +// DFU Descriptor Templates +//--------------------------------------------------------------------+ + // Length of template descriptor: 9 bytes + number of alternatives * 9 #define TUD_DFU_DESC_LEN(_alt_count) (9 + (_alt_count) * 9) @@ -654,8 +676,9 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \ _TUD_DFU_ALT_7(_itfnum, _alt_count+1, _stridx+1) - -//------------- CDC-ECM -------------// +//--------------------------------------------------------------------+ +// CDC-ECM Descriptor Templates +//--------------------------------------------------------------------+ // Length of template descriptor: 71 bytes #define TUD_CDC_ECM_DESC_LEN (8+9+5+5+13+7+9+9+7+7) @@ -684,8 +707,9 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Endpoint Out */\ 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0 - -//------------- RNDIS -------------// +//--------------------------------------------------------------------+ +// RNDIS Descriptor Templates +//--------------------------------------------------------------------+ #if 0 /* Windows XP */ @@ -726,7 +750,10 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb /* Endpoint Out */\ 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0 -//------------- BT Radio -------------// +//--------------------------------------------------------------------+ +// Bluetooth Radio Descriptor Templates +//--------------------------------------------------------------------+ + #define TUD_BT_APP_CLASS (TUSB_CLASS_WIRELESS_CONTROLLER) #define TUD_BT_APP_SUBCLASS 0x01 #define TUD_BT_PROTOCOL_PRIMARY_CONTROLLER 0x01 @@ -777,10 +804,44 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb // BT Primary controller descriptor // Interface number, string index, attributes, event endpoint, event endpoint size, interval, data in, data out, data endpoint size, iso endpoint sizes +// TODO BTH should also use IAD like CDC for composite device #define TUD_BTH_DESCRIPTOR(_itfnum, _stridx, _ep_evt, _ep_evt_size, _ep_evt_interval, _ep_in, _ep_out, _ep_size,...) \ TUD_BTH_PRI_ITF(_itfnum, _stridx, _ep_evt, _ep_evt_size, _ep_evt_interval, _ep_in, _ep_out, _ep_size) \ TUD_BTH_ISO_ITFS(_itfnum + 1, _ep_in + 1, _ep_out + 1, __VA_ARGS__) +//--------------------------------------------------------------------+ +// CDC-NCM Descriptor Templates +//--------------------------------------------------------------------+ + +// Length of template descriptor +#define TUD_CDC_NCM_DESC_LEN (8+9+5+5+13+6+7+9+9+7+7) + +// CDC-ECM Descriptor Template +// Interface number, description string index, MAC address string index, EP notification address and size, EP data address (out, in), and size, max segment size. +#define TUD_CDC_NCM_DESCRIPTOR(_itfnum, _desc_stridx, _mac_stridx, _ep_notif, _ep_notif_size, _epout, _epin, _epsize, _maxsegmentsize) \ + /* Interface Association */\ + 8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_NETWORK_CONTROL_MODEL, 0, 0,\ + /* CDC Control Interface */\ + 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_NETWORK_CONTROL_MODEL, 0, _desc_stridx,\ + /* CDC-NCM Header */\ + 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_HEADER, U16_TO_U8S_LE(0x0110),\ + /* CDC-NCM Union */\ + 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_UNION, _itfnum, (uint8_t)((_itfnum) + 1),\ + /* CDC-NCM Functional Descriptor */\ + 13, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_ETHERNET_NETWORKING, _mac_stridx, 0, 0, 0, 0, U16_TO_U8S_LE(_maxsegmentsize), U16_TO_U8S_LE(0), 0, \ + /* CDC-NCM Functional Descriptor */\ + 6, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_NCM, U16_TO_U8S_LE(0x0100), 0, \ + /* Endpoint Notification */\ + 7, TUSB_DESC_ENDPOINT, _ep_notif, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_notif_size), 50,\ + /* CDC Data Interface (default inactive) */\ + 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 0, 0, TUSB_CLASS_CDC_DATA, 0, NCM_DATA_PROTOCOL_NETWORK_TRANSFER_BLOCK, 0,\ + /* CDC Data Interface (alternative active) */\ + 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 1, 2, TUSB_CLASS_CDC_DATA, 0, NCM_DATA_PROTOCOL_NETWORK_TRANSFER_BLOCK, 0,\ + /* Endpoint In */\ + 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\ + /* Endpoint Out */\ + 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0 + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb.h index b52f8839ac8..0d29e106c9b 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb.h @@ -76,9 +76,13 @@ #include "class/msc/msc_device.h" #endif -#if CFG_TUD_AUDIO - #include "class/audio/audio_device.h" -#endif + #if CFG_TUD_AUDIO + #include "class/audio/audio_device.h" + #endif + + #if CFG_TUD_VIDEO + #include "class/video/video_device.h" + #endif #if CFG_TUD_MIDI #include "class/midi/midi_device.h" @@ -100,7 +104,7 @@ #include "class/dfu/dfu_device.h" #endif - #if CFG_TUD_NET + #if CFG_TUD_ECM_RNDIS || CFG_TUD_NCM #include "class/net/net_device.h" #endif diff --git a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb_option.h b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb_option.h index ad2a26a6654..b2ebfdf66de 100644 --- a/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb_option.h +++ b/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/tusb_option.h @@ -241,6 +241,10 @@ #define CFG_TUD_AUDIO 0 #endif +#ifndef CFG_TUD_VIDEO + #define CFG_TUD_VIDEO 0 +#endif + #ifndef CFG_TUD_MIDI #define CFG_TUD_MIDI 0 #endif @@ -261,14 +265,23 @@ #define CFG_TUD_DFU 0 #endif -#ifndef CFG_TUD_NET - #define CFG_TUD_NET 0 -#endif - #ifndef CFG_TUD_BTH #define CFG_TUD_BTH 0 #endif +#ifndef CFG_TUD_ECM_RNDIS + #ifdef CFG_TUD_NET + #warning "CFG_TUD_NET is renamed to CFG_TUD_ECM_RNDIS" + #define CFG_TUD_ECM_RNDIS CFG_TUD_NET + #else + #define CFG_TUD_ECM_RNDIS 0 + #endif +#endif + +#ifndef CFG_TUD_NCM + #define CFG_TUD_NCM 0 +#endif + //-------------------------------------------------------------------- // HOST OPTIONS //-------------------------------------------------------------------- @@ -280,10 +293,34 @@ #ifndef CFG_TUH_ENUMERATION_BUFSIZE #define CFG_TUH_ENUMERATION_BUFSIZE 256 #endif - - //------------- CLASS -------------// #endif // TUSB_OPT_HOST_ENABLED +//------------- CLASS -------------// + +#ifndef CFG_TUH_HUB +#define CFG_TUH_HUB 0 +#endif + +#ifndef CFG_TUH_CDC +#define CFG_TUH_CDC 0 +#endif + +#ifndef CFG_TUH_HID +#define CFG_TUH_HID 0 +#endif + +#ifndef CFG_TUH_MIDI +#define CFG_TUH_MIDI 0 +#endif + +#ifndef CFG_TUH_MSC +#define CFG_TUH_MSC 0 +#endif + +#ifndef CFG_TUH_VENDOR +#define CFG_TUH_VENDOR 0 +#endif + //--------------------------------------------------------------------+ // Port Specific // TUP stand for TinyUSB Port (can be renamed) diff --git a/tools/sdk/esp32s2/include/asio/port/include/esp_asio_config.h b/tools/sdk/esp32s2/include/asio/port/include/esp_asio_config.h index cba316527e6..3f3a9b03ed4 100644 --- a/tools/sdk/esp32s2/include/asio/port/include/esp_asio_config.h +++ b/tools/sdk/esp32s2/include/asio/port/include/esp_asio_config.h @@ -18,6 +18,11 @@ # define ASIO_NO_TYPEID # endif // CONFIG_COMPILER_RTTI +// +// Supress OpenSSL deprecation warning, when building ASIO +// +#define ESP_OPENSSL_SUPPRESS_LEGACY_WARNING + // // LWIP compatibility inet and address macros/functions // diff --git a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_block_internal.h b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_block_internal.h index 9abe81557fa..b7ad0a554cc 100644 --- a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_block_internal.h +++ b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_block_internal.h @@ -191,6 +191,9 @@ int coap_handle_response_get_block(coap_context_t *context, void coap_block_delete_lg_xmit(coap_session_t *session, coap_lg_xmit_t *lg_xmit); +coap_tick_t coap_block_check_lg_xmit_timeouts(coap_session_t *session, + coap_tick_t now); + /** * The function that does all the work for the coap_add_data_large*() * functions. diff --git a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_dtls.h b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_dtls.h index cbd369dfce6..fc30445431d 100644 --- a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_dtls.h +++ b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_dtls.h @@ -27,6 +27,12 @@ typedef struct coap_dtls_pki_t coap_dtls_pki_t; #ifndef COAP_DTLS_HINT_LENGTH #define COAP_DTLS_HINT_LENGTH 128 #endif +#ifndef COAP_DTLS_MAX_PSK_IDENTITY +#define COAP_DTLS_MAX_PSK_IDENTITY 64 +#endif +#ifndef COAP_DTLS_MAX_PSK +#define COAP_DTLS_MAX_PSK 64 +#endif typedef enum coap_dtls_role_t { COAP_DTLS_ROLE_CLIENT, /**< Internal function invoked for client */ diff --git a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_event.h b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_event.h index 89b2a63967c..b6ea60524a2 100644 --- a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_event.h +++ b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_event.h @@ -24,34 +24,34 @@ * Scalar type to represent different events, e.g. DTLS events or * retransmission timeouts. */ - typedef unsigned int coap_event_t; - +typedef enum coap_event_t { /** * (D)TLS events for COAP_PROTO_DTLS and COAP_PROTO_TLS */ -#define COAP_EVENT_DTLS_CLOSED 0x0000 -#define COAP_EVENT_DTLS_CONNECTED 0x01DE -#define COAP_EVENT_DTLS_RENEGOTIATE 0x01DF -#define COAP_EVENT_DTLS_ERROR 0x0200 + COAP_EVENT_DTLS_CLOSED = 0x0000, + COAP_EVENT_DTLS_CONNECTED = 0x01DE, + COAP_EVENT_DTLS_RENEGOTIATE = 0x01DF, + COAP_EVENT_DTLS_ERROR = 0x0200, /** * TCP events for COAP_PROTO_TCP and COAP_PROTO_TLS */ -#define COAP_EVENT_TCP_CONNECTED 0x1001 -#define COAP_EVENT_TCP_CLOSED 0x1002 -#define COAP_EVENT_TCP_FAILED 0x1003 + COAP_EVENT_TCP_CONNECTED = 0x1001, + COAP_EVENT_TCP_CLOSED = 0x1002, + COAP_EVENT_TCP_FAILED = 0x1003, /** * CSM exchange events for reliable protocols only */ -#define COAP_EVENT_SESSION_CONNECTED 0x2001 -#define COAP_EVENT_SESSION_CLOSED 0x2002 -#define COAP_EVENT_SESSION_FAILED 0x2003 + COAP_EVENT_SESSION_CONNECTED = 0x2001, + COAP_EVENT_SESSION_CLOSED = 0x2002, + COAP_EVENT_SESSION_FAILED = 0x2003, /** - * BLOCK2 receive errors + * (Q-)BLOCK receive errors */ -#define COAP_EVENT_PARTIAL_BLOCK 0x3001 + COAP_EVENT_PARTIAL_BLOCK = 0x3001 +} coap_event_t; /** * Type for event handler functions that can be registered with a CoAP diff --git a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_time.h b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_time.h index baa8650eaff..99d117a4eb7 100644 --- a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_time.h +++ b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/coap_time.h @@ -88,7 +88,11 @@ COAP_STATIC_INLINE uint64_t coap_ticks_to_rt_us(coap_tick_t t) { #elif defined(RIOT_VERSION) #include +#ifdef XTIMER_HZ #define COAP_TICKS_PER_SECOND (XTIMER_HZ) +#else /* XTIMER_HZ */ +#define COAP_TICKS_PER_SECOND (XTIMER_HZ_BASE) +#endif /* XTIMER_HZ */ typedef uint64_t coap_tick_t; typedef int64_t coap_tick_diff_t; diff --git a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/net.h b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/net.h index 577a0b5d5a5..ea5a2cba1bb 100644 --- a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/net.h +++ b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/net.h @@ -15,6 +15,7 @@ #include #include #ifndef _WIN32 +#include #include #endif #include diff --git a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/pdu.h b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/pdu.h index a22869b69ed..8031a1c2c40 100644 --- a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/pdu.h +++ b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/pdu.h @@ -299,7 +299,6 @@ typedef enum coap_pdu_code_t { COAP_REQUEST_CODE_PATCH = COAP_REQUEST_PATCH, COAP_REQUEST_CODE_IPATCH = COAP_REQUEST_IPATCH, - COAP_RESPONSE_CODE_OK = COAP_RESPONSE_CODE(200), COAP_RESPONSE_CODE_CREATED = COAP_RESPONSE_CODE(201), COAP_RESPONSE_CODE_DELETED = COAP_RESPONSE_CODE(202), COAP_RESPONSE_CODE_VALID = COAP_RESPONSE_CODE(203), diff --git a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/resource.h b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/resource.h index 2cd9aea48fa..5cf7751f67e 100644 --- a/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/resource.h +++ b/tools/sdk/esp32s2/include/coap/libcoap/include/coap3/resource.h @@ -83,7 +83,8 @@ typedef void (*coap_method_handler_t) * variable of coap_str_const_t has to point to constant text, or point to data * within the allocated coap_str_const_t parameter. * - * @param uri_path The string URI path of the new resource. + * @param uri_path The string URI path of the new resource. The leading '/' is + * not normally required - e.g. just "full/path/for/resource". * @param flags Flags for memory management (in particular release of * memory). Possible values:@n * diff --git a/tools/sdk/esp32s2/include/config/sdkconfig.h b/tools/sdk/esp32s2/include/config/sdkconfig.h index 48660a5006f..7bad1c4fa50 100644 --- a/tools/sdk/esp32s2/include/config/sdkconfig.h +++ b/tools/sdk/esp32s2/include/config/sdkconfig.h @@ -30,6 +30,7 @@ #define CONFIG_BOOT_ROM_LOG_ALWAYS_ON 1 #define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200 #define CONFIG_ESPTOOLPY_FLASHMODE_QIO 1 +#define CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR 1 #define CONFIG_ESPTOOLPY_FLASHMODE "dio" #define CONFIG_ESPTOOLPY_FLASHFREQ_80M 1 #define CONFIG_ESPTOOLPY_FLASHFREQ "80m" @@ -70,7 +71,7 @@ #define CONFIG_TINYUSB_CDC_TX_BUFSIZE 64 #define CONFIG_TINYUSB_MSC_ENABLED 1 #define CONFIG_TINYUSB_DESC_MSC_STRING "Espressif MSC Device" -#define CONFIG_TINYUSB_MSC_BUFSIZE 512 +#define CONFIG_TINYUSB_MSC_BUFSIZE 4096 #define CONFIG_TINYUSB_HID_ENABLED 1 #define CONFIG_TINYUSB_DESC_HID_STRING "Espressif HID Device" #define CONFIG_TINYUSB_HID_BUFSIZE 64 @@ -78,6 +79,10 @@ #define CONFIG_TINYUSB_DESC_MIDI_STRING "Espressif MIDI Device" #define CONFIG_TINYUSB_MIDI_RX_BUFSIZE 64 #define CONFIG_TINYUSB_MIDI_TX_BUFSIZE 64 +#define CONFIG_TINYUSB_VIDEO_ENABLED 1 +#define CONFIG_TINYUSB_DESC_VIDEO_STRING "Espressif VIDEO Device" +#define CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE 64 +#define CONFIG_TINYUSB_VIDEO_STREAMING_IFS 1 #define CONFIG_TINYUSB_DFU_RT_ENABLED 1 #define CONFIG_TINYUSB_DESC_DFU_RT_STRING "Espressif DFU Device" #define CONFIG_TINYUSB_VENDOR_ENABLED 1 @@ -289,6 +294,7 @@ #define CONFIG_LWIP_GARP_TMR_INTERVAL 60 #define CONFIG_LWIP_TCPIP_RECVMBOX_SIZE 32 #define CONFIG_LWIP_DHCP_RESTORE_LAST_IP 1 +#define CONFIG_LWIP_DHCP_OPTIONS_LEN 68 #define CONFIG_LWIP_DHCPS 1 #define CONFIG_LWIP_DHCPS_LEASE_UNIT 60 #define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 @@ -401,6 +407,7 @@ #define CONFIG_MDNS_TASK_AFFINITY 0x0 #define CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS 2000 #define CONFIG_MDNS_TIMER_PERIOD_MS 100 +#define CONFIG_MDNS_MULTIPLE_INSTANCE 1 #define CONFIG_MQTT_PROTOCOL_311 1 #define CONFIG_MQTT_TRANSPORT_SSL 1 #define CONFIG_MQTT_TRANSPORT_WEBSOCKET 1 @@ -575,5 +582,5 @@ #define CONFIG_USB_MSC_BUFSIZE CONFIG_TINYUSB_MSC_BUFSIZE #define CONFIG_USB_MSC_ENABLED CONFIG_TINYUSB_MSC_ENABLED #define CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS -#define CONFIG_ARDUINO_IDF_COMMIT "3e370c4296" +#define CONFIG_ARDUINO_IDF_COMMIT "b86fe0c66c" #define CONFIG_ARDUINO_IDF_BRANCH "master" diff --git a/tools/sdk/esp32s2/include/driver/esp32s2/include/driver/touch_sensor.h b/tools/sdk/esp32s2/include/driver/esp32s2/include/driver/touch_sensor.h index 178e3b1a9dd..d90a56e992c 100644 --- a/tools/sdk/esp32s2/include/driver/esp32s2/include/driver/touch_sensor.h +++ b/tools/sdk/esp32s2/include/driver/esp32s2/include/driver/touch_sensor.h @@ -293,7 +293,7 @@ esp_err_t touch_pad_reset_benchmark(touch_pad_t touch_num); * @return * - ESP_OK Success */ -esp_err_t touch_pad_filter_set_config(touch_filter_config_t *filter_info); +esp_err_t touch_pad_filter_set_config(const touch_filter_config_t *filter_info); /** * @brief get parameter of touch sensor filter and detection algorithm. @@ -331,7 +331,7 @@ esp_err_t touch_pad_filter_disable(void); * @return * - ESP_OK Success */ -esp_err_t touch_pad_denoise_set_config(touch_pad_denoise_t *denoise); +esp_err_t touch_pad_denoise_set_config(const touch_pad_denoise_t *denoise); /** * @brief get parameter of denoise pad (TOUCH_PAD_NUM0). @@ -380,7 +380,7 @@ esp_err_t touch_pad_denoise_read_data(uint32_t *data); * @return * - ESP_OK Success */ -esp_err_t touch_pad_waterproof_set_config(touch_pad_waterproof_t *waterproof); +esp_err_t touch_pad_waterproof_set_config(const touch_pad_waterproof_t *waterproof); /** * @brief get parameter of waterproof function. diff --git a/tools/sdk/esp32s2/include/driver/include/driver/rmt.h b/tools/sdk/esp32s2/include/driver/include/driver/rmt.h index a7e2aad5f24..bc07954a080 100644 --- a/tools/sdk/esp32s2/include/driver/include/driver/rmt.h +++ b/tools/sdk/esp32s2/include/driver/include/driver/rmt.h @@ -856,16 +856,35 @@ esp_err_t rmt_remove_channel_from_group(rmt_channel_t channel); #if SOC_RMT_SUPPORT_TX_LOOP_COUNT /** - * @brief Set loop count for RMT TX channel + * @brief Set loop count threshold value for RMT TX channel + * + * When tx loop count reaches this value, an ISR callback will notify user * * @param channel RMT channel - * @param count loop count + * @param count loop count, 1 ~ 1023 * @return * - ESP_ERR_INVALID_ARG Parameter error * - ESP_OK Success */ esp_err_t rmt_set_tx_loop_count(rmt_channel_t channel, uint32_t count); -#endif + +/** + * @brief Enable or disable the feature that when loop count reaches the threshold, RMT will stop transmitting. + * + * - When the loop auto-stop feature is enabled will halt RMT transmission after the loop count reaches a certain threshold + * - When disabled, the RMT transmission continue indefinitely until halted by the users + * + * @note The auto-stop feature is implemented in hardware on particular targets (i.e. those with SOC_RMT_SUPPORT_TX_LOOP_AUTOSTOP defined). + * Otherwise, the auto-stop feature is implemented in software via the interrupt. + * + * @param channel RMT channel + * @param en enable bit + * @return + * - ESP_ERR_INVALID_ARG Parameter error + * - ESP_OK Success + */ +esp_err_t rmt_enable_tx_loop_autostop(rmt_channel_t channel, bool en); +#endif // SOC_RMT_SUPPORT_TX_LOOP_COUNT /** * @brief Reset RMT TX/RX memory index. diff --git a/tools/sdk/esp32s2/include/esp-face/include/dl_define.hpp b/tools/sdk/esp32s2/include/esp-face/include/dl_define.hpp index 16eb0881562..7809768a5bc 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/dl_define.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/dl_define.hpp @@ -10,7 +10,7 @@ #define DL_LOG_LAYER_LATENCY 0 /**/ - PADDING_SAME, /**/ - PADDING_SAME_MXNET /**/ + PADDING_NOT_SET, + PADDING_VALID, /**/ + PADDING_SAME_BEGIN, /**/ + PADDING_SAME_END, /**/ } padding_type_t; -} // namespace dl \ No newline at end of file + + typedef enum + { + CONSTANT, + EDGE, + REFLECT, + SYMMETRIC, + } padding_mode_t; +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/image/dl_image.hpp b/tools/sdk/esp32s2/include/esp-face/include/image/dl_image.hpp index c7fecdc49cc..4a974df063a 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/image/dl_image.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/image/dl_image.hpp @@ -370,11 +370,70 @@ namespace dl */ uint32_t get_moving_point_number(uint8_t *f1, uint8_t *f2, const uint32_t height, const uint32_t width, const uint32_t stride, const uint32_t threshold = 5); - + /** + * @brief Apply an affine transformation to an image. + * + * @tparam T + * @param input the input image. + * @param output the output image. + * @param M_inv the inverse transformation matrix. + */ template void warp_affine(dl::Tensor *input, dl::Tensor *output, dl::math::Matrix *M_inv); + + /** + * @brief Apply an affine transformation to an image. + * + * @tparam T + * @param input the pointer of the input image. + * @param shape the shape of the input image. + * @param output the output image. + * @param M_inv the inverse transformation matrix. + */ template void warp_affine(uint16_t *input, std::vector shape, dl::Tensor *output, dl::math::Matrix *M_inv); + /** + * @brief Get the otsu thresh object. + * + * @param image the gray image. + * @return uint8_t the otsu thresh. + */ + uint8_t get_otsu_thresh(Tensor &image); + + /** + * @brief Convert RGB image to gray image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @return Tensor* output image in gray format + */ + Tensor *rgb2gray(Tensor &image, bool bgr = false); + + /** + * @brief Convert RGB image to LAB image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @param fast true: use the fast alogrithm, but the accuracy will be reduced + * false: do not use the fast alogrithm + * @return Tensor* output image in LAB foramt + */ + Tensor *rgb2lab(Tensor &image, bool bgr = false, bool fast = true); + + /** + * @brief Convert RGB image to HSV image + * + * @param image input image + * @param bgr true: the image is in BGR format + * false: the image is in RGB format + * @param fast true: use the fast alogrithm, but the accuracy will be reduced + * false: do not use the fast alogrithm + * @return Tensor* output image in HSV format + */ + Tensor *rgb2hsv(Tensor &image, bool bgr = false, bool fast = true); + } // namespace image } // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_add2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_add2d.hpp index f0c5964b3d1..c43282b42de 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_add2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_add2d.hpp @@ -25,7 +25,8 @@ namespace dl const int output_exponent; /**/ Tensor *output; /**/ bool inplace; /**/ + false: the output will store to a separate memory >*/ + std::vector output_shape; /**/ public: /** @@ -35,19 +36,21 @@ namespace dl * @param activation activation of add2d, if you don't specify anything, no activation is applied * @param name name of add2d * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Add2D(const int output_exponent, const Activation *activation = NULL, const char *name = NULL, bool inplace = false) : Layer(name), activation(activation), output_exponent(output_exponent), output(NULL) - { - this->inplace = inplace; - } + Add2D(const int output_exponent, const Activation *activation = NULL, const char *name = "Add2D", bool inplace = false) : Layer(name), + activation(activation), + output_exponent(output_exponent), + output(NULL), + inplace(inplace), + output_shape({}) {} /** * @brief Destroy the Add2D object */ ~Add2D() { - if((!this->inplace) && (this->output != NULL)) + if ((!this->inplace) && (this->output != NULL)) { delete this->output; } @@ -59,10 +62,12 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; if (!this->inplace) { @@ -78,6 +83,11 @@ namespace dl { this->output = &input0; } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -105,7 +115,11 @@ namespace dl if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -116,6 +130,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::add2d(*this->output, input0, input1, this->activation, assign_core, this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "add2d"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp index f78b262beb9..8a9aaa8dfbe 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_avg_pool2d.hpp @@ -24,23 +24,26 @@ namespace dl std::vector filter_shape; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ + const padding_type_t padding_type; /**/ std::vector padding; /**/ - Tensor *output; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new AvgPool2D object. * * @param output_exponent exponent of output * @param filter_shape filter shape in [filter_height, filter_width] - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y stride in height * @param stride_x stride in width * @param name name of layer @@ -48,16 +51,23 @@ namespace dl AvgPool2D(const int output_exponent, const std::vector filter_shape, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - output_exponent(output_exponent), - filter_shape(filter_shape), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type) + const char *name = "AvgPool2D") : Layer(name), + output_exponent(output_exponent), + filter_shape(filter_shape), + padding_type(padding_type), + padding(padding), + stride_y(stride_y), + stride_x(stride_x), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** @@ -66,7 +76,7 @@ namespace dl */ ~AvgPool2D() { - if(this->output != NULL) + if (this->output != NULL) { delete this->output; } @@ -76,20 +86,31 @@ namespace dl * @brief Update output shape and padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); - std::vector output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - this->output->set_shape(output_shape); + assert(input.shape.size() == 3); + + this->output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); - this->padding = nn::get_pad_size(output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); + } + this->output->free_element(); - } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } /** * @brief Get the output @@ -108,7 +129,6 @@ namespace dl * @param autoload_enable one of true or false, * - true: load input and output from PSRAM to CACHE automatically * - false: do not - * @param assign_core not effective yet * @return AvgPool2D result */ Tensor &call(Tensor &input, uint8_t autoload_enable = 0) @@ -116,7 +136,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_base.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_base.hpp index 5c7d28d52b1..b265b454538 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_base.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_base.hpp @@ -1,6 +1,7 @@ #pragma once #include "dl_tool.hpp" #include "dl_tool_cache.hpp" +#include namespace dl { diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_concat.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_concat.hpp new file mode 100644 index 00000000000..35ebe652e53 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_concat.hpp @@ -0,0 +1,139 @@ +#pragma once + +#include +#include + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" +#include "dl_nn_concat.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Concat(input1, input2, input3, ...). + * + * @tparam feature_t support all kinds of integer and float data type + */ + template + class Concat : Layer + { + private: + int output_exponent; /**/ + int axis; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Concat object. + * + * @param name name of layer + * @param axis The axis along which the Tensor will be concatenated. + */ + Concat(int axis, const char *name = "Concat") : Layer(name), axis(axis), output_shape({}) + { + this->output = new Tensor; + } + + /** + * @brief Destroy the Concat object + */ + ~Concat() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Collect inputs' channel and memory offset, called in Model.build(). + * + * @param args pointers of concatenated Tensor + * @param print_shape whether to print the output shape. + */ + void build(std::vector *> args, bool print_shape = false) + { + assert(args.size() > 1); + int shape_size = args[0]->shape.size(); + + if (this->axis < 0) + { + this->axis = shape_size + this->axis; + } + assert((this->axis < shape_size) && (this->axis > -1)); + + int output_shape_axis = args[0]->shape[this->axis]; + + for (int i = 1; i < args.size(); i++) + { + assert(shape_size == args[i]->shape.size()); + assert(args[i]->exponent == args[i - 1]->exponent); + output_shape_axis += args[i]->shape[this->axis]; + + for (int j = 0; j < shape_size; j++) + { + if (j != this->axis) + { + assert(args[i]->shape[j] == args[i - 1]->shape[j]); + } + } + } + + this->output_exponent = args[0]->exponent; + this->output_shape = args[0]->shape; + this->output_shape[this->axis] = output_shape_axis; + + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Call Concat operation + * + * @param inputs the pointers of inputs + * @param free_inputs true: free the inputs after call + * false: do not free inputs + * @return Tensor& concat result + */ + Tensor &call(std::vector *> inputs, bool free_inputs = false) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + DL_LOG_LAYER_LATENCY_START(); + nn::concat(*this->output, inputs, this->axis, free_inputs); + DL_LOG_LAYER_LATENCY_END(this->name, "concat"); + return *this->output; + } + + /** + * @brief Get the output + * + * @return Tensor& Concat result + */ + Tensor &get_output() + { + return *this->output; + } + }; + } // namespace layer +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_conv2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_conv2d.hpp index a7c2229db09..038dd6cd79f 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_conv2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_conv2d.hpp @@ -13,8 +13,11 @@ namespace dl * @tparam feature_t supports int16_t and int8_t, * - int16_t: stands for operation in int16_t quantize * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization */ - template + template class Conv2D : public Layer { private: @@ -22,14 +25,14 @@ namespace dl const Filter *filter; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ - const Bias *bias; /**/ + const padding_type_t padding_type; /**/ + const Bias *bias; /**/ const Activation *activation; /**/ std::vector padding; /**/ - Tensor *output; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new Conv2D object. * @@ -37,33 +40,43 @@ namespace dl * @param filter filter of Conv2D * @param bias bias of Conv2D, if you don't specify anything, no bias is added * @param activation activation of Conv2D, if you don't specify anything, no activation is applied - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y stride in height * @param stride_x stride in width * @param name name of layer */ Conv2D(const int output_exponent, const Filter *filter, - const Bias *bias = NULL, + const Bias *bias = NULL, const Activation *activation = NULL, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - output_exponent(output_exponent), - filter(filter), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type), - bias(bias), - activation(activation) + const char *name = "Conv2D") : Layer(name), + output_exponent(output_exponent), + filter(filter), + stride_y(stride_y), + stride_x(stride_x), + padding_type(padding_type), + bias(bias), + activation(activation), + padding(padding), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** @@ -82,19 +95,30 @@ namespace dl * @brief Update output padding and input padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + assert(this->filter->shape.size() == 4); + assert(input.shape[2] == this->filter->shape[2]); - std::vector output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, true); - this->output->set_shape(output_shape); + this->output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, true, this->padding); + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); this->output->free_element(); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); + } - this->padding = nn::get_pad_size(output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -122,7 +146,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -153,5 +181,6 @@ namespace dl dl::tool::cache::preload_func((uint32_t)(this->filter->element), size); } }; + } // namespace layer } // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp index 37475353209..30b2c2a6c77 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_depthwise_conv2d.hpp @@ -13,8 +13,11 @@ namespace dl * @tparam feature_t supports int16_t and int8_t, * - int16_t: stands for operation in int16_t quantize * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization */ - template + template class DepthwiseConv2D : public Layer { private: @@ -22,14 +25,14 @@ namespace dl const Filter *filter; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ - const Bias *bias; /**/ + const padding_type_t padding_type; /**/ + const Bias *bias; /**/ const Activation *activation; /**/ std::vector padding; /**/ Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new DepthwiseConv2D object. * @@ -37,40 +40,50 @@ namespace dl * @param filter filter of DepthwiseConv2D * @param bias bias of DepthwiseConv2D, if you don't specify anything, no bias is added * @param activation activation of DepthwiseConv2D, if you don't specify anything, no activation is applied - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input - * such that output has the same height/width dimension as the input - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input + * such that output has the same height/width dimension as the input, + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y - stride in height * @param stride_x - stride in width * @param name name of layer */ DepthwiseConv2D(const int output_exponent, const Filter *filter, - const Bias *bias = NULL, + const Bias *bias = NULL, const Activation *activation = NULL, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - output_exponent(output_exponent), - filter(filter), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type), - bias(bias), - activation(activation) + const char *name = "DepthwiseConv2D") : Layer(name), + output_exponent(output_exponent), + filter(filter), + stride_y(stride_y), + stride_x(stride_x), + padding_type(padding_type), + bias(bias), + activation(activation), + padding(padding), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** * @brief Destroy the DepthwiseConv2D object. * */ - ~DepthwiseConv2D() + ~DepthwiseConv2D() { if (this->output != NULL) { @@ -82,19 +95,31 @@ namespace dl * @brief Update output shape and padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + assert(this->filter->shape.size() == 4); + assert(input.shape[2] == this->filter->shape[2]); - std::vector output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); - this->output->set_shape(output_shape); + this->output_shape = nn::get_output_shape(input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); - this->padding = nn::get_pad_size(output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, this->filter->shape_with_dilation, this->stride_y, this->stride_x, this->padding_type); + } this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -122,7 +147,12 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_expand_dims.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_expand_dims.hpp new file mode 100644 index 00000000000..a59bed183fb --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_expand_dims.hpp @@ -0,0 +1,128 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class ExpandDims : public Layer + { + private: + std::vector output_shape; /**/ + std::vector axis; /**/ + Tensor *output; /**/ + bool inplace; /**/ + + public: + int output_exponent; + + /** + * @brief Construct a new ExpandDims object + * + * @param axis position where the new axis is placed. + * @param name name of layer + * @param inplace true: the output will store to input + * false: the output will store to a separate memory + */ + ExpandDims(std::vector axis, const char *name = "ExpandDims", bool inplace = false) : Layer(name), + axis(axis), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the ExpandDims object + * + */ + ~ExpandDims() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * + * @param input as an input. + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->expand_dims(this->axis); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + this->output->expand_dims(this->axis); + } + this->output_shape = this->output->shape; + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& ExpandDims result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief call ExpandDims opeartion + * + * @param input + * @return Tensor& ExpandDims result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "ExpandDims"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_shape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "ExpandDims"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_flatten.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_flatten.hpp new file mode 100644 index 00000000000..70ae483a07f --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_flatten.hpp @@ -0,0 +1,120 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Flatten : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new Flatten object + * + * @param name name of layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Flatten(const char *name = "Flatten", bool inplace = false) : Layer(name), inplace(inplace), output_shape({}) + {} + + /** + * @brief Destroy the Flatten object + * + */ + ~Flatten() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + this->output_shape = {input.get_size()}; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Flatten result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Flatten operation. + * + * @param input as an input + * @return Tensor& Flatten result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->flatten(); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "flatten"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->flatten(); + DL_LOG_LAYER_LATENCY_END(this->name, "flatten"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_fullyconnected.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_fullyconnected.hpp new file mode 100644 index 00000000000..afa7e5befba --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_fullyconnected.hpp @@ -0,0 +1,167 @@ +#pragma once + +#include "dl_nn_fully_connected.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Activation(FullyConnected(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @tparam bias_t supports int16_t and int8_t, must specify when using int8 per-channel quantization + * - int16_t: for int16 quantization and int8 per-channel quantization + * - int8_t: for int8 per-tensor quantization + */ + template + class FullyConnected : public Layer + { + private: + const int output_exponent; /**/ + const bool flatten; /**/ + const Filter *filter; /**/ + const Bias *bias; /**/ + const Activation *activation; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ + + public: + /** + * @brief Construct a new FullyConnected object. + * + * @param output_exponent exponent of output + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param name name of layer + */ + FullyConnected(const int output_exponent, + const Filter *filter, + const Bias *bias = NULL, + const Activation *activation = NULL, + const bool flatten = true, + const char *name = "FullyConnected") : Layer(name), + output_exponent(output_exponent), + flatten(flatten), + filter(filter), + bias(bias), + activation(activation), + output_shape({}) + { + this->output = new Tensor; + } + + /** + * @brief Destroy the FullyConnected object. + * + */ + ~FullyConnected() + { + if (this->output != NULL) + { + delete this->output; + } + } + + /** + * @brief Update output padding and input padding. + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + assert(this->filter->shape.size() == 4); + assert(this->filter->shape[0] == 1); + assert(this->filter->shape[1] == 1); + if (this->flatten) + { + assert(input.get_size() == this->filter->shape[2]); + this->output_shape = {this->filter->shape[3]}; + } + else + { + assert(input.shape.back() == this->filter->shape[2]); + this->output_shape = input.shape; + this->output_shape[this->output_shape.size() - 1] = this->filter->shape[3]; + } + this->output->set_shape(this->output_shape); + this->output->set_exponent(this->output_exponent); + this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& FullyConnected result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call FullyConnected operation + * + * @param input as an input. + * @param autoload_enable one of true or false, + * - true: load input and output from PSRAM to CACHE automatically + * - false: do not + * @param assign_core not effective yet + * @return FullyConnected result + */ + Tensor &call(Tensor &input, bool autoload_enable = false, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_LAYER_LATENCY_INIT(); + + DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); + this->output->set_exponent(this->output_exponent); + DL_LOG_LAYER_LATENCY_END(this->name, "apply"); + + if (autoload_enable) + { + dl::tool::cache::autoload_func((uint32_t)(this->output->element), this->output->get_size() * sizeof(feature_t), + (uint32_t)(input.element), input.get_size() * sizeof(feature_t)); + } + + DL_LOG_LAYER_LATENCY_START(); + nn::fully_connected(*this->output, input, *(this->filter), this->bias, this->activation, this->flatten, assign_core); + DL_LOG_LAYER_LATENCY_END(this->name, "fully_connected"); + return *this->output; + } + + /** + * @brief Preload the filter to Cache. + * NOTE: Call this layer's preload() before previous layer's call() such that filter could be loaded while previous layer is doing calculation. + */ + void preload() + { + size_t size = sizeof(feature_t); + int shape_size = this->filter->shape.size(); + for (int i = 0; i < shape_size; ++i) + { + size *= filter->shape[i]; + } + dl::tool::cache::preload_func((uint32_t)(this->filter->element), size); + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp index 044c5f61847..93f2d30ac89 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_avg_pool2d.hpp @@ -20,8 +20,9 @@ namespace dl class GlobalAveragePool2D : public Layer { private: - const int output_exponent; /**/ - Tensor *output; /**/ + const int output_exponent; /**/ + std::vector output_shape; /**/ + Tensor *output; /**/ public: /** * @brief Construct a new GlobalAveragePool2D object. @@ -29,8 +30,9 @@ namespace dl * @param output_exponent exponent of output * @param name name of layer */ - GlobalAveragePool2D(const int output_exponent, const char *name = NULL) : Layer(name), - output_exponent(output_exponent) + GlobalAveragePool2D(const int output_exponent, const char *name = "GlobalAveragePool2D") : Layer(name), + output_exponent(output_exponent), + output_shape({}) { this->output = new Tensor; @@ -52,17 +54,26 @@ namespace dl * @brief Update output shape. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; - this->output->set_shape(output_shape); + this->output_shape = output_shape; + this->output->set_shape(this->output_shape); this->output->set_exponent(this->output_exponent); this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -90,7 +101,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp index aa146823b78..f9b7f73ff8c 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_global_max_pool2d.hpp @@ -20,15 +20,15 @@ namespace dl class GlobalMaxPool2D : public Layer { private: - Tensor *output; /**/ + Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new GlobalMaxPool2D object. * * @param name name of layer */ - GlobalMaxPool2D(const char *name = NULL) : Layer(name) + GlobalMaxPool2D(const char *name = "GlobalMaxPool2D") : Layer(name), output_shape({}) { this->output = new Tensor; } @@ -49,17 +49,26 @@ namespace dl * @brief Update output shape and exponent. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); this->output->set_exponent(input.exponent); std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; - this->output->set_shape(output_shape); + this->output_shape = output_shape; + this->output->set_shape(this->output_shape); this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -87,7 +96,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_leakyrelu.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_leakyrelu.hpp index f18d9b1c522..a972e135006 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_leakyrelu.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_leakyrelu.hpp @@ -2,7 +2,7 @@ #include "dl_constant.hpp" #include "dl_variable.hpp" -#include "dl_nn_LeakyReLU.hpp" +#include "dl_nn_leakyrelu.hpp" #include "dl_layer_base.hpp" namespace dl @@ -20,13 +20,13 @@ namespace dl class LeakyReLU : public Layer { private: - feature_t activation_alpha; /**/ - int activation_exponent; /**/ - Tensor *output; /**/ - bool inplace; /**/ + feature_t activation_alpha; /**/ + int activation_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new LeakyReLU object * @@ -34,9 +34,9 @@ namespace dl * @param activation_exponent exponent of quantized alpha * @param name name of leakyrelu * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - LeakyReLU(const int activation_alpha, const int activation_exponent, const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + LeakyReLU(const int activation_alpha, const int activation_exponent, const char *name = "LeakyReLU", bool inplace = false) : Layer(name), output(NULL), output_shape({}) { this->activation_alpha = activation_alpha; this->activation_exponent = activation_exponent; @@ -47,7 +47,7 @@ namespace dl * @brief Destroy the LeakyReLU object * */ - ~LeakyReLU() + ~LeakyReLU() { if ((!this->inplace) && (this->output != NULL)) { @@ -59,24 +59,32 @@ namespace dl * @brief Update output shape and exponent * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { - if(!this->inplace) + this->output_shape = input.shape; + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; - } - this->output->set_shape(input.shape); + } + this->output->set_shape(this->output_shape); this->output->set_exponent(input.exponent); this->output->free_element(); } else { this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); } - } /** @@ -100,10 +108,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -114,6 +126,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::leakyrelu(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max2d.hpp index 8a775a2e0f0..93bc5899443 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max2d.hpp @@ -22,28 +22,28 @@ namespace dl class Max2D : public Layer { private: - Tensor *output; /**/ - bool inplace; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new Max2D object. * * @param name name of max2d * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Max2D(const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + Max2D(const char *name = "Max2D", bool inplace = false) : Layer(name), + output(NULL), inplace(inplace), output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the Max2D object * */ - ~Max2D() + ~Max2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -58,24 +58,34 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); + this->output_shape = input0.shape; - if(!this->inplace) + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(this->output_exponent); - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } else + { this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -100,10 +110,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input0.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -114,6 +128,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::max2d(*this->output, input0, input1, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "max2d"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max_pool2d.hpp index f836a983b34..629aa87f515 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_max_pool2d.hpp @@ -23,44 +23,54 @@ namespace dl std::vector filter_shape; /**/ const int stride_y; /**/ const int stride_x; /**/ - const padding_type_t padding_type; /**/ + const padding_type_t padding_type; /**/ std::vector padding; /**/ Tensor *output; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new MaxPool2D object. * * @param filter_shape filter shape in [filter_height, filter_width] - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN or PADDING_NOT_SET, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style + * - PADDING_NOT_SET means padding with the specific "padding" value below. + * @param padding if padding_type is PADDING_NOT_SET, this value will be used as padding size. + * the shape must be 4, the value of each position is: [padding top, padding bottom, padding left, padding right] * @param stride_y stride in height * @param stride_x stride in width * @param name name of layer */ MaxPool2D(const std::vector filter_shape, const padding_type_t padding_type = PADDING_VALID, + std::vector padding = {}, const int stride_y = 1, const int stride_x = 1, - const char *name = NULL) : Layer(name), - filter_shape(filter_shape), - stride_y(stride_y), - stride_x(stride_x), - padding_type(padding_type) + const char *name = "MaxPool2D") : Layer(name), + filter_shape(filter_shape), + padding_type(padding_type), + padding(padding), + stride_y(stride_y), + stride_x(stride_x), + output_shape({}) { this->output = new Tensor; + if (this->padding_type == PADDING_NOT_SET) + { + assert(this->padding.size() == 4); + } } /** * @brief Destroy the MaxPool2D object. * */ - ~MaxPool2D() + ~MaxPool2D() { if (this->output != NULL) { @@ -72,18 +82,29 @@ namespace dl * @brief Update output shape and padding. * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { assert(input.shape[0] > 0); assert(input.shape[1] > 0); + assert(input.shape.size() == 3); + this->output->set_exponent(input.exponent); - std::vector output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - this->output->set_shape(output_shape); + this->output_shape = nn::get_output_shape(input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type, false, this->padding); + this->output->set_shape(this->output_shape); - this->padding = nn::get_pad_size(output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); - input.set_padding_size(this->padding); + if (this->padding_type != PADDING_NOT_SET) + { + this->padding = nn::get_pad_size(this->output_shape, input.shape, filter_shape, this->stride_y, this->stride_x, this->padding_type); + } this->output->free_element(); + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -111,7 +132,11 @@ namespace dl DL_LOG_LAYER_LATENCY_INIT(); DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_min2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_min2d.hpp index 71d39c9b285..e38fbf3d0d2 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_min2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_min2d.hpp @@ -22,28 +22,28 @@ namespace dl class Min2D : public Layer { private: - Tensor *output; /**/ - bool inplace; /**/ - public: - + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: /** * @brief Construct a new Min2D object * * @param name name of min2d * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Min2D(const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) - { - this->inplace = inplace; - } + Min2D(const char *name = "Min2D", bool inplace = false) : Layer(name), + output(NULL), + inplace(inplace), + output_shape({}) {} /** * @brief Destroy the Min2D object * */ - ~Min2D() + ~Min2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -58,25 +58,34 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); + this->output_shape = input0.shape; - if(!this->inplace) + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->set_exponent(input0.exponent); this->output->free_element(); } else + { this->output = &input0; - + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -101,10 +110,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input0.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -115,6 +128,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::min2d(*this->output, input0, input1, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "min2d"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_mul2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_mul2d.hpp index 0edfc9a93f0..21bcca7a81e 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_mul2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_mul2d.hpp @@ -21,14 +21,13 @@ namespace dl class Mul2D : public Layer { private: - const int output_exponent; /**/ + const int output_exponent; /**/ const Activation *activation; /**/ - Tensor *output; /**/ - bool inplace; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - const int output_exponent; /**/ - /** * @brief Construct a new Mul2D object. * @@ -36,18 +35,24 @@ namespace dl * @param activation activation of Mul2D, if you don't specify anything, no activation is applied * @param name name of layer * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Mul2D(const int output_exponent, const Activation *activation = NULL, const char *name = NULL, bool inplace = false) : Layer(name), - output_exponent(output_exponent),activation(activation), output(NULL) + Mul2D(const int output_exponent, + const Activation *activation = NULL, + const char *name = "Mul2D", + bool inplace = false) : Layer(name), + output_exponent(output_exponent), + activation(activation), + output(NULL), + inplace(inplace), + output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the Multiply2D object. */ - ~Mul2D() + ~Mul2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -61,24 +66,34 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(this->output_exponent); - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } - + else + { this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -106,7 +121,11 @@ namespace dl if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -117,6 +136,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::mul2d(*this->output, input0, input1, this->activation, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "mul2d"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_prelu.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_prelu.hpp index 4781a669130..96168a783b1 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_prelu.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_prelu.hpp @@ -24,9 +24,9 @@ namespace dl int activation_exponent; /**/ Tensor *output; /**/ bool inplace; /**/ + false: the output will store to a separate memory >*/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new PReLU object * @@ -34,20 +34,25 @@ namespace dl * @param activation_exponent exponent of quantized alpha elements * @param name name of prelu * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - PReLU(const feature_t *activation_element, const int activation_exponent = 0, const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + PReLU(const feature_t *activation_element, + const int activation_exponent = 0, + const char *name = NULL, + bool inplace = "PReLU") : Layer(name), + activation_element(activation_element), + activation_exponent(activation_exponent), + output(NULL), + inplace(inplace), + output_shape({}) { - this->activation_element = activation_element; - this->activation_exponent = activation_exponent; - this->inplace = inplace; } /** * @brief Destroy the PReLU object * */ - ~PReLU() + ~PReLU() { if ((!this->inplace) && (this->output != NULL)) { @@ -59,23 +64,31 @@ namespace dl * @brief Update output shape and exponent * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { - if(!this->inplace) + this->output_shape = input.shape; + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(input.exponent); - this->output->set_shape(input.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } else { this->output = &input; } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -99,11 +112,15 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } this->output->set_exponent(input.exponent); - this->output->apply_element(); + this->output->malloc_element(); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); DL_LOG_LAYER_LATENCY_START(); @@ -113,6 +130,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::prelu(*this->output, input, this->activation_element, this->activation_exponent, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_relu.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_relu.hpp index e70663b798c..7dd29d4a178 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_relu.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_relu.hpp @@ -21,29 +21,28 @@ namespace dl class ReLU : public Layer { private: - Tensor *output; /**/ - bool inplace; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - - /** * @brief Construct a new ReLU object * * @param name name of relu * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - ReLU(const char *name = NULL, bool inplace = false) : Layer(name), output(NULL) + ReLU(const char *name = "ReLU", bool inplace = false) : Layer(name), + output(NULL), inplace(inplace), output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the ReLU object * */ - ~ReLU() + ~ReLU() { if ((!this->inplace) && (this->output != NULL)) { @@ -55,23 +54,31 @@ namespace dl * @brief Update output shape and exponent * * @param input as an input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input) + void build(Tensor &input, bool print_shape = false) { - if(!this->inplace) + this->output_shape = input.shape; + if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(input.exponent); - this->output->set_shape(input.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); } else { this->output = &input; } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -95,10 +102,14 @@ namespace dl { DL_LOG_LAYER_LATENCY_INIT(); - if(!this->inplace) + if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output->apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output->malloc_element(); this->output->set_exponent(input.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -109,6 +120,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::relu(*this->output, input, assign_core); DL_LOG_LAYER_LATENCY_END(this->name, "relu"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_reshape.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_reshape.hpp new file mode 100644 index 00000000000..3f2ed72b6e0 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_reshape.hpp @@ -0,0 +1,124 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief Reshape(input) + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + */ + template + class Reshape : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Reshape object + * + * @param shape the target shape + * @param name name of Reshape layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Reshape(std::vector shape, const char *name = "Reshape", bool inplace = false) : Layer(name), + output_shape(shape), inplace(inplace) + { + } + + /** + * @brief Destroy the Reshape object + * + */ + ~Reshape() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Reshape result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Reshape operation. + * + * @param input as an input + * @return Tensor& Reshape result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->reshape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "reshape"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->reshape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "reshape"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_squeeze.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_squeeze.hpp new file mode 100644 index 00000000000..cee92f22764 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_squeeze.hpp @@ -0,0 +1,127 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Squeeze : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + int axis; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Squeeze object + * + * @param axis the dim to to be remove. make sure the length of the dim is equal to 1. + * if axis == INT32_MAX, all the dims with length==1 will be removed. + * @param name name of Squeeze layer + * @param inplace true: the output will store to input0 + * false: the output will store to a separate memory + */ + Squeeze(int axis = INT32_MAX, const char *name = "Squeeze", bool inplace = false) : Layer(name), axis(axis), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Squeeze object + * + */ + ~Squeeze() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(input.shape); + this->output->squeeze(this->axis); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(input.shape); + this->output->squeeze(this->axis); + } + this->output_shape = this->output->shape; + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Squeeze result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Squeeze operation. + * + * @param input as an input + * @return Tensor& Squeeze result + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->set_shape(this->output_shape); + this->output->copy_element(input, true); + DL_LOG_LAYER_LATENCY_END(this->name, "Squeeze"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_shape(this->output_shape); + DL_LOG_LAYER_LATENCY_END(this->name, "Squeeze"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_sub2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_sub2d.hpp index e3453c08b97..da03b4aad85 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_sub2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_sub2d.hpp @@ -21,13 +21,13 @@ namespace dl class Sub2D : public Layer { private: - const int output_exponent; /**/ - const Activation *activation; /**/ - Tensor *output; /**/ - bool inplace; /**/ + const int output_exponent; /**/ + const Activation *activation; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector output_shape; /**/ public: - /** * @brief Construct a new Sub2D object. * @@ -35,18 +35,17 @@ namespace dl * @param activation activation of Mul2D, if you don't specify anything, no activation is applied * @param name name of layer * @param inplace true: the output will store to input0 - * false: the output will store to a seperate memeory + * false: the output will store to a separate memory */ - Sub2D(const int output_exponent, const Activation *activation = NULL, const char *name = NULL, bool inplace = false) : Layer(name), - output_exponent(output_exponent), activation(activation), output(NULL) + Sub2D(const int output_exponent, const Activation *activation = NULL, const char *name = "Sub2D", bool inplace = false) : Layer(name), + output_exponent(output_exponent), activation(activation), output(NULL), inplace(inplace), output_shape({}) { - this->inplace = inplace; } /** * @brief Destroy the Sub2D object. */ - ~Sub2D() + ~Sub2D() { if ((!this->inplace) && (this->output != NULL)) { @@ -60,22 +59,32 @@ namespace dl * * @param input0 as one input * @param input1 as another input + * @param print_shape whether to print the output shape. */ - void build(Tensor &input0, Tensor &input1) + void build(Tensor &input0, Tensor &input1, bool print_shape = false) { assert(input0.is_same_shape(input1)); + this->output_shape = input0.shape; if (!this->inplace) { - if(this->output != NULL) + if (this->output != NULL) { this->output = new Tensor; } this->output->set_exponent(this->output_exponent); - this->output->set_shape(input0.shape); + this->output->set_shape(this->output_shape); this->output->free_element(); - } + } else + { this->output = &input0; + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } } /** @@ -103,7 +112,11 @@ namespace dl if (!this->inplace) { DL_LOG_LAYER_LATENCY_START(); - this->output.apply_element(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } + this->output.malloc_element(); this->output->set_exponent(input0.exponent); DL_LOG_LAYER_LATENCY_END(this->name, "apply"); @@ -114,6 +127,10 @@ namespace dl else { DL_LOG_LAYER_LATENCY_START(); + if (this->output->shape != this->output_shape) + { + this->output->set_shape(this->output_shape); + } nn::sub2d(this->output, input0, input1, this->activation, assign_core, this->output_exponent); DL_LOG_LAYER_LATENCY_END(this->name, "sub2d"); } diff --git a/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_transpose.hpp b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_transpose.hpp new file mode 100644 index 00000000000..d89ba8daed5 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/layer/dl_layer_transpose.hpp @@ -0,0 +1,126 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_tool.hpp" +#include "dl_layer_base.hpp" + +namespace dl +{ + namespace layer + { + /** + * @brief + * + * @tparam feature_t + */ + template + class Transpose : public Layer + { + private: + int output_exponent; /**/ + Tensor *output; /**/ + bool inplace; /**/ + std::vector perm; /**/ + std::vector output_shape; /**/ + public: + /** + * @brief Construct a new Transpose object + * + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @param name name of Transpose layer + * @param inplace true: the output will store to input + * false: the output will store to a separate memory + */ + Transpose(std::vector perm = {}, const char *name = "Transpose", bool inplace = false) : Layer(name), perm(perm), inplace(inplace), output_shape({}) + { + } + + /** + * @brief Destroy the Transpose object + * + */ + ~Transpose() + { + if ((!this->inplace) && (this->output != NULL)) + { + delete this->output; + } + } + + /** + * @brief Update output shape and exponent + * + * @param input as an input + * @param print_shape whether to print the output shape. + */ + void build(Tensor &input, bool print_shape = false) + { + this->output_exponent = input.exponent; + this->output_shape = input.shape; + for (int i = 0; i < this->perm.size(); i++) + { + this->output_shape[i] = input.shape[this->perm[i]]; + } + if (!this->inplace) + { + if (this->output != NULL) + { + this->output = new Tensor; + } + this->output->set_exponent(this->output_exponent); + this->output->set_shape(this->output_shape); + this->output->free_element(); + } + else + { + this->output = &input; + this->output->set_shape(this->output_shape); + } + + if (print_shape) + { + std::cout << this->name << " | "; + this->output->print_shape(); + } + } + + /** + * @brief Get the output + * + * @return Tensor& Transpose result + */ + Tensor &get_output() + { + return *this->output; + } + + /** + * @brief Call Transpose operation. + * + * @param input as an input. + * @return Tensor& Transpose result. + */ + Tensor &call(Tensor &input) + { + DL_LOG_LAYER_LATENCY_INIT(); + + if (!this->inplace) + { + DL_LOG_LAYER_LATENCY_START(); + this->output->set_exponent(input.exponent); + this->output->transpose(input, this->perm); + DL_LOG_LAYER_LATENCY_END(this->name, "transpose"); + } + else + { + DL_LOG_LAYER_LATENCY_START(); + this->output->transpose(this->perm); + DL_LOG_LAYER_LATENCY_END(this->name, "transpose"); + } + return *this->output; + } + }; + } // namespace layer +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/model_zoo/color_detector.hpp b/tools/sdk/esp32s2/include/esp-face/include/model_zoo/color_detector.hpp new file mode 100644 index 00000000000..063ab20b34a --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/model_zoo/color_detector.hpp @@ -0,0 +1,68 @@ +#pragma once + +#include "dl_image.hpp" + +typedef struct +{ + int area; /*!< Area of connected domains >*/ + std::vector center; /**/ + std::vector box; /**/ +} components_stats_t; + +class ColorDetector +{ +private: + std::vector> results; /*!< detection results >*/ + +public: + std::vector> color_thresh; /*!< threshold of colors, The threshold of each color is composed of 6 numbers >*/ + std::vector area_thresh; /*!< the area threshold of each color, + the area that is smaller than the threshold is filtered >*/ + bool bgr; /*!< true: the input image is in BGR format + false: the input image is in RGB format >*/ + + /** + * @brief get the color threshold of rectangular region in the image + * + * @param image the input image + * @param box the coordinates of the rectanglar region : [left_up_x, left_up_y, right_down_x, right_down_y] + * @return std::vector the threshold. + */ + std::vector cal_color_thresh(dl::Tensor &image, std::vector box); + + /** + * @brief detect the colors based on the color thresholds + * + * @param image the input image. + * @return std::vector>& detection result. + */ + std::vector> &detect(dl::Tensor &image); + + /** + * @brief Construct a new Color Detector object + * + * @param color_thresh threshold of colors, The threshold of each color is composed of 6 numbers + * @param area_thresh the area threshold of each color,the area that is smaller than the threshold is filtered + * @param bgr true: the input image is in BGR format + * false: the input image is in RGB format + */ + ColorDetector(std::vector> color_thresh, std::vector area_thresh, bool bgr = false) : color_thresh(color_thresh), area_thresh(area_thresh), bgr(bgr) + { + } + + /** + * @brief Destroy the Color Detector object + * + */ + ~ColorDetector() {} + + /** + * @brief Get the results object + * + * @return std::vector>& the detection result. + */ + std::vector> &get_results() + { + return this->results; + } +}; \ No newline at end of file diff --git a/tools/sdk/esp32s2/include/esp-face/include/model_zoo/face_recognition_tool.hpp b/tools/sdk/esp32s2/include/esp-face/include/model_zoo/face_recognition_tool.hpp index 12fe8a842a2..2226d32daf9 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/model_zoo/face_recognition_tool.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/model_zoo/face_recognition_tool.hpp @@ -92,7 +92,7 @@ namespace face_recognition_tool * @return dl::Tensor* */ template - dl::Tensor *transform_mfn_input(dl::Tensor &image, bool free_input = false, bool do_padding = true); + dl::Tensor *transform_mfn_input(dl::Tensor &image, bool free_input = false); /** * @brief transform the image to the input of a mfn model @@ -106,7 +106,7 @@ namespace face_recognition_tool * false: do not pad the result */ template - void transform_mfn_input(dl::Tensor &image, dl::Tensor &output, bool free_input = false, bool do_padding = true); + void transform_mfn_input(dl::Tensor &image, dl::Tensor &output, bool free_input = false); /** * @brief transform the mfn output embedding to a floating embedding diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn.hpp index 6dba8016f26..6c737c1d341 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn.hpp @@ -14,13 +14,13 @@ namespace dl * @param filter_shape filter shape with dilation * @param stride_y stride in height * @param stride_x stride in width - * @param pad_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET + * @param pad_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN * @param is_conv2d one of true or false, * - true: serve for Conv2D * - false: serve for other operations * @return std::vector */ - std::vector get_output_shape(const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t pad_type, const bool is_conv2d = false); + std::vector get_output_shape(const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t pad_type, const bool is_conv2d = false, std::vector padding = {}); /** * @brief Get the pad size object @@ -30,7 +30,7 @@ namespace dl * @param filter_shape filter shape with dilation * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN * @return padding size */ std::vector get_pad_size(const std::vector &output_shape, const std::vector &input_shape, const std::vector &filter_shape, const int stride_y, const int stride_x, const padding_type_t padding_type); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_add2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_add2d.hpp index d296be5350b..4d4daaaef05 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_add2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_add2d.hpp @@ -58,20 +58,20 @@ namespace dl */ template auto add2d(const int output_exponent, - Tensor &input0, - Tensor &input1, - const Activation *activation, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(output_exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp index 5b298d98c44..6e7db6ed0e0 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_avg_pool2d.hpp @@ -58,12 +58,12 @@ namespace dl * @param filter_shape filter_shape in [filter_height, filter_width] * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID: no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param assign_core not effective yet * @return avg_pool2d result */ @@ -81,19 +81,19 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter_shape, stride_y, stride_x, padding_type); Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); - input.set_padding_size(padding); + padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - avg_pool2d(output, input, input.padding, filter_shape, stride_y, stride_x, assign_core); + avg_pool2d(output, input, padding, filter_shape, stride_y, stride_x, assign_core); DL_LOG_NN_LATENCY_END("avg_pool2d"); return output; diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_concat.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_concat.hpp new file mode 100644 index 00000000000..73ed1aae905 --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_concat.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + template + void concat(Tensor &output, std::vector *> &inputs, int axis, bool free_inputs = false); + + template + Tensor concat(std::vector *> &inputs, int axis, bool free_inputs = false) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + assert(inputs.size() > 1); + int shape_size = inputs[0]->shape.size(); + + if (axis < 0) + { + axis = shape_size + axis; + } + + assert((axis < shape_size) && (axis > -1)); + + int output_shape_axis = inputs[0]->shape[axis]; + + for (int i = 1; i < inputs.size(); i++) + { + assert(shape_size == inputs[i]->shape.size()); + assert(inputs[i]->exponent == inputs[i - 1]->exponent); + output_shape_axis += inputs[i]->shape[axis]; + + for (int j = 0; j < shape_size; j++) + { + if (j != axis) + { + assert(inputs[i]->shape[j] == inputs[i - 1]->shape[j]); + } + } + } + DL_LOG_NN_LATENCY_END("assert"); + + DL_LOG_NN_LATENCY_START(); + Tensor output; + std::vector output_shape = inputs[0]->shape; + output_shape[axis] = output_shape_axis; + output.set_shape(output_shape); + output.set_exponent(inputs[0]->exponent); + output.malloc_element(); + DL_LOG_NN_LATENCY_END("malloc"); + + DL_LOG_NN_LATENCY_START(); + concat(output, inputs, axis, free_inputs); + DL_LOG_NN_LATENCY_END("concat"); + return output; + } + } // namespace nn +} // namespace dl diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_conv2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_conv2d.hpp index 77e2c617d04..27ba0372730 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_conv2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_conv2d.hpp @@ -10,7 +10,6 @@ namespace dl { /** * @brief activation(conv2d(input, filter) + bias). - * NOTE: When padding_type is SAME, make sure padding is already added in input. * * @param output as an output * @param input as an input @@ -34,7 +33,6 @@ namespace dl /** * @brief activation(conv2d(input, filter) + bias). - * NOTE: When padding_type is SAME, make sure padding is already added in input. * * @param output as an output * @param input as an input @@ -56,6 +54,29 @@ namespace dl const Activation *const activation = NULL, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** + * @brief activation(conv2d(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter filter of conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of conv2d, if you don't specify anything, no bias is added + * @param activation activation of conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** * @brief activation(conv2d(input, filter) + bias). * @@ -67,25 +88,25 @@ namespace dl * @param filter Filter of conv2d * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID: no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param bias bias of conv2d, if you don't specify anything, no bias is added * @param activation activation of conv2d, if you don't specify anything, no activation is applied * @param assign_core not effective yet * @return conv2d result */ - template + template Tensor conv2d(const int output_exponent, Tensor &input, const Filter &filter, const int stride_y, const int stride_x, const padding_type_t padding_type, - const Bias *bias, + const Bias *bias, const Activation *activation, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) { @@ -94,20 +115,19 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type, true); Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); - input.set_padding_size(padding); - input.set_padding_value(padding, 0); + padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - conv2d(output, input, input.padding, filter, stride_y, stride_x, bias, activation, assign_core); + conv2d(output, input, padding, filter, stride_y, stride_x, bias, activation, assign_core); DL_LOG_NN_LATENCY_END("conv2d"); return output; diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp index 6e972bfd81b..135815a65cb 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_depthwise_conv2d.hpp @@ -10,7 +10,6 @@ namespace dl { /** * @brief activate(depthwise_conv2d(input, filter) + bias) - * NOTE: When padding_type is SAME, make sure padding is already added in input * * @param output as an output * @param input as an input @@ -34,7 +33,6 @@ namespace dl /** * @brief activate(depthwise_conv2d(input, filter) + bias) - * NOTE: When padding_type is SAME, make sure padding is already added in input * * @param output as an output * @param input as an input @@ -56,6 +54,29 @@ namespace dl const Activation *activation = NULL, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** + * @brief activate(depthwise_conv2d(input, filter) + bias) + * + * @param output as an output + * @param input as an input + * @param padding padding size needed in [top, bottom, left, right] of this operation + * @param filter Filter of depthwise_conv2d + * @param stride_y stride in height + * @param stride_x stride in width + * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added + * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied + * @param assign_core not effective yet + */ + void depthwise_conv2d(Tensor &output, + Tensor &input, + std::vector &padding, + const Filter &filter, + const int stride_y, + const int stride_x, + const Bias *bias = NULL, + const Activation *activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + /** * @brief activation(depthwise_conv2d(input, filter) + bias) * @@ -67,25 +88,25 @@ namespace dl * @param filter filter of depthwise_conv2d * @param stride_y stride in height * @param stride_x stride in width - * @param pad_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param pad_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID means no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param bias bias of depthwise_conv2d, if you don't specify anything, no bias is added * @param activation activation of depthwise_conv2d, if you don't specify anything, no activation is applied * @param assign_core not effective yet * @return depthwise_conv2d result */ - template + template Tensor depthwise_conv2d(const int output_exponent, Tensor &input, const Filter &filter, const int stride_y, const int stride_x, const padding_type_t padding_type, - const Bias *bias, + const Bias *bias, const Activation *activation, const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) { @@ -94,20 +115,20 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); + DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); - input.set_padding_size(padding); - input.set_padding_value(padding, 0); + padding = get_pad_size(output_shape, input.shape, filter.shape_with_dilation, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - depthwise_conv2d(output, input, input.padding, filter, stride_y, stride_x, bias, activation, assign_core); + depthwise_conv2d(output, input, padding, filter, stride_y, stride_x, bias, activation, assign_core); DL_LOG_NN_LATENCY_END("depthwise_conv2d"); return output; diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_fully_connected.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_fully_connected.hpp new file mode 100644 index 00000000000..372c84825fd --- /dev/null +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_fully_connected.hpp @@ -0,0 +1,126 @@ +#pragma once + +#include "dl_constant.hpp" +#include "dl_variable.hpp" +#include "dl_nn.hpp" + +namespace dl +{ + namespace nn + { + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @param output as an output + * @param input as an input + * @param filter filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + */ + void fully_connected(Tensor &output, + Tensor &input, + const Filter &filter, + const Bias *const bias = NULL, + const Activation *const activation = NULL, + const bool flatten = true, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + + /** + * @brief activation(FullyConnected(input, filter) + bias). + * + * @tparam feature_t supports int16_t and int8_t, + * - int16_t: stands for operation in int16_t quantize + * - int8_t: stands for operation in int8_t quantize + * @param output_exponent exponent of output + * @param input as an input + * @param filter Filter of FullyConnected + * @param bias bias of FullyConnected, if you don't specify anything, no bias is added + * @param activation activation of FullyConnected, if you don't specify anything, no activation is applied + * @param flatten true: input shape is [x1, x2, ..., xn], filter shape is [1, 1, x1 * x2 * ... * xn, output_dim], output shape is [output_dim] + * false: input shape is [x1, x2, ..., xn, input_dim], filter shape is [1, 1, input_dim, output_dim], output shape is [x1, x2, ...., xn, output_dim] + * @param assign_core not effective yet + * @return FullyConnected result + */ + template + Tensor fully_connected(const int output_exponent, + Tensor &input, + const Filter &filter, + const Bias *bias, + const Activation *activation, + const bool flatten, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) + { + DL_LOG_NN_LATENCY_INIT(); + + DL_LOG_NN_LATENCY_START(); + assert(filter.shape.size() == 4); + assert(filter.shape[0] == 1); + assert(filter.shape[1] == 1); + + std::vector output_shape; + if (flatten) + { + assert(input.get_size() == filter.shape[2]); + output_shape = {filter.shape.back()}; + } + else + { + assert(input.shape.back() == filter->shape[2]); + output_shape = input.shape; + output_shape[output_shape.size() - 1] = filter.shape.back(); + } + Tensor output; + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); + DL_LOG_NN_LATENCY_END("apply"); + + DL_LOG_NN_LATENCY_START(); + fully_connected(output, input, filter, bias, activation, flatten, assign_core); + DL_LOG_NN_LATENCY_END("fully_connected"); + + return output; + } + } // namespace nn +} // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp index 723ca9eddc4..724d3ca0952 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_avg_pool2d.hpp @@ -53,7 +53,7 @@ namespace dl std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; Tensor output; - output.set_exponent(output_exponent).set_shape(output_shape).apply_element(); + output.set_exponent(output_exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp index 945645cfd55..f6f15e91bd3 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_global_max_pool2d.hpp @@ -51,7 +51,7 @@ namespace dl std::vector output_shape(input.shape.size(), 1); output_shape[2] = input.shape[2]; Tensor output; - output.set_exponent(input.exponent).set_shape(output_shape).apply_element(); + output.set_exponent(input.exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_leakyrelu.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_leakyrelu.hpp index d3738fc44ca..c41728b1ad5 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_leakyrelu.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_leakyrelu.hpp @@ -52,17 +52,17 @@ namespace dl * @return leakyrelu result or no return(result store to input) */ template - auto leakyrelu(Tensor &input, - const int activation_alpha, - const int activation_exponent, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto leakyrelu(Tensor &input, + const int activation_alpha, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input.exponent).set_shape(input.shape).apply_element(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max2d.hpp index 0a5e8f43221..466089bc386 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max2d.hpp @@ -48,20 +48,20 @@ namespace dl * @return max2d result or no return(result store to input0) */ template - auto max2d(Tensor &input0, - Tensor &input1, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto max2d(Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); DL_LOG_NN_LATENCY_INIT(); Tensor output; - - if constexpr(!inplace) + + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input0.exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(input0.exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max_pool2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max_pool2d.hpp index 7f95f3d4278..50d51728ce0 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max_pool2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_max_pool2d.hpp @@ -57,12 +57,12 @@ namespace dl * @param filter_shape filter shape in [filter_height, filter_width] * @param stride_y stride in height * @param stride_x stride in width - * @param padding_type one of PADDING_VALID or PADDING_SAME or PADDING_SAME_MXNET, + * @param padding_type one of PADDING_VALID or PADDING_SAME_END or PADDING_SAME_BEGIN, * - PADDING_VALID: no padding - * PADDING_SAME and PADDING_SAME_MXNET results in padding with zeros evenly to the left/right or up/down of the input + * PADDING_SAME_END and PADDING_SAME_BEGIN results in padding with zeros evenly to the left/right or up/down of the input * such that output has the same height/width dimension as the input, - * - PADDING_SAME results padding in TensorFlow style - * - PADDING_SAME_MXNET results padding in MXNET style + * - PADDING_SAME_END results padding in TensorFlow style + * - PADDING_SAME_BEGIN results padding in MXNET style * @param assign_core not effective yet * @return max_pool2d result */ @@ -79,20 +79,20 @@ namespace dl DL_LOG_NN_LATENCY_START(); std::vector output_shape = get_output_shape(input.shape, filter_shape, stride_y, stride_x, padding_type); Tensor output; - output.set_exponent(input.exponent).set_shape(output_shape).apply_element(); + output.set_exponent(input.exponent).set_shape(output_shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); + std::vector padding(4, 0); + DL_LOG_NN_LATENCY_START(); - if (padding_type == PADDING_SAME || padding_type == PADDING_SAME_MXNET) + if (padding_type == PADDING_SAME_END || padding_type == PADDING_SAME_BEGIN) { - std::vector padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); - input.set_padding_size(padding); - input.set_padding_value(padding, 0); + padding = get_pad_size(output_shape, input.shape, filter_shape, stride_y, stride_x, padding_type); } DL_LOG_NN_LATENCY_END("padding"); DL_LOG_NN_LATENCY_START(); - max_pool2d(output, input, input.padding, filter_shape, stride_y, stride_x, assign_core); + max_pool2d(output, input, padding, filter_shape, stride_y, stride_x, assign_core); DL_LOG_NN_LATENCY_END("max_pool2d"); return output; diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_min2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_min2d.hpp index 71cb87d50d5..8faddf3c228 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_min2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_min2d.hpp @@ -47,20 +47,20 @@ namespace dl * @return min2d result or no return(result store to input0) */ template - auto min2d(Tensor &input0, - Tensor &input1, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto min2d(Tensor &input0, + Tensor &input1, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); assert(input0.exponent == input1.exponent); DL_LOG_NN_LATENCY_INIT(); Tensor output; - - if constexpr(!inplace) + + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input0.exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(input0.exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_mul2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_mul2d.hpp index 410528a05a3..909619a8767 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_mul2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_mul2d.hpp @@ -18,12 +18,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void mul2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void mul2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(mul2d(input0, input1)). @@ -35,12 +35,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void mul2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void mul2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(mul2d(input0, input1)). @@ -57,21 +57,21 @@ namespace dl * @return mul2d result or no return(result store to input0) */ template - auto mul2d(const int output_exponent, - Tensor &input0, - Tensor &input1, - const Activation *activation, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto mul2d(const int output_exponent, + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(output_exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_prelu.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_prelu.hpp index fb4315d9fc3..e83e8975604 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_prelu.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_prelu.hpp @@ -52,17 +52,17 @@ namespace dl * @return prelu result or no return(result store to input) */ template - auto prelu(Tensor &input, - const feature_t *activation_element, - const int activation_exponent, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto prelu(Tensor &input, + const feature_t *activation_element, + const int activation_exponent, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input.exponent).set_shape(input.shape).apply_element(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); @@ -76,7 +76,7 @@ namespace dl DL_LOG_NN_LATENCY_START(); prelu(input, input, activation_element, activation_exponent, assign_core); DL_LOG_NN_LATENCY_END("prelu"); - } + } } } // namespace nn } // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_relu.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_relu.hpp index e4159fdf898..308492dfe4b 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_relu.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_relu.hpp @@ -15,9 +15,9 @@ namespace dl * @param input as an input * @param assign_core not effective yet */ - void relu(Tensor &output, - Tensor &input, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + void relu(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); /** * @brief relu(input). @@ -26,9 +26,9 @@ namespace dl * @param input as an input * @param assign_core not effective yet */ - void relu(Tensor &output, - Tensor &input, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); + void relu(Tensor &output, + Tensor &input, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE); /** * @brief relu(input) @@ -46,11 +46,11 @@ namespace dl { DL_LOG_NN_LATENCY_INIT(); Tensor output; - - if constexpr(!inplace) + + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(input.exponent).set_shape(input.shape).apply_element(); + output.set_exponent(input.exponent).set_shape(input.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_sub2d.hpp b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_sub2d.hpp index 385188e4ba2..5bbd4940b10 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_sub2d.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/nn/dl_nn_sub2d.hpp @@ -18,12 +18,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void sub2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void sub2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(sub2d(input0, input1)). @@ -35,12 +35,12 @@ namespace dl * @param assign_core not effective yet * @param output_exponent exponent of output, only and must specify if inplace operation happens */ - void sub2d(Tensor &output, - Tensor &input0, - Tensor &input1, - const Activation *const activation = NULL, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, - const int output_exponent = INT_MIN); + void sub2d(Tensor &output, + Tensor &input0, + Tensor &input1, + const Activation *const activation = NULL, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE, + const int output_exponent = INT_MIN); /** * @brief activation(sub2d(input0, input1)). @@ -57,20 +57,20 @@ namespace dl * @return sub2d result or no return(result store to input0) */ template - auto sub2d(const int output_exponent, - Tensor &input0, - Tensor &input1, - const Activation *activation, - const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type + auto sub2d(const int output_exponent, + Tensor &input0, + Tensor &input1, + const Activation *activation, + const std::vector &assign_core = CONFIG_DEFAULT_ASSIGN_CORE) -> typename std::conditional>::type { assert(input0.is_same_shape(input1)); DL_LOG_NN_LATENCY_INIT(); Tensor output; - if constexpr(!inplace) + if constexpr (!inplace) { DL_LOG_NN_LATENCY_START(); - output.set_exponent(output_exponent).set_shape(input0.shape).apply_element(); + output.set_exponent(output_exponent).set_shape(input0.shape).malloc_element(); DL_LOG_NN_LATENCY_END("apply"); DL_LOG_NN_LATENCY_START(); diff --git a/tools/sdk/esp32s2/include/esp-face/include/tool/dl_tool.hpp b/tools/sdk/esp32s2/include/esp-face/include/tool/dl_tool.hpp index f8e0871a04f..e5490e073d1 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/tool/dl_tool.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/tool/dl_tool.hpp @@ -67,62 +67,49 @@ namespace dl void copy_memory(void *dst, void *src, const int n); /** - * @brief Apply memory without initialized. Must use free_aligned() to free the memory. + * @brief Apply memory without initialized. Can use free_aligned() to free the memory. * * @param number number of elements * @param size size of element - * @param align number of aligned, e.g., 16 means 16-byte aligned + * @param align number of byte aligned, e.g., 16 means 16-byte aligned * @return pointer of allocated memory. NULL for failed */ - inline void *malloc_aligned(int number, int size, int align = 0) + inline void *malloc_aligned(int number, int size, int align = 4) { - int n = number * size; - n >>= 4; - n += 2; - n <<= 4; - int total_size = n + align + sizeof(void *) + sizeof(int); - void *res = malloc(total_size); + assert((align > 0) && (((align & (align-1)) == 0))); + int total_size = number * size; + + void *res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); #if DL_SPIRAM_SUPPORT if (NULL == res) - res = heap_caps_malloc(total_size, MALLOC_CAP_SPIRAM); + res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_SPIRAM); #endif if (NULL == res) { printf("Fail to malloc %d bytes from DRAM(%d bytyes) and PSRAM(%d bytes), PSRAM is %s.\n", total_size, - heap_caps_get_free_size(MALLOC_CAP_INTERNAL), + heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL), heap_caps_get_free_size(MALLOC_CAP_SPIRAM), DL_SPIRAM_SUPPORT ? "on" : "off"); return NULL; } - void **data = (void **)res + 2; // 4-byte for pointer, 4-bytes for n - void **aligned; - if (align) - aligned = (void **)(((size_t)data + (align - 1)) & -align); - else - aligned = data; - - aligned[-1] = res; - int *temp = (int *)aligned; - temp[-2] = n; - return (void *)aligned; + return (void *)res; } /** - * @brief Apply memory with zero-initialized. Must use dl_lib_free() to free the memory. + * @brief Apply memory with zero-initialized. Can use free_aligned() to free the memory. * * @param number number of elements * @param size size of element - * @param align number of aligned, e.g., 16 means 16-byte aligned + * @param align number of byte aligned, e.g., 16 means 16-byte aligned * @return pointer of allocated memory. NULL for failed */ - inline void *calloc_aligned(int number, int size, int align = 0) + inline void *calloc_aligned(int number, int size, int align = 4) { void *aligned = malloc_aligned(number, size, align); - int n = *((int *)aligned - 2); - set_zero(aligned, n); + set_zero(aligned, number * size); return (void *)aligned; } @@ -137,7 +124,70 @@ namespace dl if (NULL == address) return; - free(((void **)address)[-1]); + heap_caps_free(address); + } + + /** + * @brief Apply memory without initialized in preference order: internal aligned, internal, external aligned + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *malloc_aligned_prefer(int number, int size, int align = 4) + { + assert((align > 0) && (((align & (align-1)) == 0))); + int total_size = number * size; + void *res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); + if (NULL == res){ + res = heap_caps_malloc(total_size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); + } +#if DL_SPIRAM_SUPPORT + if (NULL == res){ + res = heap_caps_aligned_alloc(align, total_size, MALLOC_CAP_SPIRAM); + } +#endif + if (NULL == res) + { + printf("Fail to malloc %d bytes from DRAM(%d bytyes) and PSRAM(%d bytes), PSRAM is %s.\n", + total_size, + heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL), + heap_caps_get_free_size(MALLOC_CAP_SPIRAM), + DL_SPIRAM_SUPPORT ? "on" : "off"); + return NULL; + } + + return res; + } + + /** + * @brief Apply memory with zero-initialized in preference order: internal aligned, internal, external aligned + * + * @param number number of elements + * @param size size of element + * @param align number of byte aligned, e.g., 16 means 16-byte aligned + * @return pointer of allocated memory. NULL for failed + */ + inline void *calloc_aligned_prefer(int number, int size, int align = 4) + { + void *res = malloc_aligned_prefer(number, size, align); + set_zero(res, number * size); + + return (void *)res; + } + + /** + * @brief Free the calloc_aligned_prefer() and malloc_aligned_prefer() memory + * + * @param address pointer of memory to free + */ + inline void free_aligned_prefer(void *address) + { + if (NULL == address) + return; + + heap_caps_free(address); } /** diff --git a/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_constant.hpp b/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_constant.hpp index 73e3b0832e7..07b2dd24ee1 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_constant.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_constant.hpp @@ -57,7 +57,8 @@ namespace dl * @param exponent exponent of element * @param shape shape of Filter, * - 1D: reserved - * - 2D: [filter_height, filter_width, input_channel, output_channel] + * - 2D: for convolution is [filter_height, filter_width, input_channel, output_channel], + * for depthwise convolution is [filter_height, filter_width, input_channel, 1] * @param dilation dilation of Filter * - 1D: reserved * - 2D: [dilation_in_height, dilation_in_width] @@ -97,6 +98,9 @@ namespace dl { public: using Constant::Constant; + std::vector channel_exponent; /**/ + + Bias(const T *element, const std::vector channel_exponent, const std::vector shape); }; /** diff --git a/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_variable.hpp b/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_variable.hpp index bf6e8630856..18cbe9707e9 100644 --- a/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_variable.hpp +++ b/tools/sdk/esp32s2/include/esp-face/include/typedef/dl_variable.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "dl_tool.hpp" @@ -17,27 +18,20 @@ namespace dl class Tensor { private: - int size; /* axis_offset; /* shape; /* shape_with_padding; /* padding; /* shape; /*set_shape({0}); } /** * @brief Construct a new Tensor object by copying from input. @@ -49,21 +43,20 @@ namespace dl */ Tensor(Tensor &input, bool deep) : size(input.size), auto_free(input.auto_free), - exponent(input.exponent), - shape(input.shape), - shape_with_padding(input.shape_with_padding), - padding(input.padding) + exponent(input.exponent) { - if (deep) + this->set_shape(input.shape); + if (deep && (input.element != NULL)) { - int size_real = input.shape_with_padding.size() ? input.shape_with_padding[0] * input.shape_with_padding[1] * input.shape_with_padding[2] : 0; - T *new_element = (T *)tool::calloc_aligned(size_real, sizeof(T), 16); + int size_real = input.get_size(); + T *new_element = (T *)tool::calloc_aligned_prefer(size_real, sizeof(T), 16); tool::copy_memory(new_element, input.element, size_real * sizeof(T)); this->element = new_element; } else { this->element = input.element; + this->auto_free = false; } } @@ -77,6 +70,33 @@ namespace dl this->free_element(); } + /** + * @brief + * + * @param input an input Tensor + * @param deep one of true or false + * - true: apply a new memory, copy value from input.element to this new memory + * - false: take over input.element to this->element + * @return Tensor& self + */ + Tensor ©_element(Tensor &input, bool deep) + { + assert(this->get_size() == input.get_size()); + assert(input.element != NULL); + + this->malloc_element(); + if (deep) + { + tool::copy_memory(this->element, input.element, this->get_size() * sizeof(T)); + } + else + { + this->element = input.element; + this->auto_free = false; + } + return *this; + } + /** * @brief Set the auto free object. * @@ -120,190 +140,144 @@ namespace dl } /** - * @brief Set the shape of Tensor. Initial this->padding = {0}. Initial this->size = -1. + * @brief Set the shape of Tensor. * - * @param shape shape in - * - 2D: [height, width] + * @param shape the target shape + * * @return self */ - Tensor &set_shape(const std::vector shape) - { - for (int i = 0; i < shape.size(); ++i) - { - assert(shape[i] > 0); - } - this->shape = shape; - this->shape_with_padding = shape; - this->size = -1; - this->padding = std::vector(((this->shape.size() - 1) << 1), 0); - return *this; - } + Tensor &set_shape(const std::vector shape); /** - * @brief Set the padding size object. + * @brief print the shape of the Tensor * - * @param padding padding size in - * - 2D: [top, bottom, left, right] - * @return self */ - Tensor &set_padding_size(std::vector &padding) + void print_shape() { - assert(this->shape.size()); // call Tensor.set_shape() first - assert(this->shape.size() == 3); // TODO: || this->shape.size() == 2 - - if (this->shape.size() == 3) + if (this->shape.size()) { - std::vector new_padding = this->padding; - bool dont_update = true; - - if (padding[0] > this->padding[0]) + printf("shape = ("); + for (int i = 0; i < this->shape.size() - 1; i++) { - new_padding[0] = padding[0]; - dont_update = false; - } - - if (padding[1] > this->padding[1]) - { - new_padding[1] = padding[1]; - dont_update = false; - } - - if (padding[2] > this->padding[2]) - { - new_padding[2] = padding[2]; - dont_update = false; - } - - if (padding[3] > this->padding[3]) - { - new_padding[3] = padding[3]; - dont_update = false; + printf("%d, ", this->shape[i]); } + printf("%d)\n", this->shape.back()); + } + else + { + printf("shape = ()\n"); + } + } - if (dont_update) - { - return *this; - } + /** + * @brief flatten the Tensor + * + * @return Tensor& self + */ + Tensor &flatten(); - std::vector new_shape_with_padding = this->shape; + /** + * @brief Change a new shape to the Tensor without changing its data. + * + * @param shape the target shape + * @return Tensor& self + */ + Tensor &reshape(std::vector shape); - new_shape_with_padding[0] += (new_padding[0] + new_padding[1]); - new_shape_with_padding[1] += (new_padding[2] + new_padding[3]); - int new_size = new_shape_with_padding[0] * new_shape_with_padding[1] * new_shape_with_padding[2]; + /** + * @brief Remove dims with length==1 from Tensor + * + * @param axis the dim to to be remove. make sure the length of the dim is equal to 1. + * if axis == INT32_MAX, all the dims with length==1 will be removed. + * @return Tensor& self + */ + Tensor &squeeze(int axis = INT32_MAX); - if (this->element) // if this->element != NULL, do padding by copy memory - { - T *new_element = (T *)tool::malloc_aligned(new_size, sizeof(T), 16); - T *dst = new_element + ((new_padding[0] * new_shape_with_padding[1]) + new_padding[2]) * new_shape_with_padding[2]; - T *src = this->get_element_ptr(); - int offset_dst_next_y = new_shape_with_padding[1] * new_shape_with_padding[2]; // width * channel - int src_copy_length = this->shape[1] * this->shape[2]; // width * channel - int offset_src_next_y = this->shape_with_padding[1] * this->shape_with_padding[2]; // width * channel - for (int y = 0; y < this->shape[0]; y++) - { - tool::copy_memory(dst, src, src_copy_length * sizeof(T)); - dst += offset_dst_next_y; - src += offset_src_next_y; - } + /** + * @brief Insert a new dim that will appear at the axis position in the expanded Tensor shape. + * + * @param axis the dim to be inserted + * @return Tensor& self + */ + Tensor &expand_dims(int axis); - if (this->auto_free) - tool::free_aligned(this->element); - this->element = new_element; - this->auto_free = true; - } - this->padding = new_padding; - this->shape_with_padding = new_shape_with_padding; - this->size = new_size; - } - else if (this->shape.size() == 2) - { - printf("Tensor.set_padding_size with this->shape.size() == 2 not implement yet.\n"); - } + /** + * @brief Insert a new dim that will appear at the axis position in the expanded Tensor shape. + * + * @param axis the dim to be inserted + * @return Tensor& self + */ + Tensor &expand_dims(std::vector axis); - return *this; - } + /** + * @brief Reverse or permute the axes of the Tensor + * + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @return Tensor& self + */ + Tensor &transpose(std::vector perm = {}); /** - * @brief Set the padding value object. + * @brief Reverse or permute the axes of the input Tensor * - * @param padding padding size in - * - 2D: [top, bottom, left, right] - * @param value value to set - * @return self + * @param input the input Tensor + * @param perm the new arangement of the dims. if perm == {}, the dims arangement will be reversed. + * @return Tensor& self */ - Tensor &set_padding_value(std::vector &padding, T value); + Tensor &transpose(Tensor &input, std::vector perm = {}); /** * @brief Get the element pointer. * - * @param padding padding size in - * - 2D: [top, bottom, left, right] - * @return pointer to memory with padding + * @return pointer to memory */ - T *get_element_ptr(const std::vector padding = {0, 0, 0, 0}) + T *get_element_ptr() { - assert(this->shape.size() == 3); // TODO: || this->shape.size() == 2 - - if (this->shape.size() == 3) - { - return this->element + ((this->padding[0] - padding[0]) * this->shape_with_padding[1] + (this->padding[2] - padding[2])) * this->shape_with_padding[2]; - } - else if (this->shape.size() == 2) - { - printf("Tensor.get_element_ptr with this->shape.size() == 2 is not implemented.\n"); - } - - return NULL; + return this->element; } /** * @brief Get the element value. * - * @param index index in - * - 2D: [y, x, c] - * @param with_padding one of true or false, - * - true: make padding size in count - * - false: do not - * @return element value + * @param index the index of each dim. + * @return T element value */ - T &get_element_value(const std::vector index, const bool with_padding = false) + T get_element_value(const std::vector index) { - assert(index.size() == this->shape.size()); - assert(this->shape.size() == 3); // TODO: || this->shape() == 2 - - int i = 0; - if (this->shape.size() == 3) - { - int y = index[0]; - int x = index[1]; - int c = index[2]; - i = with_padding ? (y * this->shape_with_padding[1] + x) * this->shape_with_padding[2] + c : ((y + this->padding[0]) * this->shape_with_padding[1] + x + this->padding[2]) * this->shape_with_padding[2] + c; - } - else if (this->shape.size() == 2) - { - printf("Tensor.get_element_value with this->shape.size() == 2 is not implemented.\n"); - } + return this->element[this->get_element_index(index)]; + } - return this->element[i]; + /** + * @brief Get the element value. + * + * @param index the index of the element. + * @return T element value + */ + T get_element_value(int index) + { + return this->element[index]; } /** - * @brief Get the size of element. + * @brief Get the size of Tensor. * - * @return size of element including padding + * @return the size of Tensor. */ int get_size() { - if (this->size == -1) // didn't call Tensor.set_padding_size() before - { - this->size = 1; - for (std::vector::iterator d = this->shape.begin(); d != this->shape.end(); d++) - this->size *= *d; - } - return this->size; } + /** + * @brief Get the axis offset + * + * @return std::vector the axis offset + */ + std::vector get_axis_offset() + { + return this->axis_offset; + } + /** * @brief Apply memory with zero-initialized only if this->element is NULL. * @@ -319,7 +293,7 @@ namespace dl if (this->element != NULL) return false; - this->element = (T *)dl::tool::calloc_aligned(this->get_size(), sizeof(T), 16); + this->element = (T *)dl::tool::calloc_aligned_prefer(this->get_size(), sizeof(T), 16); this->auto_free = auto_free; return true; @@ -340,31 +314,7 @@ namespace dl if (this->element != NULL) return false; - this->element = (T *)tool::malloc_aligned(this->get_size(), sizeof(T), 16); - this->auto_free = auto_free; - - return true; - } - - /** - * @brief If this->element != NULL no memory will be applied and no value will be set in padding. - * Else apply memory without initialized and set value to padding. - * - * @param padding_value value to set in padding - * @param auto_free one of true of false - * - true: free element when object destroyed - * - false: do not - * @return - * - true: apply memory and set padding value successfully - * - false: no memory applied and no padding value set - */ - bool apply_element(const T padding_value = 0, const bool auto_free = true) - { - if (this->element != NULL) - return false; - - this->element = (T *)tool::malloc_aligned(this->get_size(), sizeof(T), 16); - this->set_padding_value(this->padding, padding_value); + this->element = (T *)tool::malloc_aligned_prefer(this->get_size(), sizeof(T), 16); this->auto_free = auto_free; return true; @@ -379,258 +329,56 @@ namespace dl { if (this->auto_free && this->element) { - tool::free_aligned(this->element); + tool::free_aligned_prefer(this->element); this->element = NULL; } } /** - * @brief Print the shape of Tensor in format "shape = ({top_padding} + {height} + {bottom_padding}, {left_padding} + {width} + {right_padding}, {channel}(channel_with_padding))\n". + * @brief print the element of the tensor + * + * @param axis_index_range the element range of each dims to be print. if axis_index_range == {}, all the element will be print. + * @param message to print */ - void print_shape() - { - printf("shape = (%d + %d + %d, %d + %d + %d, %d(%d))\n", - this->padding[0], this->shape[0], this->padding[1], - this->padding[2], this->shape[1], this->padding[3], - this->shape[2], this->shape_with_padding[2]); - } + void print(std::vector axis_index_range = {}, const char *message = ""); /** - * @brief Take numpy for example, this function print Tensor[y_start:y_end, x_start:x_end, c_start:c_end]. + * @brief print all the element of the Tensor. * - * inner box is effective value of Tensor, "0" around is padding. - * - * (with padding) - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * 000000(without padding) 00000000 - * 000000 00000000 - * 000000 00000000 - * 000000 effective value 00000000 - * 000000 00000000 - * 000000 00000000 - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * 00000000000000000000000000000000000000000000000000 - * - * @param y_start start index in height - * @param y_end end index in height - * @param x_start start index in width - * @param x_end end index in width - * @param c_start start index in channel - * @param c_end end index in channel - * @param message to print - * @param axis print aligned this axis, effective only if all y_end - y_start, x_end - x_start and c_end - c_start equals to 1 + * @param message to print * @param with_padding one of true or false, - * - true: count from (with padding) in upper image - * - false: count from (without padding) in upper image + * - true: the padding element will also be ed + * - false: the padding element will not be ed */ - void print(int y_start, int y_end, - int x_start, int x_end, - int c_start, int c_end, - const char *message, int axis = 0, const bool with_padding = false) + void print_all(const char *message = "") { - assert(y_end > y_start); - assert(x_end > x_start); - assert(c_end > c_start); - - y_start = DL_MAX(y_start, 0); - x_start = DL_MAX(x_start, 0); - c_start = DL_MAX(c_start, 0); - if (with_padding) - { - y_end = DL_MIN(y_end, this->shape_with_padding[0]); - x_end = DL_MIN(x_end, this->shape_with_padding[1]); - c_end = DL_MIN(c_end, this->shape_with_padding[2]); - } - else - { - y_end = DL_MIN(y_end, this->shape[0]); - x_end = DL_MIN(x_end, this->shape[1]); - c_end = DL_MIN(c_end, this->shape[2]); - } - - printf("%s[%d:%d, %d:%d, %d:%d] | ", message, y_start, y_end, x_start, x_end, c_start, c_end); + std::cout << "\n" + << message << " | "; this->print_shape(); - if (y_end - y_start == 1) - { - if (x_end - x_start == 1) - { - for (int c = c_start; c < c_end; c++) - printf("%7d", c); - printf("\n"); - - for (int c = c_start; c < c_end; c++) - printf("%7d", this->get_element_value({y_start, x_start, c}, with_padding)); - printf("\n"); - - return; - } - else - { - if (c_end - c_start == 1) - { - for (int x = x_start; x < x_end; x++) - printf("%7d", x); - printf("\n"); - - for (int x = x_start; x < x_end; x++) - printf("%7d", this->get_element_value({y_start, x, c_start}, with_padding)); - printf("\n"); - - return; - } - } - } - else + for (int i = 0; i < this->get_size(); i++) { - if (x_end - x_start == 1) - { - if (c_end - c_start == 1) - { - for (int y = y_start; y < y_end; y++) - printf("%7d", y); - printf("\n"); - - for (int y = y_start; y < y_end; y++) - printf("%7d", this->get_element_value({y, x_start, c_start}, with_padding)); - printf("\n"); - - return; - } - } + std::cout << this->element[i] << " "; } - - if (y_end - y_start == 1) - axis = 0; - - if (x_end - x_start == 1) - axis = 1; - - if (c_end - c_start == 1) - axis = 2; - - if (axis == 0) - { - // ______c - // | - // | - // x - // - for (int y = y_start; y < y_end; y++) - { - printf("y = %d\n ", y); - - for (int c = c_start; c < c_end; c++) - printf("%7d", c); - printf("\n"); - - for (int x = x_start; x < x_end; x++) - { - printf("%5d", x); - for (int c = c_start; c < c_end; c++) - printf("%7d", this->get_element_value({y, x, c}, with_padding)); - printf("\n"); - } - printf("\n"); - } - } - else if (axis == 1) - { - // ______c - // | - // | - // y - // - for (int x = x_start; x < x_end; x++) - { - printf("x = %d\n ", x); - - for (int c = c_start; c < c_end; c++) - printf("%7d", c); - printf("\n"); - - for (int y = y_start; y < y_end; y++) - { - printf("%5d", y); - for (int c = c_start; c < c_end; c++) - printf("%7d", this->get_element_value({y, x, c}, with_padding)); - printf("\n"); - } - printf("\n"); - } - } - else - { - // ______x - // | - // | - // y - // - for (int c = c_start; c < c_end; c++) - { - printf("c = %d\n ", c); - - for (int x = x_start; x < x_end; x++) - printf("%7d", x); - printf("\n"); - - for (int y = y_start; y < y_end; y++) - { - printf("%5d", y); - for (int x = x_start; x < x_end; x++) - printf("%7d", this->get_element_value({y, x, c}, with_padding)); - printf("\n"); - } - printf("\n"); - } - } - + std::cout << "\n"; return; } /** - * @brief print all the element of the Tensor. + * @brief Get the index of each dims * - * @param message to print - * @param with_padding one of true or false, - * - true: the padding element will also be printed - * - false: the padding element will not be printed + * @param element_index the index of the element + * @return std::vector the index of each dims */ - void print_all(const char *message, const bool with_padding = false) - { - int y_end; - int x_end; - int c_end; - if (with_padding) - { - y_end = this->shape_with_padding[0]; - x_end = this->shape_with_padding[1]; - c_end = this->shape_with_padding[2]; - } - else - { - y_end = this->shape[0]; - x_end = this->shape[1]; - c_end = this->shape[2]; - } + std::vector get_axis_index(int element_index); - printf("\n%s | ", message); - this->print_shape(); - - for (int y = 0; y < y_end; y++) - { - for (int x = 0; x < x_end; x++) - { - for (int c = 0; c < c_end; c++) - printf("%d ", this->get_element_value({y, x, c}, with_padding)); - } - } - printf("\n"); - return; - } + /** + * @brief Get the index of element + * + * @param axis_index the index of each dims + * @return int the index of element + */ + int get_element_index(const std::vector axis_index); /** * @brief Check the element value with input ground-truth. @@ -638,35 +386,39 @@ namespace dl * @param gt_element ground-truth value of element * @param bias permissible error * @param info one of true or false - * - true: print shape and result + * - true: shape and result * - false: do not + * @param failed_number maximum number of wrong element that will be printed + * * @return * - true: in permissible error * - false: not */ - bool check_element(T *gt_element, int bias = 2, bool info = true) + bool check_element(T *gt_element, int bias = 2, bool info = true, int failed_number = 0) { + int count = 0; if (info) this->print_shape(); - int i = 0; - for (int y = 0; y < this->shape[0]; y++) + int size = this->get_size(); + for (int i = 0; i < size; i++) { - for (int x = 0; x < this->shape[1]; x++) + if (DL_ABS(this->element[i] - gt_element[i]) > bias) { - for (int c = 0; c < this->shape[2]; c++) + std::vector index = get_axis_index(i); + std::cout << "element["; + for (int j = 0; j < index.size() - 1; j++) { - int a = this->get_element_value({y, x, c}); - int b = gt_element[i]; - int offset = DL_ABS(a - b); - if (offset > bias) - { - printf("element[%d, %d, %d]: %d v.s. %d\n", y, x, c, a, b); - return false; - } - i++; + std::cout << index[j] << ", "; } + std::cout << index.back() << "]: "; + std::cout << +this->element[i] << " v.s. " << +gt_element[i] << "\n"; + count++; + if (count > failed_number) + return false; } } + if (count) + return false; if (info) printf("PASS\n"); @@ -700,35 +452,44 @@ namespace dl Tensor &operator=(const Tensor &input) { - this->size = input.size; this->auto_free = input.auto_free; this->exponent = input.exponent; - this->shape = input.shape; - this->padding = input.padding; - int size_real_tmp = this->shape_with_padding.size() ? this->shape_with_padding[0] * this->shape_with_padding[1] * this->shape_with_padding[2] : 0; - int size_input_real = input.shape_with_padding.size() ? input.shape_with_padding[0] * input.shape_with_padding[1] * input.shape_with_padding[2] : 0; - this->shape_with_padding = input.shape_with_padding; - if (this->element) + int size_real_tmp = this->size; + int size_input_real = input.size; + this->set_shape(input.shape); + if (input.element) { - if (size_real_tmp != size_input_real) + if (this->element) { - tool::free_aligned(this->element); - T *new_element = (T *)tool::calloc_aligned(size_input_real, sizeof(T), 16); - tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); - this->element = new_element; + if (size_real_tmp != size_input_real) + { + tool::free_aligned_prefer(this->element); + T *new_element = (T *)tool::malloc_aligned_prefer(size_input_real, sizeof(T), 16); + tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); + this->element = new_element; + } + else + { + tool::copy_memory(this->element, input.element, size_input_real * sizeof(T)); + } } else { - tool::copy_memory(this->element, input.element, size_input_real * sizeof(T)); + T *new_element = (T *)tool::malloc_aligned_prefer(size_input_real, sizeof(T), 16); + tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); + this->element = new_element; } + return *this; } else { - T *new_element = (T *)tool::calloc_aligned(size_input_real, sizeof(T), 16); - tool::copy_memory(new_element, input.element, size_input_real * sizeof(T)); - this->element = new_element; + if (this->element) + { + tool::free_aligned_prefer(this->element); + this->element = NULL; + } + return *this; } - return *this; } }; } // namespace dl \ No newline at end of file diff --git a/tools/sdk/esp32s2/include/esp_https_server/include/esp_https_server.h b/tools/sdk/esp32s2/include/esp_https_server/include/esp_https_server.h index 00565a963ad..efe726e9e70 100644 --- a/tools/sdk/esp32s2/include/esp_https_server/include/esp_https_server.h +++ b/tools/sdk/esp32s2/include/esp_https_server/include/esp_https_server.h @@ -10,6 +10,7 @@ #include #include "esp_err.h" #include "esp_http_server.h" +#include "esp_tls.h" #ifdef __cplusplus extern "C" { @@ -20,6 +21,22 @@ typedef enum { HTTPD_SSL_TRANSPORT_INSECURE // SSL disabled } httpd_ssl_transport_mode_t; +/** + * @brief Callback data struct, contains the ESP-TLS connection handle + */ +typedef struct esp_https_server_user_cb_arg { + const esp_tls_t *tls; +} esp_https_server_user_cb_arg_t; + +/** + * @brief Callback function prototype + * Can be used to get connection or client information (SSL context) + * E.g. Client certificate, Socket FD, Connection state, etc. + * + * @param user_cb Callback data struct + */ +typedef void esp_https_server_user_cb(esp_https_server_user_cb_arg_t *user_cb); + /** * HTTPS server config struct * @@ -66,6 +83,9 @@ struct httpd_ssl_config { /** Enable tls session tickets */ bool session_tickets; + + /** User callback for esp_https_server */ + esp_https_server_user_cb *user_cb; }; typedef struct httpd_ssl_config httpd_ssl_config_t; @@ -113,6 +133,7 @@ typedef struct httpd_ssl_config httpd_ssl_config_t; .port_secure = 443, \ .port_insecure = 80, \ .session_tickets = false, \ + .user_cb = NULL, \ } /** diff --git a/tools/sdk/esp32s2/include/esp_hw_support/include/esp_sleep.h b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_sleep.h index cfdfbc04186..75d2f9726c3 100644 --- a/tools/sdk/esp32s2/include/esp_hw_support/include/esp_sleep.h +++ b/tools/sdk/esp32s2/include/esp_hw_support/include/esp_sleep.h @@ -44,6 +44,7 @@ typedef enum { #if SOC_PM_SUPPORT_CPU_PD ESP_PD_DOMAIN_CPU, //!< CPU core #endif + ESP_PD_DOMAIN_RTC8M, //!< Internal 8M oscillator ESP_PD_DOMAIN_VDDSDIO, //!< VDD_SDIO ESP_PD_DOMAIN_MAX //!< Number of domains } esp_sleep_pd_domain_t; diff --git a/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_io.h b/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_io.h index eebcabf42b4..330f4d9a165 100644 --- a/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_io.h +++ b/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_io.h @@ -65,6 +65,22 @@ esp_err_t esp_lcd_panel_io_tx_color(esp_lcd_panel_io_handle_t io, int lcd_cmd, c */ esp_err_t esp_lcd_panel_io_del(esp_lcd_panel_io_handle_t io); +/** + * @brief Type of LCD panel IO event data + */ +typedef struct { +} esp_lcd_panel_io_event_data_t; + +/** + * @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data + * + * @param[in] panel_io LCD panel IO handle, which is created by factory API like `esp_lcd_new_panel_io_spi()` + * @param[in] edata Panel IO event data, fed by driver + * @param[in] user_ctx User data, passed from `esp_lcd_panel_io_xxx_config_t` + * @return Whether a high priority task has been waken up by this function + */ +typedef bool (*esp_lcd_panel_io_color_trans_done_cb_t)(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx); + /** * @brief Panel IO configuration structure, for SPI interface */ @@ -74,8 +90,8 @@ typedef struct { int spi_mode; /*!< Traditional SPI mode (0~3) */ unsigned int pclk_hz; /*!< Frequency of pixel clock */ size_t trans_queue_depth; /*!< Size of internal transaction queue */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */ - void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ int lcd_param_bits; /*!< Bit-width of LCD parameter */ struct { @@ -100,8 +116,8 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p typedef struct { uint32_t dev_addr; /*!< I2C device address */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data transfer has finished */ - void *user_data; /*!< User private data, passed directly to on_trans_frame_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data transfer has finished */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ size_t control_phase_bytes; /*!< I2C LCD panel will encode control information (e.g. D/C seclection) into control phase, in several bytes */ unsigned int dc_bit_offset; /*!< Offset of the D/C selection bit in control phase */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ @@ -168,8 +184,8 @@ typedef struct { int cs_gpio_num; /*!< GPIO used for CS line, set to -1 will declaim exclusively use of I80 bus */ unsigned int pclk_hz; /*!< Frequency of pixel clock */ size_t trans_queue_depth; /*!< Transaction queue size, larger queue, higher throughput */ - bool (*on_color_trans_done)(esp_lcd_panel_io_handle_t panel_io, void *user_data, void *event_data); /*!< Callback, invoked when color data was tranferred done */ - void *user_data; /*!< User private data, passed directly to on_trans_done's user_data */ + esp_lcd_panel_io_color_trans_done_cb_t on_color_trans_done; /*!< Callback invoked when color data was tranferred done */ + void *user_ctx; /*!< User private data, passed directly to on_color_trans_done's user_ctx */ int lcd_cmd_bits; /*!< Bit-width of LCD command */ int lcd_param_bits; /*!< Bit-width of LCD parameter */ struct { diff --git a/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_rgb.h b/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_rgb.h index 2ddd2b6b9a6..1368bb787f6 100644 --- a/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_rgb.h +++ b/tools/sdk/esp32s2/include/esp_lcd/include/esp_lcd_panel_rgb.h @@ -18,6 +18,37 @@ extern "C" { #if SOC_LCD_RGB_SUPPORTED /** * @brief LCD RGB timing structure + * + * Total Width + * <---------------------------------------------------> + * Hsync width HBP Active Width HFP + * <---><--><--------------------------------------><---> + * ____ ____|_______________________________________|____| + * |___| | | | + * | | | + * __| | | | + * /|\ /|\ | | | | + * | VSYNC| | | | | + * |Width\|/ |__ | | | + * | /|\ | | | | + * | VBP | | | | | + * | \|/_____|_________|_______________________________________| | + * | /|\ | | / / / / / / / / / / / / / / / / / / / | | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * Total | | | |/ / / / / / / / / / / / / / / / / / / /| | + * Heigh | | | |/ / / / / / / / / / / / / / / / / / / /| | + * |Active| | |/ / / / / / / / / / / / / / / / / / / /| | + * |Heigh | | |/ / / / / / Active Display Area / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | | | |/ / / / / / / / / / / / / / / / / / / /| | + * | \|/_____|_________|_______________________________________| | + * | /|\ | | + * | VFP | | | + * \|/ \|/_____|______________________________________________________| + * */ typedef struct { unsigned int pclk_hz; /*!< Frequency of pixel clock */ @@ -38,6 +69,22 @@ typedef struct { } flags; } esp_lcd_rgb_timing_t; +/** + * @brief Type of RGB LCD panel event data + */ +typedef struct { +} esp_lcd_rgb_panel_event_data_t; + +/** + * @brief Declare the prototype of the function that will be invoked when panel IO finishes transferring color data + * + * @param[in] panel LCD panel handle, returned from `esp_lcd_new_rgb_panel` + * @param[in] edata Panel event data, fed by driver + * @param[in] user_ctx User data, passed from `esp_lcd_rgb_panel_config_t` + * @return Whether a high priority task has been waken up by this function + */ +typedef bool (*esp_lcd_rgb_panel_frame_trans_done_cb_t)(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx); + /** * @brief LCD RGB panel configuration structure */ @@ -51,8 +98,8 @@ typedef struct { int pclk_gpio_num; /*!< GPIO used for PCLK signal */ int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; /*!< GPIOs used for data lines */ int disp_gpio_num; /*!< GPIO used for display control signal, set to -1 if it's not used */ - bool (*on_frame_trans_done)(esp_lcd_panel_handle_t panel, void *user_data); /*!< Callback, invoked when one frame buffer has transferred done */ - void *user_data; /*!< User data which would be passed to on_frame_trans_done's user_data */ + esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; /*!< Callback invoked when one frame buffer has transferred done */ + void *user_ctx; /*!< User data which would be passed to on_frame_trans_done's user_ctx */ 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) */ diff --git a/tools/sdk/esp32s2/include/esp_littlefs/include/esp_littlefs.h b/tools/sdk/esp32s2/include/esp_littlefs/include/esp_littlefs.h index dbb1028790d..7b5abe9248f 100644 --- a/tools/sdk/esp32s2/include/esp_littlefs/include/esp_littlefs.h +++ b/tools/sdk/esp32s2/include/esp_littlefs/include/esp_littlefs.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include "sdkconfig.h" diff --git a/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist.h b/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist.h index 1ff624d9b55..14b7c9aa506 100644 --- a/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist.h +++ b/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist.h @@ -1,16 +1,8 @@ -// Copyright 2015-2018 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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_COEXIST_H__ #define __ESP_COEXIST_H__ @@ -32,6 +24,13 @@ typedef enum { ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */ } esp_coex_prefer_t; +typedef enum { + EXTERN_COEX_WIRE_1 = 0, + EXTERN_COEX_WIRE_2, + EXTERN_COEX_WIRE_3, + EXTERN_COEX_WIRE_NUM, +} external_coex_wire_t; + /** * @brief coex status type */ @@ -41,6 +40,36 @@ typedef enum { ESP_COEX_ST_TYPE_BT, } esp_coex_status_type_t; +/** + * @brief external coex gpio pti + */ +typedef struct { + int32_t in_pin0; + int32_t in_pin1; + int32_t out_pin0; +} esp_external_coex_gpio_set_t; + +/** + * @brief external coex pti level + */ +typedef enum { + EXTERN_COEX_PTI_MID = 0, + EXTERN_COEX_PTI_HIGH, + EXTERN_COEX_PTI_NUM, +} esp_coex_pti_level_t; + +/** + * @brief external coex pti + */ +typedef struct { + uint32_t in_pti1; + uint32_t in_pti2; + uint32_t in_pti3; + uint32_t out_pti1; + uint32_t out_pti2; + uint32_t out_pti3; +} esp_external_coex_pti_set_t; + #define ESP_COEX_BLE_ST_MESH_CONFIG 0x08 #define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10 #define ESP_COEX_BLE_ST_MESH_STANDBY 0x20 @@ -84,6 +113,18 @@ esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status); */ esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status); +#if CONFIG_EXTERNAL_COEX_ENABLE +/** + * @brief Setup gpio pin and corresponding pti level, start external coex. + * @param wire_type : to select the whole external coex gpio number. + * @param gpio_pin : gpio pin number to choose. + * @return : ESP_OK - success, other - failed + */ +esp_err_t esp_enable_extern_coex_gpio_pin(external_coex_wire_t wire_type, + esp_external_coex_gpio_set_t gpio_pin); + +esp_err_t esp_disable_extern_coex_gpio_pin(); +#endif #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist_internal.h b/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist_internal.h index 3501f0da6fb..7ba06d4c690 100644 --- a/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist_internal.h +++ b/tools/sdk/esp32s2/include/esp_wifi/include/esp_coexist_internal.h @@ -1,21 +1,14 @@ -// Copyright 2018-2018 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: 2018-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_COEXIST_INTERNAL_H__ #define __ESP_COEXIST_INTERNAL_H__ #include +#include "esp_coexist.h" #include "esp_coexist_adapter.h" #ifdef __cplusplus @@ -210,6 +203,29 @@ int coex_schm_curr_phase_idx_get(void); */ esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs); +#if CONFIG_EXTERNAL_COEX_ENABLE +/** + * @brief Set external coexistence pti level and enable it. + * + * @param level1 external coex low pti + * @param level2 external coex mid pti + * @param level3 external coex high pti + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_coex_external_set(esp_coex_pti_level_t level1, + esp_coex_pti_level_t level2, esp_coex_pti_level_t level3); + +/** + * @brief Disable external coexist + * + * @return + * - ESP_OK: succeed + */ +void esp_coex_external_stop(void); +#endif /*External Coex*/ + /** * @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library * diff --git a/tools/sdk/esp32s2/include/esp_wifi/include/esp_wifi_types.h b/tools/sdk/esp32s2/include/esp_wifi/include/esp_wifi_types.h index 503e8d7bb05..cee23f3fafc 100644 --- a/tools/sdk/esp32s2/include/esp_wifi/include/esp_wifi_types.h +++ b/tools/sdk/esp32s2/include/esp_wifi/include/esp_wifi_types.h @@ -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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_WIFI_TYPES_H__ @@ -80,6 +72,7 @@ typedef enum { WIFI_REASON_ASSOC_NOT_AUTHED = 9, WIFI_REASON_DISASSOC_PWRCAP_BAD = 10, WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11, + WIFI_REASON_BSS_TRANSITION_DISASSOC = 12, WIFI_REASON_IE_INVALID = 13, WIFI_REASON_MIC_FAILURE = 14, WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, @@ -250,7 +243,8 @@ typedef struct { wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame. Will be advertized in RSN Capabilities in RSN IE. */ uint32_t rm_enabled:1; /**< Whether Radio Measurements are enabled for the connection */ uint32_t btm_enabled:1; /**< Whether BSS Transition Management is enabled for the connection */ - uint32_t reserved:30; /**< Reserved for future feature set */ + uint32_t mbo_enabled:1; /**< Whether MBO is enabled for the connection */ + uint32_t reserved:29; /**< Reserved for future feature set */ } wifi_sta_config_t; /** @brief Configuration data for ESP32 AP or STA. diff --git a/tools/sdk/esp32s2/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h b/tools/sdk/esp32s2/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h index a01a56e9fd4..675af141ebc 100644 --- a/tools/sdk/esp32s2/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h +++ b/tools/sdk/esp32s2/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h @@ -90,7 +90,6 @@ #define portNUM_PROCESSORS 1 #endif -#define configASSERT_2 0 #define portUSING_MPU_WRAPPERS 0 #define configUSE_MUTEX 1 @@ -206,7 +205,6 @@ #define configGENERATE_RUN_TIME_STATS 1 /* Used by vTaskGetRunTimeStats() */ #endif -#define configUSE_TRACE_FACILITY_2 0 #define configBENCHMARK 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 0 @@ -306,4 +304,9 @@ extern void vPortCleanUpTCB ( void *pxTCB ); #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1 +// backward compatibility for 4.4 +#define xTaskRemoveFromUnorderedEventList vTaskRemoveFromUnorderedEventList + +#define configNUM_CORES portNUM_PROCESSORS + #endif /* FREERTOS_CONFIG_H */ diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/event_groups.h b/tools/sdk/esp32s2/include/freertos/include/freertos/event_groups.h index 84505ddaaa0..9792296e566 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/event_groups.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/event_groups.h @@ -64,7 +64,7 @@ * used to create a synchronisation point between multiple tasks (a * 'rendezvous'). * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventGroup EventGroup * @endcond */ @@ -78,7 +78,7 @@ * xEventGroupCreate() returns an EventGroupHandle_t variable that can then * be used as a parameter to other event group functions. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventGroupHandle_t EventGroupHandle_t * @endcond * \ingroup EventGroup @@ -94,7 +94,7 @@ typedef struct EventGroupDef_t * EventGroupHandle_t; * number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1, * 32 bits if set to 0. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup EventBits_t EventBits_t * @endcond * \ingroup EventGroup @@ -102,7 +102,7 @@ typedef struct EventGroupDef_t * EventGroupHandle_t; typedef TickType_t EventBits_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventGroupHandle_t xEventGroupCreate( void ); @@ -152,7 +152,7 @@ typedef TickType_t EventBits_t; * // The event group was created. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupCreate xEventGroupCreate * @endcond * \ingroup EventGroup @@ -162,7 +162,7 @@ typedef TickType_t EventBits_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventGroupHandle_t xEventGroupCreateStatic( EventGroupHandle_t * pxEventGroupBuffer ); @@ -217,7 +217,7 @@ typedef TickType_t EventBits_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, @@ -307,7 +307,7 @@ typedef TickType_t EventBits_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupWaitBits xEventGroupWaitBits * @endcond * \ingroup EventGroup @@ -319,7 +319,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ); @@ -372,7 +372,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupClearBits xEventGroupClearBits * @endcond * \ingroup EventGroup @@ -381,7 +381,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); @@ -432,7 +432,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR * @endcond * \ingroup EventGroup @@ -446,7 +446,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); @@ -516,7 +516,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSetBits xEventGroupSetBits * @endcond * \ingroup EventGroup @@ -525,7 +525,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ); @@ -595,7 +595,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR * @endcond * \ingroup EventGroup @@ -610,7 +610,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, @@ -732,7 +732,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupSync xEventGroupSync * @endcond * \ingroup EventGroup @@ -744,7 +744,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup ); @@ -758,7 +758,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, * * @return The event group bits at the time xEventGroupGetBits() was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupGetBits xEventGroupGetBits * @endcond * \ingroup EventGroup @@ -766,7 +766,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, #define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( xEventGroup, 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ); @@ -779,7 +779,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, * * @return The event group bits at the time xEventGroupGetBitsFromISR() was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR * @endcond * \ingroup EventGroup @@ -787,7 +787,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * event_groups.h * @code{c} * void xEventGroupDelete( EventGroupHandle_t xEventGroup ); @@ -802,7 +802,7 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEG */ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* For internal use only. */ void vEventGroupSetBitsCallback( void * pvEventGroup, diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/message_buffer.h b/tools/sdk/esp32s2/include/freertos/include/freertos/message_buffer.h index e57c589fbac..af5c3290b7c 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/message_buffer.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/message_buffer.h @@ -85,7 +85,7 @@ typedef void * MessageBufferHandle_t; /*-----------------------------------------------------------*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -139,7 +139,7 @@ typedef void * MessageBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferCreate xMessageBufferCreate * @endcond * \ingroup MessageBufferManagement @@ -148,7 +148,7 @@ typedef void * MessageBufferHandle_t; ( MessageBufferHandle_t ) xStreamBufferGenericCreate( xBufferSizeBytes, ( size_t ) 0, pdTRUE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -210,7 +210,7 @@ typedef void * MessageBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferCreateStatic xMessageBufferCreateStatic * @endcond * \ingroup MessageBufferManagement @@ -219,7 +219,7 @@ typedef void * MessageBufferHandle_t; ( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -314,7 +314,7 @@ typedef void * MessageBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSend xMessageBufferSend * @endcond * \ingroup MessageBufferManagement @@ -323,7 +323,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSend( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -423,7 +423,7 @@ typedef void * MessageBufferHandle_t; * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSendFromISR xMessageBufferSendFromISR * @endcond * \ingroup MessageBufferManagement @@ -432,7 +432,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSendFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -516,7 +516,7 @@ typedef void * MessageBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceive xMessageBufferReceive * @endcond * \ingroup MessageBufferManagement @@ -526,7 +526,7 @@ typedef void * MessageBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -622,7 +622,7 @@ typedef void * MessageBufferHandle_t; * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceiveFromISR xMessageBufferReceiveFromISR * @endcond * \ingroup MessageBufferManagement @@ -631,7 +631,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferReceiveFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -654,7 +654,7 @@ typedef void * MessageBufferHandle_t; vStreamBufferDelete( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferIsFull( MessageBufferHandle_t xMessageBuffer ) ); @@ -674,7 +674,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferIsFull( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferIsEmpty( MessageBufferHandle_t xMessageBuffer ) ); @@ -693,7 +693,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferIsEmpty( ( StreamBufferHandle_t ) xMessageBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * BaseType_t xMessageBufferReset( MessageBufferHandle_t xMessageBuffer ); @@ -712,7 +712,7 @@ typedef void * MessageBufferHandle_t; * the message queue to wait for space to become available, or to wait for a * a message to be available, then pdFAIL is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReset xMessageBufferReset * @endcond * \ingroup MessageBufferManagement @@ -722,7 +722,7 @@ typedef void * MessageBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * size_t xMessageBufferSpaceAvailable( MessageBufferHandle_t xMessageBuffer ) ); @@ -740,7 +740,7 @@ typedef void * MessageBufferHandle_t; * architecture, so if xMessageBufferSpacesAvailable() returns 10, then the size * of the largest message that can be written to the message buffer is 6 bytes. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSpaceAvailable xMessageBufferSpaceAvailable * @endcond * \ingroup MessageBufferManagement @@ -751,7 +751,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSpacesAvailable( ( StreamBufferHandle_t ) xMessageBuffer ) /* Corrects typo in original macro name. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * @code{c} * size_t xMessageBufferNextLengthBytes( MessageBufferHandle_t xMessageBuffer ) ); @@ -767,7 +767,7 @@ typedef void * MessageBufferHandle_t; * @return The length (in bytes) of the next message in the message buffer, or 0 * if the message buffer is empty. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferNextLengthBytes xMessageBufferNextLengthBytes * @endcond * \ingroup MessageBufferManagement @@ -776,7 +776,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferNextMessageLengthBytes( ( StreamBufferHandle_t ) xMessageBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -811,7 +811,7 @@ typedef void * MessageBufferHandle_t; * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferSendCompletedFromISR xMessageBufferSendCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -820,7 +820,7 @@ typedef void * MessageBufferHandle_t; xStreamBufferSendCompletedFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pxHigherPriorityTaskWoken ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -856,7 +856,7 @@ typedef void * MessageBufferHandle_t; * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xMessageBufferReceiveCompletedFromISR xMessageBufferReceiveCompletedFromISR * @endcond * \ingroup StreamBufferManagement diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/queue.h b/tools/sdk/esp32s2/include/freertos/include/freertos/queue.h index 81cccc05df3..05ca7de4546 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/queue.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/queue.h @@ -62,7 +62,7 @@ typedef struct QueueDefinition * QueueSetHandle_t; */ typedef struct QueueDefinition * QueueSetMemberHandle_t; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* For internal use only. */ #define queueSEND_TO_BACK ( ( BaseType_t ) 0 ) @@ -80,7 +80,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * QueueHandle_t xQueueCreate( @@ -146,7 +146,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueCreate xQueueCreate * @endcond * \ingroup QueueManagement @@ -156,7 +156,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * QueueHandle_t xQueueCreateStatic( @@ -235,7 +235,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueCreateStatic xQueueCreateStatic * @endcond * \ingroup QueueManagement @@ -245,7 +245,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToToFront( @@ -321,7 +321,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -330,7 +330,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToBack( @@ -408,7 +408,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -417,7 +417,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSend( @@ -497,7 +497,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -506,7 +506,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueOverwrite( @@ -585,7 +585,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueOverwrite xQueueOverwrite * @endcond * \ingroup QueueManagement @@ -595,7 +595,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueGenericSend( @@ -678,7 +678,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSend xQueueSend * @endcond * \ingroup QueueManagement @@ -689,7 +689,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueuePeek( @@ -780,7 +780,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueuePeek xQueuePeek * @endcond * \ingroup QueueManagement @@ -790,7 +790,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueuePeekFromISR( @@ -820,7 +820,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, * @return pdTRUE if an item was successfully received from the queue, * otherwise pdFALSE. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueuePeekFromISR xQueuePeekFromISR * @endcond * \ingroup QueueManagement @@ -829,7 +829,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueReceive( @@ -917,7 +917,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, * // ... Rest of task code. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueReceive xQueueReceive * @endcond * \ingroup QueueManagement @@ -927,7 +927,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ); @@ -940,7 +940,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, * * @return The number of messages available in the queue. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * @endcond * \ingroup QueueManagement @@ -948,7 +948,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ); @@ -963,7 +963,7 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNC * * @return The number of spaces available in the queue. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting * @endcond * \ingroup QueueManagement @@ -971,7 +971,7 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) PRIVILEGED_FUNC UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * void vQueueDelete( QueueHandle_t xQueue ); @@ -983,7 +983,7 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNC * * @param xQueue A handle to the queue to be deleted. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vQueueDelete vQueueDelete * @endcond * \ingroup QueueManagement @@ -991,7 +991,7 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) PRIVILEGED_FUNC void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToFrontFromISR( @@ -1057,7 +1057,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1067,7 +1067,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendToBackFromISR( @@ -1133,7 +1133,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1142,7 +1142,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueOverwriteFromISR( @@ -1225,7 +1225,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueOverwriteFromISR xQueueOverwriteFromISR * @endcond * \ingroup QueueManagement @@ -1234,7 +1234,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueOVERWRITE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueSendFromISR( @@ -1304,7 +1304,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueSendFromISR xQueueSendFromISR * @endcond * \ingroup QueueManagement @@ -1312,10 +1312,10 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; #define xQueueSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \ xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK ) -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /**@{*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueGenericSendFromISR( @@ -1402,7 +1402,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * queue. h * @code{c} * BaseType_t xQueueReceiveFromISR( @@ -1487,7 +1487,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR * @endcond * \ingroup QueueManagement @@ -1504,7 +1504,7 @@ BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FU BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * The functions defined above are for passing data to and from tasks. The * functions below are the equivalents for passing data to and from @@ -1778,7 +1778,7 @@ QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, */ QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* Not public API functions. */ void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/semphr.h b/tools/sdk/esp32s2/include/freertos/include/freertos/semphr.h index 7e99c0b396c..2041641b91d 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/semphr.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/semphr.h @@ -39,7 +39,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U ) #define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U ) -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** * semphr. h * @code{c} @@ -88,7 +88,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary * @endcond * \ingroup Semaphores @@ -106,7 +106,7 @@ typedef QueueHandle_t SemaphoreHandle_t; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateBinary( void ); @@ -163,7 +163,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateBinary xSemaphoreCreateBinary * @endcond * \ingroup Semaphores @@ -173,7 +173,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateBinaryStatic( StaticSemaphore_t *pxSemaphoreBuffer ); @@ -229,7 +229,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // Rest of task code goes here. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateBinaryStatic xSemaphoreCreateBinaryStatic * @endcond * \ingroup Semaphores @@ -239,7 +239,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTake( @@ -304,7 +304,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreTake xSemaphoreTake * @endcond * \ingroup Semaphores @@ -312,7 +312,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueSemaphoreTake( ( xSemaphore ), ( xBlockTime ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTakeRecursive( @@ -403,7 +403,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive * @endcond * \ingroup Semaphores @@ -465,7 +465,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGive xSemaphoreGive * @endcond * \ingroup Semaphores @@ -473,7 +473,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex ); @@ -555,7 +555,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive * @endcond * \ingroup Semaphores @@ -641,7 +641,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR * @endcond * \ingroup Semaphores @@ -649,7 +649,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGiveFromISR( ( QueueHandle_t ) ( xSemaphore ), ( pxHigherPriorityTaskWoken ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * xSemaphoreTakeFromISR( @@ -686,7 +686,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateMutex( void ); @@ -741,7 +741,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex * @endcond * \ingroup Semaphores @@ -751,7 +751,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateMutexStatic( StaticSemaphore_t *pxMutexBuffer ); @@ -808,7 +808,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // so there is no need to check it. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic * @endcond * \ingroup Semaphores @@ -951,7 +951,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount ); @@ -1027,7 +1027,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting * @endcond * \ingroup Semaphores @@ -1037,7 +1037,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * SemaphoreHandle_t xSemaphoreCreateCountingStatic( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount, StaticSemaphore_t *pxSemaphoreBuffer ); @@ -1118,7 +1118,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * // is no need to check its value. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xSemaphoreCreateCountingStatic xSemaphoreCreateCountingStatic * @endcond * \ingroup Semaphores @@ -1128,7 +1128,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr. h * @code{c} * void vSemaphoreDelete( SemaphoreHandle_t xSemaphore ); @@ -1140,7 +1140,7 @@ typedef QueueHandle_t SemaphoreHandle_t; * * @param xSemaphore A handle to the semaphore to be deleted. * - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * \defgroup vSemaphoreDelete vSemaphoreDelete * @endcond * \ingroup Semaphores @@ -1148,7 +1148,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex ); @@ -1167,7 +1167,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * TaskHandle_t xSemaphoreGetMutexHolderFromISR( SemaphoreHandle_t xMutex ); @@ -1182,7 +1182,7 @@ typedef QueueHandle_t SemaphoreHandle_t; #define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * semphr.h * @code{c} * UBaseType_t uxSemaphoreGetCount( SemaphoreHandle_t xSemaphore ); diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/stream_buffer.h b/tools/sdk/esp32s2/include/freertos/include/freertos/stream_buffer.h index 9e58cff120c..a20dcf0375e 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/stream_buffer.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/stream_buffer.h @@ -71,7 +71,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * message_buffer.h * * @code{c} @@ -134,7 +134,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferCreate xStreamBufferCreate * @endcond * \ingroup StreamBufferManagement @@ -142,7 +142,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; #define xStreamBufferCreate( xBufferSizeBytes, xTriggerLevelBytes ) xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -220,7 +220,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferCreateStatic xStreamBufferCreateStatic * @endcond * \ingroup StreamBufferManagement @@ -229,7 +229,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, pucStreamBufferStorageArea, pxStaticStreamBuffer ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -319,7 +319,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSend xStreamBufferSend * @endcond * \ingroup StreamBufferManagement @@ -330,7 +330,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -424,7 +424,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, * taskYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSendFromISR xStreamBufferSendFromISR * @endcond * \ingroup StreamBufferManagement @@ -435,7 +435,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -517,7 +517,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceive xStreamBufferReceive * @endcond * \ingroup StreamBufferManagement @@ -528,7 +528,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -607,7 +607,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, * taskYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceiveFromISR xStreamBufferReceiveFromISR * @endcond * \ingroup StreamBufferManagement @@ -618,7 +618,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -636,7 +636,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, * * @param xStreamBuffer The handle of the stream buffer to be deleted. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vStreamBufferDelete vStreamBufferDelete * @endcond * \ingroup StreamBufferManagement @@ -644,7 +644,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -660,7 +660,7 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTI * @return If the stream buffer is full then pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferIsFull xStreamBufferIsFull * @endcond * \ingroup StreamBufferManagement @@ -668,7 +668,7 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTI BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -684,7 +684,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_ * @return If the stream buffer is empty then pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferIsEmpty xStreamBufferIsEmpty * @endcond * \ingroup StreamBufferManagement @@ -692,7 +692,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -711,7 +711,7 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED * a task blocked waiting to send to or read from the stream buffer then the * stream buffer is not reset and pdFAIL is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReset xStreamBufferReset * @endcond * \ingroup StreamBufferManagement @@ -719,7 +719,7 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -736,7 +736,7 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_F * @return The number of bytes that can be written to the stream buffer before * the stream buffer would be full. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSpacesAvailable xStreamBufferSpacesAvailable * @endcond * \ingroup StreamBufferManagement @@ -744,7 +744,7 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_F size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -761,7 +761,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVIL * @return The number of bytes that can be read from the stream buffer before * the stream buffer would be empty. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferBytesAvailable xStreamBufferBytesAvailable * @endcond * \ingroup StreamBufferManagement @@ -769,7 +769,7 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVIL size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -802,7 +802,7 @@ size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILE * then the trigger level will be updated and pdTRUE is returned. Otherwise * pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSetTriggerLevel xStreamBufferSetTriggerLevel * @endcond * \ingroup StreamBufferManagement @@ -811,7 +811,7 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -846,7 +846,7 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferSendCompletedFromISR xStreamBufferSendCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -855,7 +855,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * stream_buffer.h * * @code{c} @@ -891,7 +891,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer * @return If a task was removed from the Blocked state then pdTRUE is returned. * Otherwise pdFALSE is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xStreamBufferReceiveCompletedFromISR xStreamBufferReceiveCompletedFromISR * @endcond * \ingroup StreamBufferManagement @@ -899,7 +899,7 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* Functions below here are not part of the public API. */ StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/task.h b/tools/sdk/esp32s2/include/freertos/include/freertos/task.h index 9135b76f014..125a924d061 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/task.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/task.h @@ -76,7 +76,7 @@ * returns (via a pointer parameter) an TaskHandle_t variable that can then * be used as a parameter to vTaskDelete to delete the task. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup TaskHandle_t TaskHandle_t * @endcond * \ingroup Tasks @@ -114,7 +114,7 @@ typedef enum eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */ } eNotifyAction; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** * Used internally only. */ @@ -189,11 +189,13 @@ typedef enum #define tskIDLE_PRIORITY ( ( UBaseType_t ) 0U ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro for forcing a context switch. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskYIELD taskYIELD * @endcond * \ingroup SchedulerControl @@ -201,7 +203,9 @@ typedef enum #define taskYIELD() portYIELD() /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to mark the start of a critical code region. Preemptive context * switches cannot occur when in a critical region. @@ -209,7 +213,7 @@ typedef enum * @note This may alter the stack (depending on the portable implementation) * so must be used with care! * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskENTER_CRITICAL taskENTER_CRITICAL * @endcond * \ingroup SchedulerControl @@ -228,7 +232,9 @@ typedef enum #endif // ESP_PLATFORM /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to mark the end of a critical code region. Preemptive context * switches cannot occur when in a critical region. @@ -236,7 +242,7 @@ typedef enum * @note This may alter the stack (depending on the portable implementation) * so must be used with care! * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskEXIT_CRITICAL taskEXIT_CRITICAL * @endcond * \ingroup SchedulerControl @@ -255,11 +261,13 @@ typedef enum #define taskEXIT_CRITICAL_ISR( ) portEXIT_CRITICAL_ISR( ) #endif // ESP_PLATFORM /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to disable all maskable interrupts. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS * @endcond * \ingroup SchedulerControl @@ -267,11 +275,13 @@ typedef enum #define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS() /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h + * @endcond * * Macro to enable microcontroller interrupts. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup taskENABLE_INTERRUPTS taskENABLE_INTERRUPTS * @endcond * \ingroup SchedulerControl @@ -422,7 +432,7 @@ typedef enum * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreate xTaskCreate * @endcond * \ingroup Tasks @@ -430,14 +440,14 @@ typedef enum #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) static inline IRAM_ATTR BaseType_t xTaskCreate( - TaskFunction_t pvTaskCode, - const char * const pcName, - const uint32_t usStackDepth, - void * const pvParameters, - UBaseType_t uxPriority, - TaskHandle_t * const pvCreatedTask) + TaskFunction_t pvTaskCode, + const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + const uint32_t usStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + TaskHandle_t * const pxCreatedTask) PRIVILEGED_FUNCTION { - return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, tskNO_AFFINITY ); + return xTaskCreatePinnedToCore( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, tskNO_AFFINITY ); } #endif @@ -599,20 +609,20 @@ typedef enum #if( configSUPPORT_STATIC_ALLOCATION == 1 ) static inline IRAM_ATTR TaskHandle_t xTaskCreateStatic( - TaskFunction_t pvTaskCode, - const char * const pcName, - const uint32_t ulStackDepth, - void * const pvParameters, - UBaseType_t uxPriority, - StackType_t * const pxStackBuffer, - StaticTask_t * const pxTaskBuffer) + TaskFunction_t pvTaskCode, + const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + const uint32_t ulStackDepth, + void * const pvParameters, + UBaseType_t uxPriority, + StackType_t * const puxStackBuffer, + StaticTask_t * const pxTaskBuffer) PRIVILEGED_FUNCTION { - return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, pxStackBuffer, pxTaskBuffer, tskNO_AFFINITY ); + return xTaskCreateStaticPinnedToCore( pvTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, tskNO_AFFINITY ); } #endif /* configSUPPORT_STATIC_ALLOCATION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskCreateRestricted( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask ); @@ -683,18 +693,18 @@ typedef enum * for( ;; ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestricted xTaskCreateRestricted * @endcond * \ingroup Tasks */ #if ( portUSING_MPU_WRAPPERS == 1 ) BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, - TaskHandle_t * pxCreatedTask ); + TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskCreateRestrictedStatic( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask ); @@ -777,7 +787,7 @@ typedef enum * for( ;; ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestrictedStatic xTaskCreateRestrictedStatic * @endcond * \ingroup Tasks @@ -788,7 +798,7 @@ typedef enum #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ); @@ -833,7 +843,7 @@ typedef enum * // defined or shared regions have been declared elsewhere). * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCreateRestricted xTaskCreateRestricted * @endcond * \ingroup Tasks @@ -842,7 +852,7 @@ void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskDelete( TaskHandle_t xTask ); @@ -881,7 +891,7 @@ void vTaskAllocateMPURegions( TaskHandle_t xTask, * vTaskDelete( xHandle ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskDelete vTaskDelete * @endcond * \ingroup Tasks @@ -893,10 +903,12 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; *----------------------------------------------------------*/ /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskDelay( const TickType_t xTicksToDelay ); * @endcode + * @endcond * * Delay a task for a given number of ticks. The actual time that the * task remains blocked depends on the tick rate. The constant @@ -938,7 +950,7 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskDelay vTaskDelay * @endcond * \ingroup TaskCtrl @@ -946,10 +958,12 @@ void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION; void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION; /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement ); * @endcode + * @endcond * * INCLUDE_xTaskDelayUntil must be defined as 1 for this function to be available. * See the configuration section for more information. @@ -1007,7 +1021,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskDelayUntil xTaskDelayUntil * @endcond * \ingroup TaskCtrl @@ -1026,7 +1040,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskAbortDelay( TaskHandle_t xTask ); @@ -1054,7 +1068,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, * @return If the task referenced by xTask was not in the Blocked state then * pdFAIL is returned. Otherwise pdPASS is returned. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskAbortDelay xTaskAbortDelay * @endcond * \ingroup TaskCtrl @@ -1062,7 +1076,7 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime, BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ); @@ -1107,7 +1121,7 @@ BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxTaskPriorityGet uxTaskPriorityGet * @endcond * \ingroup TaskCtrl @@ -1115,7 +1129,7 @@ BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ); @@ -1127,7 +1141,7 @@ UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * eTaskState eTaskGetState( TaskHandle_t xTask ); @@ -1149,7 +1163,7 @@ UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNC eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ); @@ -1203,7 +1217,7 @@ eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; * eInvalid ); // Include the task state in xTaskDetails. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskGetInfo vTaskGetInfo * @endcond * \ingroup TaskCtrl @@ -1214,7 +1228,7 @@ void vTaskGetInfo( TaskHandle_t xTask, eTaskState eState ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ); @@ -1254,7 +1268,7 @@ void vTaskGetInfo( TaskHandle_t xTask, * vTaskPrioritySet( NULL, tskIDLE_PRIORITY + 1 ); * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskPrioritySet vTaskPrioritySet * @endcond * \ingroup TaskCtrl @@ -1263,7 +1277,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskSuspend( TaskHandle_t xTaskToSuspend ); @@ -1312,7 +1326,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, * // with our handle as the parameter. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskSuspend vTaskSuspend * @endcond * \ingroup TaskCtrl @@ -1320,7 +1334,7 @@ void vTaskPrioritySet( TaskHandle_t xTask, void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskResume( TaskHandle_t xTaskToResume ); @@ -1367,7 +1381,7 @@ void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; * // time in accordance with its priority within the system. * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskResume vTaskResume * @endcond * \ingroup TaskCtrl @@ -1375,7 +1389,7 @@ void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION; void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void xTaskResumeFromISR( TaskHandle_t xTaskToResume ); @@ -1402,7 +1416,7 @@ void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; * otherwise pdFALSE. This is used by the ISR to determine if a context switch * may be required following the ISR. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskResumeFromISR vTaskResumeFromISR * @endcond * \ingroup TaskCtrl @@ -1412,9 +1426,9 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * SCHEDULER CONTROL *----------------------------------------------------------*/ -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskStartScheduler( void ); @@ -1445,7 +1459,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskStartScheduler vTaskStartScheduler * @endcond * \ingroup SchedulerControl @@ -1453,7 +1467,7 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION; void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskEndScheduler( void ); @@ -1507,7 +1521,7 @@ void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION; * } * @endcode * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskEndScheduler vTaskEndScheduler * @endcond * \ingroup SchedulerControl @@ -1517,7 +1531,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; /** @endcond */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskSuspendAll( void ); @@ -1566,7 +1580,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskSuspendAll vTaskSuspendAll * @endcond * \ingroup SchedulerControl @@ -1574,7 +1588,7 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskResumeAll( void ); @@ -1626,7 +1640,7 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; * } * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskResumeAll xTaskResumeAll * @endcond * \ingroup SchedulerControl @@ -1638,7 +1652,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; *----------------------------------------------------------*/ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TickType_t xTaskGetTickCount( void ); @@ -1647,7 +1661,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; * * @return The count of ticks since vTaskStartScheduler was called. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskGetTickCount xTaskGetTickCount * @endcond * \ingroup TaskUtils @@ -1655,7 +1669,7 @@ BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION; TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TickType_t xTaskGetTickCountFromISR( void ); @@ -1669,7 +1683,7 @@ TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; * microcontroller being used or interrupt nesting is either not supported or * not being used. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR * @endcond * \ingroup TaskUtils @@ -1677,7 +1691,7 @@ TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint16_t uxTaskGetNumberOfTasks( void ); @@ -1689,7 +1703,7 @@ TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; * has been deleted but not yet freed by the idle task will also be * included in the count. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks * @endcond * \ingroup TaskUtils @@ -1697,7 +1711,7 @@ TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * char *pcTaskGetName( TaskHandle_t xTaskToQuery ); @@ -1708,7 +1722,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; * xTaskToQuery. A task can query its own name by either passing in its own * handle, or by setting xTaskToQuery to NULL. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup pcTaskGetName pcTaskGetName * @endcond * \ingroup TaskUtils @@ -1716,7 +1730,7 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ); @@ -1730,7 +1744,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lin * NULL is returned if no matching name is found. INCLUDE_xTaskGetHandle * must be set to 1 in FreeRTOSConfig.h for pcTaskGetHandle() to be available. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup pcTaskGetHandle pcTaskGetHandle * @endcond * \ingroup TaskUtils @@ -1813,7 +1827,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #ifdef configUSE_APPLICATION_TASK_TAG #if configUSE_APPLICATION_TASK_TAG == 1 /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ); @@ -1830,7 +1844,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; TaskHookFunction_t pxHookFunction ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void xTaskGetApplicationTaskTag( TaskHandle_t xTask ); @@ -1844,7 +1858,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ); @@ -1932,7 +1946,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName); @@ -1952,7 +1966,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configUSE_TICK_HOOK > 0 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationTickHook( void ); @@ -1967,7 +1981,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) @@ -1986,7 +2000,7 @@ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION; #endif /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ); @@ -2155,7 +2169,7 @@ UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, * enough to contain the generated report. Approximately 40 bytes per * task should be sufficient. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskList vTaskList * @endcond * \ingroup TaskUtils @@ -2210,7 +2224,7 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unq * contain the generated report. Approximately 40 bytes per task should * be sufficient. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskGetRunTimeStats vTaskGetRunTimeStats * @endcond * \ingroup TaskUtils @@ -2218,7 +2232,7 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unq void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code * uint32_t ulTaskGetIdleRunTimeCounter( void ); @@ -2246,7 +2260,7 @@ void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lin * frequency configured using the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and * portGET_RUN_TIME_COUNTER_VALUE() macros. * - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter * @endcond * \ingroup TaskUtils @@ -2254,11 +2268,13 @@ void vTaskGetRunTimeStats( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lin uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction ); * BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2359,7 +2375,9 @@ uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; * @return Dependent on the value of eAction. See the description of the * eAction parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyIndexed xTaskNotifyIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, @@ -2373,11 +2391,13 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), NULL ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyAndQueryIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue ); * BaseType_t xTaskNotifyAndQuery( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2393,7 +2413,9 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, * than when the function returns) in the additional pulPreviousNotifyValue * parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyAndQueryIndexed xTaskNotifyAndQueryIndexed + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyAndQuery( xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue ) \ @@ -2402,11 +2424,13 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ); * BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2511,7 +2535,9 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, * @return Dependent on the value of eAction. See the description of the * eAction parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyIndexedFromISR xTaskNotifyIndexedFromISR + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, @@ -2526,11 +2552,13 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( uxIndexToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyAndQueryIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ); * BaseType_t xTaskNotifyAndQueryFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2546,7 +2574,9 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, * function is called rather than at the time the function returns) in the * additional pulPreviousNotifyValue parameter. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyAndQueryIndexedFromISR xTaskNotifyAndQueryIndexedFromISR + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyAndQueryIndexedFromISR( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) \ @@ -2555,12 +2585,14 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( tskDEFAULT_INDEX_TO_NOTIFY ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyWaitIndexed( UBaseType_t uxIndexToWaitOn, uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); * * BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); * @endcode + * @endcond * * Waits for a direct to task notification to be pending at a given index within * an array of direct to task notifications. @@ -2655,7 +2687,9 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, * already pending when xTaskNotifyWait was called) then pdPASS is * returned. Otherwise pdFAIL is returned. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyWaitIndexed xTaskNotifyWaitIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, @@ -2669,11 +2703,13 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, xTaskGenericNotifyWait( ( uxIndexToWaitOn ), ( ulBitsToClearOnEntry ), ( ulBitsToClearOnExit ), ( pulNotificationValue ), ( xTicksToWait ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyGiveIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify ); * BaseType_t xTaskNotifyGive( TaskHandle_t xTaskToNotify ); * @endcode + * @endcond * * Sends a direct to task notification to a particular index in the target * task's notification array in a manner similar to giving a counting semaphore. @@ -2737,7 +2773,9 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, * @return xTaskNotifyGive() is a macro that calls xTaskNotify() with the * eAction parameter set to eIncrement - so pdPASS is always returned. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyGiveIndexed xTaskNotifyGiveIndexed + * @endcond * \ingroup TaskNotifications */ #define xTaskNotifyGive( xTaskToNotify ) \ @@ -2746,11 +2784,13 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, xTaskGenericNotify( ( xTaskToNotify ), ( uxIndexToNotify ), ( 0 ), eIncrement, NULL ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * void vTaskNotifyGiveIndexedFromISR( TaskHandle_t xTaskHandle, UBaseType_t uxIndexToNotify, BaseType_t *pxHigherPriorityTaskWoken ); * void vTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken ); * @endcode + * @endcond * * A version of xTaskNotifyGiveIndexed() that can be called from an interrupt * service routine (ISR). @@ -2821,7 +2861,9 @@ BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn, * requested from an ISR is dependent on the port - see the documentation page * for the port in use. * + * @cond !DOC_SINGLE_GROUP * \defgroup vTaskNotifyGiveIndexedFromISR vTaskNotifyGiveIndexedFromISR + * @endcond * \ingroup TaskNotifications */ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, @@ -2833,12 +2875,14 @@ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, vTaskGenericNotifyGiveFromISR( ( xTaskToNotify ), ( uxIndexToNotify ), ( pxHigherPriorityTaskWoken ) ); /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint32_t ulTaskNotifyTakeIndexed( UBaseType_t uxIndexToWaitOn, BaseType_t xClearCountOnExit, TickType_t xTicksToWait ); * * uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ); * @endcode + * @endcond * * Waits for a direct to task notification on a particular index in the calling * task's notification array in a manner similar to taking a counting semaphore. @@ -2927,7 +2971,9 @@ void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify, * @return The task's notification count before it is either cleared to zero or * decremented (see the xClearCountOnExit parameter). * + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskNotifyTakeIndexed ulTaskNotifyTakeIndexed + * @endcond * \ingroup TaskNotifications */ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, @@ -2939,12 +2985,14 @@ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, ulTaskGenericNotifyTake( ( uxIndexToWaitOn ), ( xClearCountOnExit ), ( xTicksToWait ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * BaseType_t xTaskNotifyStateClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToCLear ); * * BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -2992,7 +3040,9 @@ uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn, * @return pdTRUE if the task's notification state was set to * eNotWaitingNotification, otherwise pdFALSE. * + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskNotifyStateClearIndexed xTaskNotifyStateClearIndexed + * @endcond * \ingroup TaskNotifications */ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, @@ -3003,12 +3053,14 @@ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, xTaskGenericNotifyStateClear( ( xTask ), ( uxIndexToClear ) ) /** + * @cond !DOC_EXCLUDE_HEADER_SECTION * task. h * @code{c} * uint32_t ulTaskNotifyValueClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToClear, uint32_t ulBitsToClear ); * * uint32_t ulTaskNotifyValueClear( TaskHandle_t xTask, uint32_t ulBitsToClear ); * @endcode + * @endcond * * See https://www.FreeRTOS.org/RTOS-task-notifications.html for details. * @@ -3057,7 +3109,9 @@ BaseType_t xTaskGenericNotifyStateClear( TaskHandle_t xTask, * * @return The value of the target task's notification value before the bits * specified by ulBitsToClear were cleared. + * @cond !DOC_SINGLE_GROUP * \defgroup ulTaskNotifyValueClear ulTaskNotifyValueClear + * @endcond * \ingroup TaskNotifications */ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, @@ -3069,7 +3123,7 @@ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, ulTaskGenericNotifyValueClear( ( xTask ), ( uxIndexToClear ), ( ulBitsToClear ) ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ); @@ -3082,14 +3136,14 @@ uint32_t ulTaskGenericNotifyValueClear( TaskHandle_t xTask, * is to be captured. The captured time includes the tick count and the number * of times the tick count has overflowed since the system first booted. * \defgroup vTaskSetTimeOutState vTaskSetTimeOutState - * @cond + * @cond !DOC_SINGLE_GROUP * \ingroup TaskCtrl * @endcond */ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code * BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ); @@ -3170,7 +3224,7 @@ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; * return uxReceived; * } * @endcode - * @cond + * @cond !DOC_SINGLE_GROUP * \defgroup xTaskCheckForTimeOut xTaskCheckForTimeOut * @endcond * \ingroup TaskCtrl @@ -3179,7 +3233,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ); @@ -3204,7 +3258,7 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, * blocked state and a context switch being performed. Otherwise pdFALSE. * * \defgroup xTaskCatchUpTicks xTaskCatchUpTicks - * @cond + * @cond !DOC_SINGLE_GROUP * \ingroup TaskCtrl * @endcond */ @@ -3214,7 +3268,7 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES *----------------------------------------------------------*/ -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * Return the handle of the task running on a certain CPU. Because of * the nature of SMP processing, there is no guarantee that this @@ -3335,8 +3389,8 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, * making the call, otherwise pdFALSE. */ BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION; -BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, - const TickType_t xItemValue ) PRIVILEGED_FUNCTION; +void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, + const TickType_t xItemValue ) PRIVILEGED_FUNCTION; /* * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY @@ -3399,11 +3453,6 @@ void vTaskPriorityDisinheritAfterTimeout( TaskHandle_t const pxMutexHolder, */ UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; -/* - * Get the current core affinity of a task - */ -BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; - /* * Set the uxTaskNumber of the task referenced by the xTask parameter to * uxHandle. diff --git a/tools/sdk/esp32s2/include/freertos/include/freertos/timers.h b/tools/sdk/esp32s2/include/freertos/include/freertos/timers.h index a8bc4f38c78..af6dcb23501 100644 --- a/tools/sdk/esp32s2/include/freertos/include/freertos/timers.h +++ b/tools/sdk/esp32s2/include/freertos/include/freertos/timers.h @@ -450,7 +450,7 @@ void vTimerSetTimerID( TimerHandle_t xTimer, BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * @endcond * @@ -1315,7 +1315,7 @@ TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; */ TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; -/** @cond */ +/** @cond !DOC_EXCLUDE_HEADER_SECTION */ /* * Functions beyond this part are not part of the public API and are intended @@ -1339,7 +1339,7 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) /** - * @cond + * @cond !DOC_EXCLUDE_HEADER_SECTION * task.h * @code{c} * void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) diff --git a/tools/sdk/esp32s2/include/freertos/port/xtensa/include/freertos/portmacro.h b/tools/sdk/esp32s2/include/freertos/port/xtensa/include/freertos/portmacro.h index 248c86d15c7..47187379c6c 100644 --- a/tools/sdk/esp32s2/include/freertos/port/xtensa/include/freertos/portmacro.h +++ b/tools/sdk/esp32s2/include/freertos/port/xtensa/include/freertos/portmacro.h @@ -24,317 +24,449 @@ * * 1 tab == 4 spaces! */ + #ifndef PORTMACRO_H #define PORTMACRO_H -#ifdef __cplusplus -extern "C" { -#endif - #ifndef __ASSEMBLER__ -#include +#include "sdkconfig.h" #include #include #include #include -#include #include -#include /* required for XSHAL_CLIB */ -#include -#include "esp_private/crosscore_int.h" -#include "esp_timer.h" /* required for FreeRTOS run time stats */ -#include "esp_system.h" -#include "esp_newlib.h" +#include /* required for xthal_get_ccount. [refactor-todo] use cpu_hal instead */ +#include /* required for XTOS_SET_INTLEVEL. [refactor-todo] add common intr functions to esp_hw_support */ +#include "xt_instr_macros.h" #include "soc/spinlock.h" -#include +#include "hal/cpu_hal.h" +#include "esp_private/crosscore_int.h" +#include "esp_attr.h" +#include "esp_timer.h" /* required for esp_timer_get_time. [refactor-todo] make this common between archs */ +#include "esp_newlib.h" /* required for esp_reent_init() in tasks.c */ +#include "esp_heap_caps.h" #include "esp_rom_sys.h" -#include "sdkconfig.h" -#include "freertos/xtensa_api.h" -#include "esp_system.h" -#include "soc/cpu.h" -#include +#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */ +#include "portbenchmark.h" +/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */ +#include +#include +#include +#include "soc/cpu.h" #ifdef CONFIG_LEGACY_INCLUDE_COMMON_HEADERS #include "soc/soc_memory_layout.h" #endif -/*----------------------------------------------------------- - * Port specific definitions. - * - * The settings in this file configure FreeRTOS correctly for the - * given hardware and compiler. - * - * These settings should not be altered. - *----------------------------------------------------------- - */ +#ifdef __cplusplus +extern "C" { +#endif + -#include "esp_system.h" -#include "hal/cpu_hal.h" -#include "xt_instr_macros.h" -/* Type definitions. */ -#define portCHAR int8_t -#define portFLOAT float -#define portDOUBLE double -#define portLONG int32_t -#define portSHORT int16_t -#define portSTACK_TYPE uint8_t -#define portBASE_TYPE int +/* --------------------------------------------------- Port Types ------------------------------------------------------ + * - Port specific types. + * - The settings in this file configure FreeRTOS correctly for the given hardware and compiler. + * - These settings should not be altered. + * - The port types must come before first as they are used further down the file + * ------------------------------------------------------------------------------------------------------------------ */ -typedef portSTACK_TYPE StackType_t; -typedef portBASE_TYPE BaseType_t; -typedef unsigned portBASE_TYPE UBaseType_t; +#define portCHAR int8_t +#define portFLOAT float +#define portDOUBLE double +#define portLONG int32_t +#define portSHORT int16_t +#define portSTACK_TYPE uint8_t +#define portBASE_TYPE int + +typedef portSTACK_TYPE StackType_t; +typedef portBASE_TYPE BaseType_t; +typedef unsigned portBASE_TYPE UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) - typedef uint16_t TickType_t; - #define portMAX_DELAY ( TickType_t ) 0xffff +typedef uint16_t TickType_t; +#define portMAX_DELAY ( TickType_t ) 0xffff #else - typedef uint32_t TickType_t; - #define portMAX_DELAY ( TickType_t ) 0xffffffffUL +typedef uint32_t TickType_t; +#define portMAX_DELAY ( TickType_t ) 0xffffffffUL #endif -/*-----------------------------------------------------------*/ -// portbenchmark -#include "portbenchmark.h" +/* Task function macros as described on the FreeRTOS.org WEB site. */ +#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) +#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) -#include "sdkconfig.h" -#include "esp_attr.h" -#include "portmacro_priv.h" - -// Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. -// They can be called from interrupts too. -// WARNING: Only applies to current CPU. See notes above. -static inline unsigned portENTER_CRITICAL_NESTED(void) { - unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); - portbenchmarkINTERRUPT_DISABLE(); - return state; -} -#define portEXIT_CRITICAL_NESTED(state) do { portbenchmarkINTERRUPT_RESTORE(state); XTOS_RESTORE_JUST_INTLEVEL(state); } while (0) -/* -Modifications to portENTER_CRITICAL. -For an introduction, see "Critical Sections & Disabling Interrupts" in docs/api-guides/freertos-smp.rst +/* ----------------------------------------------- Port Configurations ------------------------------------------------- + * - Configurations values supplied by each port + * - Required by FreeRTOS + * ------------------------------------------------------------------------------------------------------------------ */ -The original portENTER_CRITICAL only disabled the ISRs. This is enough for single-CPU operation: by -disabling the interrupts, there is no task switch so no other tasks can meddle in the data, and because -interrupts are disabled, ISRs can't corrupt data structures either. +#define portCRITICAL_NESTING_IN_TCB 0 +#define portSTACK_GROWTH ( -1 ) +#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portBYTE_ALIGNMENT 4 +#define portNOP() XT_NOP() -For multiprocessing, things get a bit more hairy. First of all, disabling the interrupts doesn't stop -the tasks or ISRs on the other processors meddling with our CPU. For tasks, this is solved by adding -a spinlock to the portENTER_CRITICAL macro. A task running on the other CPU accessing the same data will -spinlock in the portENTER_CRITICAL code until the first CPU is done. -For ISRs, we now also need muxes: while portENTER_CRITICAL disabling interrupts will stop ISRs on the same -CPU from meddling with the data, it does not stop interrupts on the other cores from interfering with the -data. For this, we also use a spinlock in the routines called by the ISR, but these spinlocks -do not disable the interrupts (because they already are). -This all assumes that interrupts are either entirely disabled or enabled. Interrupt priority levels -will break this scheme. +/* ---------------------------------------------- Forward Declarations ------------------------------------------------- + * - Forward declarations of all the port functions and macros need to implement the FreeRTOS porting interface + * - These must come before definition/declaration of the FreeRTOS porting interface + * ------------------------------------------------------------------------------------------------------------------ */ -Remark: For the ESP32, portENTER_CRITICAL and portENTER_CRITICAL_ISR both alias vPortEnterCritical, meaning -that either function can be called both from ISR as well as task context. This is not standard FreeRTOS -behaviour; please keep this in mind if you need any compatibility with other FreeRTOS implementations. -*/ -/* "mux" data structure (spinlock) */ -typedef spinlock_t portMUX_TYPE; +// --------------------- Interrupts ------------------------ -#define portMUX_FREE_VAL SPINLOCK_FREE -#define portMUX_NO_TIMEOUT SPINLOCK_WAIT_FOREVER /* When passed for 'timeout_cycles', spin forever if necessary */ -#define portMUX_TRY_LOCK SPINLOCK_NO_WAIT /* Try to acquire the spinlock a single time only */ -#define portMUX_INITIALIZER_UNLOCKED SPINLOCK_INITIALIZER +/** + * @brief Checks if the current core is in an ISR context + * + * - ISR context consist of Low/Mid priority ISR, or time tick ISR + * - High priority ISRs aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. + * + * @note [refactor-todo] Check if this should be inlined + * @return + * - pdTRUE if in ISR + * - pdFALSE otherwise + */ +BaseType_t xPortInIsrContext(void); -#define portCRITICAL_NESTING_IN_TCB 0 +/** + * @brief Asserts if in ISR context + * + * - Asserts on xPortInIsrContext() internally + * + * @note [refactor-todo] Check if this API is still required + * @note [refactor-todo] Check if this should be inlined + */ +void vPortAssertIfInISR(void); -static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux) -{ - spinlock_initialize(mux); -} +/** + * @brief Check if in ISR context from High priority ISRs + * + * - Called from High priority ISR + * - Checks if the previous context (before high priority interrupt) was in ISR context (meaning low/med priority) + * + * @note [refactor-todo] Check if this should be inlined + * @return + * - pdTRUE if in previous in ISR context + * - pdFALSE otherwise + */ +BaseType_t xPortInterruptedFromISRContext(void); -static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux) -{ - spinlock_acquire(mux, portMUX_NO_TIMEOUT); -} +/** + * @brief Disable interrupts in a nested manner + * + * - Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. + * - They can be called from interrupts too. + * - WARNING Only applies to current CPU. + * @note [refactor-todo] Define this as portSET_INTERRUPT_MASK_FROM_ISR() instead + * @return unsigned Previous interrupt state + */ +static inline unsigned __attribute__((always_inline)) portENTER_CRITICAL_NESTED(void); + +/* ---------------------- Spinlocks ------------------------ + * - Modifications made to critical sections to support SMP + * - See "Critical Sections & Disabling Interrupts" in docs/api-guides/freertos-smp.rst for more details + * - Remark: For the ESP32, portENTER_CRITICAL and portENTER_CRITICAL_ISR both alias vPortEnterCritical, meaning that + * either function can be called both from ISR as well as task context. This is not standard FreeRTOS + * behaviorr; please keep this in mind if you need any compatibility with other FreeRTOS implementations. + * @note [refactor-todo] Check if these comments are still true + * ------------------------------------------------------ */ + +typedef spinlock_t portMUX_TYPE; /**< Spinlock type used by FreeRTOS critical sections */ +#define portMUX_INITIALIZER_UNLOCKED SPINLOCK_INITIALIZER /**< Spinlock initializer */ +#define portMUX_FREE_VAL SPINLOCK_FREE /**< Spinlock is free. [refactor-todo] check if this is still required */ +#define portMUX_NO_TIMEOUT SPINLOCK_WAIT_FOREVER /**< When passed for 'timeout_cycles', spin forever if necessary. [refactor-todo] check if this is still required */ +#define portMUX_TRY_LOCK SPINLOCK_NO_WAIT /**< Try to acquire the spinlock a single time only. [refactor-todo] check if this is still required */ -static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout) -{ - return (spinlock_acquire(mux, timeout)); -} +/** + * @brief Initialize a spinlock + * + * - Initializes a spinlock that is used by FreeRTOS SMP critical sections + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux); -static inline void __attribute__((always_inline)) vPortCPUReleaseMutex(portMUX_TYPE *mux) -{ - spinlock_release(mux); -} +/** + * @brief Acquire a spinlock + * + * @note [refactor-todo] check if we still need this + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux); +/** + * @brief Acquire a spinlock but with a specified timeout + * + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this function should be renamed (due to bool return type) + * + * @param[in] mux Spinlock + * @param timeout + * @return true Spinlock acquired + * @return false Timed out + */ +static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout); + +/** + * @brief Release a spinlock + * + * @note [refactor-todo] check if we still need this + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortCPUReleaseMutex(portMUX_TYPE *mux); + +/** + * @brief Wrapper for atomic compare-and-set instruction + * + * This subroutine will atomically compare *addr to 'compare'. If *addr == compare, *addr is set to *set. *set is + * updated with the previous value of *addr (either 'compare' or some other value.) + * + * @warning From the ISA docs: in some (unspecified) cases, the s32c1i instruction may return the "bitwise inverse" of + * the old mem if the mem wasn't written. This doesn't seem to happen on the ESP32 (portMUX assertions would + * fail). + * + * @note [refactor-todo] check if we still need this + * @note [refactor-todo] Check if this function should be renamed (due to void return type) + * + * @param[inout] addr Pointer to target address + * @param[in] compare Compare value + * @param[inout] set Pointer to set value + */ +static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set); + +/** + * @brief Wrapper for atomic compare-and-set instruction in external RAM + * + * Atomic compare-and-set but the target address is placed in external RAM + * + * @note [refactor-todo] check if we still need this + * + * @param[inout] addr Pointer to target address + * @param[in] compare Compare value + * @param[inout] set Pointer to set value + */ +static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set); + +// ------------------ Critical Sections -------------------- + +/** + * @brief Enter a SMP critical section + * + * - Disable interrupts + * - Takes spinlock + * - Can be nested + * + * @param[in] mux Spinlock + */ void vPortEnterCritical(portMUX_TYPE *mux); + +/** + * @brief Exit a SMP critical section + * + * - Releases spinlock + * - Reenables interrupts + * - Can be nested + * + * @param[in] mux Spinlock + */ void vPortExitCritical(portMUX_TYPE *mux); -#define portASSERT_IF_IN_ISR() vPortAssertIfInISR() -void vPortAssertIfInISR(void); +/** + * @brief FreeRTOS compliant version of enter critical + * + * - Ensures that critical section is only entered from task context + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(portMUX_TYPE *mux); -/* - * Returns true if the current core is in ISR context; low prio ISR, med prio ISR or timer tick ISR. High prio ISRs - * aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. +/** + * @brief FreeRTOS compliant version of exit critical + * + * @param[in] mux Spinlock */ -BaseType_t xPortInIsrContext(void); +static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(portMUX_TYPE *mux); -static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(portMUX_TYPE *mux) -{ - if(!xPortInIsrContext()) { - vPortEnterCritical(mux); - } else { - esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", - __FILE__, __LINE__, __FUNCTION__); - abort(); - } -} +/** + * @brief Safe version of enter critical + * + * - This function can be used to enter a critical section from both task and ISR contexts + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortEnterCriticalSafe(portMUX_TYPE *mux); -static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(portMUX_TYPE *mux) -{ - if(!xPortInIsrContext()) { - vPortExitCritical(mux); - } else { - esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", - __FILE__, __LINE__, __FUNCTION__); - abort(); - } -} +/** + * @brief Safe version of exit critical + * + * @param[in] mux Spinlock + */ +static inline void __attribute__((always_inline)) vPortExitCriticalSafe(portMUX_TYPE *mux); -#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE -/* Calling port*_CRITICAL from ISR context would cause an assert failure. - * If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE +// ---------------------- Yielding ------------------------- + +/** + * @brief Perform a solicited context switch + * + * - Defined in portasm.S + * + * @note [refactor-todo] The rest of ESP-IDF should call taskYield() instead */ -#define portENTER_CRITICAL(mux) vPortEnterCriticalCompliance(mux) -#define portEXIT_CRITICAL(mux) vPortExitCriticalCompliance(mux) -#else -#define portENTER_CRITICAL(mux) vPortEnterCritical(mux) -#define portEXIT_CRITICAL(mux) vPortExitCritical(mux) -#endif +void vPortYield( void ); -#define portENTER_CRITICAL_ISR(mux) vPortEnterCritical(mux) -#define portEXIT_CRITICAL_ISR(mux) vPortExitCritical(mux) +/** + * @brief + * + * @note [refactor-todo] Refactor this to avoid va_args + * @param argc + * @param ... Variable arguments to allow for IDF prototype without arguments, and vanilla version WITH argument + */ +void vPortEvaluateYieldFromISR(int argc, ...); -static inline void __attribute__((always_inline)) vPortEnterCriticalSafe(portMUX_TYPE *mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(mux); - } else { - portENTER_CRITICAL(mux); - } -} +/** + * @brief Yields the other core + * + * - Send an interrupt to another core in order to make the task running on it yield for a higher-priority task. + * - Can be used to yield current core as well + * + * @note [refactor-todo] Put this into private macros as its only called from task.c and is not public API + * @param coreid ID of core to yield + */ +void vPortYieldOtherCore(BaseType_t coreid); -static inline void __attribute__((always_inline)) vPortExitCriticalSafe(portMUX_TYPE *mux) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(mux); - } else { - portEXIT_CRITICAL(mux); - } -} +/** + * @brief Checks if the current core can yield + * + * - A core cannot yield if its in an ISR or in a critical section + * + * @note [refactor-todo] See if this can be separated from port macro + * @return true Core can yield + * @return false Core cannot yield + */ +static inline bool IRAM_ATTR xPortCanYield(void); -#define portENTER_CRITICAL_SAFE(mux) vPortEnterCriticalSafe(mux) -#define portEXIT_CRITICAL_SAFE(mux) vPortExitCriticalSafe(mux) +// ------------------- Hook Functions ---------------------- -/* - * Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare - * *addr to 'compare'. If *addr == compare, *addr is set to *set. *set is updated with the previous - * value of *addr (either 'compare' or some other value.) +extern void esp_vApplicationIdleHook(void); /* Required by tasks.c */ +extern void esp_vApplicationTickHook(void); /* Required by tasks.c */ + +/** + * @brief Hook function called on entry to tickless idle + * + * - Implemented in pm_impl.c * - * Warning: From the ISA docs: in some (unspecified) cases, the s32c1i instruction may return the - * *bitwise inverse* of the old mem if the mem wasn't written. This doesn't seem to happen on the - * ESP32 (portMUX assertions would fail). + * @param xExpectedIdleTime Expected idle time */ -static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { - compare_and_set_native(addr, compare, set); -} +void vApplicationSleep(TickType_t xExpectedIdleTime); -// Critical section management. NW-TODO: replace XTOS_SET_INTLEVEL with more efficient version, if any? -// These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level. -// -// Only applies to one CPU. See notes above & below for reasons not to use these. -#define portDISABLE_INTERRUPTS() do { XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); } while (0) -#define portENABLE_INTERRUPTS() do { portbenchmarkINTERRUPT_RESTORE(0); XTOS_SET_INTLEVEL(0); } while (0) +// ----------------------- System -------------------------- +/** + * @brief Get the tick rate per second + * + * @note [refactor-todo] make this inline + * @return uint32_t Tick rate in Hz + */ +uint32_t xPortGetTickRateHz(void); -// These FreeRTOS versions are similar to the nested versions above -#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED() -#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state) +/** + * @brief Set a watchpoint to watch the last 32 bytes of the stack + * + * Callback to set a watchpoint on the end of the stack. Called every context switch to change the stack watchpoint + * around. + * + * @param pxStackStart Pointer to the start of the stack + */ +void vPortSetStackWatchpoint( void *pxStackStart ); -//Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force -//the stack memory to always be internal. -#define portTcbMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) -#define portStackMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) -#define pvPortMallocTcbMem(size) heap_caps_malloc(size, portTcbMemoryCaps) -#define pvPortMallocStackMem(size) heap_caps_malloc(size, portStackMemoryCaps) - -//xTaskCreateStatic uses these functions to check incoming memory. -#define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#ifdef CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY -#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr) -#else -#define portVALID_STACK_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#endif +/** + * @brief Get the current core's ID + * + * @note [refactor-todo] IDF should call a FreeRTOS like macro instead of port function directly + * @return BaseType_t Core ID + */ +static inline BaseType_t IRAM_ATTR xPortGetCoreID(void); -static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) -{ -#ifdef CONFIG_SPIRAM - compare_and_set_extram(addr, compare, set); -#endif -} +/* ------------------------------------------- FreeRTOS Porting Interface ---------------------------------------------- + * - Contains all the mappings of the macros required by FreeRTOS + * - Most come after forward declare as porting macros map to declared functions + * - Maps to forward declared functions + * ------------------------------------------------------------------------------------------------------------------ */ -/*-----------------------------------------------------------*/ +// ----------------------- Memory -------------------------- -/* Architecture specifics. */ -#define portSTACK_GROWTH ( -1 ) -#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) -#define portBYTE_ALIGNMENT 4 -#define portNOP() XT_NOP() -/*-----------------------------------------------------------*/ +/** + * @brief Task memory allocation macros + * + * @note Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force the stack + * memory to always be internal. + * @note [refactor-todo] Update portable.h to match v10.4.3 to use new malloc prototypes + */ +#define portTcbMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define portStackMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define pvPortMallocTcbMem(size) heap_caps_malloc(size, portTcbMemoryCaps) +#define pvPortMallocStackMem(size) heap_caps_malloc(size, portStackMemoryCaps) -/* Fine resolution time */ -#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount() -//ccount or esp_timer are initialized elsewhere -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() +// --------------------- Interrupts ------------------------ -#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER -/* Coarse resolution time (us) */ -#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0) -#endif +#define portEXIT_CRITICAL_NESTED(state) do { portbenchmarkINTERRUPT_RESTORE(state); XTOS_RESTORE_JUST_INTLEVEL(state); } while (0) -void vPortYield( void ); -void vPortEvaluateYieldFromISR(int argc, ...); -void _frxt_setup_switch( void ); +/** + * - Only applies to current core + * - These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level. + * + * @note [refactor-todo] replace XTOS_SET_INTLEVEL with more efficient version, if any? + */ +#define portDISABLE_INTERRUPTS() do { XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); } while (0) +#define portENABLE_INTERRUPTS() do { portbenchmarkINTERRUPT_RESTORE(0); XTOS_SET_INTLEVEL(0); } while (0) /** - * Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with, - * or without arguments. The macro counts only 0 or 1 arguments. + * ISR versions to enable/disable interrupts + */ +#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED() +#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state) + +#define portASSERT_IF_IN_ISR() vPortAssertIfInISR() + +// ------------------ Critical Sections -------------------- + +/** + * @brief FreeRTOS critical section macros * - * In the future, we want to switch to C++20. We also want to become compatible with clang. - * Hence, we provide two versions of the following macros which are using variadic arguments. - * The first one is using the GNU extension ##__VA_ARGS__. The second one is using the C++20 feature __VA_OPT__(,). - * This allows users to compile their code with standard C++20 enabled instead of the GNU extension. - * Below C++20, we haven't found any good alternative to using ##__VA_ARGS__. + * - Added a spinlock argument for SMP + * - Can be nested + * - Compliance versions will assert if regular critical section API is used in ISR context + * - Safe versions can be called from either contexts */ -#if defined(__cplusplus) && (__cplusplus > 201703L) -#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0 __VA_OPT__(,) __VA_ARGS__,1,0) +#ifdef CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE +#define portENTER_CRITICAL(mux) vPortEnterCriticalCompliance(mux) +#define portEXIT_CRITICAL(mux) vPortExitCriticalCompliance(mux) #else -#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0, ##__VA_ARGS__,1,0) -#endif -#define portGET_ARGUMENT_COUNT_INNER(zero, one, count, ...) count +#define portENTER_CRITICAL(mux) vPortEnterCritical(mux) +#define portEXIT_CRITICAL(mux) vPortExitCritical(mux) +#endif /* CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE */ +#define portENTER_CRITICAL_ISR(mux) vPortEnterCritical(mux) +#define portEXIT_CRITICAL_ISR(mux) vPortExitCritical(mux) +#define portENTER_CRITICAL_SAFE(mux) vPortEnterCriticalSafe(mux) +#define portEXIT_CRITICAL_SAFE(mux) vPortExitCriticalSafe(mux) -_Static_assert(portGET_ARGUMENT_COUNT() == 0, "portGET_ARGUMENT_COUNT() result does not match for 0 arguments"); -_Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result does not match for 1 argument"); +// ---------------------- Yielding ------------------------- -#define portYIELD() vPortYield() +#define portYIELD() vPortYield() /** * @note The macro below could be used when passing a single argument, or without any argument, * it was developed to support both usages of portYIELD inside of an ISR. Any other usage form - * might result in undesired behaviour + * might result in undesired behavior + * + * @note [refactor-todo] Refactor this to avoid va_args */ #if defined(__cplusplus) && (__cplusplus > 201703L) #define portYIELD_FROM_ISR(...) vPortEvaluateYieldFromISR(portGET_ARGUMENT_COUNT(__VA_ARGS__) __VA_OPT__(,) __VA_ARGS__) @@ -351,121 +483,137 @@ _Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result */ #define portYIELD_WITHIN_API() esp_crosscore_int_send_yield(xPortGetCoreID()) -/*-----------------------------------------------------------*/ - -/* Task function macros as described on the FreeRTOS.org WEB site. */ -#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) -#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) - -// When coprocessors are defined, we to maintain a pointer to coprocessors area. -// We currently use a hack: redefine field xMPU_SETTINGS in TCB block as a structure that can hold: -// MPU wrappers, coprocessor area pointer, trace code structure, and more if needed. -// The field is normally used for memory protection. FreeRTOS should create another general purpose field. -typedef struct { - #if XCHAL_CP_NUM > 0 - volatile StackType_t* coproc_area; // Pointer to coprocessor save area; MUST BE FIRST - #endif - - #if portUSING_MPU_WRAPPERS - // Define here mpu_settings, which is port dependent - int mpu_setting; // Just a dummy example here; MPU not ported to Xtensa yet - #endif - - #if configUSE_TRACE_FACILITY_2 - struct { - // Cf. porttraceStamp() - int taskstamp; /* Stamp from inside task to see where we are */ - int taskstampcount; /* A counter usually incremented when we restart the task's loop */ - } porttrace; - #endif -} xMPU_SETTINGS; - -// Main hack to use MPU_wrappers even when no MPU is defined (warning: mpu_setting should not be accessed; otherwise move this above xMPU_SETTINGS) -#if (XCHAL_CP_NUM > 0 || configUSE_TRACE_FACILITY_2) && !portUSING_MPU_WRAPPERS // If MPU wrappers not used, we still need to allocate coproc area - #undef portUSING_MPU_WRAPPERS - #define portUSING_MPU_WRAPPERS 1 // Enable it to allocate coproc area - #define MPU_WRAPPERS_H // Override mpu_wrapper.h to disable unwanted code - #define PRIVILEGED_FUNCTION - #define PRIVILEGED_DATA -#endif - -extern void esp_vApplicationIdleHook( void ); -extern void esp_vApplicationTickHook( void ); +// ------------------- Hook Functions ---------------------- #ifndef CONFIG_FREERTOS_LEGACY_HOOKS -#define vApplicationIdleHook esp_vApplicationIdleHook -#define vApplicationTickHook esp_vApplicationTickHook +#define vApplicationIdleHook esp_vApplicationIdleHook +#define vApplicationTickHook esp_vApplicationTickHook #endif /* !CONFIG_FREERTOS_LEGACY_HOOKS */ -void vApplicationSleep( TickType_t xExpectedIdleTime ); +#define portSUPPRESS_TICKS_AND_SLEEP(idleTime) vApplicationSleep(idleTime) -#define portSUPPRESS_TICKS_AND_SLEEP( idleTime ) vApplicationSleep( idleTime ) +// ------------------- Run Time Stats ---------------------- -void _xt_coproc_release(volatile void * coproc_sa_base); +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() -/* Architecture specific optimisations. */ -#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 +/** + * - Fine resolution uses ccount + * - ALT is coarse and uses esp_timer + * @note [refactor-todo] Make fine and alt timers mutually exclusive + */ +#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount() +#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER +#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0) +#endif +// -------------- Optimized Task Selection ----------------- + +#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 /* Check the configuration. */ #if( configMAX_PRIORITIES > 32 ) - #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice. +#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice. #endif /* Store/clear the ready priorities in a bit map. */ #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) +#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __builtin_clz( ( uxReadyPriorities ) ) ) +#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ -/*-----------------------------------------------------------*/ -#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __builtin_clz( ( uxReadyPriorities ) ) ) -#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ +/* --------------------------------------------- Inline Implementations ------------------------------------------------ + * - Implementation of inline functions of the forward declares + * - Should come after forward declare and FreeRTOS Porting interface, as implementation may use both. + * - For implementation of non-inlined functions, see port.c + * ------------------------------------------------------------------------------------------------------------------ */ -/* - * Send an interrupt to another core in order to make the task running - * on it yield for a higher-priority task. - */ +// --------------------- Interrupts ------------------------ -void vPortYieldOtherCore( BaseType_t coreid) ; +static inline unsigned portENTER_CRITICAL_NESTED(void) +{ + unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); + portbenchmarkINTERRUPT_DISABLE(); + return state; +} -/* - Callback to set a watchpoint on the end of the stack. Called every context switch to change the stack - watchpoint around. - */ -void vPortSetStackWatchpoint( void* pxStackStart ); +// ---------------------- Spinlocks ------------------------ -/* - * Returns true if the current core is in ISR context; low prio ISR, med prio ISR or timer tick ISR. High prio ISRs - * aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. - */ -BaseType_t xPortInIsrContext(void); +static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux) +{ + spinlock_initialize(mux); +} -/* - * This function will be called in High prio ISRs. Returns true if the current core was in ISR context - * before calling into high prio ISR context. - */ -BaseType_t xPortInterruptedFromISRContext(void); +static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux) +{ + spinlock_acquire(mux, portMUX_NO_TIMEOUT); +} -/* - * The structures and methods of manipulating the MPU are contained within the - * port layer. - * - * Fills the xMPUSettings structure with the memory region information - * contained in xRegions. - */ -#if( portUSING_MPU_WRAPPERS == 1 ) - struct xMEMORY_REGION; - void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t usStackDepth ) PRIVILEGED_FUNCTION; - void vPortReleaseTaskMPUSettings( xMPU_SETTINGS *xMPUSettings ); +static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout) +{ + return (spinlock_acquire(mux, timeout)); +} + +static inline void __attribute__((always_inline)) vPortCPUReleaseMutex(portMUX_TYPE *mux) +{ + spinlock_release(mux); +} + +static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + compare_and_set_native(addr, compare, set); +} + +static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ +#ifdef CONFIG_SPIRAM + compare_and_set_extram(addr, compare, set); #endif +} -/* Multi-core: get current core ID */ -static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) { - return cpu_hal_get_core_id(); +// ------------------ Critical Sections -------------------- + +static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(portMUX_TYPE *mux) +{ + if (!xPortInIsrContext()) { + vPortEnterCritical(mux); + } else { + esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", + __FILE__, __LINE__, __FUNCTION__); + abort(); + } } -/* Get tick rate per second */ -uint32_t xPortGetTickRateHz(void); +static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(portMUX_TYPE *mux) +{ + if (!xPortInIsrContext()) { + vPortExitCritical(mux); + } else { + esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", + __FILE__, __LINE__, __FUNCTION__); + abort(); + } +} + +static inline void __attribute__((always_inline)) vPortEnterCriticalSafe(portMUX_TYPE *mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(mux); + } else { + portENTER_CRITICAL(mux); + } +} + +static inline void __attribute__((always_inline)) vPortExitCriticalSafe(portMUX_TYPE *mux) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(mux); + } else { + portEXIT_CRITICAL(mux); + } +} + +// ---------------------- Yielding ------------------------- static inline bool IRAM_ATTR xPortCanYield(void) { @@ -484,22 +632,115 @@ static inline bool IRAM_ATTR xPortCanYield(void) return ((ps_reg & PS_INTLEVEL_MASK) == 0); } -// porttrace -#if configUSE_TRACE_FACILITY_2 -#include "porttrace.h" +// ----------------------- System -------------------------- + +static inline BaseType_t IRAM_ATTR xPortGetCoreID(void) +{ + return (uint32_t) cpu_hal_get_core_id(); +} + + + +/* ------------------------------------------------------ Misc --------------------------------------------------------- + * - Miscellaneous porting macros + * - These are not port of the FreeRTOS porting interface, but are used by other FreeRTOS dependent components + * - [refactor-todo] Remove dependency on MPU wrappers by modifying TCB + * ------------------------------------------------------------------------------------------------------------------ */ + +// -------------------- Co-Processor ----------------------- + +// When coprocessors are defined, we maintain a pointer to coprocessors area. +// We currently use a hack: redefine field xMPU_SETTINGS in TCB block as a structure that can hold: +// MPU wrappers, coprocessor area pointer, trace code structure, and more if needed. +// The field is normally used for memory protection. FreeRTOS should create another general purpose field. +typedef struct { +#if XCHAL_CP_NUM > 0 + volatile StackType_t *coproc_area; // Pointer to coprocessor save area; MUST BE FIRST +#endif + +#if portUSING_MPU_WRAPPERS + // Define here mpu_settings, which is port dependent + int mpu_setting; // Just a dummy example here; MPU not ported to Xtensa yet #endif +} xMPU_SETTINGS; -// configASSERT_2 if requested -#if configASSERT_2 -#include -void exit(int); -#define configASSERT( x ) if (!(x)) { porttracePrint(-1); printf("\nAssertion failed in %s:%d\n", __FILE__, __LINE__); exit(-1); } +// Main hack to use MPU_wrappers even when no MPU is defined (warning: mpu_setting should not be accessed; otherwise move this above xMPU_SETTINGS) +#if (XCHAL_CP_NUM > 0) && !portUSING_MPU_WRAPPERS // If MPU wrappers not used, we still need to allocate coproc area +#undef portUSING_MPU_WRAPPERS +#define portUSING_MPU_WRAPPERS 1 // Enable it to allocate coproc area +#define MPU_WRAPPERS_H // Override mpu_wrapper.h to disable unwanted code +#define PRIVILEGED_FUNCTION +#define PRIVILEGED_DATA #endif -#endif // __ASSEMBLER__ +void _xt_coproc_release(volatile void *coproc_sa_base); + +/* + * The structures and methods of manipulating the MPU are contained within the + * port layer. + * + * Fills the xMPUSettings structure with the memory region information + * contained in xRegions. + */ +#if( portUSING_MPU_WRAPPERS == 1 ) +struct xMEMORY_REGION; +void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION *const xRegions, StackType_t *pxBottomOfStack, uint32_t usStackDepth ) PRIVILEGED_FUNCTION; +void vPortReleaseTaskMPUSettings( xMPU_SETTINGS *xMPUSettings ); +#endif + +// -------------------- VA_ARGS Yield ---------------------- + +/** + * Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with, + * or without arguments. The macro counts only 0 or 1 arguments. + * + * In the future, we want to switch to C++20. We also want to become compatible with clang. + * Hence, we provide two versions of the following macros which are using variadic arguments. + * The first one is using the GNU extension ##__VA_ARGS__. The second one is using the C++20 feature __VA_OPT__(,). + * This allows users to compile their code with standard C++20 enabled instead of the GNU extension. + * Below C++20, we haven't found any good alternative to using ##__VA_ARGS__. + */ +#if defined(__cplusplus) && (__cplusplus > 201703L) +#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0 __VA_OPT__(,) __VA_ARGS__,1,0) +#else +#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0, ##__VA_ARGS__,1,0) +#endif +#define portGET_ARGUMENT_COUNT_INNER(zero, one, count, ...) count + +_Static_assert(portGET_ARGUMENT_COUNT() == 0, "portGET_ARGUMENT_COUNT() result does not match for 0 arguments"); +_Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result does not match for 1 argument"); + +// -------------------- Heap Related ----------------------- + +/** + * @brief Checks if a given piece of memory can be used to store a task's TCB + * + * - Defined in port_common.c + * + * @param ptr Pointer to memory + * @return true Memory can be used to store a TCB + * @return false Otherwise + */ +bool xPortCheckValidTCBMem(const void *ptr); + +/** + * @brief Checks if a given piece of memory can be used to store a task's stack + * + * - Defined in port_common.c + * + * @param ptr Pointer to memory + * @return true Memory can be used to store a task stack + * @return false Otherwise + */ +bool xPortcheckValidStackMem(const void *ptr); + +#define portVALID_TCB_MEM(ptr) xPortCheckValidTCBMem(ptr) +#define portVALID_STACK_MEM(ptr) xPortcheckValidStackMem(ptr) #ifdef __cplusplus } #endif +#endif // __ASSEMBLER__ + #endif /* PORTMACRO_H */ diff --git a/tools/sdk/esp32s2/include/freertos/port/xtensa/include/freertos/portmacro_priv.h b/tools/sdk/esp32s2/include/freertos/port/xtensa/include/freertos/portmacro_priv.h deleted file mode 100644 index 843456b5aa8..00000000000 --- a/tools/sdk/esp32s2/include/freertos/port/xtensa/include/freertos/portmacro_priv.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that has become a de facto standard. * - * * - * Help yourself get started quickly and support the FreeRTOS * - * project by purchasing a FreeRTOS tutorial book, reference * - * manual, or both from: http://www.FreeRTOS.org/Documentation * - * * - * Thank you! * - * * - *************************************************************************** - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. - - >>! NOTE: The modification to the GPL is included to allow you to !<< - >>! distribute a combined work that includes FreeRTOS without being !<< - >>! obliged to provide the source code for proprietary components !<< - >>! outside of the FreeRTOS kernel. !<< - - FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. Full license text is available from the following - link: http://www.freertos.org/a00114.html - - 1 tab == 4 spaces! - - *************************************************************************** - * * - * Having a problem? Start by reading the FAQ "My application does * - * not run, what could be wrong?" * - * * - * http://www.FreeRTOS.org/FAQHelp.html * - * * - *************************************************************************** - - http://www.FreeRTOS.org - Documentation, books, training, latest versions, - license and Real Time Engineers Ltd. contact details. - - http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - including FreeRTOS+Trace - an indispensable productivity tool, a DOS - compatible FAT file system, and our tiny thread aware UDP/IP stack. - - http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High - Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and middleware. - - http://www.SafeRTOS.com - High Integrity Systems also provide a safety - engineered and independently SIL3 certified version for use in safety and - mission critical applications that require provable dependability. - - 1 tab == 4 spaces! -*/ - - -/* This header holds the macros for porting which should only be used inside FreeRTOS */ - -#pragma once -#include "soc/soc_memory_layout.h" - -//xTaskCreateStatic uses these functions to check incoming memory. -#define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#ifdef CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY -#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr) -#else -#define portVALID_STACK_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) -#endif diff --git a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/rmt_ll.h b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/rmt_ll.h index 958fe7aef5d..ba73eaa2b75 100644 --- a/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/rmt_ll.h +++ b/tools/sdk/esp32s2/include/hal/esp32s2/include/hal/rmt_ll.h @@ -1,16 +1,9 @@ -// Copyright 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. +/* + * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + #pragma once #include @@ -22,6 +15,8 @@ extern "C" { #endif +#define RMT_LL_MAX_LOOP_COUNT (1023)/*!< Max loop count that hardware is supported */ + #define RMT_LL_HW_BASE (&RMT) #define RMT_LL_MEM_BASE (&RMTMEM) diff --git a/tools/sdk/esp32s2/include/hal/include/hal/i2s_hal.h b/tools/sdk/esp32s2/include/hal/include/hal/i2s_hal.h index a08813db808..037970fa2b3 100644 --- a/tools/sdk/esp32s2/include/hal/include/hal/i2s_hal.h +++ b/tools/sdk/esp32s2/include/hal/include/hal/i2s_hal.h @@ -1,16 +1,8 @@ -// Copyright 2020 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: 2020-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ /******************************************************************************* * NOTICE @@ -176,28 +168,28 @@ void i2s_hal_enable_slave_fd_mode(i2s_hal_context_t *hal); * * @param hal Context of the HAL layer */ -#define i2s_hal_start_tx(hal) i2s_ll_tx_start((hal)->dev) +void i2s_hal_start_tx(i2s_hal_context_t *hal); /** * @brief Start I2S rx * * @param hal Context of the HAL layer */ -#define i2s_hal_start_rx(hal) i2s_ll_rx_start((hal)->dev) +void i2s_hal_start_rx(i2s_hal_context_t *hal); /** * @brief Stop I2S tx * * @param hal Context of the HAL layer */ -#define i2s_hal_stop_tx(hal) i2s_ll_tx_stop((hal)->dev) +void i2s_hal_stop_tx(i2s_hal_context_t *hal); /** * @brief Stop I2S rx * * @param hal Context of the HAL layer */ -#define i2s_hal_stop_rx(hal) i2s_ll_rx_stop((hal)->dev) +void i2s_hal_stop_rx(i2s_hal_context_t *hal); /** * @brief Set the received data length to trigger `in_suc_eof` interrupt. diff --git a/tools/sdk/esp32s2/include/hal/include/hal/lcd_hal.h b/tools/sdk/esp32s2/include/hal/include/hal/lcd_hal.h index 76e28dda0e4..db255b3d1e4 100644 --- a/tools/sdk/esp32s2/include/hal/include/hal/lcd_hal.h +++ b/tools/sdk/esp32s2/include/hal/include/hal/lcd_hal.h @@ -1,22 +1,8 @@ -// Copyright 2021 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. - -/******************************************************************************* - * NOTICE - * The HAL is not public api, don't use in application code. - * See readme.md in soc/README.md - ******************************************************************************/ +/* + * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once diff --git a/tools/sdk/esp32s2/include/hal/include/hal/lcd_types.h b/tools/sdk/esp32s2/include/hal/include/hal/lcd_types.h index 69dab14801d..01e6d0c2949 100644 --- a/tools/sdk/esp32s2/include/hal/include/hal/lcd_types.h +++ b/tools/sdk/esp32s2/include/hal/include/hal/lcd_types.h @@ -1,16 +1,8 @@ -// Copyright 2021 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: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -21,15 +13,12 @@ extern "C" { /** * @brief LCD clock source * @note User should select the clock source based on the real requirement: - * ╔═════════════════════╦══════════════════════════╦════════════════════════════╗ - * ║ LCD clock source ║ Features ║ Power Management ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_PLL160M ║ High resolution, fixed ║ ESP_PM_APB_FREQ_MAX lock ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_APLL ║ Configurable resolution ║ ESP_PM_NO_LIGHT_SLEEP lock ║ - * ╠═════════════════════╬══════════════════════════╬════════════════════════════╣ - * ║ LCD_CLK_SRC_XTAL ║ Medium resolution, fixed ║ No PM lock ║ - * ╚═════════════════════╩══════════════════════════╩════════════════════════════╝ + * + * | LCD clock source | Features | Power Management | + * |---------------------|--------------------------|----------------------------| + * | LCD_CLK_SRC_PLL160M | High resolution, fixed | ESP_PM_APB_FREQ_MAX lock | + * | LCD_CLK_SRC_APLL | Configurable resolution | ESP_PM_NO_LIGHT_SLEEP lock | + * | LCD_CLK_SRC_XTAL | Medium resolution, fixed | No PM lock | */ typedef enum { LCD_CLK_SRC_PLL160M, /*!< Select PLL160M as the source clock */ diff --git a/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_types.h b/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_types.h index ec027bf8705..9085f5eecd8 100644 --- a/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_types.h +++ b/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_types.h @@ -1,16 +1,8 @@ -// Copyright 2015-2020 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: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -155,12 +147,23 @@ typedef enum { TOUCH_PAD_INTR_MASK_INACTIVE = BIT(2), /*! +#include +#include "sdkconfig.h" +#include "esp_err.h" #if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/spi_flash.h" #elif CONFIG_IDF_TARGET_ESP32S2 @@ -34,9 +40,9 @@ extern "C" { #endif /** - * @brief Register ROM functions and init flash device registers to make use of octal flash + * @brief To setup Flash chip */ -esp_err_t esp_opiflash_init(void); +esp_err_t spi_flash_init_chip_state(void); /** * @brief Make MSPI work under 20Mhz @@ -88,6 +94,12 @@ void spi_timing_get_flash_timing_param(spi_flash_hal_timing_config_t *out_timing */ bool spi_timine_config_flash_is_tuned(void); +/** + * @brief Set Flash chip specifically required MSPI register settings here + */ +void spi_flash_set_vendor_required_regs(void); + + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h b/tools/sdk/esp32s2/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h new file mode 100644 index 00000000000..4292213943f --- /dev/null +++ b/tools/sdk/esp32s2/include/wpa_supplicant/esp_supplicant/include/esp_mbo.h @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _ESP_MBO_H +#define _ESP_MBO_H + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * enum non_pref_chan_reason: Reason for non preference of channel + */ +enum non_pref_chan_reason { + NON_PREF_CHAN_REASON_UNSPECIFIED = 0, + NON_PREF_CHAN_REASON_RSSI = 1, + NON_PREF_CHAN_REASON_EXT_INTERFERENCE = 2, + NON_PREF_CHAN_REASON_INT_INTERFERENCE = 3, +}; + +/** + * @brief Channel structure for non preferred channel + * + * @param reason: enum non_pref_chan_reason + * @param oper_class: operating class for the channel + * @param chan: channel number + * @param preference: channel preference + */ +struct non_pref_chan { + enum non_pref_chan_reason reason; + uint8_t oper_class; + uint8_t chan; + uint8_t preference; +}; + +/** + * @brief Array structure for non preferred channel struct + * + * @param non_pref_chan_num: channel count + * @param chan: array of non_pref_chan type + */ +struct non_pref_chan_s { + size_t non_pref_chan_num; + struct non_pref_chan chan[]; +}; + +/** + * @brief Update channel preference for MBO IE + * + * @param non_pref_chan: Non preference channel list + * + * @return + * - 0: success else failure + */ +int esp_mbo_update_non_pref_chan(struct non_pref_chan_s *non_pref_chan); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h b/tools/sdk/esp32s2/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h index a1dcfb655c5..4301385d2cf 100644 --- a/tools/sdk/esp32s2/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h +++ b/tools/sdk/esp32s2/include/wpa_supplicant/esp_supplicant/include/esp_wnm.h @@ -1,17 +1,7 @@ -/** - * Copyright 2020 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 +/* + * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD * - * 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-License-Identifier: Apache-2.0 */ #ifndef _ESP_WNM_H @@ -29,11 +19,13 @@ enum btm_query_reason { REASON_UNSPECIFIED = 0, REASON_FRAME_LOSS = 1, REASON_DELAY = 2, - REASON_QOS_CAPACITY = 3, - REASON_FIRST_ASSOC = 4, - REASON_LOAD_BALALNCE = 5, - REASON_BETTER_AP = 6, - REASON_CURRENT_DEAUTH = 7, + REASON_BANDWIDTH = 3, + REASON_LOAD_BALANCE = 4, + REASON_RSSI = 5, + REASON_RETRANSMISSIONS = 6, + REASON_INTERFERENCE = 7, + REASON_GRAY_ZONE = 8, + REASON_PREMIUM_AP = 9, }; /** diff --git a/tools/sdk/esp32s2/ld/libcat_face_detect.a b/tools/sdk/esp32s2/ld/libcat_face_detect.a index 1bc5162b09f..98527ca429a 100644 Binary files a/tools/sdk/esp32s2/ld/libcat_face_detect.a and b/tools/sdk/esp32s2/ld/libcat_face_detect.a differ diff --git a/tools/sdk/esp32s2/ld/libdl.a b/tools/sdk/esp32s2/ld/libdl.a index 1e6c8c48421..efe06e32edb 100644 Binary files a/tools/sdk/esp32s2/ld/libdl.a and b/tools/sdk/esp32s2/ld/libdl.a differ diff --git a/tools/sdk/esp32s2/ld/libhuman_face_detect.a b/tools/sdk/esp32s2/ld/libhuman_face_detect.a index 72fd6f5eb49..2e04b6d2a42 100644 Binary files a/tools/sdk/esp32s2/ld/libhuman_face_detect.a and b/tools/sdk/esp32s2/ld/libhuman_face_detect.a differ diff --git a/tools/sdk/esp32s2/ld/sections.ld b/tools/sdk/esp32s2/ld/sections.ld index 94bf03d6a9f..cf784476531 100644 --- a/tools/sdk/esp32s2/ld/sections.ld +++ b/tools/sdk/esp32s2/ld/sections.ld @@ -205,7 +205,7 @@ SECTIONS *libesp_system.a:ubsan.*(.literal .literal.* .text .text.*) *libfreertos.a:(EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .literal.* EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:port_common.*) .text.*) *libfreertos.a:port.*(.literal.pxPortInitialiseStack .literal.unlikely.vPortEndScheduler .literal.vApplicationStackOverflowHook .literal.vPortAssertIfInISR .literal.vPortEnterCritical .literal.vPortExitCritical .literal.vPortSetStackWatchpoint .literal.vPortYieldOtherCore .literal.xPortInIsrContext .literal.xPortStartScheduler .text .text.pxPortInitialiseStack .text.unlikely.vPortEndScheduler .text.vApplicationStackOverflowHook .text.vPortAssertIfInISR .text.vPortEnterCritical .text.vPortExitCritical .text.vPortSetStackWatchpoint .text.vPortYieldOtherCore .text.xPortGetTickRateHz .text.xPortInIsrContext .text.xPortStartScheduler) - *libfreertos.a:port_common.*(.literal.esp_startup_start_app_common .text .text.esp_startup_start_app_common) + *libfreertos.a:port_common.*(.literal.esp_startup_start_app_common .literal.xPortCheckValidTCBMem .literal.xPortcheckValidStackMem .text .text.esp_startup_start_app_common .text.xPortCheckValidTCBMem .text.xPortcheckValidStackMem) *libgcc.a:_divsf3.*(.literal .literal.* .text .text.*) *libgcc.a:lib2funcs.*(.literal .literal.* .text .text.*) *libgcov.a:(.literal .literal.* .text .text.*) @@ -371,8 +371,8 @@ SECTIONS *(.ext_ram.bss*) *(.bss .bss.*) - *(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem) *(.ext_ram.bss .ext_ram.bss.*) + *(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem) *(COMMON) _bt_bss_start = ABSOLUTE(.); *libbt.a:(.bss .bss.* COMMON) diff --git a/tools/sdk/esp32s2/lib/libapp_trace.a b/tools/sdk/esp32s2/lib/libapp_trace.a index 65b1f96e83b..ac3a85ea72f 100644 Binary files a/tools/sdk/esp32s2/lib/libapp_trace.a and b/tools/sdk/esp32s2/lib/libapp_trace.a differ diff --git a/tools/sdk/esp32s2/lib/libapp_update.a b/tools/sdk/esp32s2/lib/libapp_update.a index 36db9c85c17..38f7d7e635e 100644 Binary files a/tools/sdk/esp32s2/lib/libapp_update.a and b/tools/sdk/esp32s2/lib/libapp_update.a differ diff --git a/tools/sdk/esp32s2/lib/libarduino_tinyusb.a b/tools/sdk/esp32s2/lib/libarduino_tinyusb.a index e004a2db069..184eb360c23 100644 Binary files a/tools/sdk/esp32s2/lib/libarduino_tinyusb.a and b/tools/sdk/esp32s2/lib/libarduino_tinyusb.a differ diff --git a/tools/sdk/esp32s2/lib/libasio.a b/tools/sdk/esp32s2/lib/libasio.a index 3a23faf503f..b1dc1b216ee 100644 Binary files a/tools/sdk/esp32s2/lib/libasio.a and b/tools/sdk/esp32s2/lib/libasio.a differ diff --git a/tools/sdk/esp32s2/lib/libbootloader_support.a b/tools/sdk/esp32s2/lib/libbootloader_support.a index ffa6ff3b490..22f8033876c 100644 Binary files a/tools/sdk/esp32s2/lib/libbootloader_support.a and b/tools/sdk/esp32s2/lib/libbootloader_support.a differ diff --git a/tools/sdk/esp32s2/lib/libcoap.a b/tools/sdk/esp32s2/lib/libcoap.a index 6a5173eb19d..a0093c629d2 100644 Binary files a/tools/sdk/esp32s2/lib/libcoap.a and b/tools/sdk/esp32s2/lib/libcoap.a differ diff --git a/tools/sdk/esp32s2/lib/libcoexist.a b/tools/sdk/esp32s2/lib/libcoexist.a index 0f146c2c899..cfc9be30fc2 100644 Binary files a/tools/sdk/esp32s2/lib/libcoexist.a and b/tools/sdk/esp32s2/lib/libcoexist.a differ diff --git a/tools/sdk/esp32s2/lib/libconsole.a b/tools/sdk/esp32s2/lib/libconsole.a index 3f95dd5e32d..aa0ca4a1a40 100644 Binary files a/tools/sdk/esp32s2/lib/libconsole.a and b/tools/sdk/esp32s2/lib/libconsole.a differ diff --git a/tools/sdk/esp32s2/lib/libcore.a b/tools/sdk/esp32s2/lib/libcore.a index e017a1006a3..0ea53525c5b 100644 Binary files a/tools/sdk/esp32s2/lib/libcore.a and b/tools/sdk/esp32s2/lib/libcore.a differ diff --git a/tools/sdk/esp32s2/lib/libcxx.a b/tools/sdk/esp32s2/lib/libcxx.a index 9202ad02b03..99c85f299ad 100644 Binary files a/tools/sdk/esp32s2/lib/libcxx.a and b/tools/sdk/esp32s2/lib/libcxx.a differ diff --git a/tools/sdk/esp32s2/lib/libdriver.a b/tools/sdk/esp32s2/lib/libdriver.a index 271f07c3d00..3f7b5b90508 100644 Binary files a/tools/sdk/esp32s2/lib/libdriver.a and b/tools/sdk/esp32s2/lib/libdriver.a differ diff --git a/tools/sdk/esp32s2/lib/libefuse.a b/tools/sdk/esp32s2/lib/libefuse.a index 45e85b5b281..994398fcf35 100644 Binary files a/tools/sdk/esp32s2/lib/libefuse.a and b/tools/sdk/esp32s2/lib/libefuse.a differ diff --git a/tools/sdk/esp32s2/lib/libesp-tls.a b/tools/sdk/esp32s2/lib/libesp-tls.a index 0fbddfec7bd..8c8e740c521 100644 Binary files a/tools/sdk/esp32s2/lib/libesp-tls.a and b/tools/sdk/esp32s2/lib/libesp-tls.a differ diff --git a/tools/sdk/esp32s2/lib/libesp32-camera.a b/tools/sdk/esp32s2/lib/libesp32-camera.a index b6dff3e52a3..6bd84c93d7a 100644 Binary files a/tools/sdk/esp32s2/lib/libesp32-camera.a and b/tools/sdk/esp32s2/lib/libesp32-camera.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_common.a b/tools/sdk/esp32s2/lib/libesp_common.a index 3d55f543596..adbc942d3e1 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_common.a and b/tools/sdk/esp32s2/lib/libesp_common.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_eth.a b/tools/sdk/esp32s2/lib/libesp_eth.a index 5a3c5d1ec1f..d8752b6e178 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_eth.a and b/tools/sdk/esp32s2/lib/libesp_eth.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_event.a b/tools/sdk/esp32s2/lib/libesp_event.a index 3ba390e2ef4..b5e063cbfd9 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_event.a and b/tools/sdk/esp32s2/lib/libesp_event.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_gdbstub.a b/tools/sdk/esp32s2/lib/libesp_gdbstub.a index 2432b1aeced..1ba4aa80d12 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_gdbstub.a and b/tools/sdk/esp32s2/lib/libesp_gdbstub.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_hid.a b/tools/sdk/esp32s2/lib/libesp_hid.a index 82ea9ff4cbb..a0753a2ec8a 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_hid.a and b/tools/sdk/esp32s2/lib/libesp_hid.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_http_client.a b/tools/sdk/esp32s2/lib/libesp_http_client.a index 557786f2310..598dda23545 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_http_client.a and b/tools/sdk/esp32s2/lib/libesp_http_client.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_http_server.a b/tools/sdk/esp32s2/lib/libesp_http_server.a index 7dcb8e9bdb5..6e7ef78c017 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_http_server.a and b/tools/sdk/esp32s2/lib/libesp_http_server.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_https_ota.a b/tools/sdk/esp32s2/lib/libesp_https_ota.a index 31fadcfb272..9b721d649eb 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_https_ota.a and b/tools/sdk/esp32s2/lib/libesp_https_ota.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_https_server.a b/tools/sdk/esp32s2/lib/libesp_https_server.a index fe3cf5581d8..89979aa87ca 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_https_server.a and b/tools/sdk/esp32s2/lib/libesp_https_server.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_hw_support.a b/tools/sdk/esp32s2/lib/libesp_hw_support.a index 2dacebef4e3..f2d2229e29b 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_hw_support.a and b/tools/sdk/esp32s2/lib/libesp_hw_support.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_ipc.a b/tools/sdk/esp32s2/lib/libesp_ipc.a index a846df70856..a5245e30694 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_ipc.a and b/tools/sdk/esp32s2/lib/libesp_ipc.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_lcd.a b/tools/sdk/esp32s2/lib/libesp_lcd.a index 4bcdbecb1ca..0c3a9418984 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_lcd.a and b/tools/sdk/esp32s2/lib/libesp_lcd.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_littlefs.a b/tools/sdk/esp32s2/lib/libesp_littlefs.a index 16cb7dea9b6..66b7958bcad 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_littlefs.a and b/tools/sdk/esp32s2/lib/libesp_littlefs.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_local_ctrl.a b/tools/sdk/esp32s2/lib/libesp_local_ctrl.a index fabc0fe34f0..e92c6014500 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_local_ctrl.a and b/tools/sdk/esp32s2/lib/libesp_local_ctrl.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_netif.a b/tools/sdk/esp32s2/lib/libesp_netif.a index e30fa30a9b5..3f3fd194596 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_netif.a and b/tools/sdk/esp32s2/lib/libesp_netif.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_phy.a b/tools/sdk/esp32s2/lib/libesp_phy.a index 10c41de3f84..fbb2b1f358a 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_phy.a and b/tools/sdk/esp32s2/lib/libesp_phy.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_pm.a b/tools/sdk/esp32s2/lib/libesp_pm.a index ffa717deb5d..f156c9906df 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_pm.a and b/tools/sdk/esp32s2/lib/libesp_pm.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_ringbuf.a b/tools/sdk/esp32s2/lib/libesp_ringbuf.a index 46a0abb1b61..fbbd39850e8 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_ringbuf.a and b/tools/sdk/esp32s2/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a b/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a index eb9d9aa7d49..79368ffd203 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a and b/tools/sdk/esp32s2/lib/libesp_serial_slave_link.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_system.a b/tools/sdk/esp32s2/lib/libesp_system.a index 338875d18ca..b97bf823467 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_system.a and b/tools/sdk/esp32s2/lib/libesp_system.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_timer.a b/tools/sdk/esp32s2/lib/libesp_timer.a index c869d63ec01..604761d623e 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_timer.a and b/tools/sdk/esp32s2/lib/libesp_timer.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_websocket_client.a b/tools/sdk/esp32s2/lib/libesp_websocket_client.a index 86d2344ffa3..d1d4cce573d 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_websocket_client.a and b/tools/sdk/esp32s2/lib/libesp_websocket_client.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_wifi.a b/tools/sdk/esp32s2/lib/libesp_wifi.a index 8b21c2fc5a0..9ecdc54b417 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_wifi.a and b/tools/sdk/esp32s2/lib/libesp_wifi.a differ diff --git a/tools/sdk/esp32s2/lib/libespcoredump.a b/tools/sdk/esp32s2/lib/libespcoredump.a index 25b0cc93cad..dbff1ec0f16 100644 Binary files a/tools/sdk/esp32s2/lib/libespcoredump.a and b/tools/sdk/esp32s2/lib/libespcoredump.a differ diff --git a/tools/sdk/esp32s2/lib/libespnow.a b/tools/sdk/esp32s2/lib/libespnow.a index debe3c57249..1c9c4851315 100644 Binary files a/tools/sdk/esp32s2/lib/libespnow.a and b/tools/sdk/esp32s2/lib/libespnow.a differ diff --git a/tools/sdk/esp32s2/lib/libfatfs.a b/tools/sdk/esp32s2/lib/libfatfs.a index 9a65e421336..355140be2b9 100644 Binary files a/tools/sdk/esp32s2/lib/libfatfs.a and b/tools/sdk/esp32s2/lib/libfatfs.a differ diff --git a/tools/sdk/esp32s2/lib/libfreemodbus.a b/tools/sdk/esp32s2/lib/libfreemodbus.a index 50511f3c123..b9e0fca5abb 100644 Binary files a/tools/sdk/esp32s2/lib/libfreemodbus.a and b/tools/sdk/esp32s2/lib/libfreemodbus.a differ diff --git a/tools/sdk/esp32s2/lib/libfreertos.a b/tools/sdk/esp32s2/lib/libfreertos.a index 733f6a3ee3a..ee14407fac1 100644 Binary files a/tools/sdk/esp32s2/lib/libfreertos.a and b/tools/sdk/esp32s2/lib/libfreertos.a differ diff --git a/tools/sdk/esp32s2/lib/libhal.a b/tools/sdk/esp32s2/lib/libhal.a index c13b15b5ff4..6ce696e646a 100644 Binary files a/tools/sdk/esp32s2/lib/libhal.a and b/tools/sdk/esp32s2/lib/libhal.a differ diff --git a/tools/sdk/esp32s2/lib/libheap.a b/tools/sdk/esp32s2/lib/libheap.a index 7ed09f63f9c..673282ace1a 100644 Binary files a/tools/sdk/esp32s2/lib/libheap.a and b/tools/sdk/esp32s2/lib/libheap.a differ diff --git a/tools/sdk/esp32s2/lib/liblog.a b/tools/sdk/esp32s2/lib/liblog.a index cd6ad238403..4abce7dcab0 100644 Binary files a/tools/sdk/esp32s2/lib/liblog.a and b/tools/sdk/esp32s2/lib/liblog.a differ diff --git a/tools/sdk/esp32s2/lib/liblwip.a b/tools/sdk/esp32s2/lib/liblwip.a index 84c9a7cbc7c..6fb9552493a 100644 Binary files a/tools/sdk/esp32s2/lib/liblwip.a and b/tools/sdk/esp32s2/lib/liblwip.a differ diff --git a/tools/sdk/esp32s2/lib/libmbedcrypto.a b/tools/sdk/esp32s2/lib/libmbedcrypto.a index c11c0cb50c2..f23f00429ed 100644 Binary files a/tools/sdk/esp32s2/lib/libmbedcrypto.a and b/tools/sdk/esp32s2/lib/libmbedcrypto.a differ diff --git a/tools/sdk/esp32s2/lib/libmbedtls.a b/tools/sdk/esp32s2/lib/libmbedtls.a index c69d43d797a..88c24274720 100644 Binary files a/tools/sdk/esp32s2/lib/libmbedtls.a and b/tools/sdk/esp32s2/lib/libmbedtls.a differ diff --git a/tools/sdk/esp32s2/lib/libmdns.a b/tools/sdk/esp32s2/lib/libmdns.a index 863f659c447..caa89e815b2 100644 Binary files a/tools/sdk/esp32s2/lib/libmdns.a and b/tools/sdk/esp32s2/lib/libmdns.a differ diff --git a/tools/sdk/esp32s2/lib/libmesh.a b/tools/sdk/esp32s2/lib/libmesh.a index 8f4fbde53cd..4a43e09b1c2 100644 Binary files a/tools/sdk/esp32s2/lib/libmesh.a and b/tools/sdk/esp32s2/lib/libmesh.a differ diff --git a/tools/sdk/esp32s2/lib/libmqtt.a b/tools/sdk/esp32s2/lib/libmqtt.a index 56d63e439e0..12e59e01c3f 100644 Binary files a/tools/sdk/esp32s2/lib/libmqtt.a and b/tools/sdk/esp32s2/lib/libmqtt.a differ diff --git a/tools/sdk/esp32s2/lib/libnet80211.a b/tools/sdk/esp32s2/lib/libnet80211.a index 93351e991c8..69800846e43 100644 Binary files a/tools/sdk/esp32s2/lib/libnet80211.a and b/tools/sdk/esp32s2/lib/libnet80211.a differ diff --git a/tools/sdk/esp32s2/lib/libnewlib.a b/tools/sdk/esp32s2/lib/libnewlib.a index 1f724357d57..a9b0adb894b 100644 Binary files a/tools/sdk/esp32s2/lib/libnewlib.a and b/tools/sdk/esp32s2/lib/libnewlib.a differ diff --git a/tools/sdk/esp32s2/lib/libnvs_flash.a b/tools/sdk/esp32s2/lib/libnvs_flash.a index a75e4c5782c..7c3ecb087bf 100644 Binary files a/tools/sdk/esp32s2/lib/libnvs_flash.a and b/tools/sdk/esp32s2/lib/libnvs_flash.a differ diff --git a/tools/sdk/esp32s2/lib/libopenssl.a b/tools/sdk/esp32s2/lib/libopenssl.a index 0c02d23769a..ae0543e096c 100644 Binary files a/tools/sdk/esp32s2/lib/libopenssl.a and b/tools/sdk/esp32s2/lib/libopenssl.a differ diff --git a/tools/sdk/esp32s2/lib/libpp.a b/tools/sdk/esp32s2/lib/libpp.a index 3aa7310ee69..f6b7fc13fee 100644 Binary files a/tools/sdk/esp32s2/lib/libpp.a and b/tools/sdk/esp32s2/lib/libpp.a differ diff --git a/tools/sdk/esp32s2/lib/libprotocomm.a b/tools/sdk/esp32s2/lib/libprotocomm.a index 42d5c8885f5..7d5dcb48c40 100644 Binary files a/tools/sdk/esp32s2/lib/libprotocomm.a and b/tools/sdk/esp32s2/lib/libprotocomm.a differ diff --git a/tools/sdk/esp32s2/lib/libpthread.a b/tools/sdk/esp32s2/lib/libpthread.a index 9bbcb0516fd..58b2c22ac9e 100644 Binary files a/tools/sdk/esp32s2/lib/libpthread.a and b/tools/sdk/esp32s2/lib/libpthread.a differ diff --git a/tools/sdk/esp32s2/lib/libsdmmc.a b/tools/sdk/esp32s2/lib/libsdmmc.a index ba4320bc74d..d94647ebb3e 100644 Binary files a/tools/sdk/esp32s2/lib/libsdmmc.a and b/tools/sdk/esp32s2/lib/libsdmmc.a differ diff --git a/tools/sdk/esp32s2/lib/libsmartconfig.a b/tools/sdk/esp32s2/lib/libsmartconfig.a index 29134ba9039..d1b81cbf1ea 100644 Binary files a/tools/sdk/esp32s2/lib/libsmartconfig.a and b/tools/sdk/esp32s2/lib/libsmartconfig.a differ diff --git a/tools/sdk/esp32s2/lib/libsoc.a b/tools/sdk/esp32s2/lib/libsoc.a index 57560c731e3..ad9543d0bf5 100644 Binary files a/tools/sdk/esp32s2/lib/libsoc.a and b/tools/sdk/esp32s2/lib/libsoc.a differ diff --git a/tools/sdk/esp32s2/lib/libspi_flash.a b/tools/sdk/esp32s2/lib/libspi_flash.a index 7d19d683fd9..a5db338b9a2 100644 Binary files a/tools/sdk/esp32s2/lib/libspi_flash.a and b/tools/sdk/esp32s2/lib/libspi_flash.a differ diff --git a/tools/sdk/esp32s2/lib/libspiffs.a b/tools/sdk/esp32s2/lib/libspiffs.a index eb8c65fa83b..79b1af01df6 100644 Binary files a/tools/sdk/esp32s2/lib/libspiffs.a and b/tools/sdk/esp32s2/lib/libspiffs.a differ diff --git a/tools/sdk/esp32s2/lib/libtcp_transport.a b/tools/sdk/esp32s2/lib/libtcp_transport.a index 993d07d6661..b844a197f2a 100644 Binary files a/tools/sdk/esp32s2/lib/libtcp_transport.a and b/tools/sdk/esp32s2/lib/libtcp_transport.a differ diff --git a/tools/sdk/esp32s2/lib/libtcpip_adapter.a b/tools/sdk/esp32s2/lib/libtcpip_adapter.a index 6c20dd87b02..6215e82396e 100644 Binary files a/tools/sdk/esp32s2/lib/libtcpip_adapter.a and b/tools/sdk/esp32s2/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/esp32s2/lib/libtouch_element.a b/tools/sdk/esp32s2/lib/libtouch_element.a index 8720a0c1b40..0bb6a1cf082 100644 Binary files a/tools/sdk/esp32s2/lib/libtouch_element.a and b/tools/sdk/esp32s2/lib/libtouch_element.a differ diff --git a/tools/sdk/esp32s2/lib/libulp.a b/tools/sdk/esp32s2/lib/libulp.a index b69794e91a2..5b910490675 100644 Binary files a/tools/sdk/esp32s2/lib/libulp.a and b/tools/sdk/esp32s2/lib/libulp.a differ diff --git a/tools/sdk/esp32s2/lib/libusb.a b/tools/sdk/esp32s2/lib/libusb.a index c6004586a2f..a3a69f8c0e2 100644 Binary files a/tools/sdk/esp32s2/lib/libusb.a and b/tools/sdk/esp32s2/lib/libusb.a differ diff --git a/tools/sdk/esp32s2/lib/libvfs.a b/tools/sdk/esp32s2/lib/libvfs.a index 94902934bd2..6d837302c88 100644 Binary files a/tools/sdk/esp32s2/lib/libvfs.a and b/tools/sdk/esp32s2/lib/libvfs.a differ diff --git a/tools/sdk/esp32s2/lib/libwapi.a b/tools/sdk/esp32s2/lib/libwapi.a index 91bddc368c8..8914130654f 100644 Binary files a/tools/sdk/esp32s2/lib/libwapi.a and b/tools/sdk/esp32s2/lib/libwapi.a differ diff --git a/tools/sdk/esp32s2/lib/libwear_levelling.a b/tools/sdk/esp32s2/lib/libwear_levelling.a index f27dd314042..2731e946188 100644 Binary files a/tools/sdk/esp32s2/lib/libwear_levelling.a and b/tools/sdk/esp32s2/lib/libwear_levelling.a differ diff --git a/tools/sdk/esp32s2/lib/libwifi_provisioning.a b/tools/sdk/esp32s2/lib/libwifi_provisioning.a index 40d6d4fc7f7..b2316845a13 100644 Binary files a/tools/sdk/esp32s2/lib/libwifi_provisioning.a and b/tools/sdk/esp32s2/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/esp32s2/lib/libwpa_supplicant.a b/tools/sdk/esp32s2/lib/libwpa_supplicant.a index 5afc5fd0100..40da40383dd 100644 Binary files a/tools/sdk/esp32s2/lib/libwpa_supplicant.a and b/tools/sdk/esp32s2/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/esp32s2/lib/libxtensa.a b/tools/sdk/esp32s2/lib/libxtensa.a index c7ff5169849..5d9d565b6fd 100644 Binary files a/tools/sdk/esp32s2/lib/libxtensa.a and b/tools/sdk/esp32s2/lib/libxtensa.a differ diff --git a/tools/sdk/esp32s2/sdkconfig b/tools/sdk/esp32s2/sdkconfig index be0df95cf98..240cd9d014c 100644 --- a/tools/sdk/esp32s2/sdkconfig +++ b/tools/sdk/esp32s2/sdkconfig @@ -93,6 +93,7 @@ CONFIG_ESPTOOLPY_FLASHMODE_QIO=y # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set # CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" # CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set CONFIG_ESPTOOLPY_FLASHFREQ_80M=y @@ -203,7 +204,7 @@ CONFIG_TINYUSB_CDC_TX_BUFSIZE=64 # CONFIG_TINYUSB_MSC_ENABLED=y CONFIG_TINYUSB_DESC_MSC_STRING="Espressif MSC Device" -CONFIG_TINYUSB_MSC_BUFSIZE=512 +CONFIG_TINYUSB_MSC_BUFSIZE=4096 # end of Mass Storage (MSC) driver # @@ -223,6 +224,15 @@ CONFIG_TINYUSB_MIDI_RX_BUFSIZE=64 CONFIG_TINYUSB_MIDI_TX_BUFSIZE=64 # end of MIDI driver +# +# VIDEO driver +# +CONFIG_TINYUSB_VIDEO_ENABLED=y +CONFIG_TINYUSB_DESC_VIDEO_STRING="Espressif VIDEO Device" +CONFIG_TINYUSB_VIDEO_STREAMING_BUFSIZE=64 +CONFIG_TINYUSB_VIDEO_STREAMING_IFS=1 +# end of VIDEO driver + # # DFU Runtime driver # @@ -658,6 +668,7 @@ CONFIG_ESP_WIFI_FTM_ENABLE=y CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT=y CONFIG_ESP_WIFI_FTM_RESPONDER_SUPPORT=y # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_EXTERNAL_COEXIST_ENABLE is not set # end of Wi-Fi # @@ -867,6 +878,7 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 # CONFIG_LWIP_DHCP_DOES_ARP_CHECK is not set # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 # # DHCP server @@ -1123,6 +1135,7 @@ CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 # CONFIG_MDNS_STRICT_MODE is not set CONFIG_MDNS_TIMER_PERIOD_MS=100 # CONFIG_MDNS_NETWORKING_SOCKET is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y # end of mDNS # @@ -1426,7 +1439,7 @@ CONFIG_USB_CDC_RX_BUFSIZE=64 CONFIG_USB_CDC_TX_BUFSIZE=64 CONFIG_USB_MSC_ENABLED=y CONFIG_USB_DESC_MSC_STRING="Espressif MSC Device" -CONFIG_USB_MSC_BUFSIZE=512 +CONFIG_USB_MSC_BUFSIZE=4096 CONFIG_USB_DESC_HID_STRING="Espressif HID Device" CONFIG_USB_DEBUG_LEVEL=0 # CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set @@ -1475,6 +1488,7 @@ CONFIG_TASK_WDT_PANIC=y CONFIG_TASK_WDT_TIMEOUT_S=5 # CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_TIMER_TASK_STACK_SIZE=4096 +# CONFIG_EXTERNAL_COEX_ENABLE is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y @@ -1539,7 +1553,7 @@ CONFIG_USB_DESC_CDC_STRING="Espressif CDC Device" CONFIG_USB_DESC_MSC_STRING="Espressif MSC Device" CONFIG_USB_DESC_HID_STRING="Espressif HID Device" CONFIG_USB_MSC_ENABLED=y -CONFIG_USB_MSC_BUFSIZE=512 +CONFIG_USB_MSC_BUFSIZE=4096 CONFIG_USB_CDC_ENABLED=y CONFIG_USB_CDC_RX_BUFSIZE=64 CONFIG_USB_CDC_TX_BUFSIZE=64