diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 3571042bb..1cf8d2a9d 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -185,8 +185,8 @@ void uartAttachRx(uart_t* uart, uint8_t rxPin, bool inverted) return; } pinMode(rxPin, INPUT); - pinMatrixInAttach(rxPin, UART_RXD_IDX(uart->num), inverted); uartEnableInterrupt(uart); + pinMatrixInAttach(rxPin, UART_RXD_IDX(uart->num), inverted); } void uartAttachTx(uart_t* uart, uint8_t txPin, bool inverted) diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index 3fe3403f8..b22b921e8 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -111,10 +111,10 @@ void MDNSResponder::disableArduino(){ } } -void MDNSResponder::enableWorkstation(wifi_interface_t interface){ +void MDNSResponder::enableWorkstation(esp_interface_t interface){ char winstance[21+_hostname.length()]; uint8_t mac[6]; - esp_wifi_get_mac(interface, mac); + esp_wifi_get_mac((wifi_interface_t)interface, mac); sprintf(winstance, "%s [%02x:%02x:%02x:%02x:%02x:%02x]", _hostname.c_str(), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); if(mdns_service_add(NULL, "_workstation", "_tcp", 9, NULL, 0)) { diff --git a/libraries/ESPmDNS/src/ESPmDNS.h b/libraries/ESPmDNS/src/ESPmDNS.h index 8f56ea42f..9c4390953 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.h +++ b/libraries/ESPmDNS/src/ESPmDNS.h @@ -84,7 +84,7 @@ public: void enableArduino(uint16_t port=3232, bool auth=false); void disableArduino(); - void enableWorkstation(wifi_interface_t interface=ESP_IF_WIFI_STA); + void enableWorkstation(esp_interface_t interface=ESP_IF_WIFI_STA); void disableWorkstation(); IPAddress queryHost(char *host, uint32_t timeout=2000); diff --git a/libraries/WiFi/src/WiFi.cpp b/libraries/WiFi/src/WiFi.cpp index 5c2a69f4c..125d1c336 100644 --- a/libraries/WiFi/src/WiFi.cpp +++ b/libraries/WiFi/src/WiFi.cpp @@ -70,7 +70,7 @@ void WiFiClass::printDiag(Print& p) */ wifi_config_t conf; - esp_wifi_get_config(WIFI_IF_STA, &conf); + esp_wifi_get_config((wifi_interface_t)WIFI_IF_STA, &conf); const char* ssid = reinterpret_cast(conf.sta.ssid); p.print("SSID ("); diff --git a/libraries/WiFi/src/WiFiAP.cpp b/libraries/WiFi/src/WiFiAP.cpp index 75a7bf5d6..7b5178db4 100644 --- a/libraries/WiFi/src/WiFiAP.cpp +++ b/libraries/WiFi/src/WiFiAP.cpp @@ -134,13 +134,13 @@ bool WiFiAPClass::softAP(const char* ssid, const char* passphrase, int channel, wifi_config_t conf; wifi_config_t conf_current; wifi_softap_config(&conf, ssid, passphrase, channel, WIFI_AUTH_WPA_WPA2_PSK, ssid_hidden, max_connection); - esp_err_t err = esp_wifi_get_config(WIFI_IF_AP, &conf_current); + esp_err_t err = esp_wifi_get_config((wifi_interface_t)WIFI_IF_AP, &conf_current); if(err){ log_e("get AP config failed"); return false; } if(!softap_config_equal(conf, conf_current)) { - err = esp_wifi_set_config(WIFI_IF_AP, &conf); + err = esp_wifi_set_config((wifi_interface_t)WIFI_IF_AP, &conf); if(err){ log_e("set AP config failed"); return false; @@ -187,7 +187,7 @@ bool WiFiAPClass::softAPdisconnect(bool wifioff) return false; } - ret = esp_wifi_set_config(WIFI_IF_AP, &conf) == ESP_OK; + ret = esp_wifi_set_config((wifi_interface_t)WIFI_IF_AP, &conf) == ESP_OK; if(ret && wifioff) { ret = WiFi.enableAP(false) == ESP_OK; @@ -289,7 +289,7 @@ uint8_t WiFiAPClass::softAPSubnetCIDR() uint8_t* WiFiAPClass::softAPmacAddress(uint8_t* mac) { if(WiFiGenericClass::getMode() != WIFI_MODE_NULL){ - esp_wifi_get_mac(WIFI_IF_AP, mac); + esp_wifi_get_mac((wifi_interface_t)WIFI_IF_AP, mac); } return mac; } @@ -305,7 +305,7 @@ String WiFiAPClass::softAPmacAddress(void) if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ return String(); } - esp_wifi_get_mac(WIFI_IF_AP, mac); + esp_wifi_get_mac((wifi_interface_t)WIFI_IF_AP, mac); sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return String(macStr); diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 4165e1646..ce9ac9ab4 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -216,7 +216,7 @@ static char default_hostname[32] = {0,}; static const char * get_esp_netif_hostname(){ if(default_hostname[0] == 0){ uint8_t eth_mac[6]; - esp_wifi_get_mac(WIFI_IF_STA, eth_mac); + esp_wifi_get_mac((wifi_interface_t)WIFI_IF_STA, eth_mac); snprintf(default_hostname, 32, "%s%02X%02X%02X", CONFIG_IDF_TARGET "-", eth_mac[3], eth_mac[4], eth_mac[5]); } return (const char *)default_hostname; diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index bb9746b09..441cf11f1 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -168,7 +168,7 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_ wifi_sta_config(&conf, ssid, passphrase, bssid, channel); - if(esp_wifi_get_config(ESP_IF_WIFI_STA, ¤t_conf) != ESP_OK){ + if(esp_wifi_get_config((wifi_interface_t)ESP_IF_WIFI_STA, ¤t_conf) != ESP_OK){ log_e("get current config failed!"); return WL_CONNECT_FAILED; } @@ -178,14 +178,14 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_ return WL_CONNECT_FAILED; } - if(esp_wifi_set_config(ESP_IF_WIFI_STA, &conf) != ESP_OK){ + if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf) != ESP_OK){ log_e("set config failed!"); return WL_CONNECT_FAILED; } } else if(status() == WL_CONNECTED){ return WL_CONNECTED; } else { - if(esp_wifi_set_config(ESP_IF_WIFI_STA, &conf) != ESP_OK){ + if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf) != ESP_OK){ log_e("set config failed!"); return WL_CONNECT_FAILED; } @@ -225,7 +225,7 @@ wl_status_t WiFiSTAClass::begin() } wifi_config_t current_conf; - if(esp_wifi_get_config(ESP_IF_WIFI_STA, ¤t_conf) != ESP_OK || esp_wifi_set_config(ESP_IF_WIFI_STA, ¤t_conf) != ESP_OK) { + if(esp_wifi_get_config((wifi_interface_t)ESP_IF_WIFI_STA, ¤t_conf) != ESP_OK || esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, ¤t_conf) != ESP_OK) { log_e("config failed"); return WL_CONNECT_FAILED; } @@ -272,7 +272,7 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap) if(WiFi.getMode() & WIFI_MODE_STA){ if(eraseap){ - if(esp_wifi_set_config(ESP_IF_WIFI_STA, &conf)){ + if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf)){ log_e("clear config failed!"); } } @@ -398,7 +398,7 @@ IPAddress WiFiSTAClass::localIP() uint8_t* WiFiSTAClass::macAddress(uint8_t* mac) { if(WiFiGenericClass::getMode() != WIFI_MODE_NULL){ - esp_wifi_get_mac(ESP_IF_WIFI_STA, mac); + esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_STA, mac); } else{ esp_read_mac(mac, ESP_MAC_WIFI_STA); @@ -418,7 +418,7 @@ String WiFiSTAClass::macAddress(void) esp_read_mac(mac, ESP_MAC_WIFI_STA); } else{ - esp_wifi_get_mac(ESP_IF_WIFI_STA, mac); + esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_STA, mac); } sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return String(macStr); @@ -549,7 +549,7 @@ String WiFiSTAClass::psk() const return String(); } wifi_config_t conf; - esp_wifi_get_config(ESP_IF_WIFI_STA, &conf); + esp_wifi_get_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf); return String(reinterpret_cast(conf.sta.password)); } diff --git a/libraries/WiFiProv/src/WiFiProv.cpp b/libraries/WiFiProv/src/WiFiProv.cpp index e60f0f3cc..f383a6cb5 100644 --- a/libraries/WiFiProv/src/WiFiProv.cpp +++ b/libraries/WiFiProv/src/WiFiProv.cpp @@ -51,7 +51,7 @@ static const uint8_t custom_service_uuid[16] = { 0xb4, 0xdf, 0x5a, 0x1c, 0x3f, static void get_device_service_name(prov_scheme_t prov_scheme, char *service_name, size_t max) { uint8_t eth_mac[6] = {0,0,0,0,0,0}; - if(esp_wifi_get_mac(WIFI_IF_STA, eth_mac) != ESP_OK){ + if(esp_wifi_get_mac((wifi_interface_t)WIFI_IF_STA, eth_mac) != ESP_OK){ log_e("esp_wifi_get_mac failed!"); return; } @@ -158,7 +158,7 @@ void WiFiProvClass :: beginProvision(prov_scheme_t prov_scheme, scheme_handler_t log_i("Already Provisioned"); #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO static wifi_config_t conf; - esp_wifi_get_config(WIFI_IF_STA,&conf); + esp_wifi_get_config((wifi_interface_t)WIFI_IF_STA,&conf); log_i("Attempting connect to AP: %s\n",conf.sta.ssid); #endif esp_wifi_start(); diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 21956b930..375c64aa9 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -149,8 +149,8 @@ "host": "x86_64-apple-darwin", "url": "https://dl.espressif.com/dl/esptool-3.0.0.2-macos.tar.gz", "archiveFileName": "esptool-3.0.0.2-macos.tar.gz", - "checksum": "SHA-256:9213f46d5aa865558da4a2ef4218e87eef4782779128083c15ce2b3e4d07a1ea", - "size": "3849615" + "checksum": "SHA-256:2cafab7f1ebce89475b84c115548eaace40b6366d7b3f9862cdb2fc64f806643", + "size": "3859642" }, { "host": "x86_64-pc-linux-gnu", diff --git a/platform.txt b/platform.txt index 93005c6b0..cdbf660e9 100644 --- a/platform.txt +++ b/platform.txt @@ -22,12 +22,12 @@ compiler.prefix=xtensa-{build.mcu}-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.3-dev-1720-g494a124d9-dirty" -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/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-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/lwip/port/esp32/tcp_isn" "-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/esp_rom/include" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32/include" "-I{compiler.sdk.path}/include/esp32/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32/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/espcoredump/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32/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/app_trace/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/bootloader_support/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/include" "-I{compiler.sdk.path}/include/bt/common/osi/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/unity/unity/extras/fixture/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-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_gdbstub/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/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/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-face/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/include" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/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.esp32=-lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lperfmon -lesp32 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lbt -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_gdbstub -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -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 -lulp -lwifi_provisioning -lbutton -ljson_parser -ljson_generator -lesp_schedule -lesp_rainmaker -lqrcode -lws2812_led -lesp-face -lesp32-camera -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_gdbstub -lesp_hid -lesp_local_ctrl -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lbutton -lesp_rainmaker -lmqtt -lwifi_provisioning -lprotocomm -lprotobuf-c -ljson -ljson_parser -ljson_generator -lesp_schedule -lqrcode -lws2812_led -lesp-face -lpe -lfd -lfr -ldetection_cat_face -ldetection -ldl -lesp32-camera -lesp_littlefs -lfb_gfx -lbt -lbtdm_app -lesp_adc_cal -lmdns -lconsole -lfatfs -lwear_levelling -lopenssl -lspiffs -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lxt_hal -lm -lnewlib -lgcc -lstdc++ -lpthread -lapp_trace -lgcov -lapp_trace -lgcov -lc +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.3-dev-2398-g2bfdd036b-dirty" -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/port/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-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/esp_rom/include" "-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/esp32/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32/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/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32/include" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32/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/app_trace/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/bootloader_support/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/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/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-I{compiler.sdk.path}/include/perfmon/include" "-I{compiler.sdk.path}/include/asio/asio/asio/include" "-I{compiler.sdk.path}/include/asio/port/include" "-I{compiler.sdk.path}/include/bt/include" "-I{compiler.sdk.path}/include/bt/common/osi/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/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-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/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/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-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/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/include" "-I{compiler.sdk.path}/include/esp32-camera/driver/include" "-I{compiler.sdk.path}/include/esp32-camera/conversions/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.esp32=-lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lperfmon -lesp32 -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 -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 -lulp -lwifi_provisioning -lbutton -ljson_parser -ljson_generator -lesp_schedule -lesp_rainmaker -lqrcode -lws2812_led -lesp-dsp -lesp-face -lesp32-camera -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_hid -lesp_local_ctrl -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lbutton -lesp_rainmaker -lmqtt -lwifi_provisioning -lprotocomm -lprotobuf-c -ljson -ljson_parser -ljson_generator -lesp_schedule -lqrcode -lws2812_led -lesp-dsp -lesp-face -lpe -lfd -lfr -ldetection_cat_face -ldetection -ldl -lesp32-camera -lesp_littlefs -lfb_gfx -lbt -lbtdm_app -lesp_adc_cal -lmdns -lconsole -lfatfs -lwear_levelling -lopenssl -lspiffs -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lperfmon -lesp32 -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 -lrtc -lsmartconfig -lphy -lxt_hal -lm -lnewlib -lgcc -lstdc++ -lpthread -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -O2 -fstack-protector -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32=-mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -O2 -fstack-protector -std=gnu++11 -fexceptions -fno-rtti -MMD -c compiler.S.flags.esp32=-ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -O2 -fstack-protector -x assembler-with-cpp -MMD -c -compiler.c.elf.flags.esp32=-mlongcalls -T esp32.rom.api.ld -T esp32.rom.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32_out.ld -T esp32.project.ld -T esp32.peripherals.ld -Wl,--cref -fno-rtti -fno-lto -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u ld_include_panic_highint_hdl -u start_app -u start_app_other_cores -u vfs_include_syscalls_impl -u call_user_start_cpu0 -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -u app_main -u newlib_include_locks_impl -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u __cxa_guard_dummy +compiler.c.elf.flags.esp32=-mlongcalls -T esp32.rom.ld -T esp32.rom.api.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32_out.ld -T esp32.project.ld -T esp32.peripherals.ld -Wl,--cref -fno-rtti -fno-lto -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u ld_include_panic_highint_hdl -u start_app -u start_app_other_cores -u vfs_include_syscalls_impl -u call_user_start_cpu0 -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -u app_main -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u __cxa_guard_dummy compiler.ar.flags.esp32=cru build.extra_flags.esp32=-DARDUINO_SERIAL_PORT=0 # @@ -37,12 +37,12 @@ build.extra_flags.esp32=-DARDUINO_SERIAL_PORT=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.3-dev-1720-g494a124d9-dirty" -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/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-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/lwip/port/esp32/tcp_isn" "-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/esp_rom/include" "-I{compiler.sdk.path}/include/esp_common/include" "-I{compiler.sdk.path}/include/esp_system/include" "-I{compiler.sdk.path}/include/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32s2/include" "-I{compiler.sdk.path}/include/esp32s2/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32s2/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/espcoredump/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32s2/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/app_trace/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/bootloader_support/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/include" "-I{compiler.sdk.path}/include/nvs_flash/include" "-I{compiler.sdk.path}/include/pthread/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-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/unity/unity/extras/fixture/src" "-I{compiler.sdk.path}/include/cmock/CMock/src" "-I{compiler.sdk.path}/include/coap/port/include" "-I{compiler.sdk.path}/include/coap/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-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_gdbstub/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/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/freertos/include/freertos" "-I{compiler.sdk.path}/include/tinyusb/tinyusb/src" "-I{compiler.sdk.path}/include/tinyusb/additions/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/include" "-I{compiler.sdk.path}/include/esp-face/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/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.esp32s2=-lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lesp32s2 -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lcbor -lunity -lcmock -lcoap -lconsole -lnghttp -lesp-tls -lesp_adc_cal -lesp_gdbstub -lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_https_server -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 -lesp-face -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_gdbstub -lesp_hid -lesp_local_ctrl -lesp_https_server -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lmqtt -lperfmon -lwifi_provisioning -lprotocomm -lprotobuf-c -ljson -lesp-face -lpe -lfd -lfr -ldetection_cat_face -ldetection -ldl -lesp_littlefs -lfb_gfx -lesp_adc_cal -lmdns -lconsole -lfatfs -lwear_levelling -lopenssl -lspiffs -ltinyusb -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lxtensa -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -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 -lesp_ringbuf -ldriver -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lxt_hal -lesp32s2 -lm -lnewlib -lgcc -lstdc++ -lpthread -lapp_trace -lgcov -lapp_trace -lgcov -lc +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.3-dev-2398-g2bfdd036b-dirty" -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/port/xtensa/include" "-I{compiler.sdk.path}/include/esp_hw_support/include" "-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/esp_rom/include" "-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/esp32s2/include" "-I{compiler.sdk.path}/include/driver/include" "-I{compiler.sdk.path}/include/driver/esp32s2/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/xtensa/include" "-I{compiler.sdk.path}/include/xtensa/esp32s2/include" "-I{compiler.sdk.path}/include/espcoredump/include" "-I{compiler.sdk.path}/include/esp_timer/include" "-I{compiler.sdk.path}/include/esp_ipc/include" "-I{compiler.sdk.path}/include/esp_pm/include" "-I{compiler.sdk.path}/include/vfs/include" "-I{compiler.sdk.path}/include/esp_wifi/include" "-I{compiler.sdk.path}/include/esp_wifi/esp32s2/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/app_trace/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/bootloader_support/include" "-I{compiler.sdk.path}/include/app_update/include" "-I{compiler.sdk.path}/include/spi_flash/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/wpa_supplicant/include" "-I{compiler.sdk.path}/include/wpa_supplicant/port/include" "-I{compiler.sdk.path}/include/wpa_supplicant/include/esp_supplicant" "-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/port/include/coap" "-I{compiler.sdk.path}/include/coap/libcoap/include" "-I{compiler.sdk.path}/include/coap/libcoap/include/coap2" "-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/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/freertos/include/freertos" "-I{compiler.sdk.path}/include/tinyusb/tinyusb/src" "-I{compiler.sdk.path}/include/tinyusb/additions/include" "-I{compiler.sdk.path}/include/ulp/include" "-I{compiler.sdk.path}/include/wifi_provisioning/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/face_detection/include" "-I{compiler.sdk.path}/include/esp-face/face_recognition/include" "-I{compiler.sdk.path}/include/esp-face/object_detection/include" "-I{compiler.sdk.path}/include/esp-face/image_util/include" "-I{compiler.sdk.path}/include/esp-face/pose_estimation/include" "-I{compiler.sdk.path}/include/esp-face/lib/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.esp32s2=-lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lesp32s2 -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 -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 -lesp-dsp -lesp-face -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_hid -lesp_local_ctrl -lesp_https_server -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lmqtt -lperfmon -lwifi_provisioning -lprotocomm -lprotobuf-c -ljson -lesp-dsp -lesp-face -lpe -lfd -lfr -ldetection_cat_face -ldetection -ldl -lesp_littlefs -lfb_gfx -lesp_adc_cal -lmdns -lconsole -lfatfs -lwear_levelling -lopenssl -lspiffs -ltinyusb -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lesp_pm -lmbedtls -lefuse -lbootloader_support -lapp_update -lesp_ipc -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -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 -lesp_ringbuf -ldriver -lxtensa -lespcoredump -lesp32s2 -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 -lrtc -lsmartconfig -lphy -lesp32s2 -lxt_hal -lm -lnewlib -lgcc -lstdc++ -lpthread -lapp_trace -lgcov -lapp_trace -lgcov -lc compiler.c.flags.esp32s2=-mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -fstack-protector -std=gnu99 -Wno-old-style-declaration -MMD -c compiler.cpp.flags.esp32s2=-mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -fstack-protector -std=gnu++11 -fexceptions -fno-rtti -MMD -c compiler.S.flags.esp32s2=-ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -fstack-protector -x assembler-with-cpp -MMD -c -compiler.c.elf.flags.esp32s2=-mlongcalls -T esp32s2.rom.api.ld -T esp32s2.rom.ld -T esp32s2.rom.libgcc.ld -T esp32s2.rom.newlib-data.ld -T esp32s2.rom.newlib-funcs.ld -T esp32s2.rom.spiflash.ld -T esp32s2_out.ld -T esp32s2.project.ld -T esp32s2.peripherals.ld -Wl,--cref -fno-rtti -fno-lto -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u ld_include_panic_highint_hdl -u start_app -u vfs_include_syscalls_impl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -u app_main -u newlib_include_locks_impl -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u __cxa_guard_dummy +compiler.c.elf.flags.esp32s2=-mlongcalls -T esp32s2.rom.ld -T esp32s2.rom.api.ld -T esp32s2.rom.libgcc.ld -T esp32s2.rom.newlib-funcs.ld -T esp32s2.rom.newlib-data.ld -T esp32s2.rom.spiflash.ld -T esp32s2_out.ld -T esp32s2.project.ld -T esp32s2.peripherals.ld -Wl,--cref -fno-rtti -fno-lto -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u ld_include_panic_highint_hdl -u start_app -u vfs_include_syscalls_impl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -u app_main -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u __cxa_guard_dummy compiler.ar.flags.esp32s2=cru build.extra_flags.esp32s2=-DARDUINO_SERIAL_PORT={build.serial} # diff --git a/tools/esptool.py b/tools/esptool.py index 94c41a535..751d8cd7c 100755 --- a/tools/esptool.py +++ b/tools/esptool.py @@ -68,7 +68,7 @@ except Exception: raise -__version__ = "3.0-dev" +__version__ = "3.1-dev" MAX_UINT32 = 0xffffffff MAX_UINT24 = 0xffffff @@ -2051,12 +2051,12 @@ class BaseFirmwareImage(object): raise FatalError('Cannot place SHA256 digest on segment boundary' '(elf_sha256_offset=%d, file_pos=%d, segment_size=%d)' % (self.elf_sha256_offset, file_pos, segment_len)) + # offset relative to the data part + patch_offset -= self.SEG_HEADER_LEN if segment_data[patch_offset:patch_offset + self.SHA256_DIGEST_LEN] != b'\x00' * self.SHA256_DIGEST_LEN: raise FatalError('Contents of segment at SHA256 digest offset 0x%x are not all zero. Refusing to overwrite.' % self.elf_sha256_offset) assert(len(self.elf_sha256) == self.SHA256_DIGEST_LEN) - # offset relative to the data part - patch_offset -= self.SEG_HEADER_LEN segment_data = segment_data[0:patch_offset] + self.elf_sha256 + \ segment_data[patch_offset + self.SHA256_DIGEST_LEN:] return segment_data @@ -2908,8 +2908,8 @@ def write_flash(esp, args): if args.compress is None and not args.no_compress: args.compress = not args.no_stub - # For encrypt option we do few sanity checks before actual flash write - if args.encrypt: + # In case we have encrypted files to write, we first do few sanity checks before actual flash + if args.encrypt or args.encrypt_files is not None: do_write = True if not esp.secure_download_mode: @@ -2929,7 +2929,10 @@ def write_flash(esp, args): print('Flash encryption key is not programmed') do_write = False - for address, argfile in args.addr_filename: + # Determine which files list contain the ones to encrypt + files_to_encrypt = args.addr_filename if args.encrypt else args.encrypt_files + + for address, argfile in files_to_encrypt: if address % esp.FLASH_ENCRYPTED_WRITE_ALIGN: print("File %s address 0x%x is not %d byte aligned, can't flash encrypted" % (argfile.name, address, esp.FLASH_ENCRYPTED_WRITE_ALIGN)) @@ -2952,29 +2955,54 @@ def write_flash(esp, args): if args.erase_all: erase_flash(esp, args) - if args.encrypt and args.compress: - print('\nWARNING: - compress and encrypt options are mutually exclusive ') - print('Will flash uncompressed') - args.compress = False + """ Create a list describing all the files we have to flash. Each entry holds an "encrypt" flag + marking whether the file needs encryption or not. This list needs to be sorted. + + First, append to each entry of our addr_filename list the flag args.encrypt + For example, if addr_filename is [(0x1000, "partition.bin"), (0x8000, "bootloader")], + all_files will be [(0x1000, "partition.bin", args.encrypt), (0x8000, "bootloader", args.encrypt)], + where, of course, args.encrypt is either True or False + """ + all_files = [(offs, filename, args.encrypt) for (offs, filename) in args.addr_filename] + + """Now do the same with encrypt_files list, if defined. + In this case, the flag is True + """ + if args.encrypt_files is not None: + encrypted_files_flag = [(offs, filename, True) for (offs, filename) in args.encrypt_files] + + # Concatenate both lists and sort them. + # As both list are already sorted, we could simply do a merge instead, + # but for the sake of simplicity and because the lists are very small, + # let's use sorted. + all_files = sorted(all_files + encrypted_files_flag, key=lambda x: x[0]) + + for address, argfile, encrypted in all_files: + compress = args.compress + + # Check whether we can compress the current file before flashing + if compress and encrypted: + print('\nWARNING: - compress and encrypt options are mutually exclusive ') + print('Will flash %s uncompressed' % argfile.name) + compress = False - for address, argfile in args.addr_filename: if args.no_stub: print('Erasing flash...') - image = pad_to(argfile.read(), esp.FLASH_ENCRYPTED_WRITE_ALIGN if args.encrypt else 4) + image = pad_to(argfile.read(), esp.FLASH_ENCRYPTED_WRITE_ALIGN if encrypted else 4) if len(image) == 0: print('WARNING: File %s is empty' % argfile.name) continue image = _update_image_flash_params(esp, address, args, image) calcmd5 = hashlib.md5(image).hexdigest() uncsize = len(image) - if args.compress: + if compress: uncimage = image image = zlib.compress(uncimage, 9) ratio = uncsize / len(image) blocks = esp.flash_defl_begin(uncsize, len(image), address) else: ratio = 1.0 - blocks = esp.flash_begin(uncsize, address, begin_rom_encrypted=args.encrypt) + blocks = esp.flash_begin(uncsize, address, begin_rom_encrypted=encrypted) argfile.seek(0) # in case we need it again seq = 0 written = 0 @@ -2983,12 +3011,12 @@ def write_flash(esp, args): print_overwrite('Writing at 0x%08x... (%d %%)' % (address + seq * esp.FLASH_WRITE_SIZE, 100 * (seq + 1) // blocks)) sys.stdout.flush() block = image[0:esp.FLASH_WRITE_SIZE] - if args.compress: + if compress: esp.flash_defl_block(block, seq, timeout=DEFAULT_TIMEOUT * ratio * 2) else: # Pad the last block block = block + b'\xff' * (esp.FLASH_WRITE_SIZE - len(block)) - if args.encrypt: + if encrypted: esp.flash_encrypt_block(block, seq) else: esp.flash_block(block, seq) @@ -2997,7 +3025,7 @@ def write_flash(esp, args): written += len(block) t = time.time() - t speed_msg = "" - if args.compress: + if compress: if t > 0.0: speed_msg = " (effective %.1f kbit/s)" % (uncsize / t * 8 / 1000) print_overwrite('Wrote %d bytes (%d compressed) at 0x%08x in %.1f seconds%s...' % (uncsize, written, address, t, speed_msg), last_line=True) @@ -3006,7 +3034,7 @@ def write_flash(esp, args): speed_msg = " (%.1f kbit/s)" % (written / t * 8 / 1000) print_overwrite('Wrote %d bytes at 0x%08x in %.1f seconds%s...' % (written, address, t, speed_msg), last_line=True) - if not args.encrypt and not esp.secure_download_mode: + if not encrypted and not esp.secure_download_mode: try: res = esp.flash_md5sum(address, uncsize) if res != calcmd5: @@ -3025,7 +3053,14 @@ def write_flash(esp, args): # skip sending flash_finish to ROM loader here, # as it causes the loader to exit and run user code esp.flash_begin(0, 0) - if args.compress: + + # Get the "encrypted" flag for the last file flashed + # Note: all_files list contains triplets like: + # (address: Integer, filename: String, encrypted: Boolean) + last_file_encrypted = all_files[-1][2] + + # Check whether the last file flashed was compressed or not + if args.compress and not last_file_encrypted: esp.flash_defl_finish(False) else: esp.flash_finish(False) @@ -3033,7 +3068,12 @@ def write_flash(esp, args): if args.verify: print('Verifying just-written flash...') print('(This option is deprecated, flash contents are now always read back after flashing.)') - verify_flash(esp, args) + # If some encrypted files have been flashed print a warning saying that we won't check them + if args.encrypt or args.encrypt_files is not None: + print('WARNING: - cannot verify encrypted files, they will be ignored') + # Call verify_flash function only if there at least one non-encrypted file flashed + if not args.encrypt: + verify_flash(esp, args) def image_info(args): @@ -3368,7 +3408,7 @@ def main(custom_commandline=None): parent.add_argument('--flash_size', '-fs', help='SPI Flash size in MegaBytes (1MB, 2MB, 4MB, 8MB, 16M)' ' plus ESP8266-only (256KB, 512KB, 2MB-c1, 4MB-c1)' + extra_fs_message, action=FlashSizeAction, auto_detect=auto_detect, - default=os.environ.get('ESPTOOL_FS', 'detect' if auto_detect else '1MB')) + default=os.environ.get('ESPTOOL_FS', '1MB' if is_elf2image else 'keep')) add_spi_connection_arg(parent) parser_write_flash = subparsers.add_parser( @@ -3387,6 +3427,10 @@ def main(custom_commandline=None): '(mostly superfluous, data is read back during flashing)', action='store_true') parser_write_flash.add_argument('--encrypt', help='Apply flash encryption when writing data (required correct efuse settings)', action='store_true') + # In order to not break backward compatibility, our list of encrypted files to flash is a new parameter + parser_write_flash.add_argument('--encrypt-files', metavar='
', + help='Files to be encrypted on the flash. Address followed by binary filename, separated by space.', + action=AddrFilenamePairAction) parser_write_flash.add_argument('--ignore-flash-encryption-efuse-setting', help='Ignore flash encryption efuse settings ', action='store_true') @@ -3501,7 +3545,6 @@ def main(custom_commandline=None): expand_file_arguments() args = parser.parse_args(custom_commandline) - print('esptool.py v%s' % __version__) # operation function can take 1 arg (args), 2 args (esp, arg) @@ -3511,6 +3554,13 @@ def main(custom_commandline=None): parser.print_help() sys.exit(1) + # Forbid the usage of both --encrypt, which means encrypt all the given files, + # and --encrypt-files, which represents the list of files to encrypt. + # The reason is that allowing both at the same time increases the chances of + # having contradictory lists (e.g. one file not available in one of list). + if args.operation == "write_flash" and args.encrypt and args.encrypt_files is not None: + raise FatalError("Options --encrypt and --encrypt-files must not be specified at the same time.") + operation_func = globals()[args.operation] if PYTHON2: @@ -3738,7 +3788,7 @@ class AddrFilenamePairAction(argparse.Action): # Sort the addresses and check for overlapping end = 0 - for address, argfile in sorted(pairs): + for address, argfile in sorted(pairs, key=lambda x: x[0]): argfile.seek(0, 2) # seek to end size = argfile.tell() argfile.seek(0) diff --git a/tools/platformio-build-esp32.py b/tools/platformio-build-esp32.py index 3a93ed071..9e220bbb8 100644 --- a/tools/platformio-build-esp32.py +++ b/tools/platformio-build-esp32.py @@ -80,8 +80,8 @@ env.Append( "-mfix-esp32-psram-cache-strategy=memw", "-Wl,--gc-sections", "-Wl,--undefined=uxTopUsedPriority", - "-T", "esp32.rom.api.ld", "-T", "esp32.rom.ld", + "-T", "esp32.rom.api.ld", "-T", "esp32.rom.libgcc.ld", "-T", "esp32.rom.newlib-data.ld", "-T", "esp32.rom.syscalls.ld", @@ -98,7 +98,6 @@ env.Append( "-u", "vfs_include_syscalls_impl", "-u", "call_user_start_cpu0", "-u", "app_main", - "-u", "newlib_include_locks_impl", "-u", "newlib_include_heap_impl", "-u", "newlib_include_syscalls_impl", "-u", "newlib_include_pthread_impl", @@ -110,7 +109,7 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "config"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "newlib", "platform_include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "freertos", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "freertos", "xtensa", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "freertos", "port", "xtensa", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_hw_support", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_hw_support", "port", "esp32"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "heap", "include"), @@ -120,23 +119,23 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "lwip", "lwip", "src", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "lwip", "port", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "lwip", "port", "esp32", "include", "arch"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "lwip", "port", "esp32", "tcp_isn"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "soc", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "soc", "esp32"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "soc", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "hal", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "hal", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_rom", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_rom", "esp32"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_common", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_system", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "xtensa", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "xtensa", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "driver", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "driver", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_ringbuf", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "efuse", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "efuse", "esp32", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "xtensa", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "xtensa", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "espcoredump", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_timer", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_ipc", "include"), @@ -157,6 +156,9 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "spi_flash", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "nvs_flash", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "pthread", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_gdbstub", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_gdbstub", "xtensa"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_gdbstub", "esp32"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "port", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "include", "esp_supplicant"), @@ -169,7 +171,6 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "cbor", "port", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "unity", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "unity", "unity", "src"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "unity", "unity", "extras", "fixture", "src"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "cmock", "CMock", "src"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "coap", "port", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "coap", "port", "include", "coap"), @@ -181,7 +182,6 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-tls"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-tls", "esp-tls-crypto"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_adc_cal", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_gdbstub", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_hid", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "tcp_transport", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_http_client", "include"), @@ -222,6 +222,29 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp_rainmaker", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "qrcode", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "ws2812_led"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "dotprod", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "support", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "windows", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "windows", "hann", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "windows", "blackman", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "windows", "blackman_harris", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "windows", "blackman_nuttall", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "windows", "nuttall", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "windows", "flat_top", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "iir", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "fir", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "math", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "math", "add", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "math", "sub", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "math", "mul", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "math", "addc", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "math", "mulc", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "math", "sqrt", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "matrix", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "fft", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "dct", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "conv", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-dsp", "modules", "common", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-face", "face_detection", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-face", "face_recognition", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "esp-face", "object_detection", "include"), @@ -242,7 +265,7 @@ env.Append( ], LIBS=[ - "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lperfmon", "-lesp32", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lbt", "-lcbor", "-lunity", "-lcmock", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_gdbstub", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-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", "-lulp", "-lwifi_provisioning", "-lbutton", "-ljson_parser", "-ljson_generator", "-lesp_schedule", "-lesp_rainmaker", "-lqrcode", "-lws2812_led", "-lesp-face", "-lesp32-camera", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_gdbstub", "-lesp_hid", "-lesp_local_ctrl", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lbutton", "-lesp_rainmaker", "-lmqtt", "-lwifi_provisioning", "-lprotocomm", "-lprotobuf-c", "-ljson", "-ljson_parser", "-ljson_generator", "-lesp_schedule", "-lqrcode", "-lws2812_led", "-lesp-face", "-lpe", "-lfd", "-lfr", "-ldetection_cat_face", "-ldetection", "-ldl", "-lesp32-camera", "-lesp_littlefs", "-lfb_gfx", "-lbt", "-lbtdm_app", "-lesp_adc_cal", "-lmdns", "-lconsole", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxt_hal", "-lm", "-lnewlib", "-lgcc", "-lstdc++", "-lpthread", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc" + "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-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", "-lulp", "-lwifi_provisioning", "-lbutton", "-ljson_parser", "-ljson_generator", "-lesp_schedule", "-lesp_rainmaker", "-lqrcode", "-lws2812_led", "-lesp-dsp", "-lesp-face", "-lesp32-camera", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_hid", "-lesp_local_ctrl", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lbutton", "-lesp_rainmaker", "-lmqtt", "-lwifi_provisioning", "-lprotocomm", "-lprotobuf-c", "-ljson", "-ljson_parser", "-ljson_generator", "-lesp_schedule", "-lqrcode", "-lws2812_led", "-lesp-dsp", "-lesp-face", "-lpe", "-lfd", "-lfr", "-ldetection_cat_face", "-ldetection", "-ldl", "-lesp32-camera", "-lesp_littlefs", "-lfb_gfx", "-lbt", "-lbtdm_app", "-lesp_adc_cal", "-lmdns", "-lconsole", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lperfmon", "-lesp32", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxt_hal", "-lm", "-lnewlib", "-lgcc", "-lstdc++", "-lpthread", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc" ], CPPDEFINES=[ @@ -251,7 +274,7 @@ env.Append( "UNITY_INCLUDE_CONFIG_H", "WITH_POSIX", "_GNU_SOURCE", - ("IDF_VER", '\\"v4.3-dev-1720-g494a124d9-dirty\\"'), + ("IDF_VER", '\\"v4.3-dev-2398-g2bfdd036b-dirty\\"'), "ESP_PLATFORM", "ARDUINO_ARCH_ESP32", "ESP32", diff --git a/tools/platformio-build-esp32s2.py b/tools/platformio-build-esp32s2.py index b23e6b1f9..5897608bf 100644 --- a/tools/platformio-build-esp32s2.py +++ b/tools/platformio-build-esp32s2.py @@ -74,11 +74,11 @@ env.Append( "-fno-lto", "-Wl,--gc-sections", "-Wl,--undefined=uxTopUsedPriority", - "-T", "esp32s2.rom.api.ld", "-T", "esp32s2.rom.ld", + "-T", "esp32s2.rom.api.ld", "-T", "esp32s2.rom.libgcc.ld", - "-T", "esp32s2.rom.newlib-data.ld", "-T", "esp32s2.rom.newlib-funcs.ld", + "-T", "esp32s2.rom.newlib-data.ld", "-T", "esp32s2.rom.spiflash.ld", "-T", "esp32s2_out.ld", "-T", "esp32s2.project.ld", @@ -92,7 +92,6 @@ env.Append( "-u", "vfs_include_syscalls_impl", "-u", "call_user_start_cpu0", "-u", "app_main", - "-u", "newlib_include_locks_impl", "-u", "newlib_include_heap_impl", "-u", "newlib_include_syscalls_impl", "-u", "newlib_include_pthread_impl", @@ -104,7 +103,7 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "config"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "newlib", "platform_include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "freertos", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "freertos", "xtensa", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "freertos", "port", "xtensa", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hw_support", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hw_support", "port", "esp32s2"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hw_support", "port", "esp32s2", "private_include"), @@ -115,23 +114,23 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "lwip", "lwip", "src", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "lwip", "port", "esp32", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "lwip", "port", "esp32", "include", "arch"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "lwip", "port", "esp32", "tcp_isn"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "soc", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "soc", "esp32s2"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "soc", "esp32s2", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "hal", "esp32s2", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "hal", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_rom", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_rom", "esp32s2"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_common", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_system", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "xtensa", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "xtensa", "esp32s2", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp32s2", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "driver", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "driver", "esp32s2", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_ringbuf", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "efuse", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "efuse", "esp32s2", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "xtensa", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "xtensa", "esp32s2", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "espcoredump", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_timer", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_ipc", "include"), @@ -152,6 +151,9 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "spi_flash", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "nvs_flash", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "pthread", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_gdbstub", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_gdbstub", "xtensa"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_gdbstub", "esp32s2"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "port", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "include", "esp_supplicant"), @@ -160,7 +162,6 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "cbor", "port", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "unity", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "unity", "unity", "src"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "unity", "unity", "extras", "fixture", "src"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "cmock", "CMock", "src"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "coap", "port", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "coap", "port", "include", "coap"), @@ -172,7 +173,6 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-tls"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-tls", "esp-tls-crypto"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_adc_cal", "include"), - join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_gdbstub", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_hid", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "tcp_transport", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp_http_client", "include"), @@ -210,6 +210,29 @@ env.Append( join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "tinyusb", "additions", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "ulp", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wifi_provisioning", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "dotprod", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "support", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "windows", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "windows", "hann", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "windows", "blackman", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "windows", "blackman_harris", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "windows", "blackman_nuttall", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "windows", "nuttall", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "windows", "flat_top", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "iir", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "fir", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "math", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "math", "add", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "math", "sub", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "math", "mul", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "math", "addc", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "math", "mulc", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "math", "sqrt", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "matrix", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "fft", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "dct", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "conv", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-dsp", "modules", "common", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-face", "face_detection", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-face", "face_recognition", "include"), join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "esp-face", "object_detection", "include"), @@ -228,7 +251,7 @@ env.Append( ], LIBS=[ - "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lesp32s2", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lcbor", "-lunity", "-lcmock", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_gdbstub", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lesp_https_server", "-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", "-lesp-face", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_gdbstub", "-lesp_hid", "-lesp_local_ctrl", "-lesp_https_server", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lperfmon", "-lwifi_provisioning", "-lprotocomm", "-lprotobuf-c", "-ljson", "-lesp-face", "-lpe", "-lfd", "-lfr", "-ldetection_cat_face", "-ldetection", "-ldl", "-lesp_littlefs", "-lfb_gfx", "-lesp_adc_cal", "-lmdns", "-lconsole", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-ltinyusb", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxtensa", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-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", "-lesp_ringbuf", "-ldriver", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lxt_hal", "-lesp32s2", "-lm", "-lnewlib", "-lgcc", "-lstdc++", "-lpthread", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc" + "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lesp32s2", "-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", "-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", "-lesp-dsp", "-lesp-face", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_hid", "-lesp_local_ctrl", "-lesp_https_server", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lperfmon", "-lwifi_provisioning", "-lprotocomm", "-lprotobuf-c", "-ljson", "-lesp-dsp", "-lesp-face", "-lpe", "-lfd", "-lfr", "-ldetection_cat_face", "-ldetection", "-ldl", "-lesp_littlefs", "-lfb_gfx", "-lesp_adc_cal", "-lmdns", "-lconsole", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-ltinyusb", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lesp_pm", "-lmbedtls", "-lefuse", "-lbootloader_support", "-lapp_update", "-lesp_ipc", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-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", "-lesp_ringbuf", "-ldriver", "-lxtensa", "-lespcoredump", "-lesp32s2", "-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", "-lrtc", "-lsmartconfig", "-lphy", "-lesp32s2", "-lxt_hal", "-lm", "-lnewlib", "-lgcc", "-lstdc++", "-lpthread", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc" ], CPPDEFINES=[ @@ -237,7 +260,7 @@ env.Append( "UNITY_INCLUDE_CONFIG_H", "WITH_POSIX", "_GNU_SOURCE", - ("IDF_VER", '\\"v4.3-dev-1720-g494a124d9-dirty\\"'), + ("IDF_VER", '\\"v4.3-dev-2398-g2bfdd036b-dirty\\"'), "ESP_PLATFORM", "ARDUINO_ARCH_ESP32", "ESP32", diff --git a/tools/sdk/esp32/bin/bootloader_dio_40m.bin b/tools/sdk/esp32/bin/bootloader_dio_40m.bin index cf10655fc..d732c6fbb 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dio_40m.bin and b/tools/sdk/esp32/bin/bootloader_dio_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_dio_80m.bin b/tools/sdk/esp32/bin/bootloader_dio_80m.bin index 84180b024..bce29d389 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dio_80m.bin and b/tools/sdk/esp32/bin/bootloader_dio_80m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_dout_40m.bin b/tools/sdk/esp32/bin/bootloader_dout_40m.bin index cf10655fc..d732c6fbb 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dout_40m.bin and b/tools/sdk/esp32/bin/bootloader_dout_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_dout_80m.bin b/tools/sdk/esp32/bin/bootloader_dout_80m.bin index 84180b024..bce29d389 100644 Binary files a/tools/sdk/esp32/bin/bootloader_dout_80m.bin and b/tools/sdk/esp32/bin/bootloader_dout_80m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qio_40m.bin b/tools/sdk/esp32/bin/bootloader_qio_40m.bin index cf10655fc..d732c6fbb 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qio_40m.bin and b/tools/sdk/esp32/bin/bootloader_qio_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qio_80m.bin b/tools/sdk/esp32/bin/bootloader_qio_80m.bin index 84180b024..bce29d389 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qio_80m.bin and b/tools/sdk/esp32/bin/bootloader_qio_80m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qout_40m.bin b/tools/sdk/esp32/bin/bootloader_qout_40m.bin index cf10655fc..d732c6fbb 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qout_40m.bin and b/tools/sdk/esp32/bin/bootloader_qout_40m.bin differ diff --git a/tools/sdk/esp32/bin/bootloader_qout_80m.bin b/tools/sdk/esp32/bin/bootloader_qout_80m.bin index 84180b024..bce29d389 100644 Binary files a/tools/sdk/esp32/bin/bootloader_qout_80m.bin and b/tools/sdk/esp32/bin/bootloader_qout_80m.bin differ diff --git a/tools/sdk/esp32/include/app_trace/include/esp_app_trace_util.h b/tools/sdk/esp32/include/app_trace/include/esp_app_trace_util.h index cda26c7a7..57c4f94fb 100644 --- a/tools/sdk/esp32/include/app_trace/include/esp_app_trace_util.h +++ b/tools/sdk/esp32/include/app_trace/include/esp_app_trace_util.h @@ -24,7 +24,7 @@ extern "C" { /** Infinite waiting timeout */ #define ESP_APPTRACE_TMO_INFINITE ((uint32_t)-1) -/** Structure which holds data necessary for measuring time intervals. +/** Structure which holds data necessary for measuring time intervals. * * After initialization via esp_apptrace_tmo_init() user needs to call esp_apptrace_tmo_check() * periodically to check timeout for expiration. @@ -100,7 +100,7 @@ esp_err_t esp_apptrace_lock_give(esp_apptrace_lock_t *lock); /** Ring buffer control structure. * - * @note For purposes of application tracing module if there is no enough space for user data and write pointer can be wrapped + * @note For purposes of application tracing module if there is no enough space for user data and write pointer can be wrapped * current ring buffer size can be temporarily shrinked in order to provide buffer with requested size. */ typedef struct { diff --git a/tools/sdk/esp32/include/app_update/include/esp_ota_ops.h b/tools/sdk/esp32/include/app_update/include/esp_ota_ops.h index cf24e75fa..c37f96f93 100644 --- a/tools/sdk/esp32/include/app_update/include/esp_ota_ops.h +++ b/tools/sdk/esp32/include/app_update/include/esp_ota_ops.h @@ -50,7 +50,7 @@ typedef uint32_t esp_ota_handle_t; /** * @brief Return esp_app_desc structure. This structure includes app version. - * + * * Return description for running app. * @return Pointer to esp_app_desc structure. */ @@ -157,6 +157,18 @@ esp_err_t esp_ota_write_with_offset(esp_ota_handle_t handle, const void *data, s */ esp_err_t esp_ota_end(esp_ota_handle_t handle); +/** + * @brief Abort OTA update, free the handle and memory associated with it. + * + * @param handle obtained from esp_ota_begin(). + * + * @return + * - ESP_OK: Handle and its associated memory is freed successfully. + * - ESP_ERR_NOT_FOUND: OTA handle was not found. + */ +esp_err_t esp_ota_abort(esp_ota_handle_t handle); + + /** * @brief Configure OTA data for a new boot partition * @@ -225,7 +237,7 @@ const esp_partition_t* esp_ota_get_next_update_partition(const esp_partition_t * /** * @brief Returns esp_app_desc structure for app partition. This structure includes app version. - * + * * Returns a description for the requested app partition. * @param[in] partition Pointer to app partition. (only app partition) * @param[out] app_desc Structure of info about app. diff --git a/tools/sdk/esp32/include/asio/port/include/esp_exception.h b/tools/sdk/esp32/include/asio/port/include/esp_exception.h index a4a316013..cbf20d7a6 100644 --- a/tools/sdk/esp32/include/asio/port/include/esp_exception.h +++ b/tools/sdk/esp32/include/asio/port/include/esp_exception.h @@ -30,7 +30,7 @@ namespace detail { template void throw_exception(const Exception& e) { - ESP_LOGE("esp32_asio_exception", "Caught exception: %s!", e.what()); + ESP_LOGE("esp32_asio_exception", "Caught exception: %s!", e.what()); abort(); } }} diff --git a/tools/sdk/esp32/include/bootloader_support/include/bootloader_clock.h b/tools/sdk/esp32/include/bootloader_support/include/bootloader_clock.h index da3bc9e64..98546e829 100644 --- a/tools/sdk/esp32/include/bootloader_support/include/bootloader_clock.h +++ b/tools/sdk/esp32/include/bootloader_support/include/bootloader_clock.h @@ -31,4 +31,3 @@ int bootloader_clock_get_rated_freq_mhz(void); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/bootloader_support/include/bootloader_common.h b/tools/sdk/esp32/include/bootloader_support/include/bootloader_common.h index baf36702c..0723d1951 100644 --- a/tools/sdk/esp32/include/bootloader_support/include/bootloader_common.h +++ b/tools/sdk/esp32/include/bootloader_support/include/bootloader_common.h @@ -23,6 +23,8 @@ #include "esp32s2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/rtc.h" #endif #ifdef __cplusplus diff --git a/tools/sdk/esp32/include/bootloader_support/include/bootloader_flash.h b/tools/sdk/esp32/include/bootloader_support/include/bootloader_flash.h index 5b7459654..8bf748525 100644 --- a/tools/sdk/esp32/include/bootloader_support/include/bootloader_flash.h +++ b/tools/sdk/esp32/include/bootloader_support/include/bootloader_flash.h @@ -27,4 +27,3 @@ */ esp_err_t bootloader_flash_wrap_set(spi_flash_wrap_mode_t mode); #endif - diff --git a/tools/sdk/esp32/include/bootloader_support/include/bootloader_mem.h b/tools/sdk/esp32/include/bootloader_support/include/bootloader_mem.h index 81c1b4ce7..bc54833ff 100644 --- a/tools/sdk/esp32/include/bootloader_support/include/bootloader_mem.h +++ b/tools/sdk/esp32/include/bootloader_support/include/bootloader_mem.h @@ -21,4 +21,4 @@ void bootloader_init_mem(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/bootloader_support/include/esp_app_format.h b/tools/sdk/esp32/include/bootloader_support/include/esp_app_format.h index 33b92cc9c..4dfd11b0b 100644 --- a/tools/sdk/esp32/include/bootloader_support/include/esp_app_format.h +++ b/tools/sdk/esp32/include/bootloader_support/include/esp_app_format.h @@ -23,6 +23,7 @@ typedef enum { ESP_CHIP_ID_ESP32 = 0x0000, /*!< chip ID: ESP32 */ ESP_CHIP_ID_ESP32S2 = 0x0002, /*!< chip ID: ESP32-S2 */ ESP_CHIP_ID_ESP32S3 = 0x0004, /*!< chip ID: ESP32-S3 */ + ESP_CHIP_ID_ESP32C3 = 0x0005, /*!< chip ID: ESP32-C3 */ ESP_CHIP_ID_INVALID = 0xFFFF /*!< Invalid chip ID (we defined it to make sure the esp_chip_id_t is 2 bytes size) */ } __attribute__((packed)) esp_chip_id_t; diff --git a/tools/sdk/esp32/include/bootloader_support/include/esp_flash_encrypt.h b/tools/sdk/esp32/include/bootloader_support/include/esp_flash_encrypt.h index ef3b80271..33e6aabed 100644 --- a/tools/sdk/esp32/include/bootloader_support/include/esp_flash_encrypt.h +++ b/tools/sdk/esp32/include/bootloader_support/include/esp_flash_encrypt.h @@ -52,7 +52,7 @@ static inline /** @cond */ IRAM_ATTR /** @endcond */ bool esp_flash_encryption_e uint32_t flash_crypt_cnt = 0; #if CONFIG_IDF_TARGET_ESP32 flash_crypt_cnt = REG_GET_FIELD(EFUSE_BLK0_RDATA0_REG, EFUSE_RD_FLASH_CRYPT_CNT); -#elif CONFIG_IDF_TARGET_ESP32S2 +#else flash_crypt_cnt = REG_GET_FIELD(EFUSE_RD_REPEAT_DATA1_REG, EFUSE_SPI_BOOT_CRYPT_CNT); #endif /* __builtin_parity is in flash, so we calculate parity inline */ diff --git a/tools/sdk/esp32/include/bootloader_support/include/esp_secure_boot.h b/tools/sdk/esp32/include/bootloader_support/include/esp_secure_boot.h index f15c240d3..3eb4db016 100644 --- a/tools/sdk/esp32/include/bootloader_support/include/esp_secure_boot.h +++ b/tools/sdk/esp32/include/bootloader_support/include/esp_secure_boot.h @@ -22,6 +22,10 @@ #if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/secure_boot.h" +#elif CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/rom/efuse.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/efuse.h" #endif typedef struct ets_secure_boot_signature ets_secure_boot_signature_t; @@ -67,7 +71,7 @@ static inline bool esp_secure_boot_enabled(void) * @important This function is intended to be called from bootloader code only. * * This function is only used in the context of the Secure Boot V1 scheme. - * + * * If secure boot is not yet enabled for bootloader, this will: * 1) generate the secure boot key and burn it on EFUSE * (without enabling R/W protection) @@ -91,9 +95,9 @@ esp_err_t esp_secure_boot_generate_digest(void); * * @important This function is intended to be called from bootloader code only. * - * @important In case of Secure Boot V1, this will enable r/w protection - * of secure boot key on EFUSE, therefore it is to be ensured that - * esp_secure_boot_generate_digest() is called before this .If secure boot is not + * @important In case of Secure Boot V1, this will enable r/w protection + * of secure boot key on EFUSE, therefore it is to be ensured that + * esp_secure_boot_generate_digest() is called before this .If secure boot is not * yet enabled for bootloader, this will * 1) enable R/W protection of secure boot key on EFUSE * 2) enable secure boot by blowing the EFUSE_RD_ABS_DONE_0 efuse. @@ -116,9 +120,9 @@ esp_err_t esp_secure_boot_permanently_enable(void); * enabled on the chip via efuse. * * @important This function is intended to be called from bootloader code only. - * - * @important In case of Secure Boot V2, this will enable write protection - * of secure boot key on EFUSE in BLK2. .If secure boot is not + * + * @important In case of Secure Boot V2, this will enable write protection + * of secure boot key on EFUSE in BLK2. .If secure boot is not * yet enabled for bootloader, this will * 1) enable W protection of secure boot key on EFUSE * 2) enable secure boot by blowing the EFUSE_RD_ABS_DONE_1 efuse. @@ -127,7 +131,7 @@ esp_err_t esp_secure_boot_permanently_enable(void); * ROM bootloader does this.) * * @param image_data Image metadata of the application to be loaded. - * + * * Will fail if efuses have been part-burned in a way that indicates * secure boot should not or could not be correctly enabled. * @@ -141,7 +145,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag * * For ECDSA Scheme (Secure Boot V1) - deterministic ECDSA w/ SHA256 image * For RSA Scheme (Secure Boot V2) - RSA-PSS Verification of the SHA-256 image - * + * * Public key is compiled into the calling program in the ECDSA Scheme. * See the apt docs/security/secure-boot-v1.rst or docs/security/secure-boot-v2.rst for details. * diff --git a/tools/sdk/esp32/include/bt/common/osi/include/osi/mutex.h b/tools/sdk/esp32/include/bt/common/osi/include/osi/mutex.h index 1b9784d62..2055b2c10 100644 --- a/tools/sdk/esp32/include/bt/common/osi/include/osi/mutex.h +++ b/tools/sdk/esp32/include/bt/common/osi/include/osi/mutex.h @@ -50,4 +50,3 @@ void osi_mutex_global_lock(void); void osi_mutex_global_unlock(void); #endif /* __MUTEX_H__ */ - diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h index f17fcbc22..5e0d9c381 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_blufi_api.h @@ -116,7 +116,7 @@ typedef struct { } esp_blufi_ap_record_t; /** - * @brief BLUFI callback parameters union + * @brief BLUFI callback parameters union */ typedef union { /** @@ -175,7 +175,7 @@ typedef union { } sta_ssid; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_STA_SSID */ /** - * @brief + * @brief * ESP_BLUFI_EVENT_RECV_STA_PASSWD */ struct blufi_recv_sta_passwd_evt_param { @@ -192,7 +192,7 @@ typedef union { } softap_ssid; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_SOFTAP_SSID */ /** - * @brief + * @brief * ESP_BLUFI_EVENT_RECV_SOFTAP_PASSWD */ struct blufi_recv_softap_passwd_evt_param { @@ -208,7 +208,7 @@ typedef union { } softap_max_conn_num; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_SOFTAP_MAX_CONN_NUM */ /** - * @brief + * @brief * ESP_BLUFI_EVENT_RECV_SOFTAP_AUTH_MODE */ struct blufi_recv_softap_auth_mode_evt_param { @@ -216,7 +216,7 @@ typedef union { } softap_auth_mode; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_SOFTAP_AUTH_MODE */ /** - * @brief + * @brief * ESP_BLUFI_EVENT_RECV_SOFTAP_CHANNEL */ struct blufi_recv_softap_channel_evt_param { @@ -229,7 +229,7 @@ typedef union { struct blufi_recv_username_evt_param { uint8_t *name; /*!< Username point */ int name_len; /*!< Username length */ - } username; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_USERNAME*/ + } username; /*!< Blufi callback param of ESP_BLUFI_EVENT_RECV_USERNAME*/ /** * @brief ESP_BLUFI_EVENT_RECV_CA_CERT @@ -277,7 +277,7 @@ typedef union { esp_blufi_error_state_t state; /*!< Blufi error state */ } report_error; /*!< Blufi callback param of ESP_BLUFI_EVENT_REPORT_ERROR */ /** - * @brief + * @brief * ESP_BLUFI_EVENT_RECV_CUSTOM_DATA */ struct blufi_recv_custom_data_evt_param { @@ -296,7 +296,7 @@ typedef void (* esp_blufi_event_cb_t)(esp_blufi_cb_event_t event, esp_blufi_cb_p /* security function declare */ /** - * @brief BLUFI negotiate data handler + * @brief BLUFI negotiate data handler * @param data : data from phone * @param len : length of data from phone * @param output_data : data want to send to phone @@ -307,7 +307,7 @@ typedef void (*esp_blufi_negotiate_data_handler_t)(uint8_t *data, int len, uint8 /** * @brief BLUFI encrypt the data after negotiate a share key * @param iv8 : initial vector(8bit), normally, blufi core will input packet sequence number - * @param crypt_data : plain text and encrypted data, the encrypt function must support autochthonous encrypt + * @param crypt_data : plain text and encrypted data, the encrypt function must support autochthonous encrypt * @param crypt_len : length of plain text * @return Nonnegative number is encrypted length, if error, return negative number; */ @@ -316,7 +316,7 @@ typedef int (* esp_blufi_encrypt_func_t)(uint8_t iv8, uint8_t *crypt_data, int c /** * @brief BLUFI decrypt the data after negotiate a share key * @param iv8 : initial vector(8bit), normally, blufi core will input packet sequence number - * @param crypt_data : encrypted data and plain text, the encrypt function must support autochthonous decrypt + * @param crypt_data : encrypted data and plain text, the encrypt function must support autochthonous decrypt * @param crypt_len : length of encrypted text * @return Nonnegative number is decrypted length, if error, return negative number; */ @@ -376,7 +376,7 @@ esp_err_t esp_blufi_profile_deinit(void); * @param opmode : wifi opmode * @param sta_conn_state : station is already in connection or not * @param softap_conn_num : softap connection number - * @param extra_info : extra information, such as sta_ssid, softap_ssid and etc. + * @param extra_info : extra information, such as sta_ssid, softap_ssid and etc. * * @return ESP_OK - success, other - failed * @@ -397,7 +397,7 @@ esp_err_t esp_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list /** * * @brief Get BLUFI profile version - * + * * @return Most 8bit significant is Great version, Least 8bit is Sub version * */ diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_bt_main.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_bt_main.h index fad010d2c..d605906d1 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_bt_main.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_bt_main.h @@ -37,7 +37,7 @@ typedef enum { * */ esp_bluedroid_status_t esp_bluedroid_get_status(void); - + /** * @brief Enable bluetooth, must after esp_bluedroid_init() * diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h index 3abef78b7..f3dfaa950 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h @@ -292,6 +292,8 @@ typedef enum { ESP_BLE_SM_ONLY_ACCEPT_SPECIFIED_SEC_AUTH, /* Enable/Disable OOB support */ ESP_BLE_SM_OOB_SUPPORT, + /* Appl encryption key size */ + ESP_BLE_APP_ENC_KEY_SIZE, ESP_BLE_SM_MAX_PARAM, } esp_ble_sm_param_t; @@ -915,7 +917,7 @@ esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params); esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_data_length); /** - * @brief This function sets the random address for the application + * @brief This function sets the static Random Address and Non-Resolvable Private Address for the application * * @param[in] rand_addr: the random address which should be setting * @@ -1137,6 +1139,20 @@ esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_e /** * @brief Set a GAP security parameter value. Overrides the default value. * +* Secure connection is highly recommended to avoid some major +* vulnerabilities like 'Impersonation in the Pin Pairing Protocol' +* (CVE-2020-26555) and 'Authentication of the LE Legacy Pairing +* Protocol'. +* +* To accept only `secure connection mode`, it is necessary do as following: +* +* 1. Set bit `ESP_LE_AUTH_REQ_SC_ONLY` (`param_type` is +* `ESP_BLE_SM_AUTHEN_REQ_MODE`), bit `ESP_LE_AUTH_BOND` and bit +* `ESP_LE_AUTH_REQ_MITM` is optional as required. +* +* 2. Set to `ESP_BLE_ONLY_ACCEPT_SPECIFIED_AUTH_ENABLE` (`param_type` is +* `ESP_BLE_SM_ONLY_ACCEPT_SPECIFIED_SEC_AUTH`). +* * @param[in] param_type : the type of the param which to be set * @param[in] value : the param value * @param[in] len : the length of the param value @@ -1303,6 +1319,17 @@ esp_err_t esp_ble_get_current_conn_params(esp_bd_addr_t bd_addr, esp_gap_conn_pa */ esp_err_t esp_gap_ble_set_channels(esp_gap_ble_channels channels); +/** +* @brief This function is called to authorized a link after Authentication(MITM protection) +* +* @param[in] bd_addr: BD address of the peer device. +* @param[out] authorize: Authorized the link or not. +* +* @return - ESP_OK : success +* - other : failed +* +*/ +esp_err_t esp_gap_ble_set_authorization(esp_bd_addr_t bd_addr, bool authorize); #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h index 66fffb7d7..f7d2df64d 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h @@ -222,6 +222,7 @@ typedef enum { ESP_BT_GAP_READ_REMOTE_NAME_EVT, /*!< read Remote Name event */ ESP_BT_GAP_MODE_CHG_EVT, ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< remove bond device complete event */ + ESP_BT_GAP_QOS_CMPL_EVT, /*!< QOS complete event */ ESP_BT_GAP_EVT_MAX, } esp_bt_gap_cb_event_t; @@ -364,6 +365,16 @@ typedef union { esp_bt_status_t status; /*!< Indicate the remove bond device operation success status */ }remove_bond_dev_cmpl; /*!< Event parameter of ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT */ + /** + * @brief ESP_BT_GAP_QOS_CMPL_EVT + */ + struct qos_cmpl_param { + esp_bt_status_t stat; /*!< QoS status */ + esp_bd_addr_t bda; /*!< remote bluetooth device address*/ + uint32_t t_poll; /*!< poll interval, the maximum time between transmissions + which from the master to a particular slave on the ACL + logical transport. unit is 0.625ms. */ + } qos_cmpl; /*!< QoS complete parameter struct */ } esp_bt_gap_cb_param_t; /** @@ -720,6 +731,21 @@ esp_err_t esp_bt_gap_set_afh_channels(esp_bt_gap_afh_channels channels); */ esp_err_t esp_bt_gap_read_remote_name(esp_bd_addr_t remote_bda); +/** +* @brief Config Quality of service +* +* @param[in] remote_bda: The remote device's address +* @param[in] t_poll: Poll interval, the maximum time between transmissions + which from the master to a particular slave on the ACL + logical transport. unit is 0.625ms +* +* @return - ESP_OK : success +* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled +* - other : failed +* +*/ +esp_err_t esp_bt_gap_set_qos(esp_bd_addr_t remote_bda, uint32_t t_poll); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatt_defs.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatt_defs.h index 58130a163..9177753bd 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatt_defs.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatt_defs.h @@ -283,6 +283,8 @@ typedef enum { #define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 - 0x0040 */ /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta/bta_gatt_api.h */ #define ESP_GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 - 0x0080 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta/bta_gatt_api.h */ #define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 - 0x0100 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta/bta_gatt_api.h */ +#define ESP_GATT_PERM_READ_AUTHORIZATION (1 << 9) /* bit 9 - 0x0200 */ +#define ESP_GATT_PERM_WRITE_AUTHORIZATION (1 << 10) /* bit 10 - 0x0400 */ typedef uint16_t esp_gatt_perm_t; /* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta/bta_gatt_api.h */ diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h index a65a15398..b8d4bdcf7 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gattc_api.h @@ -358,8 +358,8 @@ esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id); /** - * @brief This function is called to get service from local cache. - * This function report service search result by a callback + * @brief This function is called to get service from local cache. + * This function report service search result by a callback * event, and followed by a service search complete event. * * @param[in] gattc_if: Gatt client access interface. @@ -613,6 +613,29 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if, uint16_t handle, esp_gatt_auth_req_t auth_req); +/** + * @brief This function is called to read a service's characteristics of + * the given characteristic UUID + * + * @param[in] gattc_if: Gatt client access interface. + * @param[in] conn_id : connection ID. + * @param[in] start_handle : the attribute start handle. + * @param[in] end_handle : the attribute end handle + * @param[in] uuid : The UUID of attribute which will be read. + * @param[in] auth_req : authenticate request type + * + * @return + * - ESP_OK: success + * - other: failed + * + */ +esp_err_t esp_ble_gattc_read_by_type (esp_gatt_if_t gattc_if, + uint16_t conn_id, + uint16_t start_handle, + uint16_t end_handle, + esp_bt_uuid_t *uuid, + esp_gatt_auth_req_t auth_req); + /** * @brief This function is called to read multiple characteristic or * characteristic descriptors. @@ -815,10 +838,10 @@ esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda); /** * @brief Add or delete the associated address with the source address. -* Note: The role of this API is mainly when the client side has stored a server-side database, -* when it needs to connect another device, but the device's attribute database is the same -* as the server database stored on the client-side, calling this API can use the database -* that the device has stored used as the peer server database to reduce the attribute +* Note: The role of this API is mainly when the client side has stored a server-side database, +* when it needs to connect another device, but the device's attribute database is the same +* as the server database stored on the client-side, calling this API can use the database +* that the device has stored used as the peer server database to reduce the attribute * database search and discovery process and speed up the connection time. * The associated address mains that device want to used the database has stored in the local cache. * The source address mains that device want to share the database to the associated address device. @@ -832,7 +855,7 @@ esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda); * - other: failed * */ -esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_addr, +esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_addr, esp_bd_addr_t assoc_addr, bool is_assoc); /** * @brief Get the address list which has store the attribute table in the gattc cache. There will @@ -847,7 +870,7 @@ esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_ad esp_err_t esp_ble_gattc_cache_get_addr_list(esp_gatt_if_t gattc_if); /** -* @brief Clean the service cache of this device in the gattc stack, +* @brief Clean the service cache of this device in the gattc stack, * * @param[in] remote_bda: remote device BD address. * diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatts_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatts_api.h index 5da14eb1b..475ae08c5 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatts_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_gatts_api.h @@ -346,7 +346,7 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatts_if, /** - * @brief Create a service attribute tab. + * @brief Create a service attribute tab. * @param[in] gatts_attr_db: the pointer to the service attr tab * @param[in] gatts_if: GATT server access interface * @param[in] max_nb_attr: the number of attribute to be added to the service database. @@ -357,12 +357,12 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatts_if, * - other : failed * */ -esp_err_t esp_ble_gatts_create_attr_tab(const esp_gatts_attr_db_t *gatts_attr_db, +esp_err_t esp_ble_gatts_create_attr_tab(const esp_gatts_attr_db_t *gatts_attr_db, esp_gatt_if_t gatts_if, uint8_t max_nb_attr, uint8_t srvc_inst_id); /** - * @brief This function is called to add an included service. This function have to be called between + * @brief This function is called to add an included service. This function have to be called between * 'esp_ble_gatts_create_service' and 'esp_ble_gatts_add_char'. After included * service is included, a callback event ESP_GATTS_ADD_INCL_SRVC_EVT * is reported the included service ID. @@ -388,7 +388,7 @@ esp_err_t esp_ble_gatts_add_included_service(uint16_t service_handle, uint16_t i * @param[in] char_uuid : Characteristic UUID. * @param[in] perm : Characteristic value declaration attribute permission. * @param[in] property : Characteristic Properties - * @param[in] char_val : Characteristic value + * @param[in] char_val : Characteristic value * @param[in] control : attribute response control byte * * @return @@ -410,7 +410,7 @@ esp_err_t esp_ble_gatts_add_char(uint16_t service_handle, esp_bt_uuid_t *char_ * be added. * @param[in] perm: descriptor access permission. * @param[in] descr_uuid: descriptor UUID. - * @param[in] char_descr_val : Characteristic descriptor value + * @param[in] char_descr_val : Characteristic descriptor value * @param[in] control : attribute response control byte * @return * - ESP_OK : success diff --git a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h index 80b25d3c9..72461736f 100644 --- a/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h +++ b/tools/sdk/esp32/include/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h @@ -402,7 +402,7 @@ esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr, esp_hf_cal */ esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr, esp_hf_call_status_t call_state, - esp_hf_call_setup_status_t call_setup_state, + esp_hf_call_setup_status_t call_setup_state, esp_hf_network_state_t ntk_state, int signal, esp_hf_roaming_status_t roam, int batt_lev, esp_hf_call_held_status_t call_held_status); @@ -423,7 +423,7 @@ esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name); /** * - * @brief Response to AT+CLCC command from HFP Client. + * @brief Response to AT+CLCC command from HFP Client. * As a precondition to use this API, Service Level Connection shall exist between AG and HF Client. * * @param[in] remote_addr: remote bluetooth device address @@ -592,4 +592,4 @@ void esp_hf_outgoing_data_ready(void); } #endif -#endif //__ESP_HF_AG_API_H__ \ No newline at end of file +#endif //__ESP_HF_AG_API_H__ diff --git a/tools/sdk/esp32/include/config/sdkconfig.h b/tools/sdk/esp32/include/config/sdkconfig.h index a01253d72..d0a9476d3 100644 --- a/tools/sdk/esp32/include/config/sdkconfig.h +++ b/tools/sdk/esp32/include/config/sdkconfig.h @@ -4,6 +4,7 @@ */ #pragma once #define CONFIG_IDF_CMAKE 1 +#define CONFIG_IDF_TARGET_ARCH_XTENSA 1 #define CONFIG_IDF_TARGET "esp32" #define CONFIG_IDF_TARGET_ESP32 1 #define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0000 @@ -202,6 +203,7 @@ #define CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE 2048 #define CONFIG_ESP_CONSOLE_UART_DEFAULT 1 #define CONFIG_ESP_CONSOLE_UART 1 +#define CONFIG_ESP_CONSOLE_MULTIPLE_UART 1 #define CONFIG_ESP_CONSOLE_UART_NUM 0 #define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200 #define CONFIG_ESP_INT_WDT 1 @@ -226,6 +228,7 @@ #define CONFIG_ETH_DMA_TX_BUFFER_NUM 10 #define CONFIG_ETH_USE_SPI_ETHERNET 1 #define CONFIG_ETH_SPI_ETHERNET_DM9051 1 +#define CONFIG_ETH_SPI_ETHERNET_W5500 1 #define CONFIG_ESP_EVENT_POST_FROM_ISR 1 #define CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR 1 #define CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS 1 @@ -332,7 +335,6 @@ #define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8 #define CONFIG_LWIP_NETIF_LOOPBACK 1 #define CONFIG_LWIP_LOOPBACK_MAX_PBUFS 8 -#define CONFIG_LWIP_TCP_ISN_HOOK 1 #define CONFIG_LWIP_MAX_ACTIVE_TCP 16 #define CONFIG_LWIP_MAX_LISTENING_TCP 16 #define CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION 1 @@ -349,6 +351,7 @@ #define CONFIG_LWIP_TCP_RTO_TIME 3000 #define CONFIG_LWIP_MAX_UDP_PCBS 16 #define CONFIG_LWIP_UDP_RECVMBOX_SIZE 6 +#define CONFIG_LWIP_CHECKSUM_CHECK_ICMP 1 #define CONFIG_LWIP_TCPIP_TASK_STACK_SIZE 2560 #define CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 1 #define CONFIG_LWIP_TCPIP_TASK_AFFINITY 0x0 @@ -364,6 +367,9 @@ #define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1 #define CONFIG_LWIP_SNTP_UPDATE_DELAY 3600000 #define CONFIG_LWIP_ESP_LWIP_ASSERT 1 +#define CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT 1 +#define CONFIG_LWIP_HOOK_IP6_ROUTE_NONE 1 +#define CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE 1 #define CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC 1 #define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384 #define CONFIG_MBEDTLS_CERTIFICATE_BUNDLE 1 @@ -445,9 +451,9 @@ #define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1 #define CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS 1 #define CONFIG_SPI_FLASH_YIELD_DURING_ERASE 1 -#define CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS 20 -#define CONFIG_SPI_FLASH_ERASE_YIELD_TICKS 1 -#define CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE 8192 +#define CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS 10 +#define CONFIG_SPI_FLASH_ERASE_YIELD_TICKS 2 +#define CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE 4096 #define CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP 1 #define CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP 1 #define CONFIG_SPI_FLASH_SUPPORT_GD_CHIP 1 @@ -480,6 +486,10 @@ #define CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT 30 #define CONFIG_WPA_MBEDTLS_CRYPTO 1 #define CONFIG_IO_GLITCH_FILTER_TIME_MS 50 +#define CONFIG_DSP_OPTIMIZED 1 +#define CONFIG_DSP_OPTIMIZATION 1 +#define CONFIG_DSP_MAX_FFT_SIZE_4096 1 +#define CONFIG_DSP_MAX_FFT_SIZE 4096 #define CONFIG_XTENSA_IMPL 1 #define CONFIG_MTMN_LITE_QUANT 1 #define CONFIG_MFN56_1X 1 @@ -586,7 +596,6 @@ #define CONFIG_SPIRAM_SUPPORT CONFIG_ESP32_SPIRAM_SUPPORT #define CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS #define CONFIG_STACK_CHECK_NORM CONFIG_COMPILER_STACK_CHECK_MODE_NORM -#define CONFIG_SUPPORT_STATIC_ALLOCATION CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION #define CONFIG_SUPPORT_TERMIOS CONFIG_VFS_SUPPORT_TERMIOS #define CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT #define CONFIG_SW_COEXIST_ENABLE CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE @@ -617,5 +626,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 "494a124d9" +#define CONFIG_ARDUINO_IDF_COMMIT "2bfdd036b" #define CONFIG_ARDUINO_IDF_BRANCH "master" diff --git a/tools/sdk/esp32/include/console/argtable3/argtable3.h b/tools/sdk/esp32/include/console/argtable3/argtable3.h index 37a321fb5..abb2009cc 100644 --- a/tools/sdk/esp32/include/console/argtable3/argtable3.h +++ b/tools/sdk/esp32/include/console/argtable3/argtable3.h @@ -39,7 +39,7 @@ extern "C" { #endif #define ARG_REX_ICASE 1 - + /* bit masks for arg_hdr.flag */ enum { @@ -218,7 +218,7 @@ struct arg_str* arg_str0(const char* shortopts, const char* datatype, const char* glossary); struct arg_str* arg_str1(const char* shortopts, - const char* longopts, + const char* longopts, const char* datatype, const char *glossary); struct arg_str* arg_strn(const char* shortopts, diff --git a/tools/sdk/esp32/include/console/esp_console.h b/tools/sdk/esp32/include/console/esp_console.h index 98201cdbc..29aab8b4f 100644 --- a/tools/sdk/esp32/include/console/esp_console.h +++ b/tools/sdk/esp32/include/console/esp_console.h @@ -100,6 +100,20 @@ typedef struct { } #endif +/** + * @brief Parameters for console device: USB CDC + * + * @note It's an empty structure for now, reserved for future + * + */ +typedef struct { + +} esp_console_dev_usb_cdc_config_t; + +#define ESP_CONSOLE_DEV_CDC_CONFIG_DEFAULT() \ +{ \ +} + /** * @brief initialize console module * @param config console configuration @@ -304,6 +318,27 @@ struct esp_console_repl_s { */ esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl); +/** + * @brief Establish a console REPL environment over USB CDC + * + * @param[in] dev_config USB CDC configuration + * @param[in] repl_config REPL configuration + * @param[out] ret_repl return REPL handle after initialization succeed, return NULL otherwise + * + * @note This is a all-in-one function to establish the environment needed for REPL, includes: + * - Initializes linenoise + * - Spawn new thread to run REPL in the background + * + * @attention This function is meant to be used in the examples to make the code more compact. + * Applications which use console functionality should be based on + * the underlying linenoise and esp_console functions. + * + * @return + * - ESP_OK on success + * - ESP_FAIL Parameter error + */ +esp_err_t esp_console_new_repl_usb_cdc(const esp_console_dev_usb_cdc_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl); + /** * @brief Start REPL environment * @param[in] repl REPL handle returned from esp_console_new_repl_xxx diff --git a/tools/sdk/esp32/include/driver/esp32/include/driver/adc.h b/tools/sdk/esp32/include/driver/esp32/include/driver/adc.h index 2ee228b32..6f0127501 100644 --- a/tools/sdk/esp32/include/driver/esp32/include/driver/adc.h +++ b/tools/sdk/esp32/include/driver/esp32/include/driver/adc.h @@ -69,4 +69,4 @@ int hall_sensor_read(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/driver/esp32/include/driver/dac.h b/tools/sdk/esp32/include/driver/esp32/include/driver/dac.h index c0a418c19..db9292473 100644 --- a/tools/sdk/esp32/include/driver/esp32/include/driver/dac.h +++ b/tools/sdk/esp32/include/driver/esp32/include/driver/dac.h @@ -41,4 +41,4 @@ esp_err_t dac_i2s_disable(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/driver/esp32/include/driver/touch_sensor.h b/tools/sdk/esp32/include/driver/esp32/include/driver/touch_sensor.h index b56f4439e..d55c12e10 100644 --- a/tools/sdk/esp32/include/driver/esp32/include/driver/touch_sensor.h +++ b/tools/sdk/esp32/include/driver/esp32/include/driver/touch_sensor.h @@ -337,4 +337,4 @@ esp_err_t touch_pad_filter_delete(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/driver/include/driver/adc2_wifi_private.h b/tools/sdk/esp32/include/driver/include/driver/adc2_wifi_private.h index b8ab56627..c5204f888 100644 --- a/tools/sdk/esp32/include/driver/include/driver/adc2_wifi_private.h +++ b/tools/sdk/esp32/include/driver/include/driver/adc2_wifi_private.h @@ -55,4 +55,3 @@ void adc2_cal_include(void); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/driver/include/driver/adc_common.h b/tools/sdk/esp32/include/driver/include/driver/adc_common.h index 719f60a4d..b0dfd1e65 100644 --- a/tools/sdk/esp32/include/driver/include/driver/adc_common.h +++ b/tools/sdk/esp32/include/driver/include/driver/adc_common.h @@ -24,25 +24,47 @@ extern "C" { #endif +#if CONFIG_IDF_TARGET_ESP32 /**** `adc1_channel_t` will be deprecated functions, combine into `adc_channel_t` ********/ typedef enum { - ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO36 (ESP32), GPIO1 (ESP32-S2) */ - ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO37 (ESP32), GPIO2 (ESP32-S2) */ - ADC1_CHANNEL_2, /*!< ADC1 channel 2 is GPIO38 (ESP32), GPIO3 (ESP32-S2) */ - ADC1_CHANNEL_3, /*!< ADC1 channel 3 is GPIO39 (ESP32), GPIO4 (ESP32-S2) */ - ADC1_CHANNEL_4, /*!< ADC1 channel 4 is GPIO32 (ESP32), GPIO5 (ESP32-S2) */ - ADC1_CHANNEL_5, /*!< ADC1 channel 5 is GPIO33 (ESP32), GPIO6 (ESP32-S2) */ - ADC1_CHANNEL_6, /*!< ADC1 channel 6 is GPIO34 (ESP32), GPIO7 (ESP32-S2) */ - ADC1_CHANNEL_7, /*!< ADC1 channel 7 is GPIO35 (ESP32), GPIO8 (ESP32-S2) */ -#if CONFIG_IDF_TARGET_ESP32 + ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO36 */ + ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO37 */ + ADC1_CHANNEL_2, /*!< ADC1 channel 2 is GPIO38 */ + ADC1_CHANNEL_3, /*!< ADC1 channel 3 is GPIO39 */ + ADC1_CHANNEL_4, /*!< ADC1 channel 4 is GPIO32 */ + ADC1_CHANNEL_5, /*!< ADC1 channel 5 is GPIO33 */ + ADC1_CHANNEL_6, /*!< ADC1 channel 6 is GPIO34 */ + ADC1_CHANNEL_7, /*!< ADC1 channel 7 is GPIO35 */ ADC1_CHANNEL_MAX, -#elif CONFIG_IDF_TARGET_ESP32S2 - ADC1_CHANNEL_8, /*!< ADC1 channel 6 is GPIO9 (ESP32-S2)*/ - ADC1_CHANNEL_9, /*!< ADC1 channel 7 is GPIO10 (ESP32-S2) */ - ADC1_CHANNEL_MAX, -#endif } adc1_channel_t; +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 // TODO ESP32-S3 channels are wrong IDF-1776 +/**** `adc1_channel_t` will be deprecated functions, combine into `adc_channel_t` ********/ +typedef enum { + ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO1 */ + ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO2 */ + ADC1_CHANNEL_2, /*!< ADC1 channel 2 is GPIO3 */ + ADC1_CHANNEL_3, /*!< ADC1 channel 3 is GPIO4 */ + ADC1_CHANNEL_4, /*!< ADC1 channel 4 is GPIO5 */ + ADC1_CHANNEL_5, /*!< ADC1 channel 5 is GPIO6 */ + ADC1_CHANNEL_6, /*!< ADC1 channel 6 is GPIO7 */ + ADC1_CHANNEL_7, /*!< ADC1 channel 7 is GPIO8 */ + ADC1_CHANNEL_8, /*!< ADC1 channel 6 is GPIO9 */ + ADC1_CHANNEL_9, /*!< ADC1 channel 7 is GPIO10 */ + ADC1_CHANNEL_MAX, +} adc1_channel_t; +#elif CONFIG_IDF_TARGET_ESP32C3 +/**** `adc1_channel_t` will be deprecated functions, combine into `adc_channel_t` ********/ +typedef enum { + ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO0 */ + ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO1 */ + ADC1_CHANNEL_2, /*!< ADC1 channel 2 is GPIO2 */ + ADC1_CHANNEL_3, /*!< ADC1 channel 3 is GPIO3 */ + ADC1_CHANNEL_4, /*!< ADC1 channel 4 is GPIO34 */ + ADC1_CHANNEL_MAX, +} adc1_channel_t; +#endif // CONFIG_IDF_TARGET_* +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 // TODO ESP32-S3 channels are wrong IDF-1776 /**** `adc2_channel_t` will be deprecated functions, combine into `adc_channel_t` ********/ typedef enum { ADC2_CHANNEL_0 = 0, /*!< ADC2 channel 0 is GPIO4 (ESP32), GPIO11 (ESP32-S2) */ @@ -57,6 +79,14 @@ typedef enum { ADC2_CHANNEL_9, /*!< ADC2 channel 9 is GPIO26 (ESP32), GPIO20 (ESP32-S2) */ ADC2_CHANNEL_MAX, } adc2_channel_t; +#elif CONFIG_IDF_TARGET_ESP32C3 +/**** `adc2_channel_t` will be deprecated functions, combine into `adc_channel_t` ********/ +typedef enum { + ADC2_CHANNEL_0 = 0, /*!< ADC2 channel 0 is GPIO5 */ + ADC2_CHANNEL_MAX, +} adc2_channel_t; +#endif + /** * @brief ADC rtc controller attenuation option. @@ -73,6 +103,13 @@ typedef enum { #define ADC_WIDTH_11Bit ADC_WIDTH_BIT_11 #define ADC_WIDTH_12Bit ADC_WIDTH_BIT_12 +#if CONFIG_IDF_TARGET_ESP32C3 +/** + * @brief Digital ADC DMA read max timeout value, it may make the ``adc_digi_read_bytes`` block forever if the OS supports + */ +#define ADC_MAX_DELAY UINT32_MAX +#endif + /** * @brief ADC digital controller encode option. * @@ -84,20 +121,52 @@ typedef enum { ADC_ENCODE_MAX, } adc_i2s_encode_t; +#if CONFIG_IDF_TARGET_ESP32C3 +//This feature is currently supported on ESP32C3, will be supported on other chips soon +/** + * @brief Digital ADC DMA configuration + */ +typedef struct adc_digi_init_config_s { + uint32_t max_store_buf_size; ///< Max length of the converted data that driver can store before they are processed. When this length is reached, driver will dump out all the old data and start to store them again. + uint32_t conv_num_each_intr; ///< Bytes of data that can be converted in 1 interrupt. + uint32_t dma_chan; ///< DMA channel. + uint16_t adc1_chan_mask; ///< Channel list of ADC1 to be initialized. + uint16_t adc2_chan_mask; ///< Channel list of ADC2 to be initialized. +} adc_digi_init_config_t; +#endif + /*--------------------------------------------------------------- Common setting ---------------------------------------------------------------*/ /** * @brief Enable ADC power + * @deprecated Use adc_power_acquire and adc_power_release instead. */ -void adc_power_on(void); +void adc_power_on(void) __attribute__((deprecated)); /** * @brief Power off SAR ADC - * This function will force power down for ADC + * @deprecated Use adc_power_acquire and adc_power_release instead. + * This function will force power down for ADC. + * This function is deprecated because forcing power ADC power off may + * disrupt operation of other components which may be using the ADC. */ -void adc_power_off(void); +void adc_power_off(void) __attribute__((deprecated)); + +/** + * @brief Increment the usage counter for ADC module. + * ADC will stay powered on while the counter is greater than 0. + * Call adc_power_release when done using the ADC. + */ +void adc_power_acquire(void); + +/** + * @brief Decrement the usage counter for ADC module. + * ADC will stay powered on while the counter is greater than 0. + * Call this function when done using the ADC. + */ +void adc_power_release(void); /** * @brief Initialize ADC pad @@ -137,7 +206,7 @@ esp_err_t adc1_pad_get_io_num(adc1_channel_t channel, gpio_num_t *gpio_num); * - 2.5 dB attenuation (ADC_ATTEN_DB_2_5) gives full-scale voltage 1.5 V * - 6 dB attenuation (ADC_ATTEN_DB_6) gives full-scale voltage 2.2 V * - 11 dB attenuation (ADC_ATTEN_DB_11) gives full-scale voltage 3.9 V (see note below) - * + * * Due to ADC characteristics, most accurate results are obtained within the following approximate voltage ranges: * * +----------+------------+--------------------------+ @@ -159,7 +228,7 @@ esp_err_t adc1_pad_get_io_num(adc1_channel_t channel, gpio_num_t *gpio_num); * | +------------+--------------------------+ * | | 11 | 150 ~ 2600 | * +----------+------------+--------------------------+ - * + * * For maximum accuracy, use the ADC calibration APIs and measure voltages within these recommended ranges. * @note The full-scale voltage is the voltage corresponding to a maximum reading (depending on ADC1 configured bit width, * this value in ESP32 is 4095 for 12-bits, 2047 for 11-bits, 1023 for 10-bits, 511 for 9 bits. @@ -199,6 +268,8 @@ esp_err_t adc1_config_width(adc_bits_width_t width_bit); * the input of GPIO36 and GPIO39 will be pulled down for about 80ns. * When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. + * As a workaround, call adc_power_acquire() in the app. This will result in higher power consumption (by ~1mA), + * but will remove the glitches on GPIO36 and GPIO39. * * @note Call ``adc1_config_width()`` before the first time this * function is called. @@ -236,10 +307,8 @@ esp_err_t adc_set_clk_div(uint8_t clk_div); /** * @brief Configure ADC capture width. * - * @note ESP32-S2 only supports ``ADC_WIDTH_BIT_13``. - * * @param adc_unit ADC unit index - * @param width_bit Bit capture width for ADC unit. ESP32-S2 only supports ``ADC_WIDTH_BIT_13``. + * @param width_bit Bit capture width for ADC unit. * * @return * - ESP_OK success @@ -312,6 +381,9 @@ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten); * the input of GPIO36 and GPIO39 will be pulled down for about 80ns. * When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. + * As a workaround, call adc_power_acquire() in the app. This will result in higher power consumption (by ~1mA), + * but will remove the glitches on GPIO36 and GPIO39. + * * * @note ESP32: * For a given channel, ``adc2_config_channel_atten()`` @@ -323,7 +395,7 @@ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten); * the low priority controller will read the invalid ADC2 data. Default priority: Wi-Fi > RTC > Digital; * * @param channel ADC2 channel to read - * @param width_bit Bit capture width for ADC2. ESP32-S2 only supports ``ADC_WIDTH_BIT_13``. + * @param width_bit Bit capture width for ADC2 * @param raw_out the variable to hold the output data. * * @return @@ -369,7 +441,8 @@ esp_err_t adc2_vref_to_gpio(gpio_num_t gpio) __attribute__((deprecated)); /*--------------------------------------------------------------- Digital controller setting ---------------------------------------------------------------*/ - +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 +//These APIs are only supported on ESP32 and ESP32-S2. On ESP32-C3 and later chips, please use ``adc_digi_initialize`` and ``adc_digi_deinitialize`` /** * @brief ADC digital controller initialization. * @return @@ -383,17 +456,81 @@ esp_err_t adc_digi_init(void); * - ESP_OK Success */ esp_err_t adc_digi_deinit(void); +#endif /** * @brief Setting the digital controller. * - * @param config Pointer to digital controller paramter. Refer to `adc_digi_config_t`. + * @param config Pointer to digital controller paramter. Refer to ``adc_digi_config_t``. * * @return - * - ESP_OK Success + * - ESP_ERR_INVALID_STATE Driver state is invalid. + * - ESP_OK On success */ esp_err_t adc_digi_controller_config(const adc_digi_config_t *config); +#if CONFIG_IDF_TARGET_ESP32C3 +//This feature is currently supported on ESP32C3, will be supported on other chips soon +/*--------------------------------------------------------------- + DMA setting +---------------------------------------------------------------*/ +/** + * @brief Initialize the Digital ADC. + * + * @param init_config Pointer to Digital ADC initilisation config. Refer to ``adc_digi_init_config_t``. + * + * @return + * - ESP_ERR_INVALID_ARG If the combination of arguments is invalid. + * - ESP_ERR_NOT_FOUND No free interrupt found with the specified flags + * - ESP_ERR_NO_MEM If out of memory + * - ESP_OK On success + */ +esp_err_t adc_digi_initialize(const adc_digi_init_config_t *init_config); + +/** + * @brief Start the Digital ADC and DMA peripherals. After this, the hardware starts working. + * + * @return + * - ESP_ERR_INVALID_STATE Driver state is invalid. + * - ESP_OK On success + */ +esp_err_t adc_digi_start(void); + +/** + * @brief Stop the Digital ADC and DMA peripherals. After this, the hardware stops working. + * + * @return + * - ESP_ERR_INVALID_STATE Driver state is invalid. + * - ESP_OK On success + */ +esp_err_t adc_digi_stop(void); + +/** + * @brief Read bytes from Digital ADC through DMA. + * + * @param[out] buf Buffer to read from ADC. + * @param[in] length_max Expected length of data read from the ADC. + * @param[out] out_length Real length of data read from the ADC via this API. + * @param[in] timeout_ms Time to wait for data via this API, in millisecond. + * + * @return + * - ESP_ERR_INVALID_STATE Driver state is invalid. Usually it means the ADC sampling rate is faster than the task processing rate. + * - ESP_ERR_TIMEOUT Operation timed out + * - ESP_OK On success + */ +esp_err_t adc_digi_read_bytes(uint8_t *buf, uint32_t length_max, uint32_t *out_length, uint32_t timeout_ms); + +/** + * @brief Deinitialize the Digital ADC. + * + * @return + * - ESP_ERR_INVALID_STATE Driver state is invalid. + * - ESP_OK On success + */ +esp_err_t adc_digi_deinitialize(void); + +#endif //#if CONFIG_IDF_TARGET_ESP32C3 + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/driver/include/driver/can.h b/tools/sdk/esp32/include/driver/include/driver/can.h index 7b42ce1dc..e28a9c443 100644 --- a/tools/sdk/esp32/include/driver/include/driver/can.h +++ b/tools/sdk/esp32/include/driver/include/driver/can.h @@ -71,4 +71,4 @@ typedef twai_status_info_t can_status_info_t; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/driver/include/driver/dac_common.h b/tools/sdk/esp32/include/driver/include/driver/dac_common.h index 478841fc7..b1aefc953 100644 --- a/tools/sdk/esp32/include/driver/include/driver/dac_common.h +++ b/tools/sdk/esp32/include/driver/include/driver/dac_common.h @@ -96,4 +96,3 @@ esp_err_t dac_cw_generator_config(dac_cw_config_t *cw); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/driver/include/driver/gpio.h b/tools/sdk/esp32/include/driver/include/driver/gpio.h index 28a5337e2..333f75ddb 100644 --- a/tools/sdk/esp32/include/driver/include/driver/gpio.h +++ b/tools/sdk/esp32/include/driver/include/driver/gpio.h @@ -31,6 +31,8 @@ #include "esp32/rom/gpio.h" #elif CONFIG_IDF_TARGET_ESP32S2 #include "esp32s2/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/gpio.h" #endif #ifdef CONFIG_LEGACY_INCLUDE_COMMON_HEADERS @@ -93,9 +95,11 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type); /** * @brief Enable GPIO module interrupt signal * - * @note Please do not use the interrupt of GPIO36 and GPIO39 when using ADC. + * @note Please do not use the interrupt of GPIO36 and GPIO39 when using ADC or Wi-Fi with sleep mode enabled. * Please refer to the comments of `adc1_get_raw`. * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. + * As a workaround, call adc_power_acquire() in the app. This will result in higher power consumption (by ~1mA), + * but will remove the glitches on GPIO36 and GPIO39. * * @param gpio_num GPIO number. If you want to enable an interrupt on e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16); * @@ -444,4 +448,3 @@ esp_err_t gpio_force_unhold_all(void); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/driver/include/driver/i2c.h b/tools/sdk/esp32/include/driver/include/driver/i2c.h index 3cd9f3b74..30488fc57 100644 --- a/tools/sdk/esp32/include/driver/include/driver/i2c.h +++ b/tools/sdk/esp32/include/driver/include/driver/i2c.h @@ -1,4 +1,4 @@ -// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -24,7 +24,6 @@ extern "C" { #include "esp_intr_alloc.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" -#include "freertos/xtensa_api.h" #include "freertos/task.h" #include "freertos/queue.h" #include "freertos/ringbuf.h" diff --git a/tools/sdk/esp32/include/driver/include/driver/mcpwm.h b/tools/sdk/esp32/include/driver/include/driver/mcpwm.h index 19f26b216..fce8a815e 100644 --- a/tools/sdk/esp32/include/driver/include/driver/mcpwm.h +++ b/tools/sdk/esp32/include/driver/include/driver/mcpwm.h @@ -662,4 +662,3 @@ esp_err_t mcpwm_isr_register(mcpwm_unit_t mcpwm_num, void (*fn)(void *), void *a #endif #endif //SOC_MCPWM_SUPPORTED - diff --git a/tools/sdk/esp32/include/driver/include/driver/periph_ctrl.h b/tools/sdk/esp32/include/driver/include/driver/periph_ctrl.h index b6c6a9d71..f7c04da9b 100644 --- a/tools/sdk/esp32/include/driver/include/driver/periph_ctrl.h +++ b/tools/sdk/esp32/include/driver/include/driver/periph_ctrl.h @@ -74,8 +74,8 @@ void periph_module_reset(periph_module_t periph); * wifi_bt_common_module_disable has to be called the same number of times * in order to put the peripheral into disabled state. * - * @return NULL - * + * @return NULL + * */ void wifi_bt_common_module_enable(void); @@ -86,8 +86,8 @@ void wifi_bt_common_module_enable(void); * wifi_bt_common_module_disable has to be called the same number of times * in order to put the peripheral into disabled state. * - * @return NULL - * + * @return NULL + * */ void wifi_bt_common_module_disable(void); diff --git a/tools/sdk/esp32/include/driver/include/driver/rmt.h b/tools/sdk/esp32/include/driver/include/driver/rmt.h index 4764a976e..3d0f90bf9 100644 --- a/tools/sdk/esp32/include/driver/include/driver/rmt.h +++ b/tools/sdk/esp32/include/driver/include/driver/rmt.h @@ -28,7 +28,11 @@ extern "C" { #include "soc/rmt_struct.h" #include "hal/rmt_types.h" -#define RMT_CHANNEL_FLAGS_ALWAYS_ON (1 << 0) /*!< Channel can work when APB frequency is changing (RMT channel adopts REF_TICK as clock source) */ +#define RMT_CHANNEL_FLAGS_AWARE_DFS (1 << 0) /*!< Channel can work during APB clock scaling */ + +/** @cond */ +#define RMT_CHANNEL_FLAGS_ALWAYS_ON RMT_CHANNEL_FLAGS_AWARE_DFS /*!< Deprecated name, defined here for compatibility */ +/** @endcond */ /** * @brief Define memory space of each RMT channel (in words = 4 bytes) @@ -357,7 +361,7 @@ esp_err_t rmt_rx_start(rmt_channel_t channel, bool rx_idx_rst); esp_err_t rmt_rx_stop(rmt_channel_t channel); /** -* @brief Reset RMT TX/RX memory index. +* @brief Reset RMT TX memory * * @param channel RMT channel * @@ -365,7 +369,18 @@ esp_err_t rmt_rx_stop(rmt_channel_t channel); * - ESP_ERR_INVALID_ARG Parameter error * - ESP_OK Success */ -esp_err_t rmt_memory_rw_rst(rmt_channel_t channel); +esp_err_t rmt_tx_memory_reset(rmt_channel_t channel); + +/** +* @brief Reset RMT RX memory +* +* @param channel RMT channel +* +* @return +* - ESP_ERR_INVALID_ARG Parameter error +* - ESP_OK Success +*/ +esp_err_t rmt_rx_memory_reset(rmt_channel_t channel); /** * @brief Set RMT memory owner. @@ -504,22 +519,6 @@ esp_err_t rmt_get_idle_level(rmt_channel_t channel, bool *idle_out_en, rmt_idle_ */ esp_err_t rmt_get_status(rmt_channel_t channel, uint32_t *status); -/** -* @brief Set mask value to RMT interrupt enable register. -* -* @param mask Bit mask to set to the register -* -*/ -void rmt_set_intr_enable_mask(uint32_t mask); - -/** -* @brief Clear mask value to RMT interrupt enable register. -* -* @param mask Bit mask to clear the register -* -*/ -void rmt_clr_intr_enable_mask(uint32_t mask); - /** * @brief Set RMT RX interrupt enable * @@ -833,6 +832,36 @@ esp_err_t rmt_add_channel_to_group(rmt_channel_t channel); esp_err_t rmt_remove_channel_from_group(rmt_channel_t channel); #endif +/** +* @brief Reset RMT TX/RX memory index. +* +* @param channel RMT channel +* +* @return +* - ESP_ERR_INVALID_ARG Parameter error +* - ESP_OK Success +*/ +esp_err_t rmt_memory_rw_rst(rmt_channel_t channel) +__attribute__((deprecated("use rmt_tx_memory_reset or rmt_rx_memory_reset instead"))); + +/** +* @brief Set mask value to RMT interrupt enable register. +* +* @param mask Bit mask to set to the register +* +*/ +void rmt_set_intr_enable_mask(uint32_t mask) +__attribute__((deprecated("interrupt should be handled by driver"))); + +/** +* @brief Clear mask value to RMT interrupt enable register. +* +* @param mask Bit mask to clear the register +* +*/ +void rmt_clr_intr_enable_mask(uint32_t mask) +__attribute__((deprecated("interrupt should be handled by driver"))); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/driver/include/driver/rtc_io.h b/tools/sdk/esp32/include/driver/include/driver/rtc_io.h index c6127e666..ea8878223 100644 --- a/tools/sdk/esp32/include/driver/include/driver/rtc_io.h +++ b/tools/sdk/esp32/include/driver/include/driver/rtc_io.h @@ -18,6 +18,7 @@ #include #include "esp_err.h" #include "driver/gpio.h" +#include "soc/soc_caps.h" #include "soc/rtc_io_periph.h" #include "hal/rtc_io_types.h" #ifdef __cplusplus @@ -32,8 +33,11 @@ extern "C" { */ static inline bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num) { - return (gpio_num < GPIO_PIN_COUNT - && rtc_io_num_map[gpio_num] >= 0); +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + return (gpio_num < GPIO_PIN_COUNT && rtc_io_num_map[gpio_num] >= 0); +#else + return false; +#endif } #define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num) // Deprecated, use rtc_gpio_is_valid_gpio() @@ -48,9 +52,15 @@ static inline bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num) */ static inline int rtc_io_number_get(gpio_num_t gpio_num) { +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED return rtc_io_num_map[gpio_num]; +#else + return gpio_num; +#endif } +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + /** * @brief Init a GPIO as RTC GPIO * @@ -186,6 +196,34 @@ esp_err_t rtc_gpio_pullup_dis(gpio_num_t gpio_num); */ esp_err_t rtc_gpio_pulldown_dis(gpio_num_t gpio_num); +/** + * @brief Set RTC GPIO pad drive capability + * + * @param gpio_num GPIO number, only support output GPIOs + * @param strength Drive capability of the pad + * + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG Parameter error + */ +esp_err_t rtc_gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength); + +/** + * @brief Get RTC GPIO pad drive capability + * + * @param gpio_num GPIO number, only support output GPIOs + * @param strength Pointer to accept drive capability of the pad + * + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG Parameter error + */ +esp_err_t rtc_gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t* strength); + +#endif // SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + +#if SOC_RTCIO_HOLD_SUPPORTED + /** * @brief Enable hold function on an RTC IO pad * @@ -249,29 +287,9 @@ esp_err_t rtc_gpio_force_hold_all(void); */ esp_err_t rtc_gpio_force_hold_dis_all(void); -/** - * @brief Set RTC GPIO pad drive capability - * - * @param gpio_num GPIO number, only support output GPIOs - * @param strength Drive capability of the pad - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t rtc_gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength); +#endif // SOC_RTCIO_HOLD_SUPPORTED -/** - * @brief Get RTC GPIO pad drive capability - * - * @param gpio_num GPIO number, only support output GPIOs - * @param strength Pointer to accept drive capability of the pad - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t rtc_gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t* strength); +#if SOC_RTCIO_WAKE_SUPPORTED /** * @brief Enable wakeup from sleep mode using specific GPIO @@ -294,6 +312,8 @@ esp_err_t rtc_gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) */ esp_err_t rtc_gpio_wakeup_disable(gpio_num_t gpio_num); +#endif // SOC_RTCIO_WAKE_SUPPORTED + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/driver/include/driver/sdio_slave.h b/tools/sdk/esp32/include/driver/include/driver/sdio_slave.h index 20420d477..c1bc1fb7a 100644 --- a/tools/sdk/esp32/include/driver/include/driver/sdio_slave.h +++ b/tools/sdk/esp32/include/driver/include/driver/sdio_slave.h @@ -275,5 +275,3 @@ esp_err_t sdio_slave_wait_int(int pos, TickType_t wait); #endif #endif /*_DRIVER_SDIO_SLAVE_H */ - - diff --git a/tools/sdk/esp32/include/driver/include/driver/sdmmc_host.h b/tools/sdk/esp32/include/driver/include/driver/sdmmc_host.h index 48c4c5e56..e9da4ae19 100644 --- a/tools/sdk/esp32/include/driver/include/driver/sdmmc_host.h +++ b/tools/sdk/esp32/include/driver/include/driver/sdmmc_host.h @@ -244,4 +244,4 @@ esp_err_t sdmmc_host_pullup_en(int slot, int width); } #endif -#endif //SOC_SDMMC_HOST_SUPPORTED \ No newline at end of file +#endif //SOC_SDMMC_HOST_SUPPORTED diff --git a/tools/sdk/esp32/include/driver/include/driver/spi_common_internal.h b/tools/sdk/esp32/include/driver/include/driver/spi_common_internal.h index 51c7e01f2..23a2b9005 100644 --- a/tools/sdk/esp32/include/driver/include/driver/spi_common_internal.h +++ b/tools/sdk/esp32/include/driver/include/driver/spi_common_internal.h @@ -152,7 +152,7 @@ bool spicommon_dma_chan_free(int dma_chan); /** * @brief Connect SPI and DMA peripherals - * + * * @param host SPI peripheral * @param dma_chan DMA channel */ diff --git a/tools/sdk/esp32/include/driver/include/driver/spi_master.h b/tools/sdk/esp32/include/driver/include/driver/spi_master.h index b6a4a78eb..717287a62 100644 --- a/tools/sdk/esp32/include/driver/include/driver/spi_master.h +++ b/tools/sdk/esp32/include/driver/include/driver/spi_master.h @@ -22,7 +22,6 @@ /** SPI master clock is divided by 80MHz apb clock. Below defines are example frequencies, and are accurate. Be free to specify a random frequency, it will be rounded to closest frequency (to macros below if above 8MHz). * 8MHz */ -#if APB_CLK_FREQ==80*1000*1000 #define SPI_MASTER_FREQ_8M (APB_CLK_FREQ/10) #define SPI_MASTER_FREQ_9M (APB_CLK_FREQ/9) ///< 8.89MHz #define SPI_MASTER_FREQ_10M (APB_CLK_FREQ/8) ///< 10MHz @@ -33,14 +32,6 @@ #define SPI_MASTER_FREQ_26M (APB_CLK_FREQ/3) ///< 26.67MHz #define SPI_MASTER_FREQ_40M (APB_CLK_FREQ/2) ///< 40MHz #define SPI_MASTER_FREQ_80M (APB_CLK_FREQ/1) ///< 80MHz -#elif APB_CLK_FREQ==40*1000*1000 -#define SPI_MASTER_FREQ_7M (APB_CLK_FREQ/6) ///< 13.33MHz -#define SPI_MASTER_FREQ_8M (APB_CLK_FREQ/5) ///< 16MHz -#define SPI_MASTER_FREQ_10M (APB_CLK_FREQ/4) ///< 20MHz -#define SPI_MASTER_FREQ_13M (APB_CLK_FREQ/3) ///< 26.67MHz -#define SPI_MASTER_FREQ_20M (APB_CLK_FREQ/2) ///< 40MHz -#define SPI_MASTER_FREQ_40M (APB_CLK_FREQ/1) ///< 80MHz -#endif #ifdef __cplusplus extern "C" { @@ -394,4 +385,3 @@ int spi_get_freq_limit(bool gpio_is_used, int input_delay_ns); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/driver/include/driver/spi_slave_hd.h b/tools/sdk/esp32/include/driver/include/driver/spi_slave_hd.h index cea9cd2a9..7613d3c32 100644 --- a/tools/sdk/esp32/include/driver/include/driver/spi_slave_hd.h +++ b/tools/sdk/esp32/include/driver/include/driver/spi_slave_hd.h @@ -165,4 +165,4 @@ void spi_slave_hd_write_buffer(spi_host_device_t host_id, int addr, uint8_t *dat #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/driver/include/driver/touch_pad.h b/tools/sdk/esp32/include/driver/include/driver/touch_pad.h index 1f427ff0b..4b7a021f5 100644 --- a/tools/sdk/esp32/include/driver/include/driver/touch_pad.h +++ b/tools/sdk/esp32/include/driver/include/driver/touch_pad.h @@ -14,4 +14,4 @@ #pragma once -#include "driver/touch_sensor.h" \ No newline at end of file +#include "driver/touch_sensor.h" diff --git a/tools/sdk/esp32/include/driver/include/driver/touch_sensor_common.h b/tools/sdk/esp32/include/driver/include/driver/touch_sensor_common.h index a114b03da..f9855bc9d 100644 --- a/tools/sdk/esp32/include/driver/include/driver/touch_sensor_common.h +++ b/tools/sdk/esp32/include/driver/include/driver/touch_sensor_common.h @@ -28,6 +28,7 @@ extern "C" { * @return * - ESP_OK Success * - ESP_ERR_NO_MEM Touch pad init error + * - ESP_ERR_NOT_SUPPORTED Touch pad is providing current to external XTAL */ esp_err_t touch_pad_init(void); @@ -167,4 +168,4 @@ bool touch_pad_meas_is_done(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/driver/include/driver/twai.h b/tools/sdk/esp32/include/driver/include/driver/twai.h index d369ad230..81a754b1b 100644 --- a/tools/sdk/esp32/include/driver/include/driver/twai.h +++ b/tools/sdk/esp32/include/driver/include/driver/twai.h @@ -345,4 +345,4 @@ esp_err_t twai_clear_receive_queue(void); } #endif -#endif //SOC_TWAI_SUPPORTED \ No newline at end of file +#endif //SOC_TWAI_SUPPORTED diff --git a/tools/sdk/esp32/include/driver/include/driver/uart.h b/tools/sdk/esp32/include/driver/include/driver/uart.h index 45564a0a9..7269b3fa1 100644 --- a/tools/sdk/esp32/include/driver/include/driver/uart.h +++ b/tools/sdk/esp32/include/driver/include/driver/uart.h @@ -23,7 +23,6 @@ extern "C" { #include "soc/soc_caps.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" -#include "freertos/xtensa_api.h" #include "freertos/task.h" #include "freertos/queue.h" #include "freertos/ringbuf.h" @@ -867,4 +866,3 @@ void uart_set_always_rx_timeout(uart_port_t uart_num, bool always_rx_timeout_en) #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/efuse/esp32/include/esp_efuse_table.h b/tools/sdk/esp32/include/efuse/esp32/include/esp_efuse_table.h index 71fcc6dfb..c1023b742 100644 --- a/tools/sdk/esp32/include/efuse/esp32/include/esp_efuse_table.h +++ b/tools/sdk/esp32/include/efuse/esp32/include/esp_efuse_table.h @@ -69,4 +69,3 @@ extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_VERSION[]; #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/efuse/include/esp32c3/esp_efuse.h b/tools/sdk/esp32/include/efuse/include/esp32c3/esp_efuse.h new file mode 100644 index 000000000..9ae3ab08d --- /dev/null +++ b/tools/sdk/esp32/include/efuse/include/esp32c3/esp_efuse.h @@ -0,0 +1,70 @@ +// 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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Type of eFuse blocks ESP32C3 + */ +typedef enum { + EFUSE_BLK0 = 0, /**< Number of eFuse BLOCK0. REPEAT_DATA */ + + EFUSE_BLK1 = 1, /**< Number of eFuse BLOCK1. MAC_SPI_8M_SYS */ + + EFUSE_BLK2 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */ + EFUSE_BLK_SYS_DATA_PART1 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */ + + EFUSE_BLK3 = 3, /**< Number of eFuse BLOCK3. USER_DATA*/ + EFUSE_BLK_USER_DATA = 3, /**< Number of eFuse BLOCK3. USER_DATA*/ + + EFUSE_BLK4 = 4, /**< Number of eFuse BLOCK4. KEY0 */ + EFUSE_BLK_KEY0 = 4, /**< Number of eFuse BLOCK4. KEY0 */ + + EFUSE_BLK5 = 5, /**< Number of eFuse BLOCK5. KEY1 */ + EFUSE_BLK_KEY1 = 5, /**< Number of eFuse BLOCK5. KEY1 */ + + EFUSE_BLK6 = 6, /**< Number of eFuse BLOCK6. KEY2 */ + EFUSE_BLK_KEY2 = 6, /**< Number of eFuse BLOCK6. KEY2 */ + + EFUSE_BLK7 = 7, /**< Number of eFuse BLOCK7. KEY3 */ + EFUSE_BLK_KEY3 = 7, /**< Number of eFuse BLOCK7. KEY3 */ + + EFUSE_BLK8 = 8, /**< Number of eFuse BLOCK8. KEY4 */ + EFUSE_BLK_KEY4 = 8, /**< Number of eFuse BLOCK8. KEY4 */ + + EFUSE_BLK9 = 9, /**< Number of eFuse BLOCK9. KEY5 */ + EFUSE_BLK_KEY5 = 9, /**< Number of eFuse BLOCK9. KEY5 */ + EFUSE_BLK_KEY_MAX = 10, + + EFUSE_BLK10 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ + EFUSE_BLK_SYS_DATA_PART2 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ + + EFUSE_BLK_MAX +} esp_efuse_block_t; + +/** + * @brief Type of coding scheme + */ +typedef enum { + EFUSE_CODING_SCHEME_NONE = 0, /**< None */ + EFUSE_CODING_SCHEME_RS = 3, /**< Reed-Solomon coding */ +} esp_efuse_coding_scheme_t; + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/efuse/include/esp32s2/esp_efuse.h b/tools/sdk/esp32/include/efuse/include/esp32s2/esp_efuse.h index 30dcb5e80..9e5096b9b 100644 --- a/tools/sdk/esp32/include/efuse/include/esp32s2/esp_efuse.h +++ b/tools/sdk/esp32/include/efuse/include/esp32s2/esp_efuse.h @@ -49,6 +49,7 @@ typedef enum { EFUSE_BLK9 = 9, /**< Number of eFuse BLOCK9. KEY5 */ EFUSE_BLK_KEY5 = 9, /**< Number of eFuse BLOCK9. KEY5 */ + EFUSE_BLK_KEY_MAX = 10, EFUSE_BLK10 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ EFUSE_BLK_SYS_DATA_PART2 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ @@ -56,14 +57,6 @@ typedef enum { EFUSE_BLK_MAX } esp_efuse_block_t; -struct esp_efuse_desc_s; - -/** - * @brief Given a key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY5, return - * efuse field for setting the key purpose - */ -const struct esp_efuse_desc_s **esp_efuse_get_purpose_field(esp_efuse_block_t block); - /** * @brief Type of coding scheme */ diff --git a/tools/sdk/esp32/include/efuse/include/esp32s2/esp_efuse_rtc_table.h b/tools/sdk/esp32/include/efuse/include/esp32s2/esp_efuse_rtc_table.h new file mode 100644 index 000000000..b9157ef07 --- /dev/null +++ b/tools/sdk/esp32/include/efuse/include/esp32s2/esp_efuse_rtc_table.h @@ -0,0 +1,108 @@ +// Copyright 2017-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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "esp_err.h" +#include "sdkconfig.h" + +#define RTCCALIB_ESP32S2_ADCCOUNT 2 +#define RTCCALIB_ESP32S2_ATTENCOUNT 4 + +#define RTCCALIB_V1_PARAM_VLOW 0 +#define RTCCALIB_V1_PARAM_VHIGH 1 +#define RTCCALIB_V2_PARAM_VHIGH 0 +#define RTCCALIB_V2_PARAM_VINIT 1 + +// these are the tags. Either use them directly or use esp_efuse_rtc_table_get_tag to calculate +// the corresponding tag. +#define RTCCALIB_V1IDX_A10L 1 +#define RTCCALIB_V1IDX_A11L 2 +#define RTCCALIB_V1IDX_A12L 3 +#define RTCCALIB_V1IDX_A13L 4 +#define RTCCALIB_V1IDX_A20L 5 +#define RTCCALIB_V1IDX_A21L 6 +#define RTCCALIB_V1IDX_A22L 7 +#define RTCCALIB_V1IDX_A23L 8 +#define RTCCALIB_V1IDX_A10H 9 +#define RTCCALIB_V1IDX_A11H 10 +#define RTCCALIB_V1IDX_A12H 11 +#define RTCCALIB_V1IDX_A13H 12 +#define RTCCALIB_V1IDX_A20H 13 +#define RTCCALIB_V1IDX_A21H 14 +#define RTCCALIB_V1IDX_A22H 15 +#define RTCCALIB_V1IDX_A23H 16 +#define RTCCALIB_V2IDX_A10H 17 +#define RTCCALIB_V2IDX_A11H 18 +#define RTCCALIB_V2IDX_A12H 19 +#define RTCCALIB_V2IDX_A13H 20 +#define RTCCALIB_V2IDX_A20H 21 +#define RTCCALIB_V2IDX_A21H 22 +#define RTCCALIB_V2IDX_A22H 23 +#define RTCCALIB_V2IDX_A23H 24 +#define RTCCALIB_V2IDX_A10I 25 +#define RTCCALIB_V2IDX_A11I 26 +#define RTCCALIB_V2IDX_A12I 27 +#define RTCCALIB_V2IDX_A13I 28 +#define RTCCALIB_V2IDX_A20I 29 +#define RTCCALIB_V2IDX_A21I 30 +#define RTCCALIB_V2IDX_A22I 31 +#define RTCCALIB_V2IDX_A23I 32 +#define RTCCALIB_IDX_TMPSENSOR 33 + +/** + * @brief Get rtc calibration version. + */ +int esp_efuse_rtc_table_read_calib_version(void); + +/** + * @brief Helper function to calculate a tag from human-readable parameters. + * Tag is used to index the desired data from the efuse. + * For example, (1, 1, 3, 1) yields the tag RTCCALIB_V1IDX_A13H + * extra params are used for identification when a adc_num-atten combination has + * multiple efuse values. + * @param adc_channel_num verbatim numbering of the ADC channel. For channel 1, use 1 and not 0. + * @param atten attenuation. use the enum value. + * @param version the version of the scheme to index for. + * @param extra_params defined differently for each version. + * */ +int esp_efuse_rtc_table_get_tag(int version, int adc_channel_num, int atten, int extra_params); + +/** + * @brief Fetches a raw value from efuse and does signed bit parsing + * @param tag tag obtained with esp_efuse_rtc_table_get_tag + * + * */ +int esp_efuse_rtc_table_get_raw_efuse_value(int tag); + +/** + * @brief Fetches a raw value from efuse and resolve it to get + * the original number that it meant to represent. + * + * @param tag tag obtained with esp_efuse_rtc_table_get_tag + * @param use_zero_inputs Does not perform the raw value fetching before resolving the number, + * but proceed as if all zeros were read from efuse. + * + * */ +int esp_efuse_rtc_table_get_parsed_efuse_value(int tag, bool skip_efuse_reading); + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/efuse/include/esp32s3/esp_efuse.h b/tools/sdk/esp32/include/efuse/include/esp32s3/esp_efuse.h index 484ca4445..4c2beedfd 100644 --- a/tools/sdk/esp32/include/efuse/include/esp32s3/esp_efuse.h +++ b/tools/sdk/esp32/include/efuse/include/esp32s3/esp_efuse.h @@ -49,6 +49,7 @@ typedef enum { EFUSE_BLK9 = 9, /**< Number of eFuse BLOCK9. KEY5 */ EFUSE_BLK_KEY5 = 9, /**< Number of eFuse BLOCK9. KEY5 */ + EFUSE_BLK_KEY_MAX = 10, EFUSE_BLK10 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ EFUSE_BLK_SYS_DATA_PART2 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ @@ -56,14 +57,6 @@ typedef enum { EFUSE_BLK_MAX } esp_efuse_block_t; -struct esp_efuse_desc_s; - -/** - * @brief Given a key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY5, return - * efuse field for setting the key purpose - */ -const struct esp_efuse_desc_s **esp_efuse_get_purpose_field(esp_efuse_block_t block); - /** * @brief Type of coding scheme */ diff --git a/tools/sdk/esp32/include/efuse/include/esp_efuse.h b/tools/sdk/esp32/include/efuse/include/esp_efuse.h index 84d03c5a2..6b349e665 100644 --- a/tools/sdk/esp32/include/efuse/include/esp_efuse.h +++ b/tools/sdk/esp32/include/efuse/include/esp_efuse.h @@ -29,6 +29,8 @@ extern "C" { #include "esp32s2/esp_efuse.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/esp_efuse.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/esp_efuse.h" #endif #define ESP_ERR_EFUSE 0x1600 /*!< Base error code for efuse api. */ @@ -36,20 +38,16 @@ extern "C" { #define ESP_ERR_EFUSE_CNT_IS_FULL (ESP_ERR_EFUSE + 0x02) /*!< Error field is full. */ #define ESP_ERR_EFUSE_REPEATED_PROG (ESP_ERR_EFUSE + 0x03) /*!< Error repeated programming of programmed bits is strictly forbidden. */ #define ESP_ERR_CODING (ESP_ERR_EFUSE + 0x04) /*!< Error while a encoding operation. */ - -/** - * @brief Structure eFuse field - */ -struct esp_efuse_desc_s { - esp_efuse_block_t efuse_block: 8; /**< Block of eFuse */ - uint8_t bit_start; /**< Start bit [0..255] */ - uint16_t bit_count; /**< Length of bit field [1..-]*/ -}; +#define ESP_ERR_NOT_ENOUGH_UNUSED_KEY_BLOCKS (ESP_ERR_EFUSE + 0x05) /*!< Error not enough unused key blocks available */ /** * @brief Type definition for an eFuse field */ -typedef struct esp_efuse_desc_s esp_efuse_desc_t; +typedef struct { + esp_efuse_block_t efuse_block: 8; /**< Block of eFuse */ + uint8_t bit_start; /**< Start bit [0..255] */ + uint16_t bit_count; /**< Length of bit field [1..-]*/ +} esp_efuse_desc_t; /** * @brief Reads bits from EFUSE field and writes it into an array. @@ -57,6 +55,9 @@ typedef struct esp_efuse_desc_s esp_efuse_desc_t; * The number of read bits will be limited to the minimum value * from the description of the bits in "field" structure or "dst_size_bits" required size. * Use "esp_efuse_get_field_size()" function to determine the length of the field. + * + * @note Please note that reading in the batch mode does not show uncommitted changes. + * * @param[in] field A pointer to the structure describing the fields of efuse. * @param[out] dst A pointer to array that will contain the result of reading. * @param[in] dst_size_bits The number of bits required to read. @@ -77,6 +78,7 @@ esp_err_t esp_efuse_read_field_blob(const esp_efuse_desc_t* field[], void* dst, * in the provided arguments, call esp_efuse_read_field_blob() and check the returned value instead. * * @note If assertions are enabled and the parameter is invalid, execution will abort + * @note Please note that reading in the batch mode does not show uncommitted changes. * * @param[in] field A pointer to the structure describing the fields of efuse. * @return @@ -90,6 +92,8 @@ bool esp_efuse_read_field_bit(const esp_efuse_desc_t *field[]); * @brief Reads bits from EFUSE field and returns number of bits programmed as "1". * * If the bits are set not sequentially, they will still be counted. + * @note Please note that reading in the batch mode does not show uncommitted changes. + * * @param[in] field A pointer to the structure describing the fields of efuse. * @param[out] out_cnt A pointer that will contain the number of programmed as "1" bits. * @@ -195,6 +199,8 @@ int esp_efuse_get_field_size(const esp_efuse_desc_t* field[]); * * This is a thread-safe implementation. * Example: EFUSE_BLK2_RDATA3_REG where (blk=2, num_reg=3) + * @note Please note that reading in the batch mode does not show uncommitted changes. + * * @param[in] blk Block number of eFuse. * @param[in] num_reg The register number in the block. * @@ -231,6 +237,8 @@ esp_efuse_coding_scheme_t esp_efuse_get_coding_scheme(esp_efuse_block_t blk); /** * @brief Read key to efuse block starting at the offset and the required size. * + * @note Please note that reading in the batch mode does not show uncommitted changes. + * * @param[in] blk Block number of eFuse. * @param[in] dst_key A pointer to array that will contain the result of reading. * @param[in] offset_in_bits Start bit in block. @@ -407,13 +415,19 @@ esp_err_t esp_efuse_update_secure_version(uint32_t secure_version); */ void esp_efuse_init(uint32_t offset, uint32_t size); -/* @brief Set the batch mode of writing fields. +/** + * @brief Set the batch mode of writing fields. * - * This mode allows you to write the fields in the batch mode. - * If this mode is enabled, esp_efuse_batch_write_commit() must be called - * to actually burn any written efuses. - * In this mode, reading efuse is not possible. - * This mode should be used when burning several efuses at one time. + * This mode allows you to write the fields in the batch mode when need to burn several efuses at one time. + * To enable batch mode call begin() then perform as usually the necessary operations + * read and write and at the end call commit() to actually burn all written efuses. + * The batch mode can be used nested. The commit will be done by the last commit() function. + * The number of begin() functions should be equal to the number of commit() functions. + * + * @note Please note that reading in the batch mode does not show uncommitted changes. + * + * Note: If batch mode is enabled by the first task, at this time the second task cannot write/read efuses. + * The second task will wait for the first task to complete the batch operation. * * \code{c} * // Example of using the batch writing mode. @@ -427,10 +441,20 @@ void esp_efuse_init(uint32_t offset, uint32_t size); * esp_efuse_set_write_protect(EFUSE_BLKx); * esp_efuse_write_reg(EFUSE_BLKx, ...); * esp_efuse_write_block(EFUSE_BLKx, ...); + * esp_efuse_write(ESP_EFUSE_1, 3); // ESP_EFUSE_1 == 1, here we write a new value = 3. The changes will be burn by the commit() function. + * esp_efuse_read_...(ESP_EFUSE_1); // this function returns ESP_EFUSE_1 == 1 because uncommitted changes are not readable, it will be available only after commit. + * ... + * + * // esp_efuse_batch_write APIs can be called recursively. + * esp_efuse_batch_write_begin(); + * esp_efuse_set_write_protect(EFUSE_BLKx); + * esp_efuse_batch_write_commit(); // the burn will be skipped here, it will be done in the last commit(). + * * ... * * // Write all of these fields to the efuse registers * esp_efuse_batch_write_commit(); + * esp_efuse_read_...(ESP_EFUSE_1); // this function returns ESP_EFUSE_1 == 3. * * \endcode * @@ -460,6 +484,271 @@ esp_err_t esp_efuse_batch_write_cancel(void); */ esp_err_t esp_efuse_batch_write_commit(void); + +#ifndef CONFIG_IDF_TARGET_ESP32 + +/** + * @brief Type of key purpose + */ +typedef enum { + ESP_EFUSE_KEY_PURPOSE_USER = 0, + ESP_EFUSE_KEY_PURPOSE_RESERVED = 1, + ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 = 2, + ESP_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 = 3, + ESP_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY = 4, + ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL = 5, + ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG = 6, + ESP_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE = 7, + ESP_EFUSE_KEY_PURPOSE_HMAC_UP = 8, + ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST0 = 9, + ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST1 = 10, + ESP_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST2 = 11, + ESP_EFUSE_KEY_PURPOSE_MAX, +} esp_efuse_purpose_t; + + +/** + * @brief Returns a pointer to a key purpose for an efuse key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * To get the value of this field use esp_efuse_read_field_blob() or esp_efuse_get_key_purpose(). + * + * @return Pointer: If Successful returns a pointer to the corresponding efuse field otherwise NULL. + */ +const esp_efuse_desc_t **esp_efuse_get_purpose_field(esp_efuse_block_t block); + +/** + * @brief Returns a pointer to a key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return Pointer: If Successful returns a pointer to the corresponding efuse field otherwise NULL. + */ +const esp_efuse_desc_t** esp_efuse_get_key(esp_efuse_block_t block); + +/** + * @brief Returns a read protection for the key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return True: The key block is read protected + * False: The key block is readable. + */ +bool esp_efuse_get_key_dis_read(esp_efuse_block_t block); + +/** + * @brief Sets a read protection for the key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_set_key_dis_read(esp_efuse_block_t block); + +/** + * @brief Returns a write protection for the key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return True: The key block is write protected + * False: The key block is writeable. + */ +bool esp_efuse_get_key_dis_write(esp_efuse_block_t block); + +/** + * @brief Sets a write protection for the key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_set_key_dis_write(esp_efuse_block_t block); + +/** + * @brief Returns the current purpose set for an efuse key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return + * - Value: If Successful, it returns the value of the purpose related to the given key block. + * - ESP_EFUSE_KEY_PURPOSE_MAX: Otherwise. + */ +esp_efuse_purpose_t esp_efuse_get_key_purpose(esp_efuse_block_t block); + +/** + * @brief Sets a key purpose for an efuse key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * @param[in] purpose Key purpose. + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_set_key_purpose(esp_efuse_block_t block, esp_efuse_purpose_t purpose); + +/** + * @brief Returns a write protection of the key purpose field for an efuse key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return True: The key purpose is write protected. + * False: The key purpose is writeable. + */ +bool esp_efuse_get_keypurpose_dis_write(esp_efuse_block_t block); + +/** + * @brief Sets a write protection of the key purpose field for an efuse key block. + * + * @param[in] block A key block in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_set_keypurpose_dis_write(esp_efuse_block_t block); + +/** + * @brief Find a key block with the particular purpose set. + * + * @param[in] purpose Purpose to search for. + * @param[out] block Pointer in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX which will be set to the key block if found. + * Can be NULL, if only need to test the key block exists. + * + * @return + * - True: If found, + * - False: If not found (value at block pointer is unchanged). + */ +bool esp_efuse_find_purpose(esp_efuse_purpose_t purpose, esp_efuse_block_t *block); + +/** + * @brief Search for an unused key block and return the first one found. + * + * See esp_efuse_key_block_unused for a description of an unused key block. + * + * @return First unused key block, or EFUSE_BLK_KEY_MAX if no unused key block is found. + */ +esp_efuse_block_t esp_efuse_find_unused_key_block(void); + +/** + * @brief Return the number of unused efuse key blocks in the range EFUSE_BLK_KEY0..EFUSE_BLK_KEY_MAX + */ +unsigned esp_efuse_count_unused_key_blocks(void); + +/** + * @brief Returns true if the key block is unused, false otherwise. + * + * An unused key block is all zero content, not read or write protected, + * and has purpose 0 (ESP_EFUSE_KEY_PURPOSE_USER) + * + * @param block key block to check. + * + * @return + * - True if key block is unused, + * - False if key block is used or the specified block index is not a key block. + */ +bool esp_efuse_key_block_unused(esp_efuse_block_t block); + +/** + * @brief Returns the status of the Secure Boot public key digest revocation bit. + * + * @param[in] num_digest The number of digest in range 0..2 + * + * @return + * - True: If key digest is revoked, + * - False; If key digest is not revoked. + */ +bool esp_efuse_get_digest_revoke(unsigned num_digest); + +/** + * @brief Sets the Secure Boot public key digest revocation bit. + * + * @param[in] num_digest The number of digest in range 0..2 + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_set_digest_revoke(unsigned num_digest); + +/** + * @brief Returns a write protection of the Secure Boot public key digest revocation bit. + * + * @param[in] num_digest The number of digest in range 0..2 + * + * @return True: The revocation bit is write protected. + * False: The revocation bit is writeable. + */ +bool esp_efuse_get_write_protect_of_digest_revoke(unsigned num_digest); + +/** + * @brief Sets a write protection of the Secure Boot public key digest revocation bit. + * + * @param[in] num_digest The number of digest in range 0..2 + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_set_write_protect_of_digest_revoke(unsigned num_digest); + +/** + * @brief Program a block of key data to an efuse block + * + * The burn of a key, protection bits, and a purpose happens in batch mode. + * + * @param[in] block Block to read purpose for. Must be in range EFUSE_BLK_KEY0 to EFUSE_BLK_KEY_MAX. Key block must be unused (esp_efuse_key_block_unused). + * @param[in] purpose Purpose to set for this key. Purpose must be already unset. + * @param[in] key Pointer to data to write. + * @param[in] key_size_bytes Bytes length of data to write. + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_INVALID_STATE: Error in efuses state, unused block not found. + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_write_key(esp_efuse_block_t block, esp_efuse_purpose_t purpose, const void *key, size_t key_size_bytes); + +/** + * @brief Program keys to unused efuse blocks + * + * The burn of keys, protection bits, and purposes happens in batch mode. + * + * @param[in] purposes Array of purposes (purpose[number_of_keys]). + * @param[in] keys Array of keys (uint8_t keys[number_of_keys][32]). Each key is 32 bytes long. + * @param[in] number_of_keys The number of keys to write (up to 6 keys). + * + * @return + * - ESP_OK: Successful. + * - ESP_ERR_INVALID_ARG: Error in the passed arguments. + * - ESP_ERR_INVALID_STATE: Error in efuses state, unused block not found. + * - ESP_ERR_NOT_ENOUGH_UNUSED_KEY_BLOCKS: Error not enough unused key blocks available + * - ESP_ERR_EFUSE_REPEATED_PROG: Error repeated programming of programmed bits is strictly forbidden. + * - ESP_ERR_CODING: Error range of data does not match the coding scheme. + */ +esp_err_t esp_efuse_write_keys(esp_efuse_purpose_t purposes[], uint8_t keys[][32], unsigned number_of_keys); + +#endif // not CONFIG_IDF_TARGET_ESP32 + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_common.h b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_common.h new file mode 100644 index 000000000..a2b43cbd4 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_common.h @@ -0,0 +1,53 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsp_common_H_ +#define _dsp_common_H_ +#include +#include +#include "dsp_err.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief check power of two + * The function check if the argument is power of 2. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @return + * - true if x is power of two + * - false if no + */ +bool dsp_is_power_of_two(int x); + + +/** + * @brief Power of two + * The function return power of 2 for values 2^N. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @return + * - power of two + */ +int dsp_power_of_two(int x); + +#ifdef __cplusplus +} +#endif + +#endif // _dsp_common_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp_common/include/esp_private/gdbstub.h b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_err.h similarity index 69% rename from tools/sdk/esp32/include/esp_common/include/esp_private/gdbstub.h rename to tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_err.h index 9e7243aad..d769664c9 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_private/gdbstub.h +++ b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_err.h @@ -1,9 +1,9 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// Copyright 2018-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 @@ -11,12 +11,13 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GDBSTUB_H -#define GDBSTUB_H -#include -#include "freertos/xtensa_api.h" -void esp_gdbstub_panic_handler(XtExcFrame *frame) __attribute__((noreturn)); +#ifndef _DSP_ERR_H_ +#define _DSP_ERR_H_ -#endif +#include "stdint.h" +#include "esp_err.h" +#include "dsp_err_codes.h" + +#endif // _DSP_ERR_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_err_codes.h b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_err_codes.h new file mode 100644 index 000000000..c8827781a --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_err_codes.h @@ -0,0 +1,27 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsp_error_codes_H_ +#define _dsp_error_codes_H_ + +#define DSP_OK 0 // For internal use only. Please use ESP_OK instead +#define ESP_ERR_DSP_BASE 0x70000 +#define ESP_ERR_DSP_INVALID_LENGTH (ESP_ERR_DSP_BASE + 1) +#define ESP_ERR_DSP_INVALID_PARAM (ESP_ERR_DSP_BASE + 2) +#define ESP_ERR_DSP_PARAM_OUTOFRANGE (ESP_ERR_DSP_BASE + 3) +#define ESP_ERR_DSP_UNINITIALIZED (ESP_ERR_DSP_BASE + 4) +#define ESP_ERR_DSP_REINITIALIZED (ESP_ERR_DSP_BASE + 5) + + +#endif // _dsp_error_codes_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_platform.h new file mode 100644 index 000000000..d04f9dc78 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_platform.h @@ -0,0 +1,25 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef dsp_platform_h_ +#define dsp_platform_h_ +#include "soc/cpu.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/portable.h" +#include "freertos/task.h" +#include "freertos/semphr.h" + +#endif // dsp_platform_h_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_tests.h b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_tests.h new file mode 100644 index 000000000..3042c2d8b --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/common/include/dsp_tests.h @@ -0,0 +1,29 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _DSP_TESTS_H_ +#define _DSP_TESTS_H_ + +#define TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, actual) \ + if (actual >= max_exec) { \ + ESP_LOGE("", "Time error. Expected max: %i, reached: %i", (int)max_exec, (int)actual);\ + TEST_ASSERT_MESSAGE (false, "Exec time takes more than expected! ");\ + }\ + if (actual < min_exec) {\ + ESP_LOGE("", "Time error. Expected min: %i, reached: %i", (int)min_exec, (int)actual);\ + TEST_ASSERT_MESSAGE (false, "Exec time takes less then expected!");\ + } + + +#endif // _DSP_TESTS_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/common/include/esp_dsp.h b/tools/sdk/esp32/include/esp-dsp/modules/common/include/esp_dsp.h new file mode 100644 index 000000000..61f991f93 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/common/include/esp_dsp.h @@ -0,0 +1,61 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _esp_dsp_H_ +#define _esp_dsp_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +// Common includes +#include "dsp_common.h" + +// Signal processing +#include "dsps_dotprod.h" +#include "dsps_math.h" +#include "dsps_fir.h" +#include "dsps_biquad.h" +#include "dsps_biquad_gen.h" +#include "dsps_wind.h" +#include "dsps_conv.h" +#include "dsps_corr.h" + +#include "dsps_d_gen.h" +#include "dsps_h_gen.h" +#include "dsps_tone_gen.h" +#include "dsps_snr.h" +#include "dsps_sfdr.h" + +#include "dsps_fft2r.h" +#include "dsps_fft4r.h" +#include "dsps_dct.h" + +// Matrix operations +#include "dspm_mult.h" + +// Support functions +#include "dsps_view.h" + + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +#include "mat.h" +#endif + +#endif // _esp_dsp_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_ccorr.h b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_ccorr.h new file mode 100644 index 000000000..9d838e556 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_ccorr.h @@ -0,0 +1,63 @@ +// Copyright 2018-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. + +#ifndef _dsps_ccorr_H_ +#define _dsps_ccorr_H_ +#include "dsp_err.h" + +#include "dsps_conv_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/**@{*/ +/** + * @brief Cross correlation + * + * The function make cross correlate between two ignals. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] Signal1: input array with input 1 signal values + * @param[in] siglen1: length of the input 1 signal array + * @param[in] Signal2: input array with input 2 signal values + * @param[in] siglen2: length of the input signal array + * @param corrout: output array with result of cross correlation. The size of dest array must be (siglen1 + siglen2 - 1) !!! + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library (one of the input array are NULL, or if (siglen < patlen)) + */ +esp_err_t dsps_ccorr_f32_ansi(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *corrout); +esp_err_t dsps_ccorr_f32_ae32(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *corrout); +/**}@*/ + +#ifdef __cplusplus +} +#endif + + +#ifdef CONFIG_DSP_OPTIMIZED +#if (dsps_ccorr_f32_ae32_enabled == 1) +#define dsps_ccorr_f32 dsps_ccorr_f32_ae32 +#else +#define dsps_ccorr_f32 dsps_ccorr_f32_ansi +#endif // dsps_ccorr_f32_ae32_enabled +#else +#define dsps_ccorr_f32 dsps_ccorr_f32_ansi +#endif + +#endif // _dsps_conv_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_conv.h b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_conv.h new file mode 100644 index 000000000..7dc9e517b --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_conv.h @@ -0,0 +1,65 @@ +// Copyright 2018-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. + +#ifndef _dsps_conv_H_ +#define _dsps_conv_H_ +#include "dsp_err.h" + +#include "dsps_conv_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/**@{*/ +/** + * @brief Convolution + * + * The function convolve Signal array with Kernel array. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] Signal: input array with signal + * @param[in] siglen: length of the input signal + * @param[in] Kernel: input array with convolution kernel + * @param[in] kernlen: length of the Kernel array + * @param convout: output array with convolution result length of (siglen + Kernel -1) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_conv_f32_ae32(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *convout); +esp_err_t dsps_conv_f32_ansi(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *convout); +/**}@*/ + +#ifdef __cplusplus +} +#endif + + +#ifdef CONFIG_DSP_OPTIMIZED + +#if (dsps_conv_f32_ae32_enabled == 1) +#define dsps_conv_f32 dsps_conv_f32_ae32 +#else +#define dsps_conv_f32 dsps_conv_f32_ansi +#endif // dsps_conv_f32_ae32_enabled + +#else +#define dsps_conv_f32 dsps_conv_f32_ansi +#endif + +#endif // _dsps_conv_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_conv_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_conv_platform.h new file mode 100644 index 000000000..0a1019561 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_conv_platform.h @@ -0,0 +1,16 @@ +#ifndef _dsps_conv_platform_H_ +#define _dsps_conv_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_conv_f32_ae32_enabled 1 +#define dsps_ccorr_f32_ae32_enabled 1 +#define dsps_corr_f32_ae32_enabled 1 + +#endif + +#endif // _dsps_conv_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_corr.h b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_corr.h new file mode 100644 index 000000000..7104d30c4 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/conv/include/dsps_corr.h @@ -0,0 +1,63 @@ +// Copyright 2018-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. + +#ifndef _dsps_corr_H_ +#define _dsps_corr_H_ +#include "dsp_err.h" + +#include "dsps_conv_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/**@{*/ +/** + * @brief Correlation with pattern + * + * The function correlate input sigla array with pattern array. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] Signal: input array with signal values + * @param[in] siglen: length of the signal array + * @param[in] Pattern: input array with pattern values + * @param[in] patlen: length of the pattern array. The siglen must be bigger then patlen! + * @param dest: output array with result of correlation + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library (one of the input array are NULL, or if (siglen < patlen)) + */ +esp_err_t dsps_corr_f32_ansi(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *dest); +esp_err_t dsps_corr_f32_ae32(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *dest); +/**}@*/ + +#ifdef __cplusplus +} +#endif + + +#ifdef CONFIG_DSP_OPTIMIZED +#if (dsps_corr_f32_ae32_enabled == 1) +#define dsps_corr_f32 dsps_corr_f32_ae32 +#else +#define dsps_corr_f32 dsps_corr_f32_ansi +#endif // dsps_corr_f32_ae32_enabled +#else +#define dsps_corr_f32 dsps_corr_f32_ansi +#endif + +#endif // _dsps_corr_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/dct/include/dsps_dct.h b/tools/sdk/esp32/include/esp-dsp/modules/dct/include/dsps_dct.h new file mode 100644 index 000000000..bc0f415c1 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/dct/include/dsps_dct.h @@ -0,0 +1,95 @@ +// Copyright 2018-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. + +#ifndef _dsps_dct_H_ +#define _dsps_dct_H_ +#include "dsp_err.h" +#include "sdkconfig.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**@{*/ +/** + * @brief DCT of radix 2, unscaled + * + * DCT type II of radix 2, unscaled + * Function is FFT based + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[inout] data: input/output array with size of N*2. An elements located: Re[0],Re[1], , ... Re[N-1], any data... up to N*2 + * result of DCT will be stored to this array from 0...N-1. + * Size of data array must be N*2!!! + * @param[in] N: Size of DCT transform. Size of data array must be N*2!!! + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_dct_f32(float *data, int N); + +/**@}*/ + +/**@{*/ +/** + * @brief Inverce DCT of radix 2 + * + * Inverce DCT type III of radix 2, unscaled + * Function is FFT based + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[inout] data: input/output array with size of N*2. An elements located: Re[0],Re[1], , ... Re[N-1], any data... up to N*2 + * result of DCT will be stored to this array from 0...N-1. + * Size of data array must be N*2!!! + * @param[in] N: Size of DCT transform. Size of data array must be N*2!!! + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_dct_inv_f32(float *data, int N); + +/**@}*/ + +/**@{*/ +/** + * @brief DCTs + * + * Direct DCT type II and Inverce DCT type III, unscaled + * These functions used as a reference for general purpose. These functions are not optimyzed! + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[in] data: input/output array with size of N. An elements located: Re[0],Re[1], , ... Re[N-1] + * @param[in] N: Size of DCT transform. Size of data array must be N*2!!! + * @param[out] result: output result array with size of N. + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_dct_f32_ref(float *data, int N, float *result); +esp_err_t dsps_dct_inverce_f32_ref(float *data, int N, float *result); +/**@}*/ + + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_dct_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/dotprod/include/dsps_dotprod.h b/tools/sdk/esp32/include/esp-dsp/modules/dotprod/include/dsps_dotprod.h new file mode 100644 index 000000000..ae2e919b2 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/dotprod/include/dsps_dotprod.h @@ -0,0 +1,117 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _DSPI_DOTPROD_H_ +#define _DSPI_DOTPROD_H_ + +#include "esp_log.h" +#include "dsp_err.h" + +#include "dsps_dotprod_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif +// These functions calculates dotproduct of two vectors. + +/**@{*/ +/** + * @brief dot product of two 16 bit vectors + * Dot product calculation for two signed 16 bit arrays: *dest += (src1[i] * src2[i]) >> (15-shift); i= [0..N) + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[in] src1 source array 1 + * @param[in] src2 source array 2 + * @param dest destination pointer + * @param[in] len length of input arrays + * @param[in] shift shift of the result. + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_dotprod_s16_ansi(const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift); +esp_err_t dsps_dotprod_s16_ae32(const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift); +/**@}*/ + + +/**@{*/ +/** + * @brief dot product of two float vectors + * Dot product calculation for two floating point arrays: *dest += (src1[i] * src2[i]); i= [0..N) + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[in] src1 source array 1 + * @param[in] src2 source array 2 + * @param dest destination pointer + * @param[in] len length of input arrays + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_dotprod_f32_ansi(const float *src1, const float *src2, float *dest, int len); +esp_err_t dsps_dotprod_f32_ae32(const float *src1, const float *src2, float *dest, int len); +/**@}*/ + +/**@{*/ +/** + * @brief dot product of two float vectors with step + * Dot product calculation for two floating point arrays: *dest += (src1[i*step1] * src2[i*step2]); i= [0..N) + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[in] src1 source array 1 + * @param[in] src2 source array 2 + * @param dest destination pointer + * @param[in] len length of input arrays + * @param[in] step1 step over elements in first array + * @param[in] step2 step over elements in second array + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_dotprode_f32_ansi(const float *src1, const float *src2, float *dest, int len, int step1, int step2); +esp_err_t dsps_dotprode_f32_ae32(const float *src1, const float *src2, float *dest, int len, int step1, int step2); +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED +#if (dsps_dotprod_s16_ae32_enabled == 1) +#define dsps_dotprod_s16 dsps_dotprod_s16_ae32 +#else +#define dsps_dotprod_s16 dsps_dotprod_s16_ansi +#endif // dsps_dotprod_s16_ae32_enabled +#if (dsps_dotprod_f32_ae32_enabled == 1) +#define dsps_dotprod_f32 dsps_dotprod_f32_ae32 +#else +#define dsps_dotprod_f32 dsps_dotprod_f32_ansi +#endif // dsps_dotprod_f32_ae32_enabled +#if (dsps_dotprode_f32_ae32_enabled == 1) +#define dsps_dotprode_f32 dsps_dotprode_f32_ae32 +#else +#define dsps_dotprode_f32 dsps_dotprode_f32_ansi +#endif // dsps_dotprode_f32_ae32_enabled + +#else // CONFIG_DSP_OPTIMIZED +#define dsps_dotprod_s16 dsps_dotprod_s16_ansi +#define dsps_dotprod_f32 dsps_dotprod_f32_ansi +#define dsps_dotprode_f32 dsps_dotprode_f32_ansi +#endif // CONFIG_DSP_OPTIMIZED + +#endif // _DSPI_DOTPROD_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/dotprod/include/dsps_dotprod_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/dotprod/include/dsps_dotprod_platform.h new file mode 100644 index 000000000..83bbafb3c --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/dotprod/include/dsps_dotprod_platform.h @@ -0,0 +1,21 @@ +#ifndef _dsps_dotprod_platform_H_ +#define _dsps_dotprod_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dotprod_f32_ae32_enabled 1 +#define dotprode_f32_ae32_enabled 1 + +#endif // + +#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) + +#define dsps_dotprod_s16_ae32_enabled 1 + +#endif // + +#endif // _dsps_dotprod_platform_H_ diff --git a/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft2r.h b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft2r.h new file mode 100644 index 000000000..25f6fb8a1 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft2r.h @@ -0,0 +1,233 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_fft2r_H_ +#define _dsps_fft2r_H_ + +#include "dsp_err.h" +#include "sdkconfig.h" +#include "dsps_fft_tables.h" + +#ifndef CONFIG_DSP_MAX_FFT_SIZE +#define CONFIG_DSP_MAX_FFT_SIZE 4096 +#endif // CONFIG_DSP_MAX_FFT_SIZE + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern float *dsps_fft_w_table_fc32; +extern int dsps_fft_w_table_size; +extern uint8_t dsps_fft2r_initialized; + +extern int16_t *dsps_fft_w_table_sc16; +extern int dsps_fft_w_table_sc16_size; +extern uint8_t dsps_fft2r_sc16_initialized; + + +/**@{*/ +/** + * @brief init fft tables + * + * Initialization of Complex FFT. This function initialize coefficients table. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] fft_table_buff: pointer to floating point buffer where sin/cos table will be stored + * if this parameter set to NULL, and table_size value is more then 0, then + * dsps_fft2r_init_fc32 will allocate buffer internally + * @param[in] table_size: size of the buffer in float words + * if fft_table_buff is NULL and table_size is not 0, buffer will be allocated internally. + * If table_size is 0, buffer will not be allocated. + * + * @return + * - ESP_OK on success + * - ESP_ERR_DSP_PARAM_OUTOFRANGE if table_size > CONFIG_DSP_MAX_FFT_SIZE + * - ESP_ERR_DSP_REINITIALIZED if buffer already allocated internally by other function + * - One of the error codes from DSP library + */ +esp_err_t dsps_fft2r_init_fc32(float *fft_table_buff, int table_size); +esp_err_t dsps_fft2r_init_sc16(int16_t *fft_table_buff, int table_size); +/**@}*/ + +/**@{*/ +/** + * @brief deinit fft tables + * + * Free resources of Complex FFT. This function delete coefficients table if it was allocated by dsps_fft2r_init_fc32. + * The implementation use ANSI C and could be compiled and run on any platform + * + * + * @return + */ +void dsps_fft2r_deinit_fc32(); +void dsps_fft2r_deinit_sc16(); +/**@}*/ + +/**@{*/ +/** + * @brief complex FFT of radix 2 + * + * Complex FFT of radix 2 + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[inout] data: input/output complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] + * result of FFT will be stored to this array. + * @param[in] N: Number of complex elements in input array + * @param[in] w: pointer to the sin/cos table + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_fft2r_fc32_ansi_(float *data, int N, float *w); +esp_err_t dsps_fft2r_fc32_ae32_(float *data, int N, float *w); +esp_err_t dsps_fft2r_sc16_ansi_(int16_t *data, int N, int16_t *w); +esp_err_t dsps_fft2r_sc16_ae32_(int16_t *data, int N, int16_t *w); +/**@}*/ +// This is workaround because linker generates permanent error when assembler uses +// direct access to the table pointer +#define dsps_fft2r_fc32_ae32(data, N) dsps_fft2r_fc32_ae32_(data, N, dsps_fft_w_table_fc32) +#define dsps_fft2r_sc16_ae32(data, N) dsps_fft2r_sc16_ae32_(data, N, dsps_fft_w_table_sc16) +#define dsps_fft2r_fc32_ansi(data, N) dsps_fft2r_fc32_ansi_(data, N, dsps_fft_w_table_fc32) +#define dsps_fft2r_sc16_ansi(data, N) dsps_fft2r_sc16_ansi_(data, N, dsps_fft_w_table_sc16) + + +/**@{*/ +/** + * @brief bit reverse operation for the complex input array + * + * Bit reverse operation for the complex input array + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] data: input/ complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] + * result of FFT will be stored to this array. + * @param[in] N: Number of complex elements in input array + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_bit_rev_fc32_ansi(float *data, int N); +esp_err_t dsps_bit_rev_sc16_ansi(int16_t *data, int N); +esp_err_t dsps_bit_rev2r_fc32(float *data, int N); + +/**@{*/ + +esp_err_t dsps_bit_rev_lookup_fc32_ansi(float *data, int reverse_size, uint16_t *reverse_tab); +esp_err_t dsps_bit_rev_lookup_fc32_ae32(float *data, int reverse_size, uint16_t *reverse_tab); + +/** + * @brief Generate coefficients table for the FFT radix 2 + * + * Generate coefficients table for the FFT radix 2. This function called inside init. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] w: memory location to store coefficients. + * By default coefficients will be stored to the dsps_fft_w_table_fc32. + * Maximum size of the FFT must be setup in menuconfig + * @param[in] N: maximum size of the FFT that will be used + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_gen_w_r2_fc32(float *w, int N); +esp_err_t dsps_gen_w_r2_sc16(int16_t *w, int N); +/**@}*/ + +/**@{*/ +/** + * @brief Convert complex array to two real arrays + * + * Convert complex array to two real arrays in case if input was two real arrays. + * This function have to be used if FFT used to process real data. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] data: Input complex array and result of FFT2R. + * input has size of 2*N, because contains real and imaginary part. + * result will be stored to the same array. + * Input1: input[0..N-1], Input2: input[N..2*N-1] + * @param[in] N: Number of complex elements in input array + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_cplx2reC_fc32_ansi(float *data, int N); +esp_err_t dsps_cplx2reC_sc16(int16_t *data, int N); +/**@}*/ + +/**@{*/ +/** + * @brief Convert complex FFT result to real array + * + * Convert FFT result of complex FFT for resl input to real array. + * This function have to be used if FFT used to process real data. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] data: Input complex array and result of FFT2R. + * input has size of 2*N, because contains real and imaginary part. + * result will be stored to the same array. + * Input1: input[0..N-1], Input2: input[N..2*N-1] + * @param[in] N: Number of complex elements in input array + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_cplx2real_sc16_ansi(int16_t *data, int N); +/**@}*/ +esp_err_t dsps_cplx2real256_fc32_ansi(float *data); + +esp_err_t dsps_gen_bitrev2r_table(int N, int step, char *name_ext); + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED +#define dsps_bit_rev_fc32 dsps_bit_rev_fc32_ansi +#define dsps_cplx2reC_fc32 dsps_cplx2reC_fc32_ansi + +#if (dsps_fft2r_fc32_ae32_enabled == 1) +#define dsps_fft2r_fc32 dsps_fft2r_fc32_ae32 +#else +#define dsps_fft2r_fc32 dsps_fft2r_fc32_ansi +#endif + +#if (dsps_fft2r_sc16_ae32_enabled == 1) +#define dsps_fft2r_sc16 dsps_fft2r_sc16_ae32 +#else +#define dsps_fft2r_sc16 dsps_fft2r_sc16_ansi +#endif + +#if (dsps_bit_rev_lookup_fc32_ae32_enabled == 1) +# define dsps_bit_rev_lookup_fc32 dsps_bit_rev_lookup_fc32_ae32 +#else +#define dsps_bit_rev_lookup_fc32 dsps_bit_rev_lookup_fc32_ansi +#endif + +#else // CONFIG_DSP_OPTIMIZED + +#define dsps_fft2r_fc32 dsps_fft2r_fc32_ansi +#define dsps_bit_rev_fc32 dsps_bit_rev_fc32_ansi +#define dsps_cplx2reC_fc32 dsps_cplx2reC_fc32_ansi +#define dsps_bit_rev_sc16 dsps_bit_rev_sc16_ansi +#define dsps_bit_rev_lookup_fc32 dsps_bit_rev_lookup_fc32_ansi + +#endif // CONFIG_DSP_OPTIMIZED + +#endif // _dsps_fft2r_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft2r_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft2r_platform.h new file mode 100644 index 000000000..90a67ffa1 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft2r_platform.h @@ -0,0 +1,28 @@ +#ifndef _dsps_fft2r_platform_H_ +#define _dsps_fft2r_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_fft2r_fc32_ae32_enabled 1 + +#endif // + +#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) + +#define dsps_fft2r_sc16_ae32_enabled 1 + +#endif // + +#if (XCHAL_HAVE_LOOPS == 1) + +#define dsps_bit_rev_lookup_fc32_ae32_enabled 1 + +#endif // + + + +#endif // _dsps_fft2r_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft4r.h b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft4r.h new file mode 100644 index 000000000..675e716f6 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft4r.h @@ -0,0 +1,174 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_fft4r_H_ +#define _dsps_fft4r_H_ +#include "dsp_err.h" +#include "sdkconfig.h" + +#include "dsps_fft_tables.h" +#include "dsps_fft4r_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern float *dsps_fft4r_w_table_fc32; +extern int dsps_fft4r_w_table_size; +extern uint8_t dsps_fft4r_initialized; + +extern int16_t *dsps_fft4r_w_table_sc16; +extern int dsps_fft4r_w_table_sc16_size; +extern uint8_t dsps_fft4r_sc16_initialized; + +/**@{*/ +/** + * @brief init fft tables + * + * Initialization of Complex FFT Radix-4. This function initialize coefficients table. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] fft_table_buff: pointer to floating point buffer where sin/cos table will be stored + * if this parameter set to NULL, and table_size value is more then 0, then + * dsps_fft4r_init_fc32 will allocate buffer internally + * @param[in] max_fft_size: maximum fft size. The buffer for sin/cos table that will be used for radix-4 it's + * four times maximum length of FFT. + * if fft_table_buff is NULL and table_size is not 0, buffer will be allocated internally. + * If table_size is 0, buffer will not be allocated. + * + * @return + * - ESP_OK on success + * - ESP_ERR_DSP_PARAM_OUTOFRANGE if table_size > CONFIG_DSP_MAX_FFT_SIZE + * - ESP_ERR_DSP_REINITIALIZED if buffer already allocated internally by other function + * - One of the error codes from DSP library + */ +esp_err_t dsps_fft4r_init_fc32(float *fft_table_buff, int max_fft_size); +/**@}*/ + +/**@{*/ +/** + * @brief deinit fft tables + * + * Free resources of Complex FFT Radix-4. This function delete coefficients table if it was allocated by dsps_fft4r_init_fc32. + * The implementation use ANSI C and could be compiled and run on any platform + * + * + * @return + */ +void dsps_fft4r_deinit_fc32(); +/**@}*/ + +/**@{*/ +/** + * @brief complex FFT of radix 4 + * + * Complex FFT of radix 4 + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[inout] data: input/output complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] + * result of FFT will be stored to this array. + * @param[in] N: Number of complex elements in input array + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_fft4r_fc32_ansi_(float *data, int N, float *table, int table_size); +esp_err_t dsps_fft4r_fc32_ae32_(float *data, int N, float *table, int table_size); +/**@}*/ +// This is workaround because linker generates permanent error when assembler uses +// direct access to the table pointer +#define dsps_fft4r_fc32_ansi(data, N) dsps_fft4r_fc32_ansi_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) +#define dsps_fft4r_fc32_ae32(data, N) dsps_fft4r_fc32_ae32_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) + +/**@{*/ +/** + * @brief bit reverse operation for the complex input array radix-4 + * + * Bit reverse operation for the complex input array + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] data: input/ complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] + * result of FFT will be stored to this array. + * @param[in] N: Number of complex elements in input array + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_bit_rev4r_fc32(float *data, int N); +esp_err_t dsps_bit_rev4r_fc32_ae32(float *data, int N); +esp_err_t dsps_bit_rev4r_direct_fc32_ansi(float *data, int N); +esp_err_t dsps_bit_rev4r_sc16_ansi(int16_t *data, int N); + + +/**@{*/ +/** + * @brief Convert complex FFT result to real array + * + * Convert FFT result of complex FFT for real input to real array. + * This function have to be used if FFT used to process real data. + * This function use tabels inside and can be used only it dsps_fft4r_init_fc32(...) was + * called and FFT4 was initialized. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[inout] data: Input complex array and result of FFT2R/FFT4R. + * input has size of 2*N, because contains real and imaginary part. + * result will be stored to the same array. + * Input1: input[0..N-1], Input2: input[N..2*N-1] + * @param[in] N: Number of complex elements in input array + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_cplx2real_fc32_ansi_(float *data, int N, float *table, int table_size); +esp_err_t dsps_cplx2real_fc32_ae32_(float *data, int N, float *table, int table_size); +/**@}*/ +#define dsps_cplx2real_fc32_ansi(data, N) dsps_cplx2real_fc32_ansi_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) +#define dsps_cplx2real_fc32_ae32(data, N) dsps_cplx2real_fc32_ae32_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) + + +esp_err_t dsps_gen_bitrev4r_table(int N, int step, char *name_ext); + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED +#if (dsps_fft4r_fc32_ae32_enabled == 1) +#define dsps_fft4r_fc32 dsps_fft4r_fc32_ae32 +#else +#define dsps_fft4r_fc32 dsps_fft4r_fc32_ansi +#endif // dsps_fft4r_fc32_ae32_enabled + +#define dsps_fft4r_sc16 dsps_fft4r_sc16_ae32 +#define dsps_bit_rev4r_fc32 dsps_bit_rev4r_fc32_ae32 + +#if (dsps_cplx2real_fc32_ae32_enabled == 1) +#define dsps_cplx2real_fc32 dsps_cplx2real_fc32_ae32 +#else +#define dsps_cplx2real_fc32 dsps_cplx2real_fc32_ansi +#endif // dsps_cplx2real_fc32_ae32_enabled + +#else +#define dsps_fft4r_fc32 dsps_fft4r_fc32_ansi +#define dsps_fft4r_sc16 dsps_fft4r_sc16_ansi +#define dsps_bit_rev4r_fc32 dsps_bit_rev4r_fc32_ansi +#define dsps_cplx2real_fc32 dsps_cplx2real_fc32_ansi +#endif + +#endif // _dsps_fft4r_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft4r_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft4r_platform.h new file mode 100644 index 000000000..053449222 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft4r_platform.h @@ -0,0 +1,30 @@ +#ifndef _dsps_fft4r_platform_H_ +#define _dsps_fft4r_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_fft4r_fc32_ae32_enabled 1 +#define dsps_cplx2real_fc32_ae32_enabled 1 + +#endif // + + +#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) + +#define dsps_fft2r_sc16_ae32_enabled 1 + +#endif // + +#if (XCHAL_HAVE_LOOPS == 1) + +#define dsps_bit_rev_lookup_fc32_ae32_enabled 1 + +#endif // + + + +#endif // _dsps_fft4r_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft_tables.h b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft_tables.h new file mode 100644 index 000000000..94fbab501 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/fft/include/dsps_fft_tables.h @@ -0,0 +1,89 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_fft_tables_H_ +#define _dsps_fft_tables_H_ + + +#ifdef __cplusplus +extern "C" +{ +#endif +extern const uint16_t bitrev2r_table_16_fc32[]; +extern const uint16_t bitrev2r_table_16_fc32_size; + +extern const uint16_t bitrev2r_table_32_fc32[]; +extern const uint16_t bitrev2r_table_32_fc32_size; + +extern const uint16_t bitrev2r_table_64_fc32[]; +extern const uint16_t bitrev2r_table_64_fc32_size; + +extern const uint16_t bitrev2r_table_128_fc32[]; +extern const uint16_t bitrev2r_table_128_fc32_size; + +extern const uint16_t bitrev2r_table_256_fc32[]; +extern const uint16_t bitrev2r_table_256_fc32_size; + +extern const uint16_t bitrev2r_table_512_fc32[]; +extern const uint16_t bitrev2r_table_512_fc32_size; + +extern const uint16_t bitrev2r_table_1024_fc32[]; +extern const uint16_t bitrev2r_table_1024_fc32_size; + +extern const uint16_t bitrev2r_table_2048_fc32[]; +extern const uint16_t bitrev2r_table_2048_fc32_size; + +extern const uint16_t bitrev2r_table_4096_fc32[]; +extern const uint16_t bitrev2r_table_4096_fc32_size; + +void dsps_fft2r_rev_tables_init_fc32(void); +extern uint16_t *dsps_fft2r_rev_tables_fc32[]; +extern const uint16_t dsps_fft2r_rev_tables_fc32_size[]; + +extern const uint16_t bitrev4r_table_16_fc32[]; +extern const uint16_t bitrev4r_table_16_fc32_size; + +extern const uint16_t bitrev4r_table_32_fc32[]; +extern const uint16_t bitrev4r_table_32_fc32_size; + +extern const uint16_t bitrev4r_table_64_fc32[]; +extern const uint16_t bitrev4r_table_64_fc32_size; + +extern const uint16_t bitrev4r_table_128_fc32[]; +extern const uint16_t bitrev4r_table_128_fc32_size; + +extern const uint16_t bitrev4r_table_256_fc32[]; +extern const uint16_t bitrev4r_table_256_fc32_size; + +extern const uint16_t bitrev4r_table_512_fc32[]; +extern const uint16_t bitrev4r_table_512_fc32_size; + +extern const uint16_t bitrev4r_table_1024_fc32[]; +extern const uint16_t bitrev4r_table_1024_fc32_size; + +extern const uint16_t bitrev4r_table_2048_fc32[]; +extern const uint16_t bitrev4r_table_2048_fc32_size; + +extern const uint16_t bitrev4r_table_4096_fc32[]; +extern const uint16_t bitrev4r_table_4096_fc32_size; + +void dsps_fft4r_rev_tables_init_fc32(void); +extern uint16_t *dsps_fft4r_rev_tables_fc32[]; +extern const uint16_t dsps_fft4r_rev_tables_fc32_size[]; + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_fft_tables_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/fir/include/dsps_fir.h b/tools/sdk/esp32/include/esp-dsp/modules/fir/include/dsps_fir.h new file mode 100644 index 000000000..b18fc9c5e --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/fir/include/dsps_fir.h @@ -0,0 +1,146 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_fir_H_ +#define _dsps_fir_H_ + + +#include "dsp_err.h" + +#include "dsps_fir_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Data struct of f32 fir filter + * + * This structure used by filter internally. User should access this structure only in case of + * extensions for the DSP Library. + * All fields of this structure initialized by dsps_fir_init_f32(...) function. + */ +typedef struct fir_f32_s { + float *coeffs; /*!< Pointer to the coefficient buffer.*/ + float *delay; /*!< Pointer to the delay line buffer.*/ + int N; /*!< FIR filter coefficients amount.*/ + int pos; /*!< Position in delay line.*/ + int decim; /*!< Decimation factor.*/ + int d_pos; /*!< Actual decimation counter.*/ +} fir_f32_t; + +/** + * @brief initialize structure for 32 bit FIR filter + * + * Function initialize structure for 32 bit floating point FIR filter + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param fir: pointer to fir filter structure, that must be preallocated + * @param coeffs: array with FIR filter coefficients. Must be length N + * @param delay: array for FIR filter delay line. Must be length N + * @param N: FIR filter length. Length of coeffs and delay arrays. + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_fir_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int N); + +/** + * @brief initialize structure for 32 bit Decimation FIR filter + * Function initialize structure for 32 bit floating point FIR filter with decimation + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param fir: pointer to fir filter structure, that must be preallocated + * @param coeffs: array with FIR filter coefficients. Must be length N + * @param delay: array for FIR filter delay line. Must be length N + * @param N: FIR filter length. Length of coeffs and delay arrays. + * @param decim: decimation factor. + * @param start_pos: initial value of decimation counter. Must be [0..d) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_fird_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int N, int decim, int start_pos); + + +/**@{*/ +/** + * @brief FIR filter + * + * Function implements FIR filter + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param fir: pointer to fir filter structure, that must be initialized before + * @param[in] input: input array + * @param[out] output: array with result of FIR filter + * @param[in] len: length of input and result arrays + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_fir_f32_ansi(fir_f32_t *fir, const float *input, float *output, int len); +esp_err_t dsps_fir_f32_ae32(fir_f32_t *fir, const float *input, float *output, int len); +/**@}*/ + +/**@{*/ +/** + * @brief Decimation FIR filter + * + * Function implements FIR filter with decimation + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param fir: pointer to fir filter structure, that must be initialized before + * @param input: input array + * @param output: array with result of FIR filter + * @param len: length of input and result arrays + * + * @return: function returns amount of samples stored to the output array + * depends on the previous state value could be [0..len/decimation] + */ +int dsps_fird_f32_ansi(fir_f32_t *fir, const float *input, float *output, int len); +int dsps_fird_f32_ae32(fir_f32_t *fir, const float *input, float *output, int len); +/**@}*/ + + +#ifdef __cplusplus +} +#endif + + +#if CONFIG_DSP_OPTIMIZED + +#if (dsps_fir_f32_ae32_enabled == 1) +#define dsps_fir_f32 dsps_fir_f32_ae32 +#else +#define dsps_fir_f32 dsps_fir_f32_ansi +#endif + +#if (dsps_fird_f32_ae32_enabled == 1) +#define dsps_fird_f32 dsps_fird_f32_ae32 +#else +#define dsps_fird_f32 dsps_fird_f32_ansi +#endif + +#else // CONFIG_DSP_OPTIMIZED +#define dsps_fir_f32 dsps_fir_f32_ansi +#define dsps_fird_f32 dsps_fird_f32_ansi +#endif // CONFIG_DSP_OPTIMIZED + +#endif // _dsps_fir_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/fir/include/dsps_fir_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/fir/include/dsps_fir_platform.h new file mode 100644 index 000000000..3715edef9 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/fir/include/dsps_fir_platform.h @@ -0,0 +1,15 @@ +#ifndef _dsps_fir_platform_H_ +#define _dsps_fir_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_fir_f32_ae32_enabled 1 +#define dsps_fird_f32_ae32_enabled 1 + +#endif // + +#endif // _dsps_fir_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad.h b/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad.h new file mode 100644 index 000000000..8e809eef4 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad.h @@ -0,0 +1,66 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_biquad_H_ +#define _dsps_biquad_H_ + +#include "dsp_err.h" + +#include "dsps_add_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**@{*/ +/** + * @brief IIR filter + * + * IIR filter 2nd order direct form II (bi quad) + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[in] input: input array + * @param output: output array + * @param len: length of input and output vectors + * @param coef: array of coefficients. b0,b1,b2,a1,a2 + * expected that a0 = 1. b0..b2 - numerator, a0..a2 - denominator + * @param w: delay line w0,w1. Length of 2. + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_f32_ansi(const float *input, float *output, int len, float *coef, float *w); +esp_err_t dsps_biquad_f32_ae32(const float *input, float *output, int len, float *coef, float *w); +/**@}*/ + + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED +#if (dsps_biquad_f32_ae32_enabled == 1) +#define dsps_biquad_f32 dsps_biquad_f32_ae32 +#else +#define dsps_biquad_f32 dsps_biquad_f32_ansi +#endif +#else // CONFIG_DSP_OPTIMIZED +#define dsps_biquad_f32 dsps_biquad_f32_ansi +#endif // CONFIG_DSP_OPTIMIZED + + +#endif // _dsps_biquad_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad_gen.h b/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad_gen.h new file mode 100644 index 000000000..750dc4dff --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad_gen.h @@ -0,0 +1,200 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_biquad_gen_H_ +#define _dsps_biquad_gen_H_ + +#include "dsp_err.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +// Common rules for all generated coefficients. +// The coefficients placed to the array as follows: +// coeffs[0] = b0; +// coeffs[1] = b1; +// coeffs[2] = b2; +// coeffs[3] = a1; +// coeffs[4] = a2; +// a0 - are not placed and expected always as == 1 + +/** + * @brief LPF IIR filter coefficients + * Coefficients for low pass 2nd order IIR filter (bi-quad) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter cut off frequency in range of 0..0.5 (normalized to sample frequency) + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_lpf_f32(float *coeffs, float f, float qFactor); + +/** + * @brief HPF IIR filter coefficients + * + * Coefficients for high pass 2nd order IIR filter (bi-quad) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter cut off frequency in range of 0..0.5 (normalized to sample frequency) + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_hpf_f32(float *coeffs, float f, float qFactor); + +/** + * @brief BPF IIR filter coefficients + * + * Coefficients for band pass 2nd order IIR filter (bi-quad) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter center frequency in range of 0..0.5 (normalized to sample frequency) + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_bpf_f32(float *coeffs, float f, float qFactor); + +/** + * @brief 0 dB BPF IIR filter coefficients + * + * Coefficients for band pass 2nd order IIR filter (bi-quad) with 0 dB gain in passband + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter center frequency in range of 0..0.5 (normalized to sample frequency) + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_bpf0db_f32(float *coeffs, float f, float qFactor); + +/** + * @brief Notch IIR filter coefficients + * + * Coefficients for notch 2nd order IIR filter (bi-quad) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) + * @param gain: gain in stopband in dB + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_notch_f32(float *coeffs, float f, float gain, float qFactor); + +/** + * @brief Allpass 360 degree IIR filter coefficients + * + * Coefficients for all pass 2nd order IIR filter (bi-quad) with 360 degree phase shift + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_allpass360_f32(float *coeffs, float f, float qFactor); + +/** + * @brief Allpass 180 degree IIR filter coefficients + * + * Coefficients for all pass 2nd order IIR filter (bi-quad) with 180 degree phase shift + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_allpass180_f32(float *coeffs, float f, float qFactor); + +/** + * @brief peak IIR filter coefficients + * + * Coefficients for peak 2nd order IIR filter (bi-quad) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_peakingEQ_f32(float *coeffs, float f, float qFactor); + +/** + * @brief low shelf IIR filter coefficients + * + * Coefficients for low pass Shelf 2nd order IIR filter (bi-quad) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) + * @param gain: gain in stopband in dB + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_lowShelf_f32(float *coeffs, float f, float gain, float qFactor); + +/** + * @brief high shelf IIR filter coefficients + * + * Coefficients for high pass Shelf 2nd order IIR filter (bi-quad) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 + * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) + * @param gain: gain in stopband in dB + * @param qFactor: Q factor of filter + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_biquad_gen_highShelf_f32(float *coeffs, float f, float gain, float qFactor); + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_biquad_gen_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad_platform.h new file mode 100644 index 000000000..41551735d --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/iir/include/dsps_biquad_platform.h @@ -0,0 +1,14 @@ +#ifndef _dsps_biquad_platform_H_ +#define _dsps_biquad_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_biquad_f32_ae32_enabled 1 + +#endif + +#endif // _dsps_biquad_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/add/include/dsps_add.h b/tools/sdk/esp32/include/esp-dsp/modules/math/add/include/dsps_add.h new file mode 100644 index 000000000..32a15eb2f --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/add/include/dsps_add.h @@ -0,0 +1,78 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_add_H_ +#define _dsps_add_H_ +#include "dsp_err.h" + +#include "dsps_add_platform.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/**@{*/ +/** + * @brief add two arrays + * + * The function add one input array to another + * out[i*step_out] = input1[i*step1] + input2[i*step2]; i=[0..len) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input1: input array 1 + * @param[in] input2: input array 2 + * @param output: output array + * @param len: amount of operations for arrays + * @param step1: step over input array 1 (by default should be 1) + * @param step2: step over input array 2 (by default should be 1) + * @param step_out: step over output array (by default should be 1) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_add_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); +esp_err_t dsps_add_f32_ae32(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); + +esp_err_t dsps_add_s16_ansi(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift); +esp_err_t dsps_add_s16_ae32(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift); +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED + +#if (dsps_add_f32_ae32_enabled == 1) +#define dsps_add_f32 dsps_add_f32_ae32 +#else +#define dsps_add_f32 dsps_add_f32_ansi +#endif + +#if (dsps_add_s16_ae32_enabled == 1) +#define dsps_add_s16 dsps_add_s16_ae32 +#else +#define dsps_add_s16 dsps_add_s16_ansi +#endif + +#else // CONFIG_DSP_OPTIMIZED +#define dsps_add_f32 dsps_add_f32_ansi +#define dsps_add_s16 dsps_add_s16_ansi +#endif // CONFIG_DSP_OPTIMIZED + +#endif // _dsps_add_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/add/include/dsps_add_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/math/add/include/dsps_add_platform.h new file mode 100644 index 000000000..18dab1f2b --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/add/include/dsps_add_platform.h @@ -0,0 +1,19 @@ +#ifndef _dsps_add_platform_H_ +#define _dsps_add_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_add_f32_ae32_enabled 1 + +#endif + +#if (XCHAL_HAVE_LOOPS == 1) +#define dsps_add_s16_ae32_enabled 1 +#endif + + +#endif // _dsps_add_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/addc/include/dsps_addc.h b/tools/sdk/esp32/include/esp-dsp/modules/math/addc/include/dsps_addc.h new file mode 100644 index 000000000..595320d52 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/addc/include/dsps_addc.h @@ -0,0 +1,65 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_addc_H_ +#define _dsps_addc_H_ +#include "dsp_err.h" + +#include "dsps_addc_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/**@{*/ +/** + * @brief add constant + * + * The function adds constant to the input array + * x[i*step_out] = y[i*step_in] + C; i=[0..len) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input: input array + * @param output: output array + * @param len: amount of operations for arrays + * @param C: constant value + * @param step_in: step over input array (by default should be 1) + * @param step_out: step over output array (by default should be 1) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_addc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out); +esp_err_t dsps_addc_f32_ae32(const float *input, float *output, int len, float C, int step_in, int step_out); +/**@}*/ + +#ifdef __cplusplus +} +#endif + + +#if CONFIG_DSP_OPTIMIZED +#if (dsps_addc_f32_ae32_enabled == 1) +#define dsps_addc_f32 dsps_addc_f32_ae32 +#else +#define dsps_addc_f32 dsps_addc_f32_ansi +#endif +#else +#define dsps_addc_f32 dsps_addc_f32_ansi +#endif // CONFIG_DSP_OPTIMIZED + +#endif // _dsps_addc_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/addc/include/dsps_addc_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/math/addc/include/dsps_addc_platform.h new file mode 100644 index 000000000..2880098ca --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/addc/include/dsps_addc_platform.h @@ -0,0 +1,15 @@ +#ifndef _dsps_addc_platform_H_ +#define _dsps_addc_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_addc_f32_ae32_enabled 1 + +#endif + + +#endif // _dsps_addc_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/include/dsps_math.h b/tools/sdk/esp32/include/esp-dsp/modules/math/include/dsps_math.h new file mode 100644 index 000000000..878f34d66 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/include/dsps_math.h @@ -0,0 +1,25 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_math_H_ +#define _dsps_math_H_ + +#include "dsps_add.h" +#include "dsps_sub.h" +#include "dsps_mul.h" +#include "dsps_addc.h" +#include "dsps_mulc.h" +#include "dsps_sqrt.h" + +#endif // _dsps_math_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/mul/include/dsps_mul.h b/tools/sdk/esp32/include/esp-dsp/modules/math/mul/include/dsps_mul.h new file mode 100644 index 000000000..303da36bd --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/mul/include/dsps_mul.h @@ -0,0 +1,92 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_mul_H_ +#define _dsps_mul_H_ +#include "dsp_err.h" + +#include "dsps_mul_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/**@{*/ +/** + * @brief Multiply two arrays + * + * The function multiply one input array to another and store result to other array + * out[i*step_out] = input1[i*step1] * input2[i*step2]; i=[0..len) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input1: input array 1 + * @param[in] input2: input array 2 + * @param output: output array + * @param len: amount of operations for arrays + * @param step1: step over input array 1 (by default should be 1) + * @param step2: step over input array 2 (by default should be 1) + * @param step_out: step over output array (by default should be 1) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_mul_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); +esp_err_t dsps_mul_f32_ae32(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); +/**@}*/ + + +/**@{*/ +/** + * @brief Multiply two arrays + * + * The function multiply one input array to another and store result to other array + * out[i*step_out] = input1[i*step1] * input2[i*step2]; i=[0..len) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input1: input array 1 + * @param[in] input2: input array 2 + * @param output: output array + * @param len: amount of operations for arrays + * @param step1: step over input array 1 (by default should be 1) + * @param step2: step over input array 2 (by default should be 1) + * @param step_out: step over output array (by default should be 1) + * @param shift: output shift after multiplication (by default should be 15) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_mul_s16_ansi(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift); + +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED +#if (dsps_mul_f32_ae32_enabled == 1) +#define dsps_mul_f32 dsps_mul_f32_ae32 +#else +#define dsps_mul_f32 dsps_mul_f32_ansi +#endif // +#define dsps_mul_s16 dsps_mul_s16_ansi +#else // CONFIG_DSP_OPTIMIZED +#define dsps_mul_f32 dsps_mul_f32_ansi +#define dsps_mul_s16 dsps_mul_s16_ansi +#endif +#endif // _dsps_mul_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/mul/include/dsps_mul_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/math/mul/include/dsps_mul_platform.h new file mode 100644 index 000000000..2e195ea11 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/mul/include/dsps_mul_platform.h @@ -0,0 +1,14 @@ +#ifndef _dsps_mul_platform_H_ +#define _dsps_mul_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_mul_f32_ae32_enabled 1 + +#endif + +#endif // _dsps_mul_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/mulc/include/dsps_mulc.h b/tools/sdk/esp32/include/esp-dsp/modules/math/mulc/include/dsps_mulc.h new file mode 100644 index 000000000..6b8ff1672 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/mulc/include/dsps_mulc.h @@ -0,0 +1,75 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_mulc_H_ +#define _dsps_mulc_H_ +#include "dsp_err.h" + +#include "dsps_mulc_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**@{*/ +/** + * @brief multiply constant + * + * The function multiplies input array to the constant value + * x[i*step_out] = y[i*step_in]*C; i=[0..len) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input: input array + * @param output: output array + * @param len: amount of operations for arrays + * @param C: constant value + * @param step_in: step over input array (by default should be 1) + * @param step_out: step over output array (by default should be 1) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_mulc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out); +esp_err_t dsps_mulc_f32_ae32(const float *input, float *output, int len, float C, int step_in, int step_out); + +esp_err_t dsps_mulc_s16_ae32(const int16_t *input, int16_t *output, int len, int16_t C, int step_in, int step_out); +esp_err_t dsps_mulc_s16_ansi(const int16_t *input, int16_t *output, int len, int16_t C, int step_in, int step_out); + +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED +#if (dsps_mulc_f32_ae32_enabled == 1) +#define dsps_mulc_f32 dsps_mulc_f32_ae32 +#else // +#define dsps_mulc_f32 dsps_mulc_f32_ansi +#endif +#if (dsps_mulc_s16_ae32_enabled == 1) +#define dsps_mulc_s16 dsps_mulc_s16_ae32 +#else +#define dsps_mulc_s16 dsps_mulc_s16_ansi +#endif // dsps_mulc_s16_ae32_enabled + +#else +#define dsps_mulc_f32 dsps_mulc_f32_ansi +#define dsps_mulc_s16 dsps_mulc_s16_ansi +#endif + + +#endif // _dsps_mulc_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/mulc/include/dsps_mulc_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/math/mulc/include/dsps_mulc_platform.h new file mode 100644 index 000000000..d0d741ca4 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/mulc/include/dsps_mulc_platform.h @@ -0,0 +1,21 @@ +#ifndef _dsps_mulc_platform_H_ +#define _dsps_mulc_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_mulc_f32_ae32_enabled 1 + +#endif + +#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) + +#define dsps_mulc_s16_ae32_enabled 1 + +#endif // + + +#endif // _dsps_mulc_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/sqrt/include/dsps_sqrt.h b/tools/sdk/esp32/include/esp-dsp/modules/math/sqrt/include/dsps_sqrt.h new file mode 100644 index 000000000..31edc643e --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/sqrt/include/dsps_sqrt.h @@ -0,0 +1,91 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_sqrt_H_ +#define _dsps_sqrt_H_ +#include "dsp_err.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**@{*/ +/** + * @brief square root approximation + * + * The function takes square root approximation + * x[i] ~ sqrt(y[i]); i=[0..len) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input: input array + * @param output: output array + * @param len: amount of operations for arrays + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_sqrt_f32_ansi(const float *input, float *output, int len); +//esp_err_t dsps_sqrt_s32_ansi(const int32_t *input, int16_t *output, int len); + +/**@{*/ +/** + * @brief square root approximation + * + * The function takes square root approximation + * x ~ sqrt(y); + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] data: input value + * + * @return + * - square root value + */ +float dsps_sqrtf_f32_ansi(const float data); + + +/**@{*/ +/** + * @brief inverted square root approximation + * + * The function takes inverted square root approximation + * x ~ 1/sqrt(y); + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] data: input value + * + * @return + * - inverted square root value + */ +float dsps_inverted_sqrtf_f32_ansi(float data ); +/**@}*/ + +#ifdef __cplusplus +} +#endif + + +#ifdef CONFIG_DSP_OPTIMIZED +#define dsps_sqrt_f32 dsps_sqrt_f32_ansi +#define dsps_sqrtf_f32 dsps_sqrtf_f32_ansi +#define dsps_inverted_sqrtf_f32 dsps_inverted_sqrtf_f32_ansi +#else +#define dsps_sqrt_f32 dsps_sqrt_f32_ansi +#define dsps_sqrtf_f32 dsps_sqrtf_f32_ansi +#define dsps_inverted_sqrtf_f32 dsps_inverted_sqrtf_f32_ansi +#endif + +#endif // _dsps_sqrt_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/sub/include/dsps_sub.h b/tools/sdk/esp32/include/esp-dsp/modules/math/sub/include/dsps_sub.h new file mode 100644 index 000000000..2dc1adf33 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/sub/include/dsps_sub.h @@ -0,0 +1,67 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_sub_H_ +#define _dsps_sub_H_ +#include "dsp_err.h" + +#include "dsps_sub_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/**@{*/ +/** + * @brief sub arrays + * + * The function subtract one array from another + * out[i*step_out] = input1[i*step1] - input2[i*step2]; i=[0..len) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input1: input array 1 + * @param[in] input2: input array 2 + * @param output: output array + * @param len: amount of operations for arrays + * @param step1: step over input array 1 (by default should be 1) + * @param step2: step over input array 2 (by default should be 1) + * @param step_out: step over output array (by default should be 1) + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_sub_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); +esp_err_t dsps_sub_f32_ae32(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED + +#if (dsps_sub_f32_ae32_enabled == 1) +#define dsps_sub_f32 dsps_sub_f32_ae32 +#else +#define dsps_sub_f32 dsps_sub_f32_ansi +#endif +#else +#define dsps_sub_f32 dsps_sub_f32_ansi +#endif // CONFIG_DSP_OPTIMIZED + + +#endif // _dsps_sub_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/math/sub/include/dsps_sub_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/math/sub/include/dsps_sub_platform.h new file mode 100644 index 000000000..d71ed0ffc --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/math/sub/include/dsps_sub_platform.h @@ -0,0 +1,14 @@ +#ifndef _dsps_sub_platform_H_ +#define _dsps_sub_platform_H_ + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dsps_sub_f32_ae32_enabled 1 + +#endif + +#endif // _dsps_sub_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/dspm_mult.h b/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/dspm_mult.h new file mode 100644 index 000000000..b43c3f02b --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/dspm_mult.h @@ -0,0 +1,182 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dspm_mult_H_ +#define _dspm_mult_H_ + +#include "dsp_err.h" +#include "dspm_mult_platform.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**@{*/ +/** + * @brief Matrix multiplication + * + * Matrix multiplication for two floating point matrices: C[m][k] = A[m][n] * B[n][k] + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[in] A input matrix A[m][n] + * @param[in] B input matrix B[n][k] + * @param C result matrix C[m][k] + * @param[in] m matrix dimension + * @param[in] n matrix dimension + * @param[in] k matrix dimension + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dspm_mult_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k); +esp_err_t dspm_mult_f32_ae32(const float *A, const float *B, float *C, int m, int n, int k); +/**@}*/ + + +/** + * @brief Matrix multiplication A[3x3]xB[3x1] + * + * Matrix multiplication for two floating point matrices 3x3 and 3x1: C[1][3] = A[3][3] * B[3][1] + * The implementation is optimized for ESP32 chip. + * + * @param[in] A input matrix A[3][3] + * @param[in] B input matrix/vector B[3][1] + * @param C result matrix/vector C[3][3] + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dspm_mult_3x3x1_f32_ae32(const float *A, const float *B, float *C); + +/** + * @brief Matrix multiplication A[3x3]xB[3x3] + * + * Matrix multiplication for two square 3x3 floating point matrices: C[3][3] = A[3][3] * B[3][3] + * The implementation is optimized for ESP32 chip. + * + * @param[in] A input matrix A[3][3] + * @param[in] B input matrix B[3][3] + * @param C result matrix C[3][3] + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dspm_mult_3x3x3_f32_ae32(const float *A, const float *B, float *C); + +/** + * @brief Matrix multiplication A[4x4]xB[4x1] + * + * Matrix multiplication for two floating point matrices 4x4 and 4x1: C[1][4] = A[4][4] * B[4][1] + * The implementation is optimized for ESP32 chip. + * + * @param[in] A input matrix A[4][4] + * @param[in] B input matrix/vector B[4][1] + * @param C result matrix/vector C[4][4] + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ + +esp_err_t dspm_mult_4x4x1_f32_ae32(const float *A, const float *B, float *C); + +/** + * @brief Matrix multiplication A[4x4]xB[4x4] + * + * Matrix multiplication for two square 3x3 floating point matrices: C[4][4] = A[4][4] * B[4][4] + * The implementation is optimized for ESP32 chip. + * + * @param[in] A input matrix A[4][4] + * @param[in] B input matrix B[4][4] + * @param C result matrix C[4][4] + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dspm_mult_4x4x4_f32_ae32(const float *A, const float *B, float *C); + +/**@{*/ +/** + * @brief Matrix multiplication 16 bit signeg int + * + * Matrix multiplication for two signed 16 bit fixed point matrices: C[m][k] = (A[m][n] * B[n][k]) >> (15- shift) + * The extension (_ansi) use ANSI C and could be compiled and run on any platform. + * The extension (_ae32) is optimized for ESP32 chip. + * + * @param[in] A input matrix A[m][n] + * @param[in] B input matrix B[n][k] + * @param C result matrix C[m][k] + * @param[in] m matrix dimension + * @param[in] n matrix dimension + * @param[in] k matrix dimension + * @param[in] shift every result will be shifted and stored as 16 bit signed value. + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dspm_mult_s16_ansi(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift); +esp_err_t dspm_mult_s16_ae32(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift); +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#if CONFIG_DSP_OPTIMIZED + +#if (dspm_mult_s16_ae32_enabled == 1) +#define dspm_mult_s16 dspm_mult_s16_ae32 +#else +#define dspm_mult_s16 dspm_mult_s16_ansi +#endif + +#if (dspm_mult_f32_ae32_enabled == 1) +#define dspm_mult_f32 dspm_mult_f32_ae32 +#else +#define dspm_mult_f32 dspm_mult_f32_ansi +#endif + +#if (dspm_mult_3x3x1_f32_ae32_enabled == 1) +#define dspm_mult_3x3x1_f32 dspm_mult_3x3x1_f32_ae32 +#else +#define dspm_mult_3x3x1_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 3, 3, 1) +#endif +#if (dspm_mult_3x3x3_f32_ae32_enabled == 1) +#define dspm_mult_3x3x3_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 3, 3, 3) +#else +#define dsps_sub_f32 dsps_sub_f32_ansi +#endif +#if (dspm_mult_4x4x1_f32_ae32_enabled == 1) +#define dspm_mult_4x4x1_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 4, 4, 1) +#else +#define dsps_sub_f32 dsps_sub_f32_ansi +#endif +#if (dspm_mult_4x4x4_f32_ae32_enabled == 1) +#define dspm_mult_4x4x4_f32 dspm_mult_4x4x4_f32_ae32 +#else +#define dspm_mult_4x4x4_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 4, 4, 4) +#endif + +#else +#define dspm_mult_s16 dspm_mult_s16_ansi +#define dspm_mult_f32 dspm_mult_f32_ansi +#define dspm_mult_3x3x1_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 3, 3, 1) +#define dsps_sub_f32 dsps_sub_f32_ansi +#define dsps_sub_f32 dsps_sub_f32_ansi +#define dspm_mult_4x4x4_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 4, 4, 4) +#endif // CONFIG_DSP_OPTIMIZED + + +#endif // _dspm_mult_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/dspm_mult_platform.h b/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/dspm_mult_platform.h new file mode 100644 index 000000000..c3c09c977 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/dspm_mult_platform.h @@ -0,0 +1,26 @@ +#ifndef _dspm_mult_platform_H_ +#define _dspm_mult_platform_H_ + + + +#include +#include + + +#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) + +#define dspm_mult_f32_ae32_enabled 1 +#define dspm_mult_3x3x1_f32_ae32_enabled 1 +#define dspm_mult_3x3x3_f32_ae32_enabled 1 +#define dspm_mult_4x4x1_f32_ae32_enabled 1 +#define dspm_mult_4x4x4_f32_ae32_enabled 1 + +#endif + +#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) + +#define dspm_mult_s16_ae32_enabled 1 + +#endif + +#endif // _dspm_mult_platform_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/mat.h b/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/mat.h new file mode 100644 index 000000000..134ea6a29 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/matrix/include/mat.h @@ -0,0 +1,504 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dspm_mat_h_ +#define _dspm_mat_h_ +#include + +/** + * @brief DSP matrix namespace + * + * DSP library matrix namespace. + */ +namespace dspm { +/** + * @brief Matrix + * + * The Mat class provides basic matrix operations on single-precision floating point values. + */ +class Mat { +public: + /** + * Constructor allocate internal buffer. + * @param[in] rows: amount of matrix rows + * @param[in] cols: amount of matrix columns + */ + Mat(int rows, int cols); + /** + * Constructor use external buffer. + * @param[in] data: external buffer with row-major matrix data + * @param[in] rows: amount of matrix rows + * @param[in] cols: amount of matrix columns + */ + Mat(float *data, int rows, int cols); + /** + * Allocate matrix with undefined size. + */ + Mat(); + virtual ~Mat(); + /** + * Make copy of matrix. + * @param[in] src: source matrix + */ + Mat(const Mat &src); + /** + * Copy operator + * + * @param[in] src: source matrix + * + * @return + * - matrix copy + */ + Mat &operator=(const Mat &src); + + bool ext_buff; /*!< Flag indicates that matrix use external buffer*/ + + /** + * Access to the matrix elements. + * @param[in] row: row position + * @param[in] col: column position + * + * @return + * - element of matrix M[row][col] + */ + inline float &operator()(int row, int col) + { + return data[row * this->cols + col]; + } + /** + * Access to the matrix elements. + * @param[in] row: row position + * @param[in] col: column position + * + * @return + * - element of matrix M[row][col] + */ + inline const float &operator()(int row, int col) const + { + return data[row * this->cols + col]; + } + + /** + * += operator + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: source matrix + * + * @return + * - result matrix: result += A + */ + Mat &operator+=(const Mat &A); + + /** + * += operator + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] C: constant + * + * @return + * - result matrix: result += C + */ + Mat &operator+=(float C); + /** + * -= operator + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: source matrix + * + * @return + * - result matrix: result -= A + */ + Mat &operator-=(const Mat &A); + + /** + * -= operator + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] C: constant + * + * @return + * - result matrix: result -= C + */ + Mat &operator-=(float C); + + /** + * *= operator + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: source matrix + * + * @return + * - result matrix: result -= A + */ + Mat &operator*=(const Mat &A); + /** + * += with constant operator + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] C: constant value + * + * @return + * - result matrix: result *= C + */ + Mat &operator*=(float C); + /** + * /= with constant operator + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] C: constant value + * + * @return + * - result matrix: result /= C + */ + Mat &operator/=(float C); + /** + * /= operator + * + * @param[in] B: source matrix + * + * @return + * - result matrix: result[i,j] = result[i,j]/B[i,j] + */ + Mat &operator/=(const Mat &B); + /** + * ^= xor with constant operator + * The operator use DSP optimized implementation of multiplication. + * @param[in] C: constant value + * + * @return + * - result matrix: result ^= C + */ + Mat operator^(int C); + + /** + * Swap two rows between each other. + * @param[in] row1: position of first row + * @param[in] row2: position of second row + */ + void swapRows(int row1, int row2); + /** + * Matrix transpose. + * Change rows and columns between each other. + * + * @return + * - transposed matrix + */ + Mat t(); + + /** + * Create identity matrix. + * Create a square matrix and fill diagonal with 1. + * + * @param[in] size: matrix size + * + * @return + * - matrix [N]x[N] with 1 in diagonal + */ + static Mat eye(int size); + + /** + * Create matrix with all elements 1. + * Create a square matrix and fill all elements with 1. + * + * @param[in] size: matrix size + * + * @return + * - matrix [N]x[N] with 1 in all elements + */ + static Mat ones(int size); + + /** + * Return part of matrix from defined position (startRow, startCol) as a matrix[blockRows x blockCols]. + * + * @param[in] startRow: start row position + * @param[in] startCol: start column position + * @param[in] blockRows: amount of rows in result matrix + * @param[in] blockCols: amount of columns in the result matrix + * + * @return + * - matrix [blockRows]x[blockCols] + */ + Mat block(int startRow, int startCol, int blockRows, int blockCols); + + /** + * Normalizes the vector, i.e. divides it by its own norm. + * If it's matrix, calculate matrix norm + * + */ + void normalize(void); + + /** + * Return norm of the vector. + * If it's matrix, calculate matrix norm + * + * @return + * - matrix norm + */ + float norm(void); + + /** + * The method fill 0 to the matrix structure. + * + */ + void clear(void); + + /** + * @brief Solve the matrix + * + * Solve matrix. Find roots for the matrix A*x = b + * + * @param[in] A: matrix [N]x[N] with input coefficients + * @param[in] b: vector [N]x[1] with result values + * + * @return + * - matrix [N]x[1] with roots + */ + static Mat solve(Mat A, Mat b); + /** + * @brief Band solve the matrix + * + * Solve band matrix. Find roots for the matrix A*x = b with bandwidth k. + * + * @param[in] A: matrix [N]x[N] with input coefficients + * @param[in] b: vector [N]x[1] with result values + * @param[in] k: upper bandwidth value + * + * @return + * - matrix [N]x[1] with roots + */ + static Mat bandSolve(Mat A, Mat b, int k); + /** + * @brief Solve the matrix + * + * Different way to solve the matrix. Find roots for the matrix A*x = y + * + * @param[in] A: matrix [N]x[N] with input coefficients + * @param[in] y: vector [N]x[1] with result values + * + * @return + * - matrix [N]x[1] with roots + */ + static Mat roots(Mat A, Mat y); + + /** + * @brief Dotproduct of two vectors + * + * The method returns dotproduct of two vectors + * + * @param[in] A: Input vector A Nx1 + * @param[in] B: Input vector B Nx1 + * + * @return + * - dotproduct value + */ + static float dotProduct(Mat A, Mat B); + + /** + * @brief Augmented matrices + * + * Augmented matrices + * + * @param[in] A: Input vector A MxN + * @param[in] B: Input vector B MxK + * + * @return + * - Augmented matrix Mx(N+K) + */ + static Mat augment(Mat A, Mat B); + /** + * @brief Gaussian Elimination + * + * Gaussian Elimination of matrix + * + * @return + * - result matrix + */ + Mat gaussianEliminate(); + + /** + * Row reduction for Gaussian elimination + * + * @return + * - result matrix + */ + Mat rowReduceFromGaussian(); + + /** + * Find the inverse matrix + * + * @return + * - inverse matrix + */ + Mat inverse(); + + /** + * Find pseudo inverse matrix + * + * @return + * - inverse matrix + */ + Mat pinv(); + + int rows; /*!< Amount of rows*/ + int cols; /*!< Amount of columns*/ + float *data; /*!< Buffer with matrix data*/ + int length; /*!< Total amount of data in data array*/ + + static float abs_tol; /*!< Max acceptable absolute tolerance*/ +private: + Mat cofactor(int row, int col, int n); + float det(int n); + Mat adjoint(); + + void allocate(); // Allocate buffer + Mat expHelper(const Mat &m, int num); +}; +/** + * Print matrix to the standard iostream. + * @param[in] os: output stream + * @param[in] m: matrix to print + * + * @return + * - output stream + */ +std::ostream &operator<<(std::ostream &os, const Mat &m); +/** + * Fill the matrix from iostream. + * @param[in] is: input stream + * @param[in] m: matrix to fill + * + * @return + * - input stream + */ +std::istream &operator>>(std::istream &is, Mat &m); + +/** + * + operator, sum of two matrices + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: Input matrix A + * @param[in] B: Input matrix B + * + * @return + * - result matrix A+B +*/ +Mat operator+(const Mat &A, const Mat &B); +/** + * + operator, sum of matrix with constant + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: Input matrix A + * @param[in] C: Input constant + * + * @return + * - result matrix A+C +*/ +Mat operator+(const Mat &A, float C); + +/** + * - operator, subtraction of two matrices + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: Input matrix A + * @param[in] B: Input matrix B + * + * @return + * - result matrix A-B +*/ +Mat operator-(const Mat &A, const Mat &B); +/** + * - operator, sum of matrix with constant + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: Input matrix A + * @param[in] C: Input constant + * + * @return + * - result matrix A+C +*/ +Mat operator-(const Mat &A, float C); + +/** + * * operator, multiplication of two matrices. + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: Input matrix A + * @param[in] B: Input matrix B + * + * @return + * - result matrix A*B +*/ +Mat operator*(const Mat &A, const Mat &B); + +/** + * * operator, multiplication of matrix with constant + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: Input matrix A + * @param[in] C: floating point value + * + * @return + * - result matrix A*B +*/ +Mat operator*(const Mat &A, float C); + +/** + * * operator, multiplication of matrix with constant + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] C: floating point value + * @param[in] A: Input matrix A + * + * @return + * - result matrix A*B +*/ +Mat operator*(float C, const Mat &A); + +/** + * / operator, divide of matrix by constant + * The operator use DSP optimized implementation of multiplication. + * + * @param[in] A: Input matrix A + * @param[in] C: floating point value + * + * @return + * - result matrix A*B +*/ +Mat operator/(const Mat &A, float C); + +/** + * / operator, divide matrix A by matrix B + * + * @param[in] A: Input matrix A + * @param[in] B: Input matrix B + * + * @return + * - result matrix C, where C[i,j] = A[i,j]/B[i,j] +*/ +Mat operator/(const Mat &A, const Mat &B); + +/** + * == operator, compare two matrices + * + * @param[in] A: Input matrix A + * @param[in] B: Input matrix B + * + * @return + * - true if matrices are the same + * - false if matrices are different +*/ +bool operator==(const Mat &A, const Mat &B); + +} +#endif //_dspm_mat_h_ diff --git a/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_d_gen.h b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_d_gen.h new file mode 100644 index 000000000..8eacae865 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_d_gen.h @@ -0,0 +1,47 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_d_gen_H_ +#define _dsps_d_gen_H_ +#include "dsp_err.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief delta function + * + * The function generate delta function. + * output[i]=0, if i=[0..N) + * output[i]=1, if i=pos, pos: [0..N-1) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param output: output array. + * @param len: length of the input signal + * @param pos: delta function position + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_d_gen_f32(float *output, int len, int pos); + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_d_gen_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_h_gen.h b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_h_gen.h new file mode 100644 index 000000000..a19bef1b7 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_h_gen.h @@ -0,0 +1,48 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_h_gen_H_ +#define _dsps_h_gen_H_ +#include "dsp_err.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Heviside function + * + * The Heviside function. + * output[i]=0, if i=[0..pos) + * output[i]=1, if i=[pos..N) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param output: output array. + * @param len: length of the input signal + * @param pos: heviside function position + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ + +esp_err_t dsps_h_gen_f32(float *output, int len, int pos); + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_h_gen_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_sfdr.h b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_sfdr.h new file mode 100644 index 000000000..1b7decc0b --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_sfdr.h @@ -0,0 +1,51 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_sfdr_H_ +#define _dsps_sfdr_H_ + + +#include "dsp_err.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief SFDR + * + * The function calculates Spurious-Free Dynamic Range. + * The function makes FFT of the input, then search a spectrum maximum, and then compare + * maximum value with all others. Result calculated as minimum value. + * This function have to be used for debug and unit tests only. It's not optimized for real-time processing. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param[in] input: input array. + * @param len: length of the input signal + * @param use_dc: this parameter define will be DC value used for calculation or not. + * 0 - SNR will not include DC power + * 1 - SNR will include DC power + * + * @return + * - SFDR in DB + */ +float dsps_sfdr_f32(const float *input, int32_t len, int8_t use_dc); +float dsps_sfdr_fc32(const float *input, int32_t len); + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_sfdr_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_snr.h b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_snr.h new file mode 100644 index 000000000..163df4dec --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_snr.h @@ -0,0 +1,51 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _DSP_SNR_H_ +#define _DSP_SNR_H_ + +#include "dsp_err.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief SNR + * + * The function calculates signal to noise ration in case if signal is sine tone. + * The function makes FFT of the input, then search a spectrum maximum, and then calculated + * SNR as sum of all harmonics to the maximum value. + * This function have to be used for debug and unit tests only. It's not optimized for real-time processing. + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param input: input array. + * @param len: length of the input signal + * @param use_dc: this parameter define will be DC value used for calculation or not. + * 0 - SNR will not include DC power + * 1 - SNR will include DC power + * + * @return + * - SNR in dB + */ +float dsps_snr_f32(const float *input, int32_t len, uint8_t use_dc); +float dsps_snr_fc32(const float *input, int32_t len); + + +#ifdef __cplusplus +} +#endif + +#endif // _DSP_SNR_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_tone_gen.h b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_tone_gen.h new file mode 100644 index 000000000..281e3b6b0 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_tone_gen.h @@ -0,0 +1,48 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_tone_gen_H_ +#define _dsps_tone_gen_H_ +#include "dsp_err.h" + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief tone + * + * The function generate a tone signal. + * x[i]=A*sin(2*PI*i + ph/180*PI) + * The implementation use ANSI C and could be compiled and run on any platform + * + * @param output: output array. + * @param len: length of the input signal + * @param Ampl: amplitude + * @param freq: Naiquist frequency -1..1 + * @param phase: phase in degree + * + * @return + * - ESP_OK on success + * - One of the error codes from DSP library + */ +esp_err_t dsps_tone_gen_f32(float *output, int len, float Ampl, float freq, float phase); + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_tone_gen_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_view.h b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_view.h new file mode 100644 index 000000000..49c3022cb --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/support/include/dsps_view.h @@ -0,0 +1,64 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _dsps_view_H_ +#define _dsps_view_H_ + +#include "dsp_err.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**@{*/ +/** + * @brief plot view + * + * Generic view function. + * This function takes input samples and show then in console view as a plot. + * The main purpose to give and draft debug information to the DSP developer. + * + * @param[in] data: array with input samples. + * @param len: length of the input array + * @param width: plot width in symbols + * @param height: plot height in lines + * @param min: minimum value that will be limited by Axis Y. + * @param max: maximum value that will be limited by Axis Y. + * @param view_char: character to draw the plot calues ('.' or '|' etc) + * + */ +void dsps_view(const float *data, int32_t len, int width, int height, float min, float max, char view_char); +void dsps_view_s16(const int16_t *data, int32_t len, int width, int height, float min, float max, char view_char); +/**@}*/ + +/** + * @brief spectrum view + * + * The view function to show spectrum values in 64x10 screen. + * The function based on dsps_view. + * + * @param[in] data: array with input samples. + * @param len: length of the input array + * @param min: minimum value that will be limited by Axis Y. + * @param max: maximum value that will be limited by Axis Y. + * + */ +void dsps_view_spectrum(const float *data, int32_t len, float min, float max); + +#ifdef __cplusplus +} +#endif + +#endif // _dsps_view_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman/include/dsps_wind_blackman.h b/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman/include/dsps_wind_blackman.h new file mode 100644 index 000000000..4c7475a51 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman/include/dsps_wind_blackman.h @@ -0,0 +1,38 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_wind_blackman_H_ +#define _dsps_wind_blackman_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Blackman window + * + * The function generates Blackman window for plpha = 0.16. + * + * @param window: buffer to store window array. + * @param len: length of the window array + * + */ +void dsps_wind_blackman_f32(float *window, int len); + +#ifdef __cplusplus +} +#endif +#endif // _dsps_wind_blackman_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h b/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h new file mode 100644 index 000000000..5f93a7b63 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h @@ -0,0 +1,38 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_wind_blackman_harris_H_ +#define _dsps_wind_blackman_harris_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Blackman-Harris window + * + * The function generates Blackman-Harris window. + * + * @param window: buffer to store window array. + * @param len: length of the window array + * + */ +void dsps_wind_blackman_harris_f32(float *window, int len); + +#ifdef __cplusplus +} +#endif +#endif // _dsps_wind_blackman_harris_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h b/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h new file mode 100644 index 000000000..10b525785 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h @@ -0,0 +1,38 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_wind_blackman_nuttall_H_ +#define _dsps_wind_blackman_nuttall_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Blackman-Nuttall window + * + * The function generates Blackman-Nuttall window. + * + * @param window: buffer to store window array. + * @param len: length of the window array + * + */ +void dsps_wind_blackman_nuttall_f32(float *window, int len); + +#ifdef __cplusplus +} +#endif +#endif // _dsps_wind_blackman_nuttall_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/windows/flat_top/include/dsps_wind_flat_top.h b/tools/sdk/esp32/include/esp-dsp/modules/windows/flat_top/include/dsps_wind_flat_top.h new file mode 100644 index 000000000..85d83e506 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/windows/flat_top/include/dsps_wind_flat_top.h @@ -0,0 +1,38 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_wind_flat_top_H_ +#define _dsps_wind_flat_top_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Flat-Top window + * + * The function generates Flat-Top window. + * + * @param window: buffer to store window array. + * @param len: length of the window array + * + */ +void dsps_wind_flat_top_f32(float *window, int len); + +#ifdef __cplusplus +} +#endif +#endif // _dsps_wind_flat_top_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/windows/hann/include/dsps_wind_hann.h b/tools/sdk/esp32/include/esp-dsp/modules/windows/hann/include/dsps_wind_hann.h new file mode 100644 index 000000000..2c6825701 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/windows/hann/include/dsps_wind_hann.h @@ -0,0 +1,38 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_wind_hann_H_ +#define _dsps_wind_hann_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Hann window + * + * The function generates Hann window. + * + * @param window: buffer to store window array. + * @param len: length of the window array + * + */ +void dsps_wind_hann_f32(float *window, int len); + +#ifdef __cplusplus +} +#endif +#endif // _dsps_wind_hann_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/windows/include/dsps_wind.h b/tools/sdk/esp32/include/esp-dsp/modules/windows/include/dsps_wind.h new file mode 100644 index 000000000..c8e3404a4 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/windows/include/dsps_wind.h @@ -0,0 +1,26 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_wind_H_ +#define _dsps_wind_H_ + +#include "dsps_wind_hann.h" +#include "dsps_wind_blackman.h" +#include "dsps_wind_blackman_harris.h" +#include "dsps_wind_blackman_nuttall.h" +#include "dsps_wind_nuttall.h" +#include "dsps_wind_flat_top.h" + +#endif // _dsps_wind_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-dsp/modules/windows/nuttall/include/dsps_wind_nuttall.h b/tools/sdk/esp32/include/esp-dsp/modules/windows/nuttall/include/dsps_wind_nuttall.h new file mode 100644 index 000000000..180cb9233 --- /dev/null +++ b/tools/sdk/esp32/include/esp-dsp/modules/windows/nuttall/include/dsps_wind_nuttall.h @@ -0,0 +1,38 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef _dsps_wind_nuttall_H_ +#define _dsps_wind_nuttall_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Nuttall window + * + * The function generates Nuttall window. + * + * @param window: buffer to store window array. + * @param len: length of the window array + * + */ +void dsps_wind_nuttall_f32(float *window, int len); + +#ifdef __cplusplus +} +#endif +#endif // _dsps_wind_nuttall_H_ \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp-tls/esp_tls.h b/tools/sdk/esp32/include/esp-tls/esp_tls.h index 752c18e11..1e4dbdc78 100644 --- a/tools/sdk/esp32/include/esp-tls/esp_tls.h +++ b/tools/sdk/esp32/include/esp-tls/esp_tls.h @@ -74,6 +74,22 @@ extern "C" { #define ESP_TLS_ERR_SSL_WANT_WRITE WOLFSSL_ERROR_WANT_WRITE #define ESP_TLS_ERR_SSL_TIMEOUT WOLFSSL_CBIO_ERR_TIMEOUT #endif /*CONFIG_ESP_TLS_USING_WOLFSSL */ + +/** +* Definition of different types/sources of error codes reported +* from different components +*/ +typedef enum { + ESP_TLS_ERR_TYPE_UNKNOWN = 0, + ESP_TLS_ERR_TYPE_SYSTEM, /*!< System error -- errno */ + ESP_TLS_ERR_TYPE_MBEDTLS, /*!< Error code from mbedTLS library */ + ESP_TLS_ERR_TYPE_MBEDTLS_CERT_FLAGS, /*!< Certificate flags defined in mbedTLS */ + ESP_TLS_ERR_TYPE_ESP, /*!< ESP-IDF error type -- esp_err_t */ + ESP_TLS_ERR_TYPE_WOLFSSL, /*!< Error code from wolfSSL library */ + ESP_TLS_ERR_TYPE_WOLFSSL_CERT_FLAGS, /*!< Certificate flags defined in wolfSSL */ + ESP_TLS_ERR_TYPE_MAX, /*!< Last err type -- invalid entry */ +} esp_tls_error_type_t; + typedef struct esp_tls_last_error* esp_tls_error_handle_t; /** @@ -574,6 +590,20 @@ void esp_tls_free_global_ca_store(void); */ esp_err_t esp_tls_get_and_clear_last_error(esp_tls_error_handle_t h, int *esp_tls_code, int *esp_tls_flags); +/** + * @brief Returns the last error captured in esp_tls of a specific type + * The error information is cleared internally upon return + * + * @param[in] h esp-tls error handle. + * @param[in] err_type specific error type + * @param[out] error_code last error code returned from mbedtls api (set to zero if none) + * This pointer could be NULL if caller does not care about esp_tls_code + * @return + * - ESP_ERR_INVALID_STATE if invalid parameters + * - ESP_OK if a valid error returned and was cleared + */ +esp_err_t esp_tls_get_and_clear_error_type(esp_tls_error_handle_t h, esp_tls_error_type_t err_type, int *error_code); + #if CONFIG_ESP_TLS_USING_MBEDTLS /** * @brief Get the pointer to the global CA store currently being used. diff --git a/tools/sdk/esp32/include/esp-tls/private_include/esp_tls_error_capture_internal.h b/tools/sdk/esp32/include/esp-tls/private_include/esp_tls_error_capture_internal.h index d047b543b..fd065b2be 100644 --- a/tools/sdk/esp32/include/esp-tls/private_include/esp_tls_error_capture_internal.h +++ b/tools/sdk/esp32/include/esp-tls/private_include/esp_tls_error_capture_internal.h @@ -24,43 +24,36 @@ extern "C" { #endif /** -* Definition of different types/sources of error codes reported -* from different components -*/ -typedef enum { - ERR_TYPE_UNKNOWN = 0, - ERR_TYPE_SYSTEM, - ERR_TYPE_MBEDTLS, - ERR_TYPE_MBEDTLS_CERT_FLAGS, - ERR_TYPE_ESP, - ERR_TYPE_WOLFSSL, - ERR_TYPE_WOLFSSL_CERT_FLAGS, -} err_type_t; + * Error tracker logging macro to enable mapping tracking errors internally + * or using an external/global implementation + */ +#define ESP_INT_EVENT_TRACKER_CAPTURE(h, type, code) esp_tls_internal_event_tracker_capture(h, type, code) /** - * Error tracker logging macro, this implementation saves latest errors of - * ERR_TYPE_ESP, ERR_TYPE_ESP_TLS and ERR_TYPE_ESP_TLS_CERT_FLAGS types + * @brief Internal tracker capture error + * + * This implementation saves latest errors of available types + * + * @param[in] h esp-tls error handle + * @param[in] err_type Specific error type + * @param[int] code Error code to capture + * */ -#define ESP_INT_EVENT_TRACKER_CAPTURE(h, type, code) esp_int_event_tracker_capture(h, type, code) - -static inline void esp_int_event_tracker_capture(esp_tls_error_handle_t h, uint32_t type, int code) -{ - if (h) { - if (type == ERR_TYPE_ESP) { - h->last_error = code; - } else if (type == ERR_TYPE_MBEDTLS) { - h->esp_tls_error_code = code; - } else if (type == ERR_TYPE_MBEDTLS_CERT_FLAGS) { - h->esp_tls_flags = code; - } else if (type == ERR_TYPE_WOLFSSL) { - h->esp_tls_error_code = code; - } else if (type == ERR_TYPE_WOLFSSL_CERT_FLAGS) { - h->esp_tls_flags = code; - } - } -} +void esp_tls_internal_event_tracker_capture(esp_tls_error_handle_t h, uint32_t type, int code); +/** + * @brief Create internal tracker storage + * + * @return Error tracker handle if success or NULL if allocation error + */ +esp_tls_error_handle_t esp_tls_internal_event_tracker_create(void); +/** + * @brief Destroy internal tracker storage + * + * @param[in] h esp-tls error handle + */ + void esp_tls_internal_event_tracker_destroy(esp_tls_error_handle_t h); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/esp32/include/esp32/brownout.h b/tools/sdk/esp32/include/esp32/include/esp32/brownout.h index dafba8dd7..c17567ffb 100644 --- a/tools/sdk/esp32/include/esp32/include/esp32/brownout.h +++ b/tools/sdk/esp32/include/esp32/include/esp32/brownout.h @@ -18,4 +18,4 @@ void esp_brownout_init(void); -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp32/include/esp32/himem.h b/tools/sdk/esp32/include/esp32/include/esp32/himem.h index 0297725a1..b6b9e9d29 100644 --- a/tools/sdk/esp32/include/esp32/include/esp32/himem.h +++ b/tools/sdk/esp32/include/esp32/include/esp32/himem.h @@ -44,7 +44,7 @@ esp_err_t esp_himem_alloc(size_t size, esp_himem_handle_t *handle_out); /** * @brief Allocate a memory region to map blocks into - * + * * This allocates a contiguous CPU memory region that can be used to map blocks * of physical memory into. * @@ -61,7 +61,7 @@ esp_err_t esp_himem_alloc_map_range(size_t size, esp_himem_rangehandle_t *handle * @brief Map a block of high memory into the CPUs address space * * This effectively makes the block available for read/write operations. - * + * * @note The region to be mapped needs to have offsets and sizes that are aligned to the * SPI RAM MMU block size (32K) * @@ -149,4 +149,3 @@ size_t esp_himem_reserved_area_size(void); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/esp_adc_cal/include/esp_adc_cal.h b/tools/sdk/esp32/include/esp_adc_cal/include/esp_adc_cal.h index 7d8f1278b..5a65b0f37 100644 --- a/tools/sdk/esp32/include/esp_adc_cal/include/esp_adc_cal.h +++ b/tools/sdk/esp32/include/esp_adc_cal/include/esp_adc_cal.h @@ -56,6 +56,8 @@ typedef struct { * burned to the eFuse of the current ESP32 * * @param value_type Type of calibration value (ESP_ADC_CAL_VAL_EFUSE_VREF or ESP_ADC_CAL_VAL_EFUSE_TP) + * @note in ESP32S2, only ESP_ADC_CAL_VAL_EFUSE_TP is supported. Some old ESP32S2s do not support this, either. + * In which case you have to calibrate it manually, possibly by performing your own two-point calibration on the chip. * * @return * - ESP_OK: The calibration mode is supported in eFuse @@ -72,10 +74,10 @@ esp_err_t esp_adc_cal_check_efuse(esp_adc_cal_value_t value_type); * Characterization can be based on Two Point values, eFuse Vref, or default Vref * and the calibration values will be prioritized in that order. * - * @note + * @note * For ESP32, Two Point values and eFuse Vref calibration can be enabled/disabled using menuconfig. * For ESP32s2, only Two Point values calibration and only ADC_WIDTH_BIT_13 is supported. The parameter default_vref is unused. - * + * * * @param[in] adc_num ADC to characterize (ADC_UNIT_1 or ADC_UNIT_2) * @param[in] atten Attenuation to characterize diff --git a/tools/sdk/esp32/include/esp_common/include/esp_compiler.h b/tools/sdk/esp32/include/esp_common/include/esp_compiler.h index 6922c50ad..7ab8cb9af 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_compiler.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_compiler.h @@ -16,18 +16,18 @@ /* * The likely and unlikely macro pairs: - * These macros are useful to place when application + * These macros are useful to place when application * knows the majority ocurrence of a decision paths, * placing one of these macros can hint the compiler - * to reorder instructions producing more optimized + * to reorder instructions producing more optimized * code. - */ + */ #if (CONFIG_COMPILER_OPTIMIZATION_PERF) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) #else #define likely(x) (x) -#define unlikely(x) (x) +#define unlikely(x) (x) #endif /* @@ -48,4 +48,4 @@ #define ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(member) #endif -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp_common/include/esp_err.h b/tools/sdk/esp32/include/esp_common/include/esp_err.h index 105723976..49c3beb47 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_err.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_err.h @@ -21,7 +21,7 @@ extern "C" { #endif -typedef int32_t esp_err_t; +typedef int esp_err_t; /* Definitions for error constants. */ #define ESP_OK 0 /*!< esp_err_t value indicating success (no error) */ diff --git a/tools/sdk/esp32/include/esp_common/include/esp_expression_with_stack.h b/tools/sdk/esp32/include/esp_common/include/esp_expression_with_stack.h index 096b45752..456e5db16 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_expression_with_stack.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_expression_with_stack.h @@ -24,7 +24,7 @@ extern "C" { #endif -typedef void (*shared_stack_function)(void); +typedef void (*shared_stack_function)(void); #define ESP_EXECUTE_EXPRESSION_WITH_STACK(lock, stack, stack_size, expression) \ esp_execute_shared_stack_function(lock, stack, stack_size, expression) @@ -38,7 +38,7 @@ typedef void (*shared_stack_function)(void); * @note if either lock, stack or stack size is invalid, the expression will * be called using the current stack. */ -void esp_execute_shared_stack_function(SemaphoreHandle_t lock, +void esp_execute_shared_stack_function(SemaphoreHandle_t lock, void *stack, size_t stack_size, shared_stack_function function); @@ -46,4 +46,4 @@ void esp_execute_shared_stack_function(SemaphoreHandle_t lock, #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp_common/include/esp_int_wdt.h b/tools/sdk/esp32/include/esp_common/include/esp_int_wdt.h index 87cc23ec1..2bda5d855 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_int_wdt.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_int_wdt.h @@ -25,12 +25,12 @@ extern "C" { /* This routine enables a watchdog to catch instances of processes disabling -interrupts for too long, or code within interrupt handlers taking too long. +interrupts for too long, or code within interrupt handlers taking too long. It does this by setting up a watchdog which gets fed from the FreeRTOS task switch interrupt. When this watchdog times out, initially it will call a high-level interrupt routine that will panic FreeRTOS in order to allow for forensic examination of the state of the both CPUs. When this interrupt -handler is not called and the watchdog times out a second time, it will +handler is not called and the watchdog times out a second time, it will reset the SoC. This uses the TIMERG1 WDT. diff --git a/tools/sdk/esp32/include/esp_common/include/esp_private/crosscore_int.h b/tools/sdk/esp32/include/esp_common/include/esp_private/crosscore_int.h index d7af7f69b..e6f780176 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_private/crosscore_int.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_private/crosscore_int.h @@ -53,10 +53,10 @@ void esp_crosscore_int_send_freq_switch(int core_id); /** * Send an interrupt to a CPU indicating it should print its current backtrace - * + * * This is use internally by the Task Watchdog to dump the backtrace of the * opposite core and should not be called from application code. - * + * * @param core_id Core that should print its backtrace */ void esp_crosscore_int_send_print_backtrace(int core_id); diff --git a/tools/sdk/esp32/include/esp_common/include/esp_private/dbg_stubs.h b/tools/sdk/esp32/include/esp_common/include/esp_private/dbg_stubs.h index 899dfa56e..c784de984 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_private/dbg_stubs.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_private/dbg_stubs.h @@ -47,4 +47,4 @@ void esp_dbg_stubs_init(void); */ esp_err_t esp_dbg_stub_entry_set(esp_dbg_stub_id_t id, uint32_t entry); -#endif //ESP_DBG_STUBS_H_ \ No newline at end of file +#endif //ESP_DBG_STUBS_H_ diff --git a/tools/sdk/esp32/include/esp_common/include/esp_private/system_internal.h b/tools/sdk/esp32/include/esp_common/include/esp_private/system_internal.h index 12d7c2db8..66912a54b 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_private/system_internal.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_private/system_internal.h @@ -62,16 +62,16 @@ void esp_reset_reason_set_hint(esp_reset_reason_t hint); esp_reset_reason_t esp_reset_reason_get_hint(void); -/** +/** * @brief Get the time in microseconds since startup - * + * * @returns time since startup in microseconds */ int64_t esp_system_get_time(void); -/** +/** * @brief Get the resolution of the time returned by `esp_system_get_time`. - * + * * @returns the resolution in nanoseconds */ uint32_t esp_system_get_time_resolution(void); diff --git a/tools/sdk/esp32/include/esp_common/include/esp_task.h b/tools/sdk/esp32/include/esp_common/include/esp_task.h index 57e41d333..06ddd606c 100644 --- a/tools/sdk/esp32/include/esp_common/include/esp_task.h +++ b/tools/sdk/esp32/include/esp_common/include/esp_task.h @@ -27,6 +27,7 @@ #define _ESP_TASK_H_ #include "sdkconfig.h" +#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOSConfig.h" #define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES) diff --git a/tools/sdk/esp32/include/esp_eth/include/esp_eth.h b/tools/sdk/esp32/include/esp_eth/include/esp_eth.h index deb6a4126..76eff00b5 100644 --- a/tools/sdk/esp32/include/esp_eth/include/esp_eth.h +++ b/tools/sdk/esp32/include/esp_eth/include/esp_eth.h @@ -192,7 +192,7 @@ esp_err_t esp_eth_update_input_path( * - ESP_ERR_INVALID_ARG: transmit frame buffer failed because of some invalid argument * - ESP_FAIL: transmit frame buffer failed because some other error occurred */ -esp_err_t esp_eth_transmit(esp_eth_handle_t hdl, void *buf, uint32_t length); +esp_err_t esp_eth_transmit(esp_eth_handle_t hdl, void *buf, size_t length); /** * @brief General Receive diff --git a/tools/sdk/esp32/include/esp_eth/include/esp_eth_mac.h b/tools/sdk/esp32/include/esp_eth/include/esp_eth_mac.h index a9052eee5..7543fdd2d 100644 --- a/tools/sdk/esp32/include/esp_eth/include/esp_eth_mac.h +++ b/tools/sdk/esp32/include/esp_eth/include/esp_eth_mac.h @@ -16,9 +16,6 @@ #include #include "esp_eth_com.h" #include "sdkconfig.h" -#if CONFIG_ETH_USE_SPI_ETHERNET -#include "driver/spi_master.h" -#endif #ifdef __cplusplus extern "C" { @@ -339,8 +336,8 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_mac_config_t *config); * */ typedef struct { - spi_device_handle_t spi_hdl; /*!< Handle of SPI device driver */ - int int_gpio_num; /*!< Interrupt GPIO number */ + void *spi_hdl; /*!< Handle of SPI device driver */ + int int_gpio_num; /*!< Interrupt GPIO number */ } eth_dm9051_config_t; /** @@ -366,6 +363,39 @@ typedef struct { esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, const eth_mac_config_t *mac_config); #endif // CONFIG_ETH_SPI_ETHERNET_DM9051 +#if CONFIG_ETH_SPI_ETHERNET_W5500 +/** + * @brief W5500 specific configuration + * + */ +typedef struct { + void *spi_hdl; /*!< Handle of SPI device driver */ + int int_gpio_num; /*!< Interrupt GPIO number */ +} eth_w5500_config_t; + +/** + * @brief Default W5500 specific configuration + * + */ +#define ETH_W5500_DEFAULT_CONFIG(spi_device) \ + { \ + .spi_hdl = spi_device, \ + .int_gpio_num = 4, \ + } + +/** +* @brief Create W5500 Ethernet MAC instance +* +* @param w5500_config: W5500 specific configuration +* @param mac_config: Ethernet MAC configuration +* +* @return +* - instance: create MAC instance successfully +* - NULL: create MAC instance failed because some error occurred +*/ +esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, const eth_mac_config_t *mac_config); +#endif // CONFIG_ETH_SPI_ETHERNET_W5500 + #if CONFIG_ETH_USE_OPENETH /** * @brief Create OpenCores Ethernet MAC instance diff --git a/tools/sdk/esp32/include/esp_eth/include/esp_eth_phy.h b/tools/sdk/esp32/include/esp_eth/include/esp_eth_phy.h index cda3e7775..e40190106 100644 --- a/tools/sdk/esp32/include/esp_eth/include/esp_eth_phy.h +++ b/tools/sdk/esp32/include/esp_eth/include/esp_eth_phy.h @@ -277,6 +277,18 @@ esp_eth_phy_t *esp_eth_phy_new_ksz8041(const eth_phy_config_t *config); esp_eth_phy_t *esp_eth_phy_new_dm9051(const eth_phy_config_t *config); #endif +#if CONFIG_ETH_SPI_ETHERNET_W5500 +/** +* @brief Create a PHY instance of W5500 +* +* @param[in] config: configuration of PHY +* +* @return +* - instance: create PHY instance successfully +* - NULL: create PHY instance failed because some error occurred +*/ +esp_eth_phy_t *esp_eth_phy_new_w5500(const eth_phy_config_t *config); +#endif #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/esp_event/include/esp_event_legacy.h b/tools/sdk/esp32/include/esp_event/include/esp_event_legacy.h index ba74ec776..e4f579a0a 100644 --- a/tools/sdk/esp32/include/esp_event/include/esp_event_legacy.h +++ b/tools/sdk/esp32/include/esp_event/include/esp_event_legacy.h @@ -36,6 +36,7 @@ typedef enum { SYSTEM_EVENT_STA_AUTHMODE_CHANGE, /*!< the auth mode of AP connected by ESP32 station changed */ SYSTEM_EVENT_STA_GOT_IP, /*!< ESP32 station got IP from connected AP */ SYSTEM_EVENT_STA_LOST_IP, /*!< ESP32 station lost IP and the IP is reset to 0 */ + SYSTEM_EVENT_STA_BSS_RSSI_LOW, /*!< ESP32 station connected BSS rssi goes below threshold */ SYSTEM_EVENT_STA_WPS_ER_SUCCESS, /*!< ESP32 station wps succeeds in enrollee mode */ SYSTEM_EVENT_STA_WPS_ER_FAILED, /*!< ESP32 station wps fails in enrollee mode */ SYSTEM_EVENT_STA_WPS_ER_TIMEOUT, /*!< ESP32 station wps timeout in enrollee mode */ @@ -249,4 +250,3 @@ system_event_cb_t esp_event_loop_set_cb(system_event_cb_t cb, void *ctx) __attri #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/esp_gdbstub/esp32/gdbstub_target_config.h b/tools/sdk/esp32/include/esp_gdbstub/esp32/gdbstub_target_config.h new file mode 100644 index 000000000..ae31ae9da --- /dev/null +++ b/tools/sdk/esp32/include/esp_gdbstub/esp32/gdbstub_target_config.h @@ -0,0 +1,18 @@ +// 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. + +#pragma once + +/* Number of extra TIE defined registers, not listed in the XCHAL */ +#define GDBSTUB_EXTRA_TIE_SIZE 0 diff --git a/tools/sdk/esp32/include/esp_gdbstub/xtensa/esp_gdbstub_arch.h b/tools/sdk/esp32/include/esp_gdbstub/xtensa/esp_gdbstub_arch.h new file mode 100644 index 000000000..18b119cb3 --- /dev/null +++ b/tools/sdk/esp32/include/esp_gdbstub/xtensa/esp_gdbstub_arch.h @@ -0,0 +1,91 @@ +// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once +#include +#include "freertos/xtensa_context.h" +#include "gdbstub_target_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef XtExcFrame esp_gdbstub_frame_t; + +/* GDB regfile structure, configuration dependent */ +typedef struct { + uint32_t pc; + uint32_t a[XCHAL_NUM_AREGS]; + +#if XCHAL_HAVE_LOOPS + uint32_t lbeg; + uint32_t lend; + uint32_t lcount; +#endif + + uint32_t sar; + +#if XCHAL_HAVE_WINDOWED + uint32_t windowbase; + uint32_t windowstart; +#endif + + uint32_t configid0; + uint32_t configid1; + uint32_t ps; + +#if XCHAL_HAVE_THREADPTR + uint32_t threadptr; +#endif + +#if XCHAL_HAVE_BOOLEANS + uint32_t br; +#endif + +#if XCHAL_HAVE_S32C1I + uint32_t scompare1; +#endif + +#if XCHAL_HAVE_MAC16 + uint32_t acclo; + uint32_t acchi; + uint32_t m0; + uint32_t m1; + uint32_t m2; + uint32_t m3; +#endif + +#if XCHAL_HAVE_DFP_ACCEL + uint32_t expstate; + uint32_t f64r_lo; + uint32_t f64r_hi; + uint32_t f64s; +#endif + +#if XCHAL_HAVE_FP + uint32_t f[16]; + uint32_t fcr; + uint32_t fsr; +#endif + +#if GDBSTUB_EXTRA_TIE_SIZE > 0 + uint32_t tie[GDBSTUB_EXTRA_TIE_SIZE]; +#endif + +} esp_gdbstub_gdb_regfile_t; + + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h b/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h index a6da8573e..017ee5d5a 100644 --- a/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h +++ b/tools/sdk/esp32/include/esp_http_client/include/esp_http_client.h @@ -117,6 +117,7 @@ typedef struct { const char *cert_pem; /*!< SSL server certification, PEM format as string, if the client requires to verify server */ const char *client_cert_pem; /*!< SSL client certification, PEM format as string, if the server requires to verify client */ const char *client_key_pem; /*!< SSL client key, PEM format as string, if the server requires to verify client */ + const char *user_agent; /*!< The User Agent string to send with HTTP requests */ esp_http_client_method_t method; /*!< HTTP Method */ int timeout_ms; /*!< Network timeout in milliseconds */ bool disable_auto_redirect; /*!< Disable HTTP automatic redirects */ @@ -136,7 +137,11 @@ typedef struct { * Enum for the HTTP status codes. */ typedef enum { + /* 2xx - Success */ + HttpStatus_Ok = 200, + /* 3xx - Redirection */ + HttpStatus_MultipleChoices = 300, HttpStatus_MovedPermanently = 301, HttpStatus_Found = 302, HttpStatus_TemporaryRedirect = 307, @@ -503,7 +508,7 @@ void esp_http_client_add_auth(esp_http_client_handle_t client); * @brief Checks if entire data in the response has been read without any error. * * @param[in] client The esp_http_client handle - * + * * @return * - true * - false diff --git a/tools/sdk/esp32/include/esp_http_server/include/esp_http_server.h b/tools/sdk/esp32/include/esp_http_server/include/esp_http_server.h index 7372003df..0b5c8ceb0 100644 --- a/tools/sdk/esp32/include/esp_http_server/include/esp_http_server.h +++ b/tools/sdk/esp32/include/esp_http_server/include/esp_http_server.h @@ -412,6 +412,11 @@ typedef struct httpd_uri { * This is used if a custom processing of the control frames is needed */ bool handle_ws_control_frames; + + /** + * Pointer to subprotocol supported by URI + */ + const char *supported_subprotocol; #endif } httpd_uri_t; @@ -535,6 +540,17 @@ typedef enum { */ HTTPD_400_BAD_REQUEST, + /* This response means the client must authenticate itself + * to get the requested response. + */ + HTTPD_401_UNAUTHORIZED, + + /* The client does not have access rights to the content, + * so the server is refusing to give the requested resource. + * Unlike 401, the client's identity is known to the server. + */ + HTTPD_403_FORBIDDEN, + /* When requested URI is not found */ HTTPD_404_NOT_FOUND, diff --git a/tools/sdk/esp32/include/esp_https_ota/include/esp_https_ota.h b/tools/sdk/esp32/include/esp_https_ota/include/esp_https_ota.h index b88fdfaa5..2966c5d0a 100644 --- a/tools/sdk/esp32/include/esp_https_ota/include/esp_https_ota.h +++ b/tools/sdk/esp32/include/esp_https_ota/include/esp_https_ota.h @@ -39,12 +39,12 @@ typedef struct { /** * @brief HTTPS OTA Firmware upgrade. * - * This function allocates HTTPS OTA Firmware upgrade context, establishes HTTPS connection, - * reads image data from HTTP stream and writes it to OTA partition and + * This function allocates HTTPS OTA Firmware upgrade context, establishes HTTPS connection, + * reads image data from HTTP stream and writes it to OTA partition and * finishes HTTPS OTA Firmware upgrade operation. * This API supports URL redirection, but if CA cert of URLs differ then it * should be appended to `cert_pem` member of `config`. - * + * * @param[in] config pointer to esp_http_client_config_t structure. * * @note This API handles the entire OTA operation, so if this API is being used @@ -86,19 +86,19 @@ esp_err_t esp_https_ota(const esp_http_client_config_t *config); * - ESP_OK: HTTPS OTA Firmware upgrade context initialised and HTTPS connection established * - ESP_FAIL: For generic failure. * - ESP_ERR_INVALID_ARG: Invalid argument (missing/incorrect config, certificate, etc.) - * - For other return codes, refer documentation in app_update component and esp_http_client + * - For other return codes, refer documentation in app_update component and esp_http_client * component in esp-idf. */ esp_err_t esp_https_ota_begin(esp_https_ota_config_t *ota_config, esp_https_ota_handle_t *handle); /** - * @brief Read image data from HTTP stream and write it to OTA partition + * @brief Read image data from HTTP stream and write it to OTA partition * - * This function reads image data from HTTP stream and writes it to OTA partition. This function + * This function reads image data from HTTP stream and writes it to OTA partition. This function * must be called only if esp_https_ota_begin() returns successfully. - * This function must be called in a loop since it returns after every HTTP read operation thus + * This function must be called in a loop since it returns after every HTTP read operation thus * giving you the flexibility to stop OTA operation midway. - * + * * @param[in] https_ota_handle pointer to esp_https_ota_handle_t structure * * @return @@ -135,6 +135,7 @@ bool esp_https_ota_is_complete_data_received(esp_https_ota_handle_t https_ota_ha * * @note If this API returns successfully, esp_restart() must be called to * boot from the new firmware image + * esp_https_ota_finish should not be called after calling esp_https_ota_abort * * @param[in] https_ota_handle pointer to esp_https_ota_handle_t structure * @@ -147,17 +148,36 @@ bool esp_https_ota_is_complete_data_received(esp_https_ota_handle_t https_ota_ha esp_err_t esp_https_ota_finish(esp_https_ota_handle_t https_ota_handle); +/** + * @brief Clean-up HTTPS OTA Firmware upgrade and close HTTPS connection + * + * This function closes the HTTP connection and frees the ESP HTTPS OTA context. + * + * @note esp_https_ota_abort should not be called after calling esp_https_ota_finish + * + * @param[in] https_ota_handle pointer to esp_https_ota_handle_t structure + * + * @return + * - ESP_OK: Clean-up successful + * - ESP_ERR_INVALID_STATE: Invalid ESP HTTPS OTA state + * - ESP_FAIL: OTA not started + * - ESP_ERR_NOT_FOUND: OTA handle not found + * - ESP_ERR_INVALID_ARG: Invalid argument + */ +esp_err_t esp_https_ota_abort(esp_https_ota_handle_t https_ota_handle); + + /** * @brief Reads app description from image header. The app description provides information * like the "Firmware version" of the image. - * + * * @note This API can be called only after esp_https_ota_begin() and before esp_https_ota_perform(). * Calling this API is not mandatory. * * @param[in] https_ota_handle pointer to esp_https_ota_handle_t structure * @param[out] new_app_info pointer to an allocated esp_app_desc_t structure - * - * @return + * + * @return * - ESP_ERR_INVALID_ARG: Invalid arguments * - ESP_FAIL: Failed to read image descriptor * - ESP_OK: Successfully read image descriptor diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/clk_ctrl_os.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/clk_ctrl_os.h new file mode 100644 index 000000000..f4d769b80 --- /dev/null +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/clk_ctrl_os.h @@ -0,0 +1,50 @@ +// 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. + +#include "soc/rtc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief This function is used to enable the digital 8m rtc clock, + * to support the peripherals. + * + * @note If this function is called a number of times, the `periph_rtc_dig_clk8m_disable` + * function needs to be called same times to disable. + * + * @return true: success for enable the rtc 8M clock, false: rtc 8M clock enable failed + */ +bool periph_rtc_dig_clk8m_enable(void); + +/** + * @brief This function is used to disable the rtc digital clock, which should be called + * with the `periph_rtc_dig_clk8m_enable` pairedly + * + * @note If this function is called a number of times, the `periph_rtc_dig_clk8m_disable` + * function needs to be called same times to disable. + */ +void periph_rtc_dig_clk8m_disable(void); + +/** + * @brief This function is used to get the real clock frequency value of the rtc clock + * + * @return The real clock value + */ +uint32_t periph_rtc_dig_clk8m_get_freq(void); + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/compare_set.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/compare_set.h index b748fa9ea..5a11ab166 100644 --- a/tools/sdk/esp32/include/esp_hw_support/include/soc/compare_set.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/compare_set.h @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef __COMPARE_SET_H -#define __COMPARE_SET_H +#pragma once #include #include #include "soc/cpu.h" #include "soc/soc_memory_layout.h" + +#if __XTENSA__ #include "xtensa/xtruntime.h" +#endif #ifdef __cplusplus extern "C" { @@ -27,7 +29,7 @@ extern "C" { static inline void __attribute__((always_inline)) compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { -#if (XCHAL_HAVE_S32C1I > 0) +#if (XCHAL_HAVE_S32C1I > 0) __asm__ __volatile__ ( "WSR %2,SCOMPARE1 \n" "S32C1I %0, %1, 0 \n" @@ -35,20 +37,31 @@ static inline void __attribute__((always_inline)) compare_and_set_native(volatil :"r"(addr), "r"(compare), "0"(*set) ); #else + uint32_t old_value; + +#ifdef __XTENSA__ // No S32C1I, so do this by disabling and re-enabling interrupts (slower) - uint32_t intlevel, old_value; + uint32_t intlevel; __asm__ __volatile__ ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) "\n" : "=r"(intlevel)); +#else + unsigned old_mstatus = RV_CLEAR_CSR(mstatus, MSTATUS_MIE); +#endif old_value = *addr; if (old_value == compare) { *addr = *set; } +#ifdef __XTENSA__ __asm__ __volatile__ ("memw \n" "wsr %0, ps\n" :: "r"(intlevel)); +#else + RV_SET_CSR(mstatus, old_mstatus & MSTATUS_MIE); +#endif + *set = old_value; #endif } @@ -59,5 +72,3 @@ void compare_and_set_extram(volatile uint32_t *addr, uint32_t compare, uint32_t #ifdef __cplusplus } #endif - -#endif \ No newline at end of file diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/cpu.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/cpu.h index d01970610..441ced6b7 100644 --- a/tools/sdk/esp32/include/esp_hw_support/include/soc/cpu.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/cpu.h @@ -18,11 +18,16 @@ #include #include #include + +#if __XTENSA__ +#include "xt_instr_macros.h" +// [refactor-todo] not actually needed in this header now, +// but kept for compatibility #include "xtensa/corebits.h" #include "xtensa/config/core.h" #include "xtensa/config/specreg.h" -#include "xt_instr_macros.h" +#endif #include "hal/cpu_hal.h" @@ -91,11 +96,15 @@ typedef uint32_t esp_cpu_ccount_t; static inline esp_cpu_ccount_t esp_cpu_get_ccount(void) { - uint32_t result; - RSR(CCOUNT, result); - return result; + return cpu_hal_get_cycle_count(); } +/** + * @brief Configure CPU to disable access to invalid memory regions + * + */ +void esp_cpu_configure_region_protection(void); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/rtc_wdt.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/rtc_wdt.h index 0ed2c9a7b..7d13e6a4f 100644 --- a/tools/sdk/esp32/include/esp_hw_support/include/soc/rtc_wdt.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/rtc_wdt.h @@ -33,7 +33,7 @@ They can help to understand where the CPUs were when the WDT was triggered. W (31) boot: WDT reset info: APP CPU PC=0x400xxxxx ... function where it happened -* If you use this option RTC_WDT_STAGE_ACTION_RESET_RTC then you will see message (rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)) +* If you use this option RTC_WDT_STAGE_ACTION_RESET_RTC then you will see message (rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)) without description where were CPUs when it happened. 2) Reset counter of rtc_wdt: diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc/spinlock.h b/tools/sdk/esp32/include/esp_hw_support/include/soc/spinlock.h index 286858315..5370642a0 100644 --- a/tools/sdk/esp32/include/esp_hw_support/include/soc/spinlock.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc/spinlock.h @@ -11,15 +11,19 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef __SOC_SPINLOCK_H -#define __SOC_SPINLOCK_H +#pragma once #include #include +#include "sdkconfig.h" #include "soc/cpu.h" +#include "hal/cpu_hal.h" #include "soc/soc_memory_layout.h" #include "soc/compare_set.h" + +#if __XTENSA__ #include "xtensa/xtruntime.h" +#endif #ifdef __cplusplus extern "C" { @@ -32,8 +36,8 @@ extern "C" { #endif #define SPINLOCK_FREE 0xB33FFFFF -#define SPINLOCK_WAIT_FOREVER (-1) -#define SPINLOCK_NO_WAIT 0 +#define SPINLOCK_WAIT_FOREVER (-1) +#define SPINLOCK_NO_WAIT 0 #define SPINLOCK_INITIALIZER {.owner = SPINLOCK_FREE,.count = 0} #define CORE_ID_REGVAL_XOR_SWAP (0xCDCD ^ 0xABAB) @@ -62,28 +66,28 @@ static inline void __attribute__((always_inline)) spinlock_initialize(spinlock_t */ static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *lock, int32_t timeout) { -#if !CONFIG_FREERTOS_UNICORE +#if !CONFIG_FREERTOS_UNICORE && !BOOTLOADER_BUILD uint32_t result; uint32_t irq_status; uint32_t ccount_start; uint32_t core_id, other_core_id; - + assert(lock); - irq_status = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); - + irq_status = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); + if(timeout != SPINLOCK_WAIT_FOREVER){ - RSR(CCOUNT, ccount_start); + RSR(CCOUNT, ccount_start); } /*spin until we own a core */ RSR(PRID, core_id); /* Note: coreID is the full 32 bit core ID (CORE_ID_REGVAL_PRO/CORE_ID_REGVAL_APP) */ - + other_core_id = CORE_ID_REGVAL_XOR_SWAP ^ core_id; do { - /* lock->owner should be one of SPINLOCK_FREE, CORE_ID_REGVAL_PRO, + /* lock->owner should be one of SPINLOCK_FREE, CORE_ID_REGVAL_PRO, * CORE_ID_REGVAL_APP: * - If SPINLOCK_FREE, we want to atomically set to 'core_id'. * - If "our" core_id, we can drop through immediately. @@ -106,7 +110,7 @@ static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *l if (timeout != SPINLOCK_WAIT_FOREVER) { uint32_t ccount_now; - RSR(CCOUNT, ccount_now); + ccount_now = cpu_hal_get_cycle_count(); if (ccount_now - ccount_start > (unsigned)timeout) { XTOS_RESTORE_INTLEVEL(irq_status); return false; @@ -115,7 +119,7 @@ static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *l }while(1); /* any other value implies memory corruption or uninitialized mux */ - assert(result == core_id || result == SPINLOCK_FREE); + assert(result == core_id || result == SPINLOCK_FREE); assert((result == SPINLOCK_FREE) == (lock->count == 0)); /* we're first to lock iff count is zero */ assert(lock->count < 0xFF); /* Bad count value implies memory corruption */ @@ -123,10 +127,9 @@ static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *l XTOS_RESTORE_INTLEVEL(irq_status); return true; -#else +#else // !CONFIG_FREERTOS_UNICORE return true; -#endif - +#endif } /** @@ -135,14 +138,13 @@ static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *l */ static inline void __attribute__((always_inline)) spinlock_release(spinlock_t *lock) { - -#if !CONFIG_FREERTOS_UNICORE - uint32_t irq_status; +#if !CONFIG_FREERTOS_UNICORE && !BOOTLOADER_BUILD + uint32_t irq_status; uint32_t core_id; assert(lock); irq_status = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); - + RSR(PRID, core_id); assert(core_id == lock->owner); // This is a mutex we didn't lock, or it's corrupt lock->count--; @@ -154,12 +156,9 @@ static inline void __attribute__((always_inline)) spinlock_release(spinlock_t *l } XTOS_RESTORE_INTLEVEL(irq_status); -#endif +#endif } #ifdef __cplusplus } #endif - -#endif - diff --git a/tools/sdk/esp32/include/esp_hw_support/include/soc_log.h b/tools/sdk/esp32/include/esp_hw_support/include/soc_log.h index 2f2bfd4e9..894f0962c 100644 --- a/tools/sdk/esp32/include/esp_hw_support/include/soc_log.h +++ b/tools/sdk/esp32/include/esp_hw_support/include/soc_log.h @@ -39,6 +39,8 @@ #include "esp32s2/rom/ets_sys.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/ets_sys.h" #endif #define SOC_LOGE(tag, fmt, ...) esp_rom_printf("%s(err): " fmt, tag, ##__VA_ARGS__) diff --git a/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_apll.h b/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_apll.h index 05f274b28..db4902754 100644 --- a/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_apll.h +++ b/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_apll.h @@ -133,4 +133,3 @@ #define I2C_APLL_DSDM0 9 #define I2C_APLL_DSDM0_MSB 7 #define I2C_APLL_DSDM0_LSB 0 - diff --git a/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_bbpll.h b/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_bbpll.h index 68c87fb6c..8a9fcef37 100644 --- a/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_bbpll.h +++ b/tools/sdk/esp32/include/esp_hw_support/port/esp32/private_include/regi2c_bbpll.h @@ -205,4 +205,3 @@ #define I2C_BBPLL_BBADC_CAL_7_0 12 #define I2C_BBPLL_BBADC_CAL_7_0_MSB 7 #define I2C_BBPLL_BBADC_CAL_7_0_LSB 0 - diff --git a/tools/sdk/esp32/include/esp_hw_support/port/esp32/regi2c_ctrl.h b/tools/sdk/esp32/include/esp_hw_support/port/esp32/regi2c_ctrl.h index 1a8c2b3b2..d896cb2b8 100644 --- a/tools/sdk/esp32/include/esp_hw_support/port/esp32/regi2c_ctrl.h +++ b/tools/sdk/esp32/include/esp_hw_support/port/esp32/regi2c_ctrl.h @@ -55,4 +55,4 @@ void rom_i2c_writeReg_Mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp_hw_support/port/esp32/rtc_clk_common.h b/tools/sdk/esp32/include/esp_hw_support/port/esp32/rtc_clk_common.h index b6ae3ca2e..dec179e3b 100644 --- a/tools/sdk/esp32/include/esp_hw_support/port/esp32/rtc_clk_common.h +++ b/tools/sdk/esp32/include/esp_hw_support/port/esp32/rtc_clk_common.h @@ -45,4 +45,4 @@ static inline uint32_t clk_val_to_reg_val(uint32_t val) { #ifdef __cplusplus } -#endif \ No newline at end of file +#endif 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 79c8fc8e6..dbb102879 100644 --- a/tools/sdk/esp32/include/esp_littlefs/include/esp_littlefs.h +++ b/tools/sdk/esp32/include/esp_littlefs/include/esp_littlefs.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/tools/sdk/esp32/include/esp_netif/include/esp_netif.h b/tools/sdk/esp32/include/esp_netif/include/esp_netif.h index 5cb6e8029..b8a61118b 100644 --- a/tools/sdk/esp32/include/esp_netif/include/esp_netif.h +++ b/tools/sdk/esp32/include/esp_netif/include/esp_netif.h @@ -564,12 +564,12 @@ esp_err_t esp_netif_dhcps_stop(esp_netif_t *esp_netif); * * This function behaves differently if DHCP server or client is enabled * - * If DHCP client is enabled, main and backup DNS servers will be updated automatically - * from the DHCP lease if the relevant DHCP options are set. Fallback DNS Server is never updated from the DHCP lease + * If DHCP client is enabled, main and backup DNS servers will be updated automatically + * from the DHCP lease if the relevant DHCP options are set. Fallback DNS Server is never updated from the DHCP lease * and is designed to be set via this API. * If DHCP client is disabled, all DNS server types can be set via this API only. - * - * If DHCP server is enabled, the Main DNS Server setting is used by the DHCP server to provide a DNS Server option + * + * If DHCP server is enabled, the Main DNS Server setting is used by the DHCP server to provide a DNS Server option * to DHCP clients (Wi-Fi stations). * - The default Main DNS server is typically the IP of the Wi-Fi AP interface itself. * - This function can override it by setting server type ESP_NETIF_DNS_MAIN. @@ -722,36 +722,36 @@ uint32_t esp_ip4addr_aton(const char *addr); /** * @brief Gets media driver handle for this esp-netif instance - * + * * @param[in] esp_netif Handle to esp-netif instance - * + * * @return opaque pointer of related IO driver */ esp_netif_iodriver_handle esp_netif_get_io_driver(esp_netif_t *esp_netif); /** * @brief Searches over a list of created objects to find an instance with supplied if key - * + * * @param if_key Textual description of network interface - * + * * @return Handle to esp-netif instance */ esp_netif_t *esp_netif_get_handle_from_ifkey(const char *if_key); /** * @brief Returns configured flags for this interface - * + * * @param[in] esp_netif Handle to esp-netif instance - * - * @return Configuration flags + * + * @return Configuration flags */ esp_netif_flags_t esp_netif_get_flags(esp_netif_t *esp_netif); /** * @brief Returns configured interface key for this esp-netif instance - * + * * @param[in] esp_netif Handle to esp-netif instance - * + * * @return Textual description of related interface */ const char *esp_netif_get_ifkey(esp_netif_t *esp_netif); @@ -780,7 +780,7 @@ int esp_netif_get_route_prio(esp_netif_t *esp_netif); * @param[in] esp_netif Handle to esp-netif instance * * @param event_type (either get or lost IP) - * + * * @return specific event id which is configured to be raised if the interface lost or acquired IP address * -1 if supplied event_type is not known */ diff --git a/tools/sdk/esp32/include/esp_netif/include/esp_netif_defaults.h b/tools/sdk/esp32/include/esp_netif/include/esp_netif_defaults.h index f61d7294b..7ef65260d 100644 --- a/tools/sdk/esp32/include/esp_netif/include/esp_netif_defaults.h +++ b/tools/sdk/esp32/include/esp_netif/include/esp_netif_defaults.h @@ -134,7 +134,7 @@ extern "C" { .driver = NULL, \ .stack = ESP_NETIF_NETSTACK_DEFAULT_SLIP, \ } - + /** * @brief Default base config (esp-netif inherent) of WIFI STA diff --git a/tools/sdk/esp32/include/esp_netif/include/esp_netif_ip_addr.h b/tools/sdk/esp32/include/esp_netif/include/esp_netif_ip_addr.h index 92f374e1b..809404c1d 100644 --- a/tools/sdk/esp32/include/esp_netif/include/esp_netif_ip_addr.h +++ b/tools/sdk/esp32/include/esp_netif/include/esp_netif_ip_addr.h @@ -105,7 +105,7 @@ typedef struct _ip_addr { } u_addr; uint8_t type; } esp_ip_addr_t; - + typedef enum { ESP_IP6_ADDR_IS_UNKNOWN, ESP_IP6_ADDR_IS_GLOBAL, diff --git a/tools/sdk/esp32/include/esp_netif/include/esp_netif_types.h b/tools/sdk/esp32/include/esp_netif/include/esp_netif_types.h index 470839d19..044ca0d11 100644 --- a/tools/sdk/esp32/include/esp_netif/include/esp_netif_types.h +++ b/tools/sdk/esp32/include/esp_netif/include/esp_netif_types.h @@ -164,7 +164,7 @@ typedef struct esp_netif_inherent_config { const char * if_key; /*!< string identifier of the interface */ const char * if_desc; /*!< textual description of the interface */ int route_prio; /*!< numeric priority of this interface to become a default - routing if (if other netifs are up). + routing if (if other netifs are up). A higher value of route_prio indicates a higher priority */ } esp_netif_inherent_config_t; diff --git a/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_impl.h b/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_impl.h index 122190f26..a2e92a48a 100644 --- a/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_impl.h +++ b/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_impl.h @@ -124,7 +124,7 @@ typedef bool (* skip_light_sleep_cb_t)(void); * * This function allows you to register a callback that gets the result * that if light sleep should be skipped by peripherals. - * @param cb function to get the result + * @param cb function to get the result * @return * - ESP_OK on success * - ESP_ERR_NO_MEM if no more callback slots are available @@ -132,11 +132,11 @@ typedef bool (* skip_light_sleep_cb_t)(void); esp_err_t esp_pm_register_skip_light_sleep_callback(skip_light_sleep_cb_t cb); /** - * @brief Unregisterperipherals skip light sleep callback + * @brief Unregisterperipherals skip light sleep callback * * This function allows you to unregister a callback which was previously * registered using esp_register_skip_light_sleep_callback. - * @param cb function to get the result + * @param cb function to get the result * @return * - ESP_OK on success * - ESP_ERR_INVALID_STATE if the given callback hasn't been registered before @@ -157,4 +157,4 @@ static inline pm_time_t IRAM_ATTR pm_get_time(void) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_trace.h b/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_trace.h index 7bc35c159..e6cb7b923 100644 --- a/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_trace.h +++ b/tools/sdk/esp32/include/esp_pm/include/esp_private/pm_trace.h @@ -50,4 +50,4 @@ void esp_pm_trace_exit(esp_pm_trace_event_t event, int core_id); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp_ringbuf/include/freertos/ringbuf.h b/tools/sdk/esp32/include/esp_ringbuf/include/freertos/ringbuf.h index ef9c53229..df6cc7a6a 100644 --- a/tools/sdk/esp32/include/esp_ringbuf/include/freertos/ringbuf.h +++ b/tools/sdk/esp32/include/esp_ringbuf/include/freertos/ringbuf.h @@ -64,8 +64,6 @@ typedef enum { * buffer where this struct is of the exact size required to store a ring * buffer's control data structure. * - * @note The CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION option must be enabled for - * this structure to be available. */ #if ( configSUPPORT_STATIC_ALLOCATION == 1) typedef struct xSTATIC_RINGBUFFER { @@ -117,9 +115,6 @@ RingbufHandle_t xRingbufferCreateNoSplit(size_t xItemSize, size_t xItemNum); * @param[in] pxStaticRingbuffer Pointed to a struct of type StaticRingbuffer_t * which will be used to hold the ring buffer's data structure * - * @note The CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION option must be enabled - * for this to be available - * * @note xBufferSize of no-split/allow-split buffers MUST be 32-bit aligned. * * @return A handle to the created ring buffer @@ -521,4 +516,3 @@ void xRingbufferPrintInfo(RingbufHandle_t xRingbuffer); #endif #endif /* FREERTOS_RINGBUF_H */ - diff --git a/tools/sdk/esp32/include/soc/esp32/include/soc/sha_caps.h b/tools/sdk/esp32/include/esp_rom/esp32/esp_rom_caps.h similarity index 58% rename from tools/sdk/esp32/include/soc/esp32/include/soc/sha_caps.h rename to tools/sdk/esp32/include/esp_rom/esp32/esp_rom_caps.h index b409013f3..6188ef52a 100644 --- a/tools/sdk/esp32/include/soc/esp32/include/soc/sha_caps.h +++ b/tools/sdk/esp32/include/esp_rom/esp32/esp_rom_caps.h @@ -14,21 +14,7 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#define SOC_SHA_SUPPORT_DMA (0) - -/* ESP32 style SHA engine, where multiple states can be stored in parallel */ -#define SOC_SHA_SUPPORT_PARALLEL_ENG (1) - -/* Supported HW algorithms */ -#define SOC_SHA_SUPPORT_SHA1 (1) -#define SOC_SHA_SUPPORT_SHA256 (1) -#define SOC_SHA_SUPPORT_SHA384 (1) -#define SOC_SHA_SUPPORT_SHA512 (1) - -#ifdef __cplusplus -} -#endif +#define ESP_ROM_HAS_CRC_LE (1) // ROM CRC library supports Little Endian +#define ESP_ROM_HAS_CRC_BE (1) // ROM CRC library supports Big Endian +#define ESP_ROM_HAS_JPEG_DECODE (1) // ROM has JPEG decode library +#define ESP_ROM_SUPPORT_MULTIPLE_UART (1) // ROM has multiple UARTs available for logging diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/miniz.h b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/miniz.h index 773a0d057..7661f8044 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/miniz.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/miniz.h @@ -683,7 +683,7 @@ size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void // Compresses an image to a compressed PNG file in memory. // On entry: -// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. +// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. // The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory. // level may range from [0,10], use MZ_NO_COMPRESSION, MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc. or a decent default is MZ_DEFAULT_LEVEL // If flip is true, the image will be flipped on the Y axis (useful for OpenGL apps). @@ -789,4 +789,3 @@ mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int #endif #endif // MINIZ_HEADER_INCLUDED - diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/rtc.h b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/rtc.h index dcb46df8e..fa00b71bb 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/rtc.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/rtc.h @@ -217,4 +217,3 @@ void software_reset_cpu(int cpu_no); #endif #endif /* _ROM_RTC_H_ */ - diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/secure_boot.h b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/secure_boot.h index 259e7bab7..3e17941be 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/secure_boot.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/secure_boot.h @@ -115,4 +115,4 @@ bool ets_use_secure_boot_v2(void); } #endif -#endif /* _ROM_SECURE_BOOT_H_ */ \ No newline at end of file +#endif /* _ROM_SECURE_BOOT_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/spi_flash.h b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/spi_flash.h index c71b81001..a514c75fb 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/spi_flash.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/spi_flash.h @@ -543,11 +543,20 @@ esp_rom_spiflash_result_t esp_rom_spiflash_wait_idle(esp_rom_spiflash_chip_t *sp */ void esp_rom_spiflash_select_qio_pins(uint8_t wp_gpio_num, uint32_t spiconfig); +/** + * @brief Clear WEL bit unconditionally. + * + * @return always ESP_ROM_SPIFLASH_RESULT_OK + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_disable(void); + /** @brief Global esp_rom_spiflash_chip_t structure used by ROM functions * */ extern esp_rom_spiflash_chip_t g_rom_flashchip; +extern uint8_t g_rom_spiflash_dummy_len_plus[]; + /** * @} */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/tjpgd.h b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/tjpgd.h index 31fbc97cc..3c110a130 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32/rom/tjpgd.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32/rom/tjpgd.h @@ -41,7 +41,7 @@ typedef unsigned long DWORD; /* Error code */ typedef enum { JDR_OK = 0, /* 0: Succeeded */ - JDR_INTR, /* 1: Interrupted by output function */ + JDR_INTR, /* 1: Interrupted by output function */ JDR_INP, /* 2: Device error or wrong termination of input stream */ JDR_MEM1, /* 3: Insufficient memory pool for the image */ JDR_MEM2, /* 4: Insufficient stream input buffer */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/aes.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/aes.h new file mode 100644 index 000000000..d8002ef58 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/aes.h @@ -0,0 +1,58 @@ +// 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. + +#ifndef _ROM_AES_H_ +#define _ROM_AES_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define AES_BLOCK_SIZE 16 + +enum AES_TYPE { + AES_ENC, + AES_DEC, +}; + +enum AES_BITS { + AES128, + AES192, + AES256 +}; + +void ets_aes_enable(void); + +void ets_aes_disable(void); + +void ets_aes_set_endian(bool key_word_swap, bool key_byte_swap, + bool in_word_swap, bool in_byte_swap, + bool out_word_swap, bool out_byte_swap); + +int ets_aes_setkey(enum AES_TYPE type, const void *key, enum AES_BITS bits); + +int ets_aes_setkey_enc(const void *key, enum AES_BITS bits); + +int ets_aes_setkey_dec(const void *key, enum AES_BITS bits); + +void ets_aes_block(const void *input, void *output); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_AES_H_ */ diff --git a/tools/sdk/esp32/include/soc/esp32/include/soc/rsa_caps.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/apb_dma.h similarity index 79% rename from tools/sdk/esp32/include/soc/esp32/include/soc/rsa_caps.h rename to tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/apb_dma.h index 475dc4fe8..d4e709b74 100644 --- a/tools/sdk/esp32/include/soc/esp32/include/soc/rsa_caps.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/apb_dma.h @@ -1,4 +1,4 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD +// Copyright 2010-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. @@ -18,8 +18,7 @@ extern "C" { #endif - -#define SOC_RSA_MAX_BIT_LEN (4096) +void ets_apb_backup_init_lock_func(void(* _apb_backup_lock)(void), void(* _apb_backup_unlock)(void)); #ifdef __cplusplus } diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/bigint.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/bigint.h new file mode 100644 index 000000000..b63172ea7 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/bigint.h @@ -0,0 +1,43 @@ +// 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. + +#ifndef _ROM_BIGINT_H_ +#define _ROM_BIGINT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void ets_bigint_enable(void); + +void ets_bigint_disable(void); + +int ets_bigint_multiply(const uint32_t *x, const uint32_t *y, uint32_t len_words); + +int ets_bigint_modmult(const uint32_t *x, const uint32_t *y, const uint32_t *m, uint32_t m_dash, const uint32_t *rb, uint32_t len_words); + +int ets_bigint_modexp(const uint32_t *x, const uint32_t *y, const uint32_t *m, uint32_t m_dash, const uint32_t *rb, bool constant_time, uint32_t len_words); + +void ets_bigint_wait_finish(void); + +int ets_bigint_getz(uint32_t *z, uint32_t len_words); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_BIGINT_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/cache.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/cache.h new file mode 100644 index 000000000..487143e69 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/cache.h @@ -0,0 +1,796 @@ +// 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. + +#ifndef _ROM_CACHE_H_ +#define _ROM_CACHE_H_ + +#include +#include "esp_bit_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup cache_apis, cache operation related apis + * @brief cache apis + */ + +/** @addtogroup cache_apis + * @{ + */ +#define MIN_ICACHE_SIZE 16384 +#define MAX_ICACHE_SIZE 16384 +#define MIN_ICACHE_WAYS 8 +#define MAX_ICACHE_WAYS 8 +#define MAX_CACHE_WAYS 8 +#define MIN_CACHE_LINE_SIZE 32 +#define TAG_SIZE 4 +#define MIN_ICACHE_BANK_NUM 1 +#define MAX_ICACHE_BANK_NUM 1 +#define CACHE_MEMORY_BANK_NUM 1 +#define CACHE_MEMORY_IBANK_SIZE 0x4000 + +#define MAX_ITAG_BANK_ITEMS (MAX_ICACHE_SIZE / MAX_ICACHE_BANK_NUM / MIN_CACHE_LINE_SIZE) +#define MAX_ITAG_BLOCK_ITEMS (MAX_ICACHE_SIZE / MAX_ICACHE_BANK_NUM / MAX_ICACHE_WAYS / MIN_CACHE_LINE_SIZE) +#define MAX_ITAG_BANK_SIZE (MAX_ITAG_BANK_ITEMS * TAG_SIZE) +#define MAX_ITAG_BLOCK_SIZE (MAX_ITAG_BLOCK_ITEMS * TAG_SIZE) + +typedef enum { + CACHE_DCACHE = 0, + CACHE_ICACHE0 = 1, + CACHE_ICACHE1 = 2, +} cache_t; + +typedef enum { + CACHE_MEMORY_INVALID = 0, + CACHE_MEMORY_IBANK0 = BIT(0), + CACHE_MEMORY_IBANK1 = BIT(1), + CACHE_MEMORY_IBANK2 = BIT(2), + CACHE_MEMORY_IBANK3 = BIT(3), + CACHE_MEMORY_DBANK0 = BIT(0), + CACHE_MEMORY_DBANK1 = BIT(1), + CACHE_MEMORY_DBANK2 = BIT(2), + CACHE_MEMORY_DBANK3 = BIT(3), +} cache_array_t; + +#define ICACHE_SIZE_16KB CACHE_SIZE_HALF +#define ICACHE_SIZE_32KB CACHE_SIZE_FULL +#define DCACHE_SIZE_32KB CACHE_SIZE_HALF +#define DCACHE_SIZE_64KB CACHE_SIZE_FULL + +typedef enum { + CACHE_SIZE_HALF = 0, /*!< 8KB for icache and dcache */ + CACHE_SIZE_FULL = 1, /*!< 16KB for icache and dcache */ +} cache_size_t; + +typedef enum { + CACHE_4WAYS_ASSOC = 0, /*!< 4 way associated cache */ + CACHE_8WAYS_ASSOC = 1, /*!< 8 way associated cache */ +} cache_ways_t; + +typedef enum { + CACHE_LINE_SIZE_16B = 0, /*!< 16 Byte cache line size */ + CACHE_LINE_SIZE_32B = 1, /*!< 32 Byte cache line size */ + CACHE_LINE_SIZE_64B = 2, /*!< 64 Byte cache line size */ +} cache_line_size_t; + +typedef enum { + CACHE_AUTOLOAD_POSITIVE = 0, /*!< cache autoload step is positive */ + CACHE_AUTOLOAD_NEGATIVE = 1, /*!< cache autoload step is negative */ +} cache_autoload_order_t; + +#define CACHE_AUTOLOAD_STEP(i) ((i) - 1) + +typedef enum { + CACHE_AUTOLOAD_MISS_TRIGGER = 0, /*!< autoload only triggered by cache miss */ + CACHE_AUTOLOAD_HIT_TRIGGER = 1, /*!< autoload only triggered by cache hit */ + CACHE_AUTOLOAD_BOTH_TRIGGER = 2, /*!< autoload triggered both by cache miss and hit */ +} cache_autoload_trigger_t; + +typedef enum { + CACHE_FREEZE_ACK_BUSY = 0, /*!< in this mode, cache ack busy to CPU if a cache miss happens*/ + CACHE_FREEZE_ACK_ERROR = 1, /*!< in this mode, cache ack wrong data to CPU and trigger an error if a cache miss happens */ +} cache_freeze_mode_t; + +struct cache_mode { + uint32_t cache_size; /*!< cache size in byte */ + uint16_t cache_line_size; /*!< cache line size in byte */ + uint8_t cache_ways; /*!< cache ways, always 4 */ + uint8_t ibus; /*!< the cache index, 0 for dcache, 1 for icache */ +}; + +struct icache_tag_item { + uint32_t valid:1; /*!< the tag item is valid or not */ + uint32_t lock:1; /*!< the cache line is locked or not */ + uint32_t fifo_cnt:3; /*!< fifo cnt, 0 ~ 3 for 4 ways cache */ + uint32_t tag:13; /*!< the tag is the high part of the cache address, however is only 16MB (8MB Ibus + 8MB Dbus) range, and without low part */ + uint32_t reserved:14; +}; + +struct autoload_config { + uint8_t order; /*!< autoload step is positive or negative */ + uint8_t trigger; /*!< autoload trigger */ + uint8_t ena0; /*!< autoload region0 enable */ + uint8_t ena1; /*!< autoload region1 enable */ + uint32_t addr0; /*!< autoload region0 start address */ + uint32_t size0; /*!< autoload region0 size */ + uint32_t addr1; /*!< autoload region1 start address */ + uint32_t size1; /*!< autoload region1 size */ +}; + +struct tag_group_info { + struct cache_mode mode; /*!< cache and cache mode */ + uint32_t filter_addr; /*!< the address that used to generate the struct */ + uint32_t vaddr_offset; /*!< virtual address offset of the cache ways */ + uint32_t tag_addr[MAX_CACHE_WAYS]; /*!< tag memory address, only [0~mode.ways-1] is valid to use */ + uint32_t cache_memory_offset[MAX_CACHE_WAYS]; /*!< cache memory address, only [0~mode.ways-1] is valid to use */ +}; + +struct lock_config { + uint32_t addr; /*!< manual lock address*/ + uint16_t size; /*!< manual lock size*/ + uint16_t group; /*!< manual lock group, 0 or 1*/ +}; + +struct cache_internal_stub_table { + uint32_t (* icache_line_size)(void); + uint32_t (* icache_addr)(uint32_t addr); + uint32_t (* dcache_addr)(uint32_t addr); + void (* invalidate_icache_items)(uint32_t addr, uint32_t items); + void (* lock_icache_items)(uint32_t addr, uint32_t items); + void (* unlock_icache_items)(uint32_t addr, uint32_t items); + uint32_t (* suspend_icache_autoload)(void); + void (* resume_icache_autoload)(uint32_t autoload); + void (* freeze_icache_enable)(cache_freeze_mode_t mode); + void (* freeze_icache_disable)(void); + int (* op_addr)(uint32_t start_addr, uint32_t size, uint32_t cache_line_size, uint32_t max_sync_num, void(* cache_Iop)(uint32_t, uint32_t)); +}; + +/* Defined in the interface file, default value is rom_default_cache_internal_table */ +extern const struct cache_internal_stub_table* rom_cache_internal_table_ptr; + +typedef void (* cache_op_start)(void); +typedef void (* cache_op_end)(void); + +typedef struct { + cache_op_start start; + cache_op_end end; +} cache_op_cb_t; + +/* Defined in the interface file, default value is NULL */ +extern const cache_op_cb_t* rom_cache_op_cb; + +#define ESP_ROM_ERR_INVALID_ARG 1 +#define MMU_SET_ADDR_ALIGNED_ERROR 2 +#define MMU_SET_PASE_SIZE_ERROR 3 +#define MMU_SET_VADDR_OUT_RANGE 4 + +#define CACHE_OP_ICACHE_Y 1 +#define CACHE_OP_ICACHE_N 0 + +/** + * @brief Initialise cache mmu, mark all entries as invalid. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_MMU_Init(void); + +/** + * @brief Set ICache mmu mapping. + * Please do not call this function in your SDK application. + * + * @param uint32_t ext_ram : DPORT_MMU_ACCESS_FLASH for flash, DPORT_MMU_INVALID for invalid. In + * esp32c3, external memory is always flash + * + * @param uint32_t vaddr : virtual address in CPU address space. + * Can be Iram0,Iram1,Irom0,Drom0 and AHB buses address. + * Should be aligned by psize. + * + * @param uint32_t paddr : physical address in external memory. + * Should be aligned by psize. + * + * @param uint32_t psize : page size of ICache, in kilobytes. Should be 64 here. + * + * @param uint32_t num : pages to be set. + * + * @param uint32_t fixed : 0 for physical pages grow with virtual pages, other for virtual pages map to same physical page. + * + * @return uint32_t: error status + * 0 : mmu set success + * 2 : vaddr or paddr is not aligned + * 3 : psize error + * 4 : vaddr is out of range + */ +int Cache_Ibus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr, uint32_t psize, uint32_t num, uint32_t fixed); + +/** + * @brief Set DCache mmu mapping. + * Please do not call this function in your SDK application. + * + * @param uint32_t ext_ram : DPORT_MMU_ACCESS_FLASH for flash, DPORT_MMU_INVALID for invalid. In + * esp32c3, external memory is always flash + * + * @param uint32_t vaddr : virtual address in CPU address space. + * Can be DRam0, DRam1, DRom0, DPort and AHB buses address. + * Should be aligned by psize. + * + * @param uint32_t paddr : physical address in external memory. + * Should be aligned by psize. + * + * @param uint32_t psize : page size of DCache, in kilobytes. Should be 64 here. + * + * @param uint32_t num : pages to be set. + + * @param uint32_t fixed : 0 for physical pages grow with virtual pages, other for virtual pages map to same physical page. + * + * @return uint32_t: error status + * 0 : mmu set success + * 2 : vaddr or paddr is not aligned + * 3 : psize error + * 4 : vaddr is out of range + */ +int Cache_Dbus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr, uint32_t psize, uint32_t num, uint32_t fixed); + +/** + * @brief Count the pages in the bus room address which map to Flash. + * Please do not call this function in your SDK application. + * + * @param uint32_t bus : the bus to count with. + * + * @param uint32_t * page0_mapped : value should be initial by user, 0 for not mapped, other for mapped count. + * + * return uint32_t : the number of pages which map to Flash. + */ +uint32_t Cache_Count_Flash_Pages(uint32_t bus, uint32_t * page0_mapped); + +/** + * @brief allocate memory to used by ICache. + * Please do not call this function in your SDK application. + * + * @param cache_array_t icache_low : the data array bank used by icache low part. Due to timing constraint, can only be CACHE_MEMORY_INVALID, CACHE_MEMORY_IBANK0 + * + * return none + */ +void Cache_Occupy_ICache_MEMORY(cache_array_t icache_low); + +/** + * @brief Get cache mode of ICache or DCache. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the pointer of cache mode struct, caller should set the icache field + * + * return none + */ +void Cache_Get_Mode(struct cache_mode * mode); + +/** + * @brief set ICache modes: cache size, associate ways and cache line size. + * Please do not call this function in your SDK application. + * + * @param cache_size_t cache_size : the cache size, can be CACHE_SIZE_HALF and CACHE_SIZE_FULL + * + * @param cache_ways_t ways : the associate ways of cache, can be CACHE_4WAYS_ASSOC and CACHE_8WAYS_ASSOC + * + * @param cache_line_size_t cache_line_size : the cache line size, can be CACHE_LINE_SIZE_16B, CACHE_LINE_SIZE_32B and CACHE_LINE_SIZE_64B + * + * return none + */ +void Cache_Set_ICache_Mode(cache_size_t cache_size, cache_ways_t ways, cache_line_size_t cache_line_size); + +/** + * @brief set DCache modes: cache size, associate ways and cache line size. + * Please do not call this function in your SDK application. + * + * @param cache_size_t cache_size : the cache size, can be CACHE_SIZE_8KB and CACHE_SIZE_16KB + * + * @param cache_ways_t ways : the associate ways of cache, can be CACHE_4WAYS_ASSOC and CACHE_8WAYS_ASSOC + * + * @param cache_line_size_t cache_line_size : the cache line size, can be CACHE_LINE_SIZE_16B, CACHE_LINE_SIZE_32B and CACHE_LINE_SIZE_64B + * + * return none + */ +void Cache_Set_DCache_Mode(cache_size_t cache_size, cache_ways_t ways, cache_line_size_t cache_line_size); + +/** + * @brief check if the address is accessed through ICache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : the address to check. + * + * @return 1 if the address is accessed through ICache, 0 if not. + */ +uint32_t Cache_Address_Through_ICache(uint32_t addr); + +/** + * @brief check if the address is accessed through DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : the address to check. + * + * @return 1 if the address is accessed through DCache, 0 if not. + */ +uint32_t Cache_Address_Through_DCache(uint32_t addr); + +/** + * @brief Init mmu owner register to make i/d cache use half mmu entries. + * + * @param None + * + * @return None + */ +void Cache_Owner_Init(void); + +/** + * @brief Invalidate the cache items for ICache. + * Operation will be done CACHE_LINE_SIZE aligned. + * If the region is not in ICache addr room, nothing will be done. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr: start address to invalidate + * + * @param uint32_t items: cache lines to invalidate, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB) + * + * @return None + */ +void Cache_Invalidate_ICache_Items(uint32_t addr, uint32_t items); + +/** + * @brief Invalidate the Cache items in the region from ICache or DCache. + * If the region is not in Cache addr room, nothing will be done. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : invalidated region start address. + * + * @param uint32_t size : invalidated region size. + * + * @return 0 for success + * 1 for invalid argument + */ +int Cache_Invalidate_Addr(uint32_t addr, uint32_t size); + +/** + * @brief Invalidate all cache items in ICache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Invalidate_ICache_All(void); + +/** + * @brief Mask all buses through ICache and DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Mask_All(void); + +/** + * @brief Suspend ICache auto preload operation, then you can resume it after some ICache operations. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : 0 for ICache not auto preload before suspend. + */ +uint32_t Cache_Suspend_ICache_Autoload(void); + +/** + * @brief Resume ICache auto preload operation after some ICache operations. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : 0 for ICache not auto preload before suspend. + * + * @return None. + */ +void Cache_Resume_ICache_Autoload(uint32_t autoload); + +/** + * @brief Start an ICache manual preload, will suspend auto preload of ICache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : start address of the preload region. + * + * @param uint32_t size : size of the preload region, should not exceed the size of ICache. + * + * @param uint32_t order : the preload order, 0 for positive, other for negative + * + * @return uint32_t : 0 for ICache not auto preload before manual preload. + */ +uint32_t Cache_Start_ICache_Preload(uint32_t addr, uint32_t size, uint32_t order); + +/** + * @brief Return if the ICache manual preload done. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : 0 for ICache manual preload not done. + */ +uint32_t Cache_ICache_Preload_Done(void); + +/** + * @brief End the ICache manual preload to resume auto preload of ICache. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : 0 for ICache not auto preload before manual preload. + * + * @return None + */ +void Cache_End_ICache_Preload(uint32_t autoload); + +/** + * @brief Config autoload parameters of ICache. + * Please do not call this function in your SDK application. + * + * @param struct autoload_config * config : autoload parameters. + * + * @return None + */ +void Cache_Config_ICache_Autoload(const struct autoload_config * config); + +/** + * @brief Enable auto preload for ICache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Enable_ICache_Autoload(void); + +/** + * @brief Disable auto preload for ICache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Disable_ICache_Autoload(void); + +/** + * @brief Config a group of prelock parameters of ICache. + * Please do not call this function in your SDK application. + * + * @param struct lock_config * config : a group of lock parameters. + * + * @return None + */ + +void Cache_Enable_ICache_PreLock(const struct lock_config *config); + +/** + * @brief Disable a group of prelock parameters for ICache. + * However, the locked data will not be released. + * Please do not call this function in your SDK application. + * + * @param uint16_t group : 0 for group0, 1 for group1. + * + * @return None + */ +void Cache_Disable_ICache_PreLock(uint16_t group); + +/** + * @brief Lock the cache items for ICache. + * Operation will be done CACHE_LINE_SIZE aligned. + * If the region is not in ICache addr room, nothing will be done. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr: start address to lock + * + * @param uint32_t items: cache lines to lock, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB) + * + * @return None + */ +void Cache_Lock_ICache_Items(uint32_t addr, uint32_t items); + +/** + * @brief Unlock the cache items for ICache. + * Operation will be done CACHE_LINE_SIZE aligned. + * If the region is not in ICache addr room, nothing will be done. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr: start address to unlock + * + * @param uint32_t items: cache lines to unlock, items * cache_line_size should not exceed the bus address size(16MB/32MB/64MB) + * + * @return None + */ +void Cache_Unlock_ICache_Items(uint32_t addr, uint32_t items); + +/** + * @brief Lock the cache items in tag memory for ICache or DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : start address of lock region. + * + * @param uint32_t size : size of lock region. + * + * @return 0 for success + * 1 for invalid argument + */ +int Cache_Lock_Addr(uint32_t addr, uint32_t size); + +/** + * @brief Unlock the cache items in tag memory for ICache or DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : start address of unlock region. + * + * @param uint32_t size : size of unlock region. + * + * @return 0 for success + * 1 for invalid argument + */ +int Cache_Unlock_Addr(uint32_t addr, uint32_t size); + +/** + * @brief Disable ICache access for the cpu. + * This operation will make all ICache tag memory invalid, CPU can't access ICache, ICache will keep idle. + * Please do not call this function in your SDK application. + * + * @return uint32_t : auto preload enabled before + */ +uint32_t Cache_Disable_ICache(void); + +/** + * @brief Enable ICache access for the cpu. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : ICache will preload then. + * + * @return None + */ +void Cache_Enable_ICache(uint32_t autoload); + +/** + * @brief Suspend ICache access for the cpu. + * The ICache tag memory is still there, CPU can't access ICache, ICache will keep idle. + * Please do not change MMU, cache mode or tag memory(tag memory can be changed in some special case). + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : auto preload enabled before + */ +uint32_t Cache_Suspend_ICache(void); + +/** + * @brief Resume ICache access for the cpu. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : ICache will preload then. + * + * @return None + */ +void Cache_Resume_ICache(uint32_t autoload); + +/** + * @brief Get ICache cache line size + * + * @param None + * + * @return uint32_t: 16, 32, 64 Byte + */ +uint32_t Cache_Get_ICache_Line_Size(void); + +/** + * @brief Set default mode from boot, 8KB ICache, 16Byte cache line size. + * + * @param None + * + * @return None + */ +void Cache_Set_Default_Mode(void); + +/** + * @brief Set default mode from boot, 8KB ICache, 16Byte cache line size. + * + * @param None + * + * @return None + */ +void Cache_Enable_Defalut_ICache_Mode(void); + +/** + * @brief Enable freeze for ICache. + * Any miss request will be rejected, including cpu miss and preload/autoload miss. + * Please do not call this function in your SDK application. + * + * @param cache_freeze_mode_t mode : 0 for assert busy 1 for assert hit + * + * @return None + */ +void Cache_Freeze_ICache_Enable(cache_freeze_mode_t mode); + +/** + * @brief Disable freeze for ICache. + * Please do not call this function in your SDK application. + * + * @return None + */ +void Cache_Freeze_ICache_Disable(void); + +/** + * @brief Travel tag memory to run a call back function. + * ICache and DCache are suspend when doing this. + * The callback will get the parameter tag_group_info, which will include a group of tag memory addresses and cache memory addresses. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the cache to check and the cache mode. + * + * @param uint32_t filter_addr : only the cache lines which may include the filter_address will be returned to the call back function. + * 0 for do not filter, all cache lines will be returned. + * + * @param void (* process)(struct tag_group_info *) : call back function, which may be called many times, a group(the addresses in the group are in the same position in the cache ways) a time. + * + * @return None + */ +void Cache_Travel_Tag_Memory(struct cache_mode * mode, uint32_t filter_addr, void (* process)(struct tag_group_info *)); + +/** + * @brief Get the virtual address from cache mode, cache tag and the virtual address offset of cache ways. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the cache to calculate the virtual address and the cache mode. + * + * @param uint32_t tag : the tag part fo a tag item, 12-14 bits. + * + * @param uint32_t addr_offset : the virtual address offset of the cache ways. + * + * @return uint32_t : the virtual address. + */ +uint32_t Cache_Get_Virtual_Addr(struct cache_mode *mode, uint32_t tag, uint32_t vaddr_offset); + +/** + * @brief Get cache memory block base address. + * Please do not call this function in your SDK application. + * + * @param uint32_t icache : 0 for dcache, other for icache. + * + * @param uint32_t bank_no : 0 ~ 3 bank. + * + * @return uint32_t : the cache memory block base address, 0 if the block not used. + */ +uint32_t Cache_Get_Memory_BaseAddr(uint32_t icache, uint32_t bank_no); + +/** + * @brief Get the cache memory address from cache mode, cache memory offset and the virtual address offset of cache ways. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the cache to calculate the virtual address and the cache mode. + * + * @param uint32_t cache_memory_offset : the cache memory offset of the whole cache (ICache or DCache) for the cache line. + * + * @param uint32_t addr_offset : the virtual address offset of the cache ways. + * + * @return uint32_t : the virtual address. + */ +uint32_t Cache_Get_Memory_Addr(struct cache_mode *mode, uint32_t cache_memory_offset, uint32_t vaddr_offset); + +/** + * @brief Get the cache memory value by DRAM address. + * Please do not call this function in your SDK application. + * + * @param uint32_t cache_memory_addr : DRAM address for the cache memory, should be 4 byte aligned for IBus address. + * + * @return uint32_t : the word value of the address. + */ +uint32_t Cache_Get_Memory_value(uint32_t cache_memory_addr); +/** + * @} + */ + +/** + * @brief Get the cache MMU IROM end address. + * Please do not call this function in your SDK application. + * + * @param void + * + * @return uint32_t : the word value of the address. + */ +uint32_t Cache_Get_IROM_MMU_End(void); + +/** + * @brief Get the cache MMU DROM end address. + * Please do not call this function in your SDK application. + * + * @param void + * + * @return uint32_t : the word value of the address. + */ +uint32_t Cache_Get_DROM_MMU_End(void); + +/** + * @brief Lock the permission control section configuration. After lock, any + * configuration modification will be bypass. Digital reset will clear the lock! + * Please do not call this function in your SDK application. + * + * @param int ibus : 1 for lock ibus pms, 0 for lock dbus pms + * + * @return None + */ +void Cache_Pms_Lock(int ibus); + +/** + * @brief Set three ibus pms boundary address, which will determine pms reject section and section 1/2. + * Please do not call this function in your SDK application. + * + * @param uint32_t ibus_boundary0_addr : vaddress for split line0 + * + * @param uint32_t ibus_boundary1_addr : vaddress for split line1 + * + * @param uint32_t ibus_boundary2_addr : vaddress for split line2 + * + * @return int : ESP_ROM_ERR_INVALID_ARG for invalid address, 0 for success + */ +int Cache_Ibus_Pms_Set_Addr(uint32_t ibus_boundary0_addr, uint32_t ibus_boundary1_addr, uint32_t ibus_boundary2_addr); + +/** + * @brief Set three ibus pms attribute, which will determine pms in different section and world. + * Please do not call this function in your SDK application. + * + * @param uint32_t ibus_pms_sct2_attr : attr for section2 + * + * @param uint32_t ibus_pms_sct1_attr : attr for section1 + * + * @return None + */ +void Cache_Ibus_Pms_Set_Attr(uint32_t ibus_pms_sct2_attr, uint32_t ibus_pms_sct1_attr); + +/** + * @brief Set three dbus pms boundary address, which will determine pms reject section and section 1/2. + * Please do not call this function in your SDK application. + * + * @param uint32_t dbus_boundary0_addr : vaddress for split line0 + * + * @param uint32_t dbus_boundary1_addr : vaddress for split line1 + * + * @param uint32_t dbus_boundary2_addr : vaddress for split line2 + * + * @return int : ESP_ROM_ERR_INVALID_ARG for invalid address, 0 for success + */ +int Cache_Dbus_Pms_Set_Addr(uint32_t dbus_boundary0_addr, uint32_t dbus_boundary1_addr, uint32_t dbus_boundary2_addr); + +/** + * @brief Set three dbus pms attribute, which will determine pms in different section and world. + * Please do not call this function in your SDK application. + * + * @param uint32_t dbus_pms_sct2_attr : attr for section2 + * + * @param uint32_t dbus_pms_sct1_attr : attr for section1 + * + * @return None + */ +void Cache_Dbus_Pms_Set_Attr(uint32_t dbus_pms_sct2_attr, uint32_t dbus_pms_sct1_attr); + +/** + * @brief Used by SPI flash mmap + * + */ +uint32_t flash_instr_rodata_start_page(uint32_t bus); +uint32_t flash_instr_rodata_end_page(uint32_t bus); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_CACHE_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/crc.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/crc.h new file mode 100644 index 000000000..e683f4fd4 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/crc.h @@ -0,0 +1,127 @@ +// 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. + +#ifndef ROM_CRC_H +#define ROM_CRC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup crc_apis, uart configuration and communication related apis + * @brief crc apis + */ + +/** @addtogroup crc_apis + * @{ + */ + + +/* Standard CRC8/16/32 algorithms. */ +// CRC-8 x8+x2+x1+1 0x07 +// CRC16-CCITT x16+x12+x5+1 1021 ISO HDLC, ITU X.25, V.34/V.41/V.42, PPP-FCS +// CRC32: +//G(x) = x32 +x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x1 + 1 +//If your buf is not continuous, you can use the first result to be the second parameter. + +/** + * @brief Crc32 value that is in little endian. + * + * @param uint32_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint32_t crc32_le(uint32_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc32 value that is in big endian. + * + * @param uint32_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint32_t crc32_be(uint32_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc16 value that is in little endian. + * + * @param uint16_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint16_t crc16_le(uint16_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc16 value that is in big endian. + * + * @param uint16_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint16_t crc16_be(uint16_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc8 value that is in little endian. + * + * @param uint8_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint8_t crc8_le(uint8_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc8 value that is in big endian. + * + * @param uint32_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint8_t crc8_be(uint8_t crc, uint8_t const *buf, uint32_t len); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/digital_signature.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/digital_signature.h new file mode 100644 index 000000000..54c01681d --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/digital_signature.h @@ -0,0 +1,150 @@ +// 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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define ETS_DS_MAX_BITS 3072 + +#define ETS_DS_IV_LEN 16 + +/* Length of parameter 'C' stored in flash (not including IV) + + Comprises encrypted Y, M, rinv, md (32), mprime (4), length (4), padding (8) + + Note that if ETS_DS_MAX_BITS<4096, 'C' needs to be split up when writing to hardware +*/ +#define ETS_DS_C_LEN ((ETS_DS_MAX_BITS * 3 / 8) + 32 + 8 + 8) + +/* Encrypted ETS data. Recommended to store in flash in this format. + */ +typedef struct { + /* RSA LENGTH register parameters + * (number of words in RSA key & operands, minus one). + * + * + * This value must match the length field encrypted and stored in 'c', + * or invalid results will be returned. (The DS peripheral will + * always use the value in 'c', not this value, so an attacker can't + * alter the DS peripheral results this way, it will just truncate or + * extend the message and the resulting signature in software.) + */ + unsigned rsa_length; + + /* IV value used to encrypt 'c' */ + uint8_t iv[ETS_DS_IV_LEN]; + + /* Encrypted Digital Signature parameters. Result of AES-CBC encryption + of plaintext values. Includes an encrypted message digest. + */ + uint8_t c[ETS_DS_C_LEN]; +} ets_ds_data_t; + +typedef enum { + ETS_DS_OK, + ETS_DS_INVALID_PARAM, /* Supplied parameters are invalid */ + ETS_DS_INVALID_KEY, /* HMAC peripheral failed to supply key */ + ETS_DS_INVALID_PADDING, /* 'c' decrypted with invalid padding */ + ETS_DS_INVALID_DIGEST, /* 'c' decrypted with invalid digest */ +} ets_ds_result_t; + +void ets_ds_enable(void); + +void ets_ds_disable(void); + + +/* + * @brief Start signing a message (or padded message digest) using the Digital Signature peripheral + * + * - @param message Pointer to message (or padded digest) containing the message to sign. Should be + * (data->rsa_length + 1)*4 bytes long. @param data Pointer to DS data. Can be a pointer to data + * in flash. + * + * Caller must have already called ets_ds_enable() and ets_hmac_calculate_downstream() before calling + * this function, and is responsible for calling ets_ds_finish_sign() and then + * ets_hmac_invalidate_downstream() afterwards. + * + * @return ETS_DS_OK if signature is in progress, ETS_DS_INVALID_PARAM if param is invalid, + * EST_DS_INVALID_KEY if key or HMAC peripheral is configured incorrectly. + */ +ets_ds_result_t ets_ds_start_sign(const void *message, const ets_ds_data_t *data); + + +/* + * @brief Returns true if the DS peripheral is busy following a call to ets_ds_start_sign() + * + * A result of false indicates that a call to ets_ds_finish_sign() will not block. + * + * Only valid if ets_ds_enable() has been called. + */ +bool ets_ds_is_busy(void); + + +/* @brief Finish signing a message using the Digital Signature peripheral + * + * Must be called after ets_ds_start_sign(). Can use ets_ds_busy() to wait until + * peripheral is no longer busy. + * + * - @param signature Pointer to buffer to contain the signature. Should be + * (data->rsa_length + 1)*4 bytes long. + * - @param data Should match the 'data' parameter passed to ets_ds_start_sign() + * + * @param ETS_DS_OK if signing succeeded, ETS_DS_INVALID_PARAM if param is invalid, + * ETS_DS_INVALID_DIGEST or ETS_DS_INVALID_PADDING if there is a problem with the + * encrypted data digest or padding bytes (in case of ETS_DS_INVALID_PADDING, a + * digest is produced anyhow.) + */ +ets_ds_result_t ets_ds_finish_sign(void *signature, const ets_ds_data_t *data); + + +/* Plaintext parameters used by Digital Signature. + + Not used for signing with DS peripheral, but can be encrypted + in-device by calling ets_ds_encrypt_params() +*/ +typedef struct { + uint32_t Y[ETS_DS_MAX_BITS / 32]; + uint32_t M[ETS_DS_MAX_BITS / 32]; + uint32_t Rb[ETS_DS_MAX_BITS / 32]; + uint32_t M_prime; + uint32_t length; +} ets_ds_p_data_t; + +typedef enum { + ETS_DS_KEY_HMAC, /* The HMAC key (as stored in efuse) */ + ETS_DS_KEY_AES, /* The AES key (as derived from HMAC key by HMAC peripheral in downstream mode) */ +} ets_ds_key_t; + +/* @brief Encrypt DS parameters suitable for storing and later use with DS peripheral + * + * @param data Output buffer to store encrypted data, suitable for later use generating signatures. + * @param iv Pointer to 16 byte IV buffer, will be copied into 'data'. Should be randomly generated bytes each time. + * @param p_data Pointer to input plaintext key data. The expectation is this data will be deleted after this process is done and 'data' is stored. + * @param key Pointer to 32 bytes of key data. Type determined by key_type parameter. The expectation is the corresponding HMAC key will be stored to efuse and then permanently erased. + * @param key_type Type of key stored in 'key' (either the AES-256 DS key, or an HMAC DS key from which the AES DS key is derived using HMAC peripheral) + * + * @return ETS_DS_INVALID_PARAM if any parameter is invalid, or ETS_DS_OK if 'data' is successfully generated from the input parameters. + */ +ets_ds_result_t ets_ds_encrypt_params(ets_ds_data_t *data, const void *iv, const ets_ds_p_data_t *p_data, const void *key, ets_ds_key_t key_type); + + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/efuse.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/efuse.h new file mode 100644 index 000000000..150995773 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/efuse.h @@ -0,0 +1,392 @@ +// 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. + +#ifndef _ROM_EFUSE_H_ +#define _ROM_EFUSE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/** \defgroup efuse_APIs efuse APIs + * @brief ESP32 efuse read/write APIs + * @attention + * + */ + +/** @addtogroup efuse_APIs + * @{ + */ + +typedef enum { + ETS_EFUSE_KEY_PURPOSE_USER = 0, + ETS_EFUSE_KEY_PURPOSE_RESERVED = 1, + ETS_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY = 4, + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL = 5, + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG = 6, + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE = 7, + ETS_EFUSE_KEY_PURPOSE_HMAC_UP = 8, + ETS_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST0 = 9, + ETS_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST1 = 10, + ETS_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST2 = 11, + ETS_EFUSE_KEY_PURPOSE_MAX, +} ets_efuse_purpose_t; + +typedef enum { + ETS_EFUSE_BLOCK0 = 0, + ETS_EFUSE_MAC_SPI_SYS_0 = 1, + ETS_EFUSE_BLOCK_SYS_DATA = 2, + ETS_EFUSE_BLOCK_USR_DATA = 3, + ETS_EFUSE_BLOCK_KEY0 = 4, + ETS_EFUSE_BLOCK_KEY1 = 5, + ETS_EFUSE_BLOCK_KEY2 = 6, + ETS_EFUSE_BLOCK_KEY3 = 7, + ETS_EFUSE_BLOCK_KEY4 = 8, + ETS_EFUSE_BLOCK_KEY5 = 9, + ETS_EFUSE_BLOCK_KEY6 = 10, + ETS_EFUSE_BLOCK_MAX, +} ets_efuse_block_t; + +/** + * @brief set timing accroding the apb clock, so no read error or write error happens. + * + * @param clock: apb clock in HZ, only accept 5M(in FPGA), 10M(in FPGA), 20M, 40M, 80M. + * + * @return : 0 if success, others if clock not accepted + */ +int ets_efuse_set_timing(uint32_t clock); + +/** + * @brief Enable efuse subsystem. Called after reset. Doesn't need to be called again. + */ +void ets_efuse_start(void); + +/** + * @brief Efuse read operation: copies data from physical efuses to efuse read registers. + * + * @param null + * + * @return : 0 if success, others if apb clock is not accepted + */ +int ets_efuse_read(void); + +/** + * @brief Efuse write operation: Copies data from efuse write registers to efuse. Operates on a single block of efuses at a time. + * + * @note This function does not update read efuses, call ets_efuse_read() once all programming is complete. + * + * @return : 0 if success, others if apb clock is not accepted + */ +int ets_efuse_program(ets_efuse_block_t block); + +/** + * @brief Set all Efuse program registers to zero. + * + * Call this before writing new data to the program registers. + */ +void ets_efuse_clear_program_registers(void); + +/** + * @brief Program a block of key data to an efuse block + * + * @param key_block Block to read purpose for. Must be in range ETS_EFUSE_BLOCK_KEY0 to ETS_EFUSE_BLOCK_KEY6. Key block must be unused (@ref ets_efuse_key_block_unused). + * @param purpose Purpose to set for this key. Purpose must be already unset. + * @param data Pointer to data to write. + * @param data_len Length of data to write. + * + * @note This function also calls ets_efuse_program() for the specified block, and for block 0 (setting the purpose) + */ +int ets_efuse_write_key(ets_efuse_block_t key_block, ets_efuse_purpose_t purpose, const void *data, size_t data_len); + + +/* @brief Return the address of a particular efuse block's first read register + * + * @param block Index of efuse block to look up + * + * @return 0 if block is invalid, otherwise a numeric read register address + * of the first word in the block. + */ +uint32_t ets_efuse_get_read_register_address(ets_efuse_block_t block); + +/** + * @brief Return the current purpose set for an efuse key block + * + * @param key_block Block to read purpose for. Must be in range ETS_EFUSE_BLOCK_KEY0 to ETS_EFUSE_BLOCK_KEY6. + */ +ets_efuse_purpose_t ets_efuse_get_key_purpose(ets_efuse_block_t key_block); + +/** + * @brief Find a key block with the particular purpose set + * + * @param purpose Purpose to search for. + * @param[out] key_block Pointer which will be set to the key block if found. Can be NULL, if only need to test the key block exists. + * @return true if found, false if not found. If false, value at key_block pointer is unchanged. + */ +bool ets_efuse_find_purpose(ets_efuse_purpose_t purpose, ets_efuse_block_t *key_block); + +/** + * Return true if the key block is unused, false otherwise. + * + * An unused key block is all zero content, not read or write protected, + * and has purpose 0 (ETS_EFUSE_KEY_PURPOSE_USER) + * + * @param key_block key block to check. + * + * @return true if key block is unused, false if key block or used + * or the specified block index is not a key block. + */ +bool ets_efuse_key_block_unused(ets_efuse_block_t key_block); + + +/** + * @brief Search for an unused key block and return the first one found. + * + * See @ref ets_efuse_key_block_unused for a description of an unused key block. + * + * @return First unused key block, or ETS_EFUSE_BLOCK_MAX if no unused key block is found. + */ +ets_efuse_block_t ets_efuse_find_unused_key_block(void); + +/** + * @brief Return the number of unused efuse key blocks (0-6) + */ +unsigned ets_efuse_count_unused_key_blocks(void); + +/** + * @brief Calculate Reed-Solomon Encoding values for a block of efuse data. + * + * @param data Pointer to data buffer (length 32 bytes) + * @param rs_values Pointer to write encoded data to (length 12 bytes) + */ +void ets_efuse_rs_calculate(const void *data, void *rs_values); + +/** + * @brief Read spi flash pads configuration from Efuse + * + * @return + * - 0 for default SPI pins. + * - 1 for default HSPI pins. + * - Other values define a custom pin configuration mask. Pins are encoded as per the EFUSE_SPICONFIG_RET_SPICLK, + * EFUSE_SPICONFIG_RET_SPIQ, EFUSE_SPICONFIG_RET_SPID, EFUSE_SPICONFIG_RET_SPICS0, EFUSE_SPICONFIG_RET_SPIHD macros. + * WP pin (for quad I/O modes) is not saved in efuse and not returned by this function. + */ +uint32_t ets_efuse_get_spiconfig(void); + +/** + * @brief Read spi flash wp pad from Efuse + * + * @return + * - 0x3f for invalid. + * - 0~46 is valid. + */ +uint32_t ets_efuse_get_wp_pad(void); + +/** + * @brief Read opi flash pads configuration from Efuse + * + * @return + * - 0 for default SPI pins. + * - Other values define a custom pin configuration mask. From the LSB, every 6 bits represent a GPIO number which stand for: + * DQS, D4, D5, D6, D7 accordingly. + */ +uint32_t ets_efuse_get_opiconfig(void); + +/** + * @brief Read if download mode disabled from Efuse + * + * @return + * - true for efuse disable download mode. + * - false for efuse doesn't disable download mode. + */ +bool ets_efuse_download_modes_disabled(void); + +/** + * @brief Read if legacy spi flash boot mode disabled from Efuse + * + * @return + * - true for efuse disable legacy spi flash boot mode. + * - false for efuse doesn't disable legacy spi flash boot mode. + */ +bool ets_efuse_legacy_spi_boot_mode_disabled(void); + +/** + * @brief Read if uart print control value from Efuse + * + * @return + * - 0 for uart force print. + * - 1 for uart print when GPIO46 is low when digital reset. + * 2 for uart print when GPIO46 is high when digital reset. + * 3 for uart force slient + */ +uint32_t ets_efuse_get_uart_print_control(void); + +/** + * @brief Read which channel will used by ROM to print + * + * @return + * - 0 for UART0. + * - 1 for UART1. + */ +uint32_t ets_efuse_get_uart_print_channel(void); + +/** + * @brief Read if usb download mode disabled from Efuse + * + * (Also returns true if security download mode is enabled, as this mode + * disables USB download.) + * + * @return + * - true for efuse disable usb download mode. + * - false for efuse doesn't disable usb download mode. + */ +bool ets_efuse_usb_download_mode_disabled(void); + +/** + * @brief Read if tiny basic mode disabled from Efuse + * + * @return + * - true for efuse disable tiny basic mode. + * - false for efuse doesn't disable tiny basic mode. + */ +bool ets_efuse_tiny_basic_mode_disabled(void); + +/** + * @brief Read if usb module disabled from Efuse + * + * @return + * - true for efuse disable usb module. + * - false for efuse doesn't disable usb module. + */ +bool ets_efuse_usb_module_disabled(void); + +/** + * @brief Read if security download modes enabled from Efuse + * + * @return + * - true for efuse enable security download mode. + * - false for efuse doesn't enable security download mode. + */ +bool ets_efuse_security_download_modes_enabled(void); + +/** + * @brief Return true if secure boot is enabled in EFuse + */ +bool ets_efuse_secure_boot_enabled(void); + +/** + * @brief Return true if secure boot aggressive revoke is enabled in EFuse + */ +bool ets_efuse_secure_boot_aggressive_revoke_enabled(void); + +/** + * @brief Return true if cache encryption (flash, etc) is enabled from boot via EFuse + */ +bool ets_efuse_cache_encryption_enabled(void); + +/** + * @brief Return true if EFuse indicates an external phy needs to be used for USB + */ +bool ets_efuse_usb_use_ext_phy(void); + +/** + * @brief Return true if EFuse indicates USB device persistence is disabled + */ +bool ets_efuse_usb_force_nopersist(void); + +/** + * @brief Return true if OPI pins GPIO33-37 are powered by VDDSPI, otherwise by VDD33CPU + */ +bool ets_efuse_flash_opi_5pads_power_sel_vddspi(void); + +/** + * @brief Return true if EFuse indicates an opi flash is attached. + */ +bool ets_efuse_flash_opi_mode(void); + +/** + * @brief Return true if EFuse indicates to send a flash resume command. + */ +bool ets_efuse_force_send_resume(void); + +/** + * @brief return the time in us ROM boot need wait flash to power on from Efuse + * + * @return + * - uint32_t the time in us. + */ +uint32_t ets_efuse_get_flash_delay_us(void); + +#define EFUSE_SPICONFIG_SPI_DEFAULTS 0 +#define EFUSE_SPICONFIG_HSPI_DEFAULTS 1 + +#define EFUSE_SPICONFIG_RET_SPICLK_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPICLK_SHIFT 0 +#define EFUSE_SPICONFIG_RET_SPICLK(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPICLK_SHIFT) & EFUSE_SPICONFIG_RET_SPICLK_MASK) + +#define EFUSE_SPICONFIG_RET_SPIQ_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPIQ_SHIFT 6 +#define EFUSE_SPICONFIG_RET_SPIQ(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPIQ_SHIFT) & EFUSE_SPICONFIG_RET_SPIQ_MASK) + +#define EFUSE_SPICONFIG_RET_SPID_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPID_SHIFT 12 +#define EFUSE_SPICONFIG_RET_SPID(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPID_SHIFT) & EFUSE_SPICONFIG_RET_SPID_MASK) + +#define EFUSE_SPICONFIG_RET_SPICS0_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPICS0_SHIFT 18 +#define EFUSE_SPICONFIG_RET_SPICS0(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPICS0_SHIFT) & EFUSE_SPICONFIG_RET_SPICS0_MASK) + + +#define EFUSE_SPICONFIG_RET_SPIHD_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPIHD_SHIFT 24 +#define EFUSE_SPICONFIG_RET_SPIHD(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPIHD_SHIFT) & EFUSE_SPICONFIG_RET_SPIHD_MASK) + +/** + * @brief Enable JTAG temporarily by writing a JTAG HMAC "key" into + * the JTAG_CTRL registers. + * + * Works if JTAG has been "soft" disabled by burning the EFUSE_SOFT_DIS_JTAG efuse. + * + * Will enable the HMAC module to generate a "downstream" HMAC value from a key already saved in efuse, and then write the JTAG HMAC "key" which will enable JTAG if the two keys match. + * + * @param jtag_hmac_key Pointer to a 32 byte array containing a valid key. Supplied by user. + * @param key_block Index of a key block containing the source for this key. + * + * @return ETS_FAILED if HMAC operation fails or invalid parameter, ETS_OK otherwise. ETS_OK doesn't necessarily mean that JTAG was enabled. + */ +int ets_jtag_enable_temporarily(const uint8_t *jtag_hmac_key, ets_efuse_block_t key_block); + +/** + * @brief A crc8 algorithm used for MAC addresses in efuse + * + * @param unsigned char const *p : Pointer to original data. + * + * @param unsigned int len : Data length in byte. + * + * @return unsigned char: Crc value. + */ +unsigned char esp_crc8(unsigned char const *p, unsigned int len); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_EFUSE_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/esp_flash.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/esp_flash.h new file mode 100644 index 000000000..40e5872c0 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/esp_flash.h @@ -0,0 +1,54 @@ +// 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. + +#pragma once + +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Note: Most of esp_flash APIs in ROM are compatible with headers in ESP-IDF, this function + just adds ROM-specific parts +*/ + +struct spi_flash_chip_t; +typedef struct esp_flash_t esp_flash_t; + +/* Structure to wrap "global" data used by esp_flash in ROM */ +typedef struct { + /* Default SPI flash chip, ie main chip attached to the MCU + This chip is used if the 'chip' argument passed to esp_flash_xxx API functions is ever NULL + */ + esp_flash_t *default_chip; + + /* Global API OS notification start/end/chip_check functions + + These are used by ROM if no other host functions are configured. + */ + struct { + esp_err_t (*start)(esp_flash_t *chip); + esp_err_t (*end)(esp_flash_t *chip, esp_err_t err); + esp_err_t (*chip_check)(esp_flash_t **inout_chip); + } api_funcs; +} esp_flash_rom_global_data_t; + +/** Access a pointer to the global data used by the ROM spi_flash driver + */ +esp_flash_rom_global_data_t *esp_flash_get_rom_global_data(void); + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/ets_sys.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/ets_sys.h new file mode 100644 index 000000000..b37802488 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/ets_sys.h @@ -0,0 +1,563 @@ +// 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. + +#ifndef _ROM_ETS_SYS_H_ +#define _ROM_ETS_SYS_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup ets_sys_apis, ets system related apis + * @brief ets system apis + */ + +/** @addtogroup ets_sys_apis + * @{ + */ + +/************************************************************************ + * NOTE + * Many functions in this header files can't be run in FreeRTOS. + * Please see the comment of the Functions. + * There are also some functions that doesn't work on FreeRTOS + * without listed in the header, such as: + * xtos functions start with "_xtos_" in ld file. + * + *********************************************************************** + */ + +/** \defgroup ets_apis, Espressif Task Scheduler related apis + * @brief ets apis + */ + +/** @addtogroup ets_apis + * @{ + */ + +typedef enum { + ETS_OK = 0, /**< return successful in ets*/ + ETS_FAILED = 1 /**< return failed in ets*/ +} ETS_STATUS; + +typedef ETS_STATUS ets_status_t; + +typedef uint32_t ETSSignal; +typedef uint32_t ETSParam; + +typedef struct ETSEventTag ETSEvent; /**< Event transmit/receive in ets*/ + +struct ETSEventTag { + ETSSignal sig; /**< Event signal, in same task, different Event with different signal*/ + ETSParam par; /**< Event parameter, sometimes without usage, then will be set as 0*/ +}; + +typedef void (*ETSTask)(ETSEvent *e); /**< Type of the Task processer*/ +typedef void (* ets_idle_cb_t)(void *arg); /**< Type of the system idle callback*/ + +/** + * @brief Start the Espressif Task Scheduler, which is an infinit loop. Please do not add code after it. + * + * @param none + * + * @return none + */ +void ets_run(void); + +/** + * @brief Set the Idle callback, when Tasks are processed, will call the callback before CPU goto sleep. + * + * @param ets_idle_cb_t func : The callback function. + * + * @param void *arg : Argument of the callback. + * + * @return None + */ +void ets_set_idle_cb(ets_idle_cb_t func, void *arg); + +/** + * @brief Init a task with processer, priority, queue to receive Event, queue length. + * + * @param ETSTask task : The task processer. + * + * @param uint8_t prio : Task priority, 0-31, bigger num with high priority, one priority with one task. + * + * @param ETSEvent *queue : Queue belongs to the task, task always receives Events, Queue is circular used. + * + * @param uint8_t qlen : Queue length. + * + * @return None + */ +void ets_task(ETSTask task, uint8_t prio, ETSEvent *queue, uint8_t qlen); + +/** + * @brief Post an event to an Task. + * + * @param uint8_t prio : Priority of the Task. + * + * @param ETSSignal sig : Event signal. + * + * @param ETSParam par : Event parameter + * + * @return ETS_OK : post successful + * @return ETS_FAILED : post failed + */ +ETS_STATUS ets_post(uint8_t prio, ETSSignal sig, ETSParam par); + +/** + * @} + */ + +/** \defgroup ets_boot_apis, Boot routing related apis + * @brief ets boot apis + */ + +/** @addtogroup ets_apis + * @{ + */ + +extern const char *const exc_cause_table[40]; ///**< excption cause that defined by the core.*/ + +/** + * @brief Set Pro cpu Entry code, code can be called in PRO CPU when booting is not completed. + * When Pro CPU booting is completed, Pro CPU will call the Entry code if not NULL. + * + * @param uint32_t start : the PRO Entry code address value in uint32_t + * + * @return None + */ +void ets_set_user_start(uint32_t start); + +/** + * @brief Set Pro cpu Startup code, code can be called when booting is not completed, or in Entry code. + * When Entry code completed, CPU will call the Startup code if not NULL, else call ets_run. + * + * @param uint32_t callback : the Startup code address value in uint32_t + * + * @return None : post successful + */ +void ets_set_startup_callback(uint32_t callback); + +/** + * @brief Set App cpu Entry code, code can be called in PRO CPU. + * When APP booting is completed, APP CPU will call the Entry code if not NULL. + * + * @param uint32_t start : the APP Entry code address value in uint32_t, stored in register APPCPU_CTRL_REG_D. + * + * @return None + */ +void ets_set_appcpu_boot_addr(uint32_t start); + +/** + * @} + */ + +/** \defgroup ets_printf_apis, ets_printf related apis used in ets + * @brief ets printf apis + */ + +/** @addtogroup ets_printf_apis + * @{ + */ + +/** + * @brief Printf the strings to uart or other devices, similar with printf, simple than printf. + * Can not print float point data format, or longlong data format. + * So we maybe only use this in ROM. + * + * @param const char *fmt : See printf. + * + * @param ... : See printf. + * + * @return int : the length printed to the output device. + */ +int ets_printf(const char *fmt, ...); + +/** + * @brief Set the uart channel of ets_printf(uart_tx_one_char). + * ROM will set it base on the efuse and gpio setting, however, this can be changed after booting. + * + * @param uart_no : 0 for UART0, 1 for UART1, 2 for UART2. + * + * @return None + */ +void ets_set_printf_channel(uint8_t uart_no); + +/** + * @brief Get the uart channel of ets_printf(uart_tx_one_char). + * + * @return uint8_t uart channel used by ets_printf(uart_tx_one_char). + */ +uint8_t ets_get_printf_channel(void); + +/** + * @brief Output a char to uart, which uart to output(which is in uart module in ROM) is not in scope of the function. + * Can not print float point data format, or longlong data format + * + * @param char c : char to output. + * + * @return None + */ +void ets_write_char_uart(char c); + +/** + * @brief Ets_printf have two output functions: putc1 and putc2, both of which will be called if need ouput. + * To install putc1, which is defaulted installed as ets_write_char_uart in none silent boot mode, as NULL in silent mode. + * + * @param void (*)(char) p: Output function to install. + * + * @return None + */ +void ets_install_putc1(void (*p)(char c)); + +/** + * @brief Ets_printf have two output functions: putc1 and putc2, both of which will be called if need ouput. + * To install putc2, which is defaulted installed as NULL. + * + * @param void (*)(char) p: Output function to install. + * + * @return None + */ +void ets_install_putc2(void (*p)(char c)); + +/** + * @brief Install putc1 as ets_write_char_uart. + * In silent boot mode(to void interfere the UART attached MCU), we can call this function, after booting ok. + * + * @param None + * + * @return None + */ +void ets_install_uart_printf(void); + +#define ETS_PRINTF(...) ets_printf(...) + +#define ETS_ASSERT(v) do { \ + if (!(v)) { \ + ets_printf("%s %u \n", __FILE__, __LINE__); \ + while (1) {}; \ + } \ +} while (0); + +/** + * @} + */ + +/** \defgroup ets_timer_apis, ets_timer related apis used in ets + * @brief ets timer apis + */ + +/** @addtogroup ets_timer_apis + * @{ + */ +typedef void ETSTimerFunc(void *timer_arg);/**< timer handler*/ + +typedef struct _ETSTIMER_ { + struct _ETSTIMER_ *timer_next; /**< timer linker*/ + uint32_t timer_expire; /**< abstruct time when timer expire*/ + uint32_t timer_period; /**< timer period, 0 means timer is not periodic repeated*/ + ETSTimerFunc *timer_func; /**< timer handler*/ + void *timer_arg; /**< timer handler argument*/ +} ETSTimer; + +/** + * @brief Init ets timer, this timer range is 640 us to 429496 ms + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_timer_init(void); + +/** + * @brief In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_timer_deinit(void); + +/** + * @brief Arm an ets timer, this timer range is 640 us to 429496 ms. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @param uint32_t tmout : Timer value in ms, range is 1 to 429496. + * + * @param bool repeat : Timer is periodic repeated. + * + * @return None + */ +void ets_timer_arm(ETSTimer *timer, uint32_t tmout, bool repeat); + +/** + * @brief Arm an ets timer, this timer range is 640 us to 429496 ms. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @param uint32_t tmout : Timer value in us, range is 1 to 429496729. + * + * @param bool repeat : Timer is periodic repeated. + * + * @return None + */ +void ets_timer_arm_us(ETSTimer *ptimer, uint32_t us, bool repeat); + +/** + * @brief Disarm an ets timer. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @return None + */ +void ets_timer_disarm(ETSTimer *timer); + +/** + * @brief Set timer callback and argument. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @param ETSTimerFunc *pfunction : Timer callback. + * + * @param void *parg : Timer callback argument. + * + * @return None + */ +void ets_timer_setfn(ETSTimer *ptimer, ETSTimerFunc *pfunction, void *parg); + +/** + * @brief Unset timer callback and argument to NULL. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @return None + */ +void ets_timer_done(ETSTimer *ptimer); + +/** + * @brief CPU do while loop for some time. + * In FreeRTOS task, please call FreeRTOS apis. + * + * @param uint32_t us : Delay time in us. + * + * @return None + */ +void ets_delay_us(uint32_t us); + +/** + * @brief Set the real CPU ticks per us to the ets, so that ets_delay_us will be accurate. + * Call this function when CPU frequency is changed. + * + * @param uint32_t ticks_per_us : CPU ticks per us. + * + * @return None + */ +void ets_update_cpu_frequency(uint32_t ticks_per_us); + +/** + * @brief Set the real CPU ticks per us to the ets, so that ets_delay_us will be accurate. + * + * @note This function only sets the tick rate for the current CPU. It is located in ROM, + * so the deep sleep stub can use it even if IRAM is not initialized yet. + * + * @param uint32_t ticks_per_us : CPU ticks per us. + * + * @return None + */ +void ets_update_cpu_frequency_rom(uint32_t ticks_per_us); + +/** + * @brief Get the real CPU ticks per us to the ets. + * This function do not return real CPU ticks per us, just the record in ets. It can be used to check with the real CPU frequency. + * + * @param None + * + * @return uint32_t : CPU ticks per us record in ets. + */ +uint32_t ets_get_cpu_frequency(void); + +/** + * @brief Get xtal_freq value, If value not stored in RTC_STORE5, than store. + * + * @param None + * + * @return uint32_t : if stored in efuse(not 0) + * clock = ets_efuse_get_xtal_freq() * 1000000; + * else if analog_8M in efuse + * clock = ets_get_xtal_scale() * 625 / 16 * ets_efuse_get_8M_clock(); + * else clock = 40M. + */ +uint32_t ets_get_xtal_freq(void); + +/** + * @brief Get the apb divior by xtal frequency. + * When any types of reset happen, the default value is 2. + * + * @param None + * + * @return uint32_t : 1 or 2. + */ +uint32_t ets_get_xtal_div(void); + +/** + * @brief Get apb_freq value, If value not stored in RTC_STORE5, than store. + * + * @param None + * + * @return uint32_t : if rtc store the value (RTC_STORE5 high 16 bits and low 16 bits with same value), read from rtc register. + * clock = (REG_READ(RTC_STORE5) & 0xffff) << 12; + * else store ets_get_detected_xtal_freq() in. + */ +uint32_t ets_get_apb_freq(void); + +/** + * @} + */ + +/** \defgroup ets_intr_apis, ets interrupt configure related apis + * @brief ets intr apis + */ + +/** @addtogroup ets_intr_apis + * @{ + */ + +typedef void (* ets_isr_t)(void *);/**< interrupt handler type*/ + +/** + * @brief Attach a interrupt handler to a CPU interrupt number. + * This function equals to _xtos_set_interrupt_handler_arg(i, func, arg). + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param int i : CPU interrupt number. + * + * @param ets_isr_t func : Interrupt handler. + * + * @param void *arg : argument of the handler. + * + * @return None + */ +void ets_isr_attach(int i, ets_isr_t func, void *arg); + +/** + * @brief Mask the interrupts which show in mask bits. + * This function equals to _xtos_ints_off(mask). + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param uint32_t mask : BIT(i) means mask CPU interrupt number i. + * + * @return None + */ +void ets_isr_mask(uint32_t mask); + +/** + * @brief Unmask the interrupts which show in mask bits. + * This function equals to _xtos_ints_on(mask). + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param uint32_t mask : BIT(i) means mask CPU interrupt number i. + * + * @return None + */ +void ets_isr_unmask(uint32_t unmask); + +/** + * @brief Lock the interrupt to level 2. + * This function direct set the CPU registers. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_intr_lock(void); + +/** + * @brief Unlock the interrupt to level 0. + * This function direct set the CPU registers. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_intr_unlock(void); + +/** + * @brief Unlock the interrupt to level 0, and CPU will go into power save mode(wait interrupt). + * This function direct set the CPU registers. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_waiti0(void); + +/** + * @brief Attach an CPU interrupt to a hardware source. + * We have 4 steps to use an interrupt: + * 1.Attach hardware interrupt source to CPU. intr_matrix_set(0, ETS_WIFI_MAC_INTR_SOURCE, ETS_WMAC_INUM); + * 2.Set interrupt handler. xt_set_interrupt_handler(ETS_WMAC_INUM, func, NULL); + * 3.Enable interrupt for CPU. xt_ints_on(1 << ETS_WMAC_INUM); + * 4.Enable interrupt in the module. + * + * @param int cpu_no : The CPU which the interrupt number belongs. + * + * @param uint32_t model_num : The interrupt hardware source number, please see the interrupt hardware source table. + * + * @param uint32_t intr_num : The interrupt number CPU, please see the interrupt cpu using table. + * + * @return None + */ +void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num); + +/** + * @} + */ + +#ifndef MAC2STR +#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] +#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" +#endif + +#define ETS_MEM_BAR() asm volatile ( "" : : : "memory" ) + +typedef enum { + OK = 0, + FAIL, + PENDING, + BUSY, + CANCEL, +} STATUS; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_ETS_SYS_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/gpio.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/gpio.h new file mode 100644 index 000000000..2969d14fc --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/gpio.h @@ -0,0 +1,311 @@ +// 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. + +#ifndef _ROM_GPIO_H_ +#define _ROM_GPIO_H_ + +#include +#include + +#include "esp_attr.h" +#include "soc/gpio_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup gpio_apis, uart configuration and communication related apis + * @brief gpio apis + */ + +/** @addtogroup gpio_apis + * @{ + */ + +#define GPIO_REG_READ(reg) READ_PERI_REG(reg) +#define GPIO_REG_WRITE(reg, val) WRITE_PERI_REG(reg, val) +#define GPIO_ID_PIN0 0 +#define GPIO_ID_PIN(n) (GPIO_ID_PIN0+(n)) +#define GPIO_PIN_ADDR(i) (GPIO_PIN0_REG + i*4) + +#define GPIO_FUNC_IN_HIGH 0x38 +#define GPIO_FUNC_IN_LOW 0x3C + +#define GPIO_ID_IS_PIN_REGISTER(reg_id) \ + ((reg_id >= GPIO_ID_PIN0) && (reg_id <= GPIO_ID_PIN(GPIO_PIN_COUNT-1))) + +#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0) + +typedef enum { + GPIO_PIN_INTR_DISABLE = 0, + GPIO_PIN_INTR_POSEDGE = 1, + GPIO_PIN_INTR_NEGEDGE = 2, + GPIO_PIN_INTR_ANYEDGE = 3, + GPIO_PIN_INTR_LOLEVEL = 4, + GPIO_PIN_INTR_HILEVEL = 5 +} GPIO_INT_TYPE; + +#define GPIO_OUTPUT_SET(gpio_no, bit_value) \ + ((gpio_no < 32) ? gpio_output_set(bit_value<>gpio_no)&BIT0) : ((gpio_input_get_high()>>(gpio_no - 32))&BIT0)) + +/* GPIO interrupt handler, registered through gpio_intr_handler_register */ +typedef void (* gpio_intr_handler_fn_t)(uint32_t intr_mask, bool high, void *arg); + +/** + * @brief Initialize GPIO. This includes reading the GPIO Configuration DataSet + * to initialize "output enables" and pin configurations for each gpio pin. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void gpio_init(void); + +/** + * @brief Change GPIO(0-31) pin output by setting, clearing, or disabling pins, GPIO0<->BIT(0). + * There is no particular ordering guaranteed; so if the order of writes is significant, + * calling code should divide a single call into multiple calls. + * + * @param uint32_t set_mask : the gpios that need high level. + * + * @param uint32_t clear_mask : the gpios that need low level. + * + * @param uint32_t enable_mask : the gpios that need be changed. + * + * @param uint32_t disable_mask : the gpios that need diable output. + * + * @return None + */ +void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask); + +/** + * @brief Change GPIO(32-39) pin output by setting, clearing, or disabling pins, GPIO32<->BIT(0). + * There is no particular ordering guaranteed; so if the order of writes is significant, + * calling code should divide a single call into multiple calls. + * + * @param uint32_t set_mask : the gpios that need high level. + * + * @param uint32_t clear_mask : the gpios that need low level. + * + * @param uint32_t enable_mask : the gpios that need be changed. + * + * @param uint32_t disable_mask : the gpios that need diable output. + * + * @return None + */ +void gpio_output_set_high(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask); + +/** + * @brief Sample the value of GPIO input pins(0-31) and returns a bitmask. + * + * @param None + * + * @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO0. + */ +uint32_t gpio_input_get(void); + +/** + * @brief Sample the value of GPIO input pins(32-39) and returns a bitmask. + * + * @param None + * + * @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO32. + */ +uint32_t gpio_input_get_high(void); + +/** + * @brief Register an application-specific interrupt handler for GPIO pin interrupts. + * Once the interrupt handler is called, it will not be called again until after a call to gpio_intr_ack. + * Please do not call this function in SDK. + * + * @param gpio_intr_handler_fn_t fn : gpio application-specific interrupt handler + * + * @param void *arg : gpio application-specific interrupt handler argument. + * + * @return None + */ +void gpio_intr_handler_register(gpio_intr_handler_fn_t fn, void *arg); + +/** + * @brief Get gpio interrupts which happens but not processed. + * Please do not call this function in SDK. + * + * @param None + * + * @return uint32_t : bitmask for GPIO pending interrupts, BIT(0) for GPIO0. + */ +uint32_t gpio_intr_pending(void); + +/** + * @brief Get gpio interrupts which happens but not processed. + * Please do not call this function in SDK. + * + * @param None + * + * @return uint32_t : bitmask for GPIO pending interrupts, BIT(0) for GPIO32. + */ +uint32_t gpio_intr_pending_high(void); + +/** + * @brief Ack gpio interrupts to process pending interrupts. + * Please do not call this function in SDK. + * + * @param uint32_t ack_mask: bitmask for GPIO ack interrupts, BIT(0) for GPIO0. + * + * @return None + */ +void gpio_intr_ack(uint32_t ack_mask); + +/** + * @brief Ack gpio interrupts to process pending interrupts. + * Please do not call this function in SDK. + * + * @param uint32_t ack_mask: bitmask for GPIO ack interrupts, BIT(0) for GPIO32. + * + * @return None + */ +void gpio_intr_ack_high(uint32_t ack_mask); + +/** + * @brief Set GPIO to wakeup the ESP32. + * Please do not call this function in SDK. + * + * @param uint32_t i: gpio number. + * + * @param GPIO_INT_TYPE intr_state : only GPIO_PIN_INTR_LOLEVEL\GPIO_PIN_INTR_HILEVEL can be used + * + * @return None + */ +void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state); + +/** + * @brief disable GPIOs to wakeup the ESP32. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void gpio_pin_wakeup_disable(void); + +/** + * @brief set gpio input to a signal, one gpio can input to several signals. + * + * @param uint32_t gpio : gpio number, 0~0x2f + * gpio == 0x3C, input 0 to signal + * gpio == 0x3A, input nothing to signal + * gpio == 0x38, input 1 to signal + * + * @param uint32_t signal_idx : signal index. + * + * @param bool inv : the signal is inv or not + * + * @return None + */ +void gpio_matrix_in(uint32_t gpio, uint32_t signal_idx, bool inv); + +/** + * @brief set signal output to gpio, one signal can output to several gpios. + * + * @param uint32_t gpio : gpio number, 0~0x2f + * + * @param uint32_t signal_idx : signal index. + * signal_idx == 0x100, cancel output put to the gpio + * + * @param bool out_inv : the signal output is invert or not + * + * @param bool oen_inv : the signal output enable is invert or not + * + * @return None + */ +void gpio_matrix_out(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv); + +/** + * @brief Select pad as a gpio function from IOMUX. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_select_gpio(uint32_t gpio_num); + +/** + * @brief Set pad driver capability. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @param uint32_t drv : 0-3 + * + * @return None + */ +void gpio_pad_set_drv(uint32_t gpio_num, uint32_t drv); + +/** + * @brief Pull up the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_pullup(uint32_t gpio_num); + +/** + * @brief Pull down the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_pulldown(uint32_t gpio_num); + +/** + * @brief Unhold the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_unhold(uint32_t gpio_num); + +/** + * @brief Hold the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_hold(uint32_t gpio_num); + +/** + * @brief enable gpio pad input. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_input_enable(uint32_t gpio_num); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_GPIO_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/hmac.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/hmac.h new file mode 100644 index 000000000..223fe884a --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/hmac.h @@ -0,0 +1,63 @@ +// 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. + +#ifndef _ROM_HMAC_H_ +#define _ROM_HMAC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "efuse.h" + +void ets_hmac_enable(void); + +void ets_hmac_disable(void); + +/* Use the "upstream" HMAC key (ETS_EFUSE_KEY_PURPOSE_HMAC_UP) + to digest a message. +*/ +int ets_hmac_calculate_message(ets_efuse_block_t key_block, const void *message, size_t message_len, uint8_t *hmac); + +/* Calculate a downstream HMAC message to temporarily enable JTAG, or + to generate a Digital Signature data decryption key. + + - purpose must be ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE + or ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG + + - key_block must be in range ETS_EFUSE_BLOCK_KEY0 toETS_EFUSE_BLOCK_KEY6. + This efuse block must have the corresponding purpose set in "purpose", or + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL. + + The result of this HMAC calculation is only made available "downstream" to the + corresponding hardware module, and cannot be accessed by software. +*/ +int ets_hmac_calculate_downstream(ets_efuse_block_t key_block, ets_efuse_purpose_t purpose); + +/* Invalidate a downstream HMAC value previously calculated by ets_hmac_calculate_downstream(). + * + * - purpose must match a previous call to ets_hmac_calculate_downstream(). + * + * After this function is called, the corresponding internal operation (JTAG or DS) will no longer + * have access to the generated key. + */ +int ets_hmac_invalidate_downstream(ets_efuse_purpose_t purpose); + +#ifdef __cplusplus +} +#endif + +#endif // _ROM_HMAC_H_ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/libc_stubs.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/libc_stubs.h new file mode 100644 index 000000000..df78851c1 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/libc_stubs.h @@ -0,0 +1,104 @@ +// 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. +#ifndef _ROM_LIBC_STUBS_H_ +#define _ROM_LIBC_STUBS_H_ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +ESP32 ROM code contains implementations of some of C library functions. +Whenever a function in ROM needs to use a syscall, it calls a pointer to the corresponding syscall +implementation defined in the following struct. + +The table itself, by default, is not allocated in RAM. A global pointer syscall_table_ptr is used to +set the address + +So, before using any of the C library functions (except for pure functions and memcpy/memset functions), +application must allocate syscall table structure for each CPU being used, and populate it with pointers +to actual implementations of corresponding syscalls. +*/ + +struct syscall_stub_table +{ + struct _reent* (*__getreent)(void); + void* (*_malloc_r)(struct _reent *r, size_t); + void (*_free_r)(struct _reent *r, void*); + void* (*_realloc_r)(struct _reent *r, void*, size_t); + void* (*_calloc_r)(struct _reent *r, size_t, size_t); + void (*_abort)(void); + int (*_system_r)(struct _reent *r, const char*); + int (*_rename_r)(struct _reent *r, const char*, const char*); + clock_t (*_times_r)(struct _reent *r, struct tms *); + int (*_gettimeofday_r) (struct _reent *r, struct timeval *, void *); + void (*_raise_r)(struct _reent *r); + int (*_unlink_r)(struct _reent *r, const char*); + int (*_link_r)(struct _reent *r, const char*, const char*); + int (*_stat_r)(struct _reent *r, const char*, struct stat *); + int (*_fstat_r)(struct _reent *r, int, struct stat *); + void* (*_sbrk_r)(struct _reent *r, ptrdiff_t); + int (*_getpid_r)(struct _reent *r); + int (*_kill_r)(struct _reent *r, int, int); + void (*_exit_r)(struct _reent *r, int); + int (*_close_r)(struct _reent *r, int); + int (*_open_r)(struct _reent *r, const char *, int, int); + int (*_write_r)(struct _reent *r, int, const void *, int); + int (*_lseek_r)(struct _reent *r, int, int, int); + int (*_read_r)(struct _reent *r, int, void *, int); +#ifdef _RETARGETABLE_LOCKING + void (*_retarget_lock_init)(_LOCK_T *lock); + void (*_retarget_lock_init_recursive)(_LOCK_T *lock); + void (*_retarget_lock_close)(_LOCK_T lock); + void (*_retarget_lock_close_recursive)(_LOCK_T lock); + void (*_retarget_lock_acquire)(_LOCK_T lock); + void (*_retarget_lock_acquire_recursive)(_LOCK_T lock); + int (*_retarget_lock_try_acquire)(_LOCK_T lock); + int (*_retarget_lock_try_acquire_recursive)(_LOCK_T lock); + void (*_retarget_lock_release)(_LOCK_T lock); + void (*_retarget_lock_release_recursive)(_LOCK_T lock); +#else + void (*_lock_init)(_lock_t *lock); + void (*_lock_init_recursive)(_lock_t *lock); + void (*_lock_close)(_lock_t *lock); + void (*_lock_close_recursive)(_lock_t *lock); + void (*_lock_acquire)(_lock_t *lock); + void (*_lock_acquire_recursive)(_lock_t *lock); + int (*_lock_try_acquire)(_lock_t *lock); + int (*_lock_try_acquire_recursive)(_lock_t *lock); + void (*_lock_release)(_lock_t *lock); + void (*_lock_release_recursive)(_lock_t *lock); +#endif + int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap); + int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap); + void (*__assert_func) (const char *file, int line, const char * func, const char *failedexpr) __attribute__((noreturn)); + void (*__sinit) (struct _reent *r); + void (*_cleanup_r) (struct _reent* r); +}; + +extern struct syscall_stub_table *syscall_table_ptr; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* _ROM_LIBC_STUBS_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/lldesc.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/lldesc.h new file mode 100644 index 000000000..d4c5d92a3 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/lldesc.h @@ -0,0 +1,176 @@ +// 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. + +#ifndef _ROM_LLDESC_H_ +#define _ROM_LLDESC_H_ + +#include + +#include "sys/queue.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LLDESC_TX_MBLK_SIZE 268 /* */ +#define LLDESC_RX_SMBLK_SIZE 64 /* small block size, for small mgmt frame */ +#define LLDESC_RX_MBLK_SIZE 524 /* rx is large sinec we want to contain mgmt frame in one block*/ +#define LLDESC_RX_AMPDU_ENTRY_MBLK_SIZE 64 /* it is a small buffer which is a cycle link*/ +#define LLDESC_RX_AMPDU_LEN_MBLK_SIZE 256 /*for ampdu entry*/ +#ifdef ESP_MAC_5 +#define LLDESC_TX_MBLK_NUM 116 /* 64K / 256 */ +#define LLDESC_RX_MBLK_NUM 82 /* 64K / 512 MAX 172*/ +#define LLDESC_RX_AMPDU_ENTRY_MBLK_NUM 4 +#define LLDESC_RX_AMPDU_LEN_MLBK_NUM 12 +#else +#ifdef SBUF_RXTX +#define LLDESC_TX_MBLK_NUM_MAX (2 * 48) /* 23K / 260 - 8 */ +#define LLDESC_RX_MBLK_NUM_MAX (2 * 48) /* 23K / 524 */ +#define LLDESC_TX_MBLK_NUM_MIN (2 * 16) /* 23K / 260 - 8 */ +#define LLDESC_RX_MBLK_NUM_MIN (2 * 16) /* 23K / 524 */ +#endif +#define LLDESC_TX_MBLK_NUM 10 //(2 * 32) /* 23K / 260 - 8 */ + +#ifdef IEEE80211_RX_AMPDU +#define LLDESC_RX_MBLK_NUM 30 +#else +#define LLDESC_RX_MBLK_NUM 10 +#endif /*IEEE80211_RX_AMPDU*/ + +#define LLDESC_RX_AMPDU_ENTRY_MBLK_NUM 4 +#define LLDESC_RX_AMPDU_LEN_MLBK_NUM 8 +#endif /* !ESP_MAC_5 */ +/* + * SLC2 DMA Desc struct, aka lldesc_t + * + * -------------------------------------------------------------- + * | own | EoF | sub_sof | 5'b0 | length [11:0] | size [11:0] | + * -------------------------------------------------------------- + * | buf_ptr [31:0] | + * -------------------------------------------------------------- + * | next_desc_ptr [31:0] | + * -------------------------------------------------------------- + */ + +/* this bitfield is start from the LSB!!! */ +typedef struct lldesc_s { + volatile uint32_t size : 12, + length: 12, + offset: 5, /* h/w reserved 5bit, s/w use it as offset in buffer */ + sosf : 1, /* start of sub-frame */ + eof : 1, /* end of frame */ + owner : 1; /* hw or sw */ + volatile const uint8_t *buf; /* point to buffer data */ + union { + volatile uint32_t empty; + STAILQ_ENTRY(lldesc_s) qe; /* pointing to the next desc */ + }; +} lldesc_t; + +typedef struct tx_ampdu_entry_s { + uint32_t sub_len : 12, + dili_num : 7, + : 1, + null_byte: 2, + data : 1, + enc : 1, + seq : 8; +} tx_ampdu_entry_t; + +typedef struct lldesc_chain_s { + lldesc_t *head; + lldesc_t *tail; +} lldesc_chain_t; + +#ifdef SBUF_RXTX +enum sbuf_mask_s { + SBUF_MOVE_NO = 0, + SBUF_MOVE_TX2RX, + SBUF_MOVE_RX2TX, +} ; + +#define SBUF_MOVE_STEP 8 +#endif +#define LLDESC_SIZE sizeof(struct lldesc_s) + +/* SLC Descriptor */ +#define LLDESC_OWNER_MASK 0x80000000 +#define LLDESC_OWNER_SHIFT 31 +#define LLDESC_SW_OWNED 0 +#define LLDESC_HW_OWNED 1 + +#define LLDESC_EOF_MASK 0x40000000 +#define LLDESC_EOF_SHIFT 30 + +#define LLDESC_SOSF_MASK 0x20000000 +#define LLDESC_SOSF_SHIFT 29 + +#define LLDESC_LENGTH_MASK 0x00fff000 +#define LLDESC_LENGTH_SHIFT 12 + +#define LLDESC_SIZE_MASK 0x00000fff +#define LLDESC_SIZE_SHIFT 0 + +#define LLDESC_ADDR_MASK 0x000fffff + +void lldesc_build_chain(uint8_t *descptr, uint32_t desclen, uint8_t *mblkptr, uint32_t buflen, uint32_t blksz, uint8_t owner, + lldesc_t **head, +#ifdef TO_HOST_RESTART + lldesc_t **one_before_tail, +#endif + lldesc_t **tail); + +lldesc_t *lldesc_num2link(lldesc_t *head, uint16_t nblks); + +lldesc_t *lldesc_set_owner(lldesc_t *head, uint16_t nblks, uint8_t owner); + +static inline uint32_t lldesc_get_chain_length(lldesc_t *head) +{ + lldesc_t *ds = head; + uint32_t len = 0; + + while (ds) { + len += ds->length; + ds = STAILQ_NEXT(ds, qe); + } + + return len; +} + +static inline void lldesc_config(lldesc_t *ds, uint8_t owner, uint8_t eof, uint8_t sosf, uint16_t len) +{ + ds->owner = owner; + ds->eof = eof; + ds->sosf = sosf; + ds->length = len; +} + +#define LLDESC_CONFIG(_desc, _owner, _eof, _sosf, _len) do { \ + (_desc)->owner = (_owner); \ + (_desc)->eof = (_eof); \ + (_desc)->sosf = (_sosf); \ + (_desc)->length = (_len); \ +} while(0) + +#define LLDESC_FROM_HOST_CLEANUP(ds) LLDESC_CONFIG((ds), LLDESC_HW_OWNED, 0, 0, 0) + +#define LLDESC_MAC_RX_CLEANUP(ds) LLDESC_CONFIG((ds), LLDESC_HW_OWNED, 0, 0, (ds)->size) + +#define LLDESC_TO_HOST_CLEANUP(ds) LLDESC_CONFIG((ds), LLDESC_HW_OWNED, 0, 0, 0) + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_LLDESC_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/md5_hash.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/md5_hash.h new file mode 100644 index 000000000..63ce15857 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/md5_hash.h @@ -0,0 +1,38 @@ +/* + * MD5 internal definitions + * Copyright (c) 2003-2005, Jouni Malinen + * + * This program 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. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef _ROM_MD5_HASH_H_ +#define _ROM_MD5_HASH_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct MD5Context { + uint32_t buf[4]; + uint32_t bits[2]; + uint8_t in[64]; +}; + +void MD5Init(struct MD5Context *context); +void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len); +void MD5Final(unsigned char digest[16], struct MD5Context *context); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_MD5_HASH_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/miniz.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/miniz.h new file mode 100644 index 000000000..4c8cb7a42 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/miniz.h @@ -0,0 +1,760 @@ +#ifndef MINIZ_HEADER_INCLUDED +#define MINIZ_HEADER_INCLUDED + +#include + +// Defines to completely disable specific portions of miniz.c: +// If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. + +// Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. +#define MINIZ_NO_STDIO + +// If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or +// get/set file times, and the C run-time funcs that get/set times won't be called. +// The current downside is the times written to your archives will be from 1979. +#define MINIZ_NO_TIME + +// Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. +#define MINIZ_NO_ARCHIVE_APIS + +// Define MINIZ_NO_ARCHIVE_APIS to disable all writing related ZIP archive API's. +#define MINIZ_NO_ARCHIVE_WRITING_APIS + +// Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's. +#define MINIZ_NO_ZLIB_APIS + +// Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. +#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES + +// Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. +// Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc +// callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user +// functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. +#define MINIZ_NO_MALLOC + +#if defined(__TINYC__) && (defined(__linux) || defined(__linux__)) +// TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux +#define MINIZ_NO_TIME +#endif + +#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS) +#include +#endif + +//Hardcoded options for Xtensa - JD +#define MINIZ_X86_OR_X64_CPU 0 +#define MINIZ_LITTLE_ENDIAN 1 +#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0 +#define MINIZ_HAS_64BIT_REGISTERS 0 +#define TINFL_USE_64BIT_BITBUF 0 + + +#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__) +// MINIZ_X86_OR_X64_CPU is only used to help set the below macros. +#define MINIZ_X86_OR_X64_CPU 1 +#endif + +#if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU +// Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. +#define MINIZ_LITTLE_ENDIAN 1 +#endif + +#if MINIZ_X86_OR_X64_CPU +// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. +#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 +#endif + +#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) +// Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions). +#define MINIZ_HAS_64BIT_REGISTERS 1 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// ------------------- zlib-style API Definitions. + +// For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. Beware: mz_ulong can be either 32 or 64-bits! +typedef unsigned long mz_ulong; + +// mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap. +void mz_free(void *p); + +#define MZ_ADLER32_INIT (1) +// mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. +mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len); + +#define MZ_CRC32_INIT (0) +// mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. +mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len); + +// Compression strategies. +enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 }; + +// Method +#define MZ_DEFLATED 8 + +#ifndef MINIZ_NO_ZLIB_APIS + +// Heap allocation callbacks. +// Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long. +typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size); +typedef void (*mz_free_func)(void *opaque, void *address); +typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size); + +#define MZ_VERSION "9.1.15" +#define MZ_VERNUM 0x91F0 +#define MZ_VER_MAJOR 9 +#define MZ_VER_MINOR 1 +#define MZ_VER_REVISION 15 +#define MZ_VER_SUBREVISION 0 + +// Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other values are for advanced use (refer to the zlib docs). +enum { MZ_NO_FLUSH = 0, MZ_PARTIAL_FLUSH = 1, MZ_SYNC_FLUSH = 2, MZ_FULL_FLUSH = 3, MZ_FINISH = 4, MZ_BLOCK = 5 }; + +// Return status codes. MZ_PARAM_ERROR is non-standard. +enum { MZ_OK = 0, MZ_STREAM_END = 1, MZ_NEED_DICT = 2, MZ_ERRNO = -1, MZ_STREAM_ERROR = -2, MZ_DATA_ERROR = -3, MZ_MEM_ERROR = -4, MZ_BUF_ERROR = -5, MZ_VERSION_ERROR = -6, MZ_PARAM_ERROR = -10000 }; + +// Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. +enum { MZ_NO_COMPRESSION = 0, MZ_BEST_SPEED = 1, MZ_BEST_COMPRESSION = 9, MZ_UBER_COMPRESSION = 10, MZ_DEFAULT_LEVEL = 6, MZ_DEFAULT_COMPRESSION = -1 }; + +// Window bits +#define MZ_DEFAULT_WINDOW_BITS 15 + +struct mz_internal_state; + +// Compression/decompression stream struct. +typedef struct mz_stream_s { + const unsigned char *next_in; // pointer to next byte to read + unsigned int avail_in; // number of bytes available at next_in + mz_ulong total_in; // total number of bytes consumed so far + + unsigned char *next_out; // pointer to next byte to write + unsigned int avail_out; // number of bytes that can be written to next_out + mz_ulong total_out; // total number of bytes produced so far + + char *msg; // error msg (unused) + struct mz_internal_state *state; // internal state, allocated by zalloc/zfree + + mz_alloc_func zalloc; // optional heap allocation function (defaults to malloc) + mz_free_func zfree; // optional heap free function (defaults to free) + void *opaque; // heap alloc function user pointer + + int data_type; // data_type (unused) + mz_ulong adler; // adler32 of the source or uncompressed data + mz_ulong reserved; // not used +} mz_stream; + +typedef mz_stream *mz_streamp; + +// Returns the version string of miniz.c. +const char *mz_version(void); + +// mz_deflateInit() initializes a compressor with default options: +// Parameters: +// pStream must point to an initialized mz_stream struct. +// level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. +// level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. +// (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) +// Return values: +// MZ_OK on success. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_PARAM_ERROR if the input parameters are bogus. +// MZ_MEM_ERROR on out of memory. +int mz_deflateInit(mz_streamp pStream, int level); + +// mz_deflateInit2() is like mz_deflate(), except with more control: +// Additional parameters: +// method must be MZ_DEFLATED +// window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer) +// mem_level must be between [1, 9] (it's checked but ignored by miniz.c) +int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); + +// Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). +int mz_deflateReset(mz_streamp pStream); + +// mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. +// Parameters: +// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. +// flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. +// Return values: +// MZ_OK on success (when flushing, or if more input is needed but not available, and/or there's more output to be written but the output buffer is full). +// MZ_STREAM_END if all input has been consumed and all output bytes have been written. Don't call mz_deflate() on the stream anymore. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_PARAM_ERROR if one of the parameters is invalid. +// MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.) +int mz_deflate(mz_streamp pStream, int flush); + +// mz_deflateEnd() deinitializes a compressor: +// Return values: +// MZ_OK on success. +// MZ_STREAM_ERROR if the stream is bogus. +int mz_deflateEnd(mz_streamp pStream); + +// mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH. +mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len); + +// Single-call compression functions mz_compress() and mz_compress2(): +// Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure. +int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); +int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level); + +// mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). +mz_ulong mz_compressBound(mz_ulong source_len); + +// Initializes a decompressor. +int mz_inflateInit(mz_streamp pStream); + +// mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer: +// window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). +int mz_inflateInit2(mz_streamp pStream, int window_bits); + +// Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. +// Parameters: +// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. +// flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. +// On the first call, if flush is MZ_FINISH it's assumed the input and output buffers are both sized large enough to decompress the entire stream in a single call (this is slightly faster). +// MZ_FINISH implies that there are no more source bytes available beside what's already in the input buffer, and that the output buffer is large enough to hold the rest of the decompressed data. +// Return values: +// MZ_OK on success. Either more input is needed but not available, and/or there's more output to be written but the output buffer is full. +// MZ_STREAM_END if all needed input has been consumed and all output bytes have been written. For zlib streams, the adler-32 of the decompressed data has also been verified. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_DATA_ERROR if the deflate stream is invalid. +// MZ_PARAM_ERROR if one of the parameters is invalid. +// MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again +// with more input data, or with more room in the output buffer (except when using single call decompression, described above). +int mz_inflate(mz_streamp pStream, int flush); + +// Deinitializes a decompressor. +int mz_inflateEnd(mz_streamp pStream); + +// Single-call decompression. +// Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. +int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); + +// Returns a string description of the specified error code, or NULL if the error code is invalid. +const char *mz_error(int err); + +// Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports. +// Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. +#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES +typedef unsigned char Byte; +typedef unsigned int uInt; +typedef mz_ulong uLong; +typedef Byte Bytef; +typedef uInt uIntf; +typedef char charf; +typedef int intf; +typedef void *voidpf; +typedef uLong uLongf; +typedef void *voidp; +typedef void *const voidpc; +#define Z_NULL 0 +#define Z_NO_FLUSH MZ_NO_FLUSH +#define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH +#define Z_SYNC_FLUSH MZ_SYNC_FLUSH +#define Z_FULL_FLUSH MZ_FULL_FLUSH +#define Z_FINISH MZ_FINISH +#define Z_BLOCK MZ_BLOCK +#define Z_OK MZ_OK +#define Z_STREAM_END MZ_STREAM_END +#define Z_NEED_DICT MZ_NEED_DICT +#define Z_ERRNO MZ_ERRNO +#define Z_STREAM_ERROR MZ_STREAM_ERROR +#define Z_DATA_ERROR MZ_DATA_ERROR +#define Z_MEM_ERROR MZ_MEM_ERROR +#define Z_BUF_ERROR MZ_BUF_ERROR +#define Z_VERSION_ERROR MZ_VERSION_ERROR +#define Z_PARAM_ERROR MZ_PARAM_ERROR +#define Z_NO_COMPRESSION MZ_NO_COMPRESSION +#define Z_BEST_SPEED MZ_BEST_SPEED +#define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION +#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION +#define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY +#define Z_FILTERED MZ_FILTERED +#define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY +#define Z_RLE MZ_RLE +#define Z_FIXED MZ_FIXED +#define Z_DEFLATED MZ_DEFLATED +#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS +#define alloc_func mz_alloc_func +#define free_func mz_free_func +#define internal_state mz_internal_state +#define z_stream mz_stream +#define deflateInit mz_deflateInit +#define deflateInit2 mz_deflateInit2 +#define deflateReset mz_deflateReset +#define deflate mz_deflate +#define deflateEnd mz_deflateEnd +#define deflateBound mz_deflateBound +#define compress mz_compress +#define compress2 mz_compress2 +#define compressBound mz_compressBound +#define inflateInit mz_inflateInit +#define inflateInit2 mz_inflateInit2 +#define inflate mz_inflate +#define inflateEnd mz_inflateEnd +#define uncompress mz_uncompress +#define crc32 mz_crc32 +#define adler32 mz_adler32 +#define MAX_WBITS 15 +#define MAX_MEM_LEVEL 9 +#define zError mz_error +#define ZLIB_VERSION MZ_VERSION +#define ZLIB_VERNUM MZ_VERNUM +#define ZLIB_VER_MAJOR MZ_VER_MAJOR +#define ZLIB_VER_MINOR MZ_VER_MINOR +#define ZLIB_VER_REVISION MZ_VER_REVISION +#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION +#define zlibVersion mz_version +#define zlib_version mz_version() +#endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES + +#endif // MINIZ_NO_ZLIB_APIS + +// ------------------- Types and macros + +typedef unsigned char mz_uint8; +typedef signed short mz_int16; +typedef unsigned short mz_uint16; +typedef unsigned int mz_uint32; +typedef unsigned int mz_uint; +typedef long long mz_int64; +typedef unsigned long long mz_uint64; +typedef int mz_bool; + +#define MZ_FALSE (0) +#define MZ_TRUE (1) + +// An attempt to work around MSVC's spammy "warning C4127: conditional expression is constant" message. +#ifdef _MSC_VER +#define MZ_MACRO_END while (0, 0) +#else +#define MZ_MACRO_END while (0) +#endif + +// ------------------- ZIP archive reading/writing + +#ifndef MINIZ_NO_ARCHIVE_APIS + +enum { + MZ_ZIP_MAX_IO_BUF_SIZE = 64 * 1024, + MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260, + MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256 +}; + +typedef struct { + mz_uint32 m_file_index; + mz_uint32 m_central_dir_ofs; + mz_uint16 m_version_made_by; + mz_uint16 m_version_needed; + mz_uint16 m_bit_flag; + mz_uint16 m_method; +#ifndef MINIZ_NO_TIME + time_t m_time; +#endif + mz_uint32 m_crc32; + mz_uint64 m_comp_size; + mz_uint64 m_uncomp_size; + mz_uint16 m_internal_attr; + mz_uint32 m_external_attr; + mz_uint64 m_local_header_ofs; + mz_uint32 m_comment_size; + char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE]; + char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE]; +} mz_zip_archive_file_stat; + +typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n); +typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n); + +struct mz_zip_internal_state_tag; +typedef struct mz_zip_internal_state_tag mz_zip_internal_state; + +typedef enum { + MZ_ZIP_MODE_INVALID = 0, + MZ_ZIP_MODE_READING = 1, + MZ_ZIP_MODE_WRITING = 2, + MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 +} mz_zip_mode; + +typedef struct mz_zip_archive_tag { + mz_uint64 m_archive_size; + mz_uint64 m_central_directory_file_ofs; + mz_uint m_total_files; + mz_zip_mode m_zip_mode; + + mz_uint m_file_offset_alignment; + + mz_alloc_func m_pAlloc; + mz_free_func m_pFree; + mz_realloc_func m_pRealloc; + void *m_pAlloc_opaque; + + mz_file_read_func m_pRead; + mz_file_write_func m_pWrite; + void *m_pIO_opaque; + + mz_zip_internal_state *m_pState; + +} mz_zip_archive; + +typedef enum { + MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, + MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, + MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, + MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800 +} mz_zip_flags; + +// ZIP archive reading + +// Inits a ZIP archive reader. +// These functions read and validate the archive's central directory. +mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags); +mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags); + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags); +#endif + +// Returns the total number of files in the archive. +mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip); + +// Returns detailed information about an archive file entry. +mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat); + +// Determines if an archive file entry is a directory entry. +mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index); +mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index); + +// Retrieves the filename of an archive file entry. +// Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename. +mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size); + +// Attempts to locates a file in the archive's central directory. +// Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH +// Returns -1 if the file cannot be found. +int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags); + +// Extracts a archive file to a memory buffer using no memory allocation. +mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); +mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); + +// Extracts a archive file to a memory buffer. +mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags); + +// Extracts a archive file to a dynamically allocated heap buffer. +void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags); +void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags); + +// Extracts a archive file using a callback function to output the file's data. +mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); + +#ifndef MINIZ_NO_STDIO +// Extracts a archive file to a disk file and sets its last accessed and modified times. +// This function only extracts files, not archive directory records. +mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags); +#endif + +// Ends archive reading, freeing all allocations, and closing the input archive file if mz_zip_reader_init_file() was used. +mz_bool mz_zip_reader_end(mz_zip_archive *pZip); + +// ZIP archive writing + +#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +// Inits a ZIP archive writer. +mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size); +mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size); + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning); +#endif + +// Converts a ZIP archive reader object into a writer object, to allow efficient in-place file appends to occur on an existing archive. +// For archives opened using mz_zip_reader_init_file, pFilename must be the archive's filename so it can be reopened for writing. If the file can't be reopened, mz_zip_reader_end() will be called. +// For archives opened using mz_zip_reader_init_mem, the memory block must be growable using the realloc callback (which defaults to realloc unless you've overridden it). +// Finally, for archives opened using mz_zip_reader_init, the mz_zip_archive's user provided m_pWrite function cannot be NULL. +// Note: In-place archive modification is not recommended unless you know what you're doing, because if execution stops or something goes wrong before +// the archive is finalized the file's central directory will be hosed. +mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename); + +// Adds the contents of a memory buffer to an archive. These functions record the current local time into the archive. +// To add a directory entry, call this method with an archive name ending in a forwardslash with empty buffer. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags); +mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32); + +#ifndef MINIZ_NO_STDIO +// Adds the contents of a disk file to an archive. This function also records the disk file's modified time into the archive. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); +#endif + +// Adds a file to an archive by fully cloning the data from another archive. +// This function fully clones the source file's compressed data (no recompression), along with its full filename, extra data, and comment fields. +mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index); + +// Finalizes the archive by writing the central directory records followed by the end of central directory record. +// After an archive is finalized, the only valid call on the mz_zip_archive struct is mz_zip_writer_end(). +// An archive must be manually finalized by calling this function for it to be valid. +mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip); +mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize); + +// Ends archive writing, freeing all allocations, and closing the output file if mz_zip_writer_init_file() was used. +// Note for the archive to be valid, it must have been finalized before ending. +mz_bool mz_zip_writer_end(mz_zip_archive *pZip); + +// Misc. high-level helper functions: + +// mz_zip_add_mem_to_archive_file_in_place() efficiently (but not atomically) appends a memory blob to a ZIP archive. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); + +// Reads a single file from an archive into a heap block. +// Returns NULL on failure. +void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint zip_flags); + +#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +#endif // #ifndef MINIZ_NO_ARCHIVE_APIS + +// ------------------- Low-level Decompression API Definitions + +// Decompression flags used by tinfl_decompress(). +// TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the input is a raw deflate stream. +// TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available beyond the end of the supplied input buffer. If clear, the input buffer contains all remaining input. +// TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large enough to hold the entire decompressed stream. If clear, the output buffer is at least the size of the dictionary (typically 32KB). +// TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the decompressed bytes. +enum { + TINFL_FLAG_PARSE_ZLIB_HEADER = 1, + TINFL_FLAG_HAS_MORE_INPUT = 2, + TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, + TINFL_FLAG_COMPUTE_ADLER32 = 8 +}; + +// High level decompression functions: +// tinfl_decompress_mem_to_heap() decompresses a block in memory to a heap block allocated via malloc(). +// On entry: +// pSrc_buf, src_buf_len: Pointer and size of the Deflate or zlib source data to decompress. +// On return: +// Function returns a pointer to the decompressed data, or NULL on failure. +// *pOut_len will be set to the decompressed data's size, which could be larger than src_buf_len on uncompressible data. +// The caller must call mz_free() on the returned block when it's no longer needed. +void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); + +// tinfl_decompress_mem_to_mem() decompresses a block in memory to another block in memory. +// Returns TINFL_DECOMPRESS_MEM_TO_MEM_FAILED on failure, or the number of bytes written on success. +#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) +size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); + +// tinfl_decompress_mem_to_callback() decompresses a block in memory to an internal 32KB buffer, and a user provided callback function will be called to flush the buffer. +// Returns 1 on success or 0 on failure. +typedef int (*tinfl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser); +int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +struct tinfl_decompressor_tag; typedef struct tinfl_decompressor_tag tinfl_decompressor; + +// Max size of LZ dictionary. +#define TINFL_LZ_DICT_SIZE 32768 + +// Return status. +typedef enum { + TINFL_STATUS_BAD_PARAM = -3, + TINFL_STATUS_ADLER32_MISMATCH = -2, + TINFL_STATUS_FAILED = -1, + TINFL_STATUS_DONE = 0, + TINFL_STATUS_NEEDS_MORE_INPUT = 1, + TINFL_STATUS_HAS_MORE_OUTPUT = 2 +} tinfl_status; + +// Initializes the decompressor to its initial state. +#define tinfl_init(r) do { (r)->m_state = 0; } MZ_MACRO_END +#define tinfl_get_adler32(r) (r)->m_check_adler32 + +// Main low-level decompressor coroutine function. This is the only function actually needed for decompression. All the other functions are just high-level helpers for improved usability. +// This is a universal API, i.e. it can be used as a building block to build any desired higher level decompression API. In the limit case, it can be called once per every byte input or output. +tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags); + +// Internal/private bits follow. +enum { + TINFL_MAX_HUFF_TABLES = 3, TINFL_MAX_HUFF_SYMBOLS_0 = 288, TINFL_MAX_HUFF_SYMBOLS_1 = 32, TINFL_MAX_HUFF_SYMBOLS_2 = 19, + TINFL_FAST_LOOKUP_BITS = 10, TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS +}; + +typedef struct { + mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0]; + mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; +} tinfl_huff_table; + +#if MINIZ_HAS_64BIT_REGISTERS +#define TINFL_USE_64BIT_BITBUF 1 +#endif + +#if TINFL_USE_64BIT_BITBUF +typedef mz_uint64 tinfl_bit_buf_t; +#define TINFL_BITBUF_SIZE (64) +#else +typedef mz_uint32 tinfl_bit_buf_t; +#define TINFL_BITBUF_SIZE (32) +#endif + +struct tinfl_decompressor_tag { + mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES]; + tinfl_bit_buf_t m_bit_buf; + size_t m_dist_from_out_buf_start; + tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES]; + mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137]; +}; + +// ------------------- Low-level Compression API Definitions + +// Set TDEFL_LESS_MEMORY to 1 to use less memory (compression will be slightly slower, and raw/dynamic blocks will be output more frequently). +#define TDEFL_LESS_MEMORY 1 + +// tdefl_init() compression flags logically OR'd together (low 12 bits contain the max. number of probes per dictionary search): +// TDEFL_DEFAULT_MAX_PROBES: The compressor defaults to 128 dictionary probes per dictionary search. 0=Huffman only, 1=Huffman+LZ (fastest/crap compression), 4095=Huffman+LZ (slowest/best compression). +enum { + TDEFL_HUFFMAN_ONLY = 0, TDEFL_DEFAULT_MAX_PROBES = 128, TDEFL_MAX_PROBES_MASK = 0xFFF +}; + +// TDEFL_WRITE_ZLIB_HEADER: If set, the compressor outputs a zlib header before the deflate data, and the Adler-32 of the source data at the end. Otherwise, you'll get raw deflate data. +// TDEFL_COMPUTE_ADLER32: Always compute the adler-32 of the input data (even when not writing zlib headers). +// TDEFL_GREEDY_PARSING_FLAG: Set to use faster greedy parsing, instead of more efficient lazy parsing. +// TDEFL_NONDETERMINISTIC_PARSING_FLAG: Enable to decrease the compressor's initialization time to the minimum, but the output may vary from run to run given the same input (depending on the contents of memory). +// TDEFL_RLE_MATCHES: Only look for RLE matches (matches with a distance of 1) +// TDEFL_FILTER_MATCHES: Discards matches <= 5 chars if enabled. +// TDEFL_FORCE_ALL_STATIC_BLOCKS: Disable usage of optimized Huffman tables. +// TDEFL_FORCE_ALL_RAW_BLOCKS: Only use raw (uncompressed) deflate blocks. +// The low 12 bits are reserved to control the max # of hash probes per dictionary lookup (see TDEFL_MAX_PROBES_MASK). +enum { + TDEFL_WRITE_ZLIB_HEADER = 0x01000, + TDEFL_COMPUTE_ADLER32 = 0x02000, + TDEFL_GREEDY_PARSING_FLAG = 0x04000, + TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000, + TDEFL_RLE_MATCHES = 0x10000, + TDEFL_FILTER_MATCHES = 0x20000, + TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000, + TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000 +}; + +// High level compression functions: +// tdefl_compress_mem_to_heap() compresses a block in memory to a heap block allocated via malloc(). +// On entry: +// pSrc_buf, src_buf_len: Pointer and size of source block to compress. +// flags: The max match finder probes (default is 128) logically OR'd against the above flags. Higher probes are slower but improve compression. +// On return: +// Function returns a pointer to the compressed data, or NULL on failure. +// *pOut_len will be set to the compressed data's size, which could be larger than src_buf_len on uncompressible data. +// The caller must free() the returned block when it's no longer needed. +void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); + +// tdefl_compress_mem_to_mem() compresses a block in memory to another block in memory. +// Returns 0 on failure. +size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); + +// Compresses an image to a compressed PNG file in memory. +// On entry: +// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. +// The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory. +// level may range from [0,10], use MZ_NO_COMPRESSION, MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc. or a decent default is MZ_DEFAULT_LEVEL +// If flip is true, the image will be flipped on the Y axis (useful for OpenGL apps). +// On return: +// Function returns a pointer to the compressed data, or NULL on failure. +// *pLen_out will be set to the size of the PNG image file. +// The caller must mz_free() the returned heap block (which will typically be larger than *pLen_out) when it's no longer needed. +void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int h, int num_chans, size_t *pLen_out, mz_uint level, mz_bool flip); +void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out); + +// Output stream interface. The compressor uses this interface to write compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time. +typedef mz_bool (*tdefl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser); + +// tdefl_compress_mem_to_output() compresses a block to an output stream. The above helpers use this function internally. +mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +enum { TDEFL_MAX_HUFF_TABLES = 3, TDEFL_MAX_HUFF_SYMBOLS_0 = 288, TDEFL_MAX_HUFF_SYMBOLS_1 = 32, TDEFL_MAX_HUFF_SYMBOLS_2 = 19, TDEFL_LZ_DICT_SIZE = 32768, TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1, TDEFL_MIN_MATCH_LEN = 3, TDEFL_MAX_MATCH_LEN = 258 }; + +// TDEFL_OUT_BUF_SIZE MUST be large enough to hold a single entire compressed output block (using static/fixed Huffman codes). +#if TDEFL_LESS_MEMORY +enum { TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 12, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; +#else +enum { TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 15, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; +#endif + +// The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions. +typedef enum { + TDEFL_STATUS_BAD_PARAM = -2, + TDEFL_STATUS_PUT_BUF_FAILED = -1, + TDEFL_STATUS_OKAY = 0, + TDEFL_STATUS_DONE = 1, +} tdefl_status; + +// Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums +typedef enum { + TDEFL_NO_FLUSH = 0, + TDEFL_SYNC_FLUSH = 2, + TDEFL_FULL_FLUSH = 3, + TDEFL_FINISH = 4 +} tdefl_flush; + +// tdefl's compression state structure. +typedef struct { + tdefl_put_buf_func_ptr m_pPut_buf_func; + void *m_pPut_buf_user; + mz_uint m_flags, m_max_probes[2]; + int m_greedy_parsing; + mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size; + mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end; + mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer; + mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, m_wants_to_finish; + tdefl_status m_prev_return_status; + const void *m_pIn_buf; + void *m_pOut_buf; + size_t *m_pIn_buf_size, *m_pOut_buf_size; + tdefl_flush m_flush; + const mz_uint8 *m_pSrc; + size_t m_src_buf_left, m_out_buf_ofs; + mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1]; + mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE]; + mz_uint16 m_next[TDEFL_LZ_DICT_SIZE]; + mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE]; + mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE]; +} tdefl_compressor; + +// Initializes the compressor. +// There is no corresponding deinit() function because the tdefl API's do not dynamically allocate memory. +// pBut_buf_func: If NULL, output data will be supplied to the specified callback. In this case, the user should call the tdefl_compress_buffer() API for compression. +// If pBut_buf_func is NULL the user should always call the tdefl_compress() API. +// flags: See the above enums (TDEFL_HUFFMAN_ONLY, TDEFL_WRITE_ZLIB_HEADER, etc.) +tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +// Compresses a block of data, consuming as much of the specified input buffer as possible, and writing as much compressed data to the specified output buffer as possible. +tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush); + +// tdefl_compress_buffer() is only usable when the tdefl_init() is called with a non-NULL tdefl_put_buf_func_ptr. +// tdefl_compress_buffer() always consumes the entire input buffer. +tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush); + +tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d); +mz_uint32 tdefl_get_adler32(tdefl_compressor *d); + +// Can't use tdefl_create_comp_flags_from_zip_params if MINIZ_NO_ZLIB_APIS isn't defined, because it uses some of its macros. +#ifndef MINIZ_NO_ZLIB_APIS +// Create tdefl_compress() flags given zlib-style compression parameters. +// level may range from [0,10] (where 10 is absolute max compression, but may be much slower on some files) +// window_bits may be -15 (raw deflate) or 15 (zlib) +// strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, MZ_RLE, or MZ_FIXED +mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy); +#endif // #ifndef MINIZ_NO_ZLIB_APIS + +#ifdef __cplusplus +} +#endif + +#endif // MINIZ_HEADER_INCLUDED diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/newlib.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/newlib.h new file mode 100644 index 000000000..a852bdb7f --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/newlib.h @@ -0,0 +1,50 @@ +// 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. +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Global variables used by newlib in ROM + + Note that any of these symbols which are used by both ROM & IDF will have duplicate copies + in each "side" of the memory. However they're all pointers, and the pointers will be to the same + thing, so it's not a big memory waste and functionality is the same. + + Some variables which look like they should be here, but aren't: + + - __sf_fake_stdin, __sf_fake_stdout, __sf_fake_stderr - These are defined in ROM because ROM includes findfp.c, + but only used if _REENT_INIT or _REENT_INIT_PTR are ever called and ROM doesn't use these macros anywhere unless + printf() or similar is called without initializing reent first. ESP-IDF sets up its own minimal reent structures. + + - __lock___sinit_recursive_mutex, etc. - these are combined into common_recursive_mutex & common_mutex to save space +*/ +typedef struct { + _LOCK_T common_recursive_mutex; + _LOCK_T common_mutex; + struct _reent *global_reent; +} esp_rom_newlib_global_data_t; + +/* Called from IDF newlib component setup + to initialize common data shared between ROM and IDF +*/ +void esp_rom_newlib_init_global_data(const esp_rom_newlib_global_data_t *data); + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rom_layout.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rom_layout.h new file mode 100644 index 000000000..cd1730c84 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rom_layout.h @@ -0,0 +1,86 @@ +// 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. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SUPPORT_BTDM 1 +#define SUPPORT_WIFI 1 + +/* Structure and functions for returning ROM global layout + * + * This is for address symbols defined in the linker script, which may change during ECOs. + */ +typedef struct { + void *dram0_stack_shared_mem_start; + void *dram0_rtos_reserved_start; + void *stack_sentry; + void *stack; + void *stack_sentry_app; + void *stack_app; + + /* BTDM data */ + void *data_start_btdm; + void *data_end_btdm; + void *bss_start_btdm; + void *bss_end_btdm; + void *data_start_btdm_rom; + void *data_end_btdm_rom; + void *data_start_interface_btdm; + void *data_end_interface_btdm; + void *bss_start_interface_btdm; + void *bss_end_interface_btdm; + + /* Other DRAM ranges */ +#if SUPPORT_BTDM || SUPPORT_WIFI + void *dram_start_phyrom; + void *dram_end_phyrom; +#endif +#if SUPPORT_WIFI + void *dram_start_coexist; + void *dram_end_coexist; + void *dram_start_net80211; + void *dram_end_net80211; + void *dram_start_pp; + void *dram_end_pp; + void *data_start_interface_coexist; + void *data_end_interface_coexist; + void *bss_start_interface_coexist; + void *bss_end_interface_coexist; + void *data_start_interface_net80211; + void *data_end_interface_net80211; + void *bss_start_interface_net80211; + void *bss_end_interface_net80211; + void *data_start_interface_pp; + void *data_end_interface_pp; + void *bss_start_interface_pp; + void *bss_end_interface_pp; +#endif + void *dram_start_usbdev_rom; + void *dram_end_usbdev_rom; + void *dram_start_uart_rom; + void *dram_end_uart_rom; + +} ets_rom_layout_t; + +extern const ets_rom_layout_t * const ets_rom_layout_p; + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rsa_pss.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rsa_pss.h new file mode 100644 index 000000000..1f56f6943 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rsa_pss.h @@ -0,0 +1,46 @@ +// 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. + +#ifndef _ROM_RSA_PSS_H_ +#define _ROM_RSA_PSS_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define ETS_SIG_LEN 384 /* Bytes */ +#define ETS_DIGEST_LEN 32 /* SHA-256, bytes */ + +typedef struct { + uint8_t n[384]; /* Public key modulus */ + uint32_t e; /* Public key exponent */ + uint8_t rinv[384]; + uint32_t mdash; +} ets_rsa_pubkey_t; + +bool ets_rsa_pss_verify(const ets_rsa_pubkey_t *key, const uint8_t *sig, const uint8_t *digest); + +void ets_mgf1_sha256(const uint8_t *mgfSeed, size_t seedLen, size_t maskLen, uint8_t *mask); + +bool ets_emsa_pss_verify(const uint8_t *encoded_message, const uint8_t *mhash); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rtc.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rtc.h new file mode 100644 index 000000000..ef0c5daab --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/rtc.h @@ -0,0 +1,219 @@ +// 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. + +#ifndef _ROM_RTC_H_ +#define _ROM_RTC_H_ + +#include "ets_sys.h" + +#include +#include + +#include "soc/soc.h" +#include "soc/rtc_cntl_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup rtc_apis, rtc registers and memory related apis + * @brief rtc apis + */ + +/** @addtogroup rtc_apis + * @{ + */ + +/************************************************************************************** + * Note: * + * Some Rtc memory and registers are used, in ROM or in internal library. * + * Please do not use reserved or used rtc memory or registers. * + * * + ************************************************************************************* + * RTC Memory & Store Register usage + ************************************************************************************* + * rtc memory addr type size usage + * 0x3f421000(0x50000000) Slow SIZE_CP Co-Processor code/Reset Entry + * 0x3f421000+SIZE_CP Slow 8192-SIZE_CP + * + * 0x3ff80000(0x40070000) Fast 8192 deep sleep entry code + * + ************************************************************************************* + * RTC store registers usage + * RTC_CNTL_STORE0_REG Reserved + * RTC_CNTL_STORE1_REG RTC_SLOW_CLK calibration value + * RTC_CNTL_STORE2_REG Boot time, low word + * RTC_CNTL_STORE3_REG Boot time, high word + * RTC_CNTL_STORE4_REG External XTAL frequency + * RTC_CNTL_STORE5_REG APB bus frequency + * RTC_CNTL_STORE6_REG FAST_RTC_MEMORY_ENTRY + * RTC_CNTL_STORE7_REG FAST_RTC_MEMORY_CRC + ************************************************************************************* + */ + +#define RTC_SLOW_CLK_CAL_REG RTC_CNTL_STORE1_REG +#define RTC_BOOT_TIME_LOW_REG RTC_CNTL_STORE2_REG +#define RTC_BOOT_TIME_HIGH_REG RTC_CNTL_STORE3_REG +#define RTC_XTAL_FREQ_REG RTC_CNTL_STORE4_REG +#define RTC_APB_FREQ_REG RTC_CNTL_STORE5_REG +#define RTC_ENTRY_ADDR_REG RTC_CNTL_STORE6_REG +#define RTC_RESET_CAUSE_REG RTC_CNTL_STORE6_REG +#define RTC_MEMORY_CRC_REG RTC_CNTL_STORE7_REG + + +typedef enum { + AWAKE = 0, // +#include + +#include "rsa_pss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct ets_secure_boot_sig_block; +struct ets_secure_boot_signature_t; + +typedef struct ets_secure_boot_sig_block ets_secure_boot_sig_block_t; +typedef struct ets_secure_boot_signature ets_secure_boot_signature_t; +typedef struct ets_secure_boot_key_digests ets_secure_boot_key_digests_t; + +/* Verify bootloader image (reconfigures cache to map, + loads trusted key digests from efuse) + + If allow_key_revoke is true and aggressive revoke efuse is set, + any failed signature has its associated key revoked in efuse. + + If result is ETS_OK, the "simple hash" of the bootloader + is copied into verified_hash. +*/ +int ets_secure_boot_verify_bootloader(uint8_t *verified_hash, bool allow_key_revoke); + +/* Verify bootloader image (reconfigures cache to map), with + key digests provided as parameters.) + + Can be used to verify secure boot status before enabling + secure boot permanently. + + If result is ETS_OK, the "simple hash" of the bootloader is + copied into verified_hash. +*/ +int ets_secure_boot_verify_bootloader_with_keys(uint8_t *verified_hash, const ets_secure_boot_key_digests_t *trusted_keys); + +/* Verify supplied signature against supplied digest, using + supplied trusted key digests. + + Doesn't reconfigure cache or any other hardware access. +*/ +int ets_secure_boot_verify_signature(const ets_secure_boot_signature_t *sig, const uint8_t *image_digest, const ets_secure_boot_key_digests_t *trusted_keys); + +/* Read key digests from efuse. Any revoked/missing digests will be + marked as NULL + + Returns 0 if at least one valid digest was found. +*/ +int ets_secure_boot_read_key_digests(ets_secure_boot_key_digests_t *trusted_keys); + +#define ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC 0xE7 + +/* Secure Boot V2 signature block (up to 3 can be appended) */ +struct ets_secure_boot_sig_block { + uint8_t magic_byte; + uint8_t version; + uint8_t _reserved1; + uint8_t _reserved2; + uint8_t image_digest[32]; + ets_rsa_pubkey_t key; + uint8_t signature[384]; + uint32_t block_crc; + uint8_t _padding[16]; +}; + +_Static_assert(sizeof(ets_secure_boot_sig_block_t) == 1216, "invalid sig block size"); + +#define SECURE_BOOT_NUM_BLOCKS 3 + +/* V2 Secure boot signature sector (up to 3 blocks) */ +struct ets_secure_boot_signature { + ets_secure_boot_sig_block_t block[SECURE_BOOT_NUM_BLOCKS]; + uint8_t _padding[4096 - (sizeof(ets_secure_boot_sig_block_t) * SECURE_BOOT_NUM_BLOCKS)]; +}; + +_Static_assert(sizeof(ets_secure_boot_signature_t) == 4096, "invalid sig sector size"); + +struct ets_secure_boot_key_digests { + const void *key_digests[3]; + bool allow_key_revoke; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_SECURE_BOOT_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/sha.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/sha.h new file mode 100644 index 000000000..54b1b2167 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/sha.h @@ -0,0 +1,61 @@ +// 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. +#ifndef _ROM_SHA_H_ +#define _ROM_SHA_H_ + +#include +#include +#include "ets_sys.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SHA1 = 0, + SHA2_224, + SHA2_256, + SHA_TYPE_MAX +} SHA_TYPE; + +typedef struct SHAContext { + bool start; + bool in_hardware; // Is this context currently in peripheral? Needs to be manually cleared if multiple SHAs are interleaved + SHA_TYPE type; + uint32_t state[16]; // For SHA1/SHA224/SHA256, used 8, other used 16 + unsigned char buffer[128]; // For SHA1/SHA224/SHA256, used 64, other used 128 + uint32_t total_bits[4]; +} SHA_CTX; + +void ets_sha_enable(void); + +void ets_sha_disable(void); + +ets_status_t ets_sha_init(SHA_CTX *ctx, SHA_TYPE type); + +ets_status_t ets_sha_starts(SHA_CTX *ctx, uint16_t sha512_t); + +void ets_sha_get_state(SHA_CTX *ctx); + +void ets_sha_process(SHA_CTX *ctx, const unsigned char *input); + +void ets_sha_update(SHA_CTX *ctx, const unsigned char *input, uint32_t input_bytes, bool update_ctx); + +ets_status_t ets_sha_finish(SHA_CTX *ctx, unsigned char *output); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_SHA_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/spi_flash.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/spi_flash.h new file mode 100644 index 000000000..b591d4000 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/spi_flash.h @@ -0,0 +1,570 @@ +// 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. + +#ifndef _ROM_SPI_FLASH_H_ +#define _ROM_SPI_FLASH_H_ + +#include +#include + +#include "esp_attr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup spi_flash_apis, spi flash operation related apis + * @brief spi_flash apis + */ + +/** @addtogroup spi_flash_apis + * @{ + */ + +#define PERIPHS_SPI_FLASH_CMD SPI_MEM_CMD_REG(1) +#define PERIPHS_SPI_FLASH_ADDR SPI_MEM_ADDR_REG(1) +#define PERIPHS_SPI_FLASH_CTRL SPI_MEM_CTRL_REG(1) +#define PERIPHS_SPI_FLASH_CTRL1 SPI_MEM_CTRL1_REG(1) +#define PERIPHS_SPI_FLASH_STATUS SPI_MEM_RD_STATUS_REG(1) +#define PERIPHS_SPI_FLASH_USRREG SPI_MEM_USER_REG(1) +#define PERIPHS_SPI_FLASH_USRREG1 SPI_MEM_USER1_REG(1) +#define PERIPHS_SPI_FLASH_USRREG2 SPI_MEM_USER2_REG(1) +#define PERIPHS_SPI_FLASH_C0 SPI_MEM_W0_REG(1) +#define PERIPHS_SPI_FLASH_C1 SPI_MEM_W1_REG(1) +#define PERIPHS_SPI_FLASH_C2 SPI_MEM_W2_REG(1) +#define PERIPHS_SPI_FLASH_C3 SPI_MEM_W3_REG(1) +#define PERIPHS_SPI_FLASH_C4 SPI_MEM_W4_REG(1) +#define PERIPHS_SPI_FLASH_C5 SPI_MEM_W5_REG(1) +#define PERIPHS_SPI_FLASH_C6 SPI_MEM_W6_REG(1) +#define PERIPHS_SPI_FLASH_C7 SPI_MEM_W7_REG(1) +#define PERIPHS_SPI_FLASH_TX_CRC SPI_MEM_TX_CRC_REG(1) + +#define SPI0_R_QIO_DUMMY_CYCLELEN 5 +#define SPI0_R_QIO_ADDR_BITSLEN 23 +#define SPI0_R_FAST_DUMMY_CYCLELEN 7 +#define SPI0_R_DIO_DUMMY_CYCLELEN 3 +#define SPI0_R_FAST_ADDR_BITSLEN 23 +#define SPI0_R_SIO_ADDR_BITSLEN 23 + +#define SPI1_R_QIO_DUMMY_CYCLELEN 5 +#define SPI1_R_QIO_ADDR_BITSLEN 23 +#define SPI1_R_FAST_DUMMY_CYCLELEN 7 +#define SPI1_R_DIO_DUMMY_CYCLELEN 3 +#define SPI1_R_DIO_ADDR_BITSLEN 23 +#define SPI1_R_FAST_ADDR_BITSLEN 23 +#define SPI1_R_SIO_ADDR_BITSLEN 23 + +#define ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN 23 + +#define ESP_ROM_SPIFLASH_TWO_BYTE_STATUS_EN SPI_MEM_WRSR_2B + +//SPI address register +#define ESP_ROM_SPIFLASH_BYTES_LEN 24 +#define ESP_ROM_SPIFLASH_BUFF_BYTE_WRITE_NUM 32 +#define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM 16 +#define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_BITS 0xf + +//SPI status register +#define ESP_ROM_SPIFLASH_BUSY_FLAG BIT0 +#define ESP_ROM_SPIFLASH_WRENABLE_FLAG BIT1 +#define ESP_ROM_SPIFLASH_BP0 BIT2 +#define ESP_ROM_SPIFLASH_BP1 BIT3 +#define ESP_ROM_SPIFLASH_BP2 BIT4 +#define ESP_ROM_SPIFLASH_WR_PROTECT (ESP_ROM_SPIFLASH_BP0|ESP_ROM_SPIFLASH_BP1|ESP_ROM_SPIFLASH_BP2) +#define ESP_ROM_SPIFLASH_QE BIT9 + +#define FLASH_ID_GD25LQ32C 0xC86016 + +typedef enum { + ESP_ROM_SPIFLASH_QIO_MODE = 0, + ESP_ROM_SPIFLASH_QOUT_MODE, + ESP_ROM_SPIFLASH_DIO_MODE, + ESP_ROM_SPIFLASH_DOUT_MODE, + ESP_ROM_SPIFLASH_FASTRD_MODE, + ESP_ROM_SPIFLASH_SLOWRD_MODE +} esp_rom_spiflash_read_mode_t; + +typedef enum { + ESP_ROM_SPIFLASH_RESULT_OK, + ESP_ROM_SPIFLASH_RESULT_ERR, + ESP_ROM_SPIFLASH_RESULT_TIMEOUT +} esp_rom_spiflash_result_t; + +typedef struct { + uint32_t device_id; + uint32_t chip_size; // chip size in bytes + uint32_t block_size; + uint32_t sector_size; + uint32_t page_size; + uint32_t status_mask; +} esp_rom_spiflash_chip_t; + +typedef struct { + uint8_t data_length; + uint8_t read_cmd0; + uint8_t read_cmd1; + uint8_t write_cmd; + uint16_t data_mask; + uint16_t data; +} esp_rom_spiflash_common_cmd_t; + +/** + * @brief Fix the bug in SPI hardware communication with Flash/Ext-SRAM in High Speed. + * Please do not call this function in SDK. + * + * @param uint8_t spi: 0 for SPI0(Cache Access), 1 for SPI1(Flash read/write). + * + * @param uint8_t freqdiv: Pll is 80M, 4 for 20M, 3 for 26.7M, 2 for 40M, 1 for 80M. + * + * @return None + */ +void esp_rom_spiflash_fix_dummylen(uint8_t spi, uint8_t freqdiv); + +/** + * @brief Select SPI Flash to QIO mode when WP pad is read from Flash. + * Please do not call this function in SDK. + * + * @param uint8_t wp_gpio_num: WP gpio number. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @return None + */ +void esp_rom_spiflash_select_qiomode(uint8_t wp_gpio_num, uint32_t ishspi); + +/** + * @brief Set SPI Flash pad drivers. + * Please do not call this function in SDK. + * + * @param uint8_t wp_gpio_num: WP gpio number. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @param uint8_t *drvs: drvs[0]-bit[3:0] for cpiclk, bit[7:4] for spiq, drvs[1]-bit[3:0] for spid, drvs[1]-bit[7:4] for spid + * drvs[2]-bit[3:0] for spihd, drvs[2]-bit[7:4] for spiwp. + * Values usually read from falsh by rom code, function usually callde by rom code. + * if value with bit(3) set, the value is valid, bit[2:0] is the real value. + * + * @return None + */ +void esp_rom_spiflash_set_drvs(uint8_t wp_gpio_num, uint32_t ishspi, uint8_t *drvs); + +/** + * @brief Select SPI Flash function for pads. + * Please do not call this function in SDK. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @return None + */ +void esp_rom_spiflash_select_padsfunc(uint32_t ishspi); + +/** + * @brief SPI Flash init, clock divisor is 4, use 1 line Slow read mode. + * Please do not call this function in SDK. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @param uint8_t legacy: In legacy mode, more SPI command is used in line. + * + * @return None + */ +void esp_rom_spiflash_attach(uint32_t ishspi, bool legacy); + +/** + * @brief SPI Read Flash status register. We use CMD 0x05 (RDSR). + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t *status : The pointer to which to return the Flash status value. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read_status(esp_rom_spiflash_chip_t *spi, uint32_t *status); + +/** + * @brief SPI Read Flash status register bits 8-15. We use CMD 0x35 (RDSR2). + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t *status : The pointer to which to return the Flash status value. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read_statushigh(esp_rom_spiflash_chip_t *spi, uint32_t *status); + +/** + * @brief Write status to Falsh status register. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t status_value : Value to . + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : write OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : write error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : write timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_status(esp_rom_spiflash_chip_t *spi, uint32_t status_value); + +/** + * @brief Use a command to Read Flash status register. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t*status : The pointer to which to return the Flash status value. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read_user_cmd(uint32_t *status, uint8_t cmd); + +/** + * @brief Config SPI Flash read mode when init. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_read_mode_t mode : QIO/QOUT/DIO/DOUT/FastRD/SlowRD. + * + * This function does not try to set the QIO Enable bit in the status register, caller is responsible for this. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : config OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : config error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : config timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_config_readmode(esp_rom_spiflash_read_mode_t mode); + +/** + * @brief Config SPI Flash clock divisor. + * Please do not call this function in SDK. + * + * @param uint8_t freqdiv: clock divisor. + * + * @param uint8_t spi: 0 for SPI0, 1 for SPI1. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : config OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : config error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : config timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_config_clk(uint8_t freqdiv, uint8_t spi); + +/** + * @brief Send CommonCmd to Flash so that is can go into QIO mode, some Flash use different CMD. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_common_cmd_t *cmd : A struct to show the action of a command. + * + * @return uint16_t 0 : do not send command any more. + * 1 : go to the next command. + * n > 1 : skip (n - 1) commands. + */ +uint16_t esp_rom_spiflash_common_cmd(esp_rom_spiflash_common_cmd_t *cmd); + +/** + * @brief Unlock SPI write protect. + * Please do not call this function in SDK. + * + * @param None. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Unlock OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Unlock error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Unlock timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_unlock(void); + +/** + * @brief SPI write protect. + * Please do not call this function in SDK. + * + * @param None. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Lock OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Lock error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Lock timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_lock(void); + +/** + * @brief Update SPI Flash parameter. + * Please do not call this function in SDK. + * + * @param uint32_t deviceId : Device ID read from SPI, the low 32 bit. + * + * @param uint32_t chip_size : The Flash size. + * + * @param uint32_t block_size : The Flash block size. + * + * @param uint32_t sector_size : The Flash sector size. + * + * @param uint32_t page_size : The Flash page size. + * + * @param uint32_t status_mask : The Mask used when read status from Flash(use single CMD). + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Update OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Update error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Update timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_config_param(uint32_t deviceId, uint32_t chip_size, uint32_t block_size, + uint32_t sector_size, uint32_t page_size, uint32_t status_mask); + +/** + * @brief Erase whole flash chip. + * Please do not call this function in SDK. + * + * @param None + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_chip(void); + +/** + * @brief Erase a 64KB block of flash + * Uses SPI flash command D8H. + * Please do not call this function in SDK. + * + * @param uint32_t block_num : Which block to erase. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_block(uint32_t block_num); + +/** + * @brief Erase a sector of flash. + * Uses SPI flash command 20H. + * Please do not call this function in SDK. + * + * @param uint32_t sector_num : Which sector to erase. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_sector(uint32_t sector_num); + +/** + * @brief Erase some sectors. + * Please do not call this function in SDK. + * + * @param uint32_t start_addr : Start addr to erase, should be sector aligned. + * + * @param uint32_t area_len : Length to erase, should be sector aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_area(uint32_t start_addr, uint32_t area_len); + +/** + * @brief Write Data to Flash, you should Erase it yourself if need. + * Please do not call this function in SDK. + * + * @param uint32_t dest_addr : Address to write, should be 4 bytes aligned. + * + * @param const uint32_t *src : The pointer to data which is to write. + * + * @param uint32_t len : Length to write, should be 4 bytes aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Write OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Write error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Write timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write(uint32_t dest_addr, const uint32_t *src, int32_t len); + +/** + * @brief Read Data from Flash, you should Erase it yourself if need. + * Please do not call this function in SDK. + * + * @param uint32_t src_addr : Address to read, should be 4 bytes aligned. + * + * @param uint32_t *dest : The buf to read the data. + * + * @param uint32_t len : Length to read, should be 4 bytes aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t src_addr, uint32_t *dest, int32_t len); + +/** + * @brief SPI1 go into encrypto mode. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void esp_rom_spiflash_write_encrypted_enable(void); + +/** + * @brief Prepare 32 Bytes data to encrpto writing, you should Erase it yourself if need. + * Please do not call this function in SDK. + * + * @param uint32_t flash_addr : Address to write, should be 32 bytes aligned. + * + * @param uint32_t *data : The pointer to data which is to write. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Prepare OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Prepare error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Prepare timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_prepare_encrypted_data(uint32_t flash_addr, uint32_t *data); + +/** + * @brief SPI1 go out of encrypto mode. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void esp_rom_spiflash_write_encrypted_disable(void); + +/** + * @brief Write data to flash with transparent encryption. + * @note Sectors to be written should already be erased. + * + * @note Please do not call this function in SDK. + * + * @param uint32_t flash_addr : Address to write, should be 32 byte aligned. + * + * @param uint32_t *data : The pointer to data to write. Note, this pointer must + * be 32 bit aligned and the content of the data will be + * modified by the encryption function. + * + * @param uint32_t len : Length to write, should be 32 bytes aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Data written successfully. + * ESP_ROM_SPIFLASH_RESULT_ERR : Encryption write error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Encrypto write timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_encrypted(uint32_t flash_addr, uint32_t *data, uint32_t len); + + +/* TODO: figure out how to map these to their new names */ +typedef enum { + SPI_ENCRYPT_DESTINATION_FLASH, +} SpiEncryptDest; + +typedef esp_rom_spiflash_result_t SpiFlashOpResult; + +SpiFlashOpResult SPI_Encrypt_Write(uint32_t flash_addr, const void *data, uint32_t len); +SpiFlashOpResult SPI_Encrypt_Write_Dest(SpiEncryptDest dest, uint32_t flash_addr, const void *data, uint32_t len); +void SPI_Write_Encrypt_Enable(void); +void SPI_Write_Encrypt_Disable(void); + +/** @brief Wait until SPI flash write operation is complete + * + * @note Please do not call this function in SDK. + * + * Reads the Write In Progress bit of the SPI flash status register, + * repeats until this bit is zero (indicating write complete). + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Write is complete + * ESP_ROM_SPIFLASH_RESULT_ERR : Error while reading status. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_wait_idle(esp_rom_spiflash_chip_t *spi); + + +/** @brief Enable Quad I/O pin functions + * + * @note Please do not call this function in SDK. + * + * Sets the HD & WP pin functions for Quad I/O modes, based on the + * efuse SPI pin configuration. + * + * @param wp_gpio_num - Number of the WP pin to reconfigure for quad I/O. + * + * @param spiconfig - Pin configuration, as returned from ets_efuse_get_spiconfig(). + * - If this parameter is 0, default SPI pins are used and wp_gpio_num parameter is ignored. + * - If this parameter is 1, default HSPI pins are used and wp_gpio_num parameter is ignored. + * - For other values, this parameter encodes the HD pin number and also the CLK pin number. CLK pin selection is used + * to determine if HSPI or SPI peripheral will be used (use HSPI if CLK pin is the HSPI clock pin, otherwise use SPI). + * Both HD & WP pins are configured via GPIO matrix to map to the selected peripheral. + */ +void esp_rom_spiflash_select_qio_pins(uint8_t wp_gpio_num, uint32_t spiconfig); + + +typedef void (* spi_flash_func_t)(void); +typedef SpiFlashOpResult (* spi_flash_op_t)(void); +typedef SpiFlashOpResult (* spi_flash_erase_t)(uint32_t); +typedef SpiFlashOpResult (* spi_flash_rd_t)(uint32_t, uint32_t*, int); +typedef SpiFlashOpResult (* spi_flash_wr_t)(uint32_t, const uint32_t*, int); +typedef SpiFlashOpResult (* spi_flash_ewr_t)(uint32_t, const void*, uint32_t); +typedef SpiFlashOpResult (* spi_flash_wren_t)(void*); + +typedef struct { + uint32_t read_sub_len; + uint32_t write_sub_len; + spi_flash_op_t unlock; + spi_flash_erase_t erase_sector; + spi_flash_erase_t erase_block; + spi_flash_rd_t read; + spi_flash_wr_t write; + spi_flash_ewr_t encrypt_write; + spi_flash_func_t check_sus; + spi_flash_wren_t wren; + spi_flash_op_t wait_idle; +} spiflash_legacy_funcs_t; + + +extern const spiflash_legacy_funcs_t *rom_spiflash_legacy_funcs; + +/** @brief Global ROM spiflash data, as used by legacy + SPI flash functions +*/ +typedef struct { + esp_rom_spiflash_chip_t chip; + uint8_t dummy_len_plus[3]; + uint8_t sig_matrix; +} spiflash_legacy_data_t; + +extern spiflash_legacy_data_t *rom_spiflash_legacy_data; + +/* Defines to make the C3 ROM legacvy data access compatible with previous chips */ +#define g_rom_flashchip (rom_spiflash_legacy_data->chip) +#define g_rom_spiflash_dummy_len_plus (rom_spiflash_legacy_data->dummy_len_plus) + +/** + * @brief Clear WEL bit unconditionally. + * + * @return always ESP_ROM_SPIFLASH_RESULT_OK + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_disable(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_SPI_FLASH_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/tjpgd.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/tjpgd.h new file mode 100644 index 000000000..80d346a1c --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/tjpgd.h @@ -0,0 +1,99 @@ +/*----------------------------------------------------------------------------/ +/ TJpgDec - Tiny JPEG Decompressor include file (C)ChaN, 2012 +/----------------------------------------------------------------------------*/ +#ifndef _TJPGDEC +#define _TJPGDEC +/*---------------------------------------------------------------------------*/ +/* System Configurations */ + +#define JD_SZBUF 512 /* Size of stream input buffer */ +#define JD_FORMAT 0 /* Output pixel format 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */ +#define JD_USE_SCALE 1 /* Use descaling feature for output */ +#define JD_TBLCLIP 1 /* Use table for saturation (might be a bit faster but increases 1K bytes of code size) */ + +/*---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* These types must be 16-bit, 32-bit or larger integer */ +typedef int INT; +typedef unsigned int UINT; + +/* These types must be 8-bit integer */ +typedef char CHAR; +typedef unsigned char UCHAR; +typedef unsigned char BYTE; + +/* These types must be 16-bit integer */ +typedef short SHORT; +typedef unsigned short USHORT; +typedef unsigned short WORD; +typedef unsigned short WCHAR; + +/* These types must be 32-bit integer */ +typedef long LONG; +typedef unsigned long ULONG; +typedef unsigned long DWORD; + + +/* Error code */ +typedef enum { + JDR_OK = 0, /* 0: Succeeded */ + JDR_INTR, /* 1: Interrupted by output function */ + JDR_INP, /* 2: Device error or wrong termination of input stream */ + JDR_MEM1, /* 3: Insufficient memory pool for the image */ + JDR_MEM2, /* 4: Insufficient stream input buffer */ + JDR_PAR, /* 5: Parameter error */ + JDR_FMT1, /* 6: Data format error (may be damaged data) */ + JDR_FMT2, /* 7: Right format but not supported */ + JDR_FMT3 /* 8: Not supported JPEG standard */ +} JRESULT; + + + +/* Rectangular structure */ +typedef struct { + WORD left, right, top, bottom; +} JRECT; + + + +/* Decompressor object structure */ +typedef struct JDEC JDEC; +struct JDEC { + UINT dctr; /* Number of bytes available in the input buffer */ + BYTE *dptr; /* Current data read ptr */ + BYTE *inbuf; /* Bit stream input buffer */ + BYTE dmsk; /* Current bit in the current read byte */ + BYTE scale; /* Output scaling ratio */ + BYTE msx, msy; /* MCU size in unit of block (width, height) */ + BYTE qtid[3]; /* Quantization table ID of each component */ + SHORT dcv[3]; /* Previous DC element of each component */ + WORD nrst; /* Restart inverval */ + UINT width, height; /* Size of the input image (pixel) */ + BYTE *huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */ + WORD *huffcode[2][2]; /* Huffman code word tables [id][dcac] */ + BYTE *huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */ + LONG *qttbl[4]; /* Dequaitizer tables [id] */ + void *workbuf; /* Working buffer for IDCT and RGB output */ + BYTE *mcubuf; /* Working buffer for the MCU */ + void *pool; /* Pointer to available memory pool */ + UINT sz_pool; /* Size of momory pool (bytes available) */ + UINT (*infunc)(JDEC *, BYTE *, UINT); /* Pointer to jpeg stream input function */ + void *device; /* Pointer to I/O device identifiler for the session */ +}; + + + +/* TJpgDec API functions */ +JRESULT jd_prepare (JDEC *, UINT(*)(JDEC *, BYTE *, UINT), void *, UINT, void *); +JRESULT jd_decomp (JDEC *, UINT(*)(JDEC *, void *, JRECT *), BYTE); + + +#ifdef __cplusplus +} +#endif + +#endif /* _TJPGDEC */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/uart.h b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/uart.h new file mode 100644 index 000000000..adbae64d0 --- /dev/null +++ b/tools/sdk/esp32/include/esp_rom/include/esp32c3/rom/uart.h @@ -0,0 +1,440 @@ +// 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. + +#ifndef _ROM_UART_H_ +#define _ROM_UART_H_ + +#include "esp_types.h" +#include "esp_attr.h" +#include "ets_sys.h" +#include "soc/soc.h" +#include "soc/uart_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup uart_apis, uart configuration and communication related apis + * @brief uart apis + */ + +/** @addtogroup uart_apis + * @{ + */ + +#define RX_BUFF_SIZE 0x400 +#define TX_BUFF_SIZE 100 + +//uart int enalbe register ctrl bits +#define UART_RCV_INTEN BIT0 +#define UART_TRX_INTEN BIT1 +#define UART_LINE_STATUS_INTEN BIT2 + +//uart int identification ctrl bits +#define UART_INT_FLAG_MASK 0x0E + +//uart fifo ctrl bits +#define UART_CLR_RCV_FIFO BIT1 +#define UART_CLR_TRX_FIFO BIT2 +#define UART_RCVFIFO_TRG_LVL_BITS BIT6 + +//uart line control bits +#define UART_DIV_LATCH_ACCESS_BIT BIT7 + +//uart line status bits +#define UART_RCV_DATA_RDY_FLAG BIT0 +#define UART_RCV_OVER_FLOW_FLAG BIT1 +#define UART_RCV_PARITY_ERR_FLAG BIT2 +#define UART_RCV_FRAME_ERR_FLAG BIT3 +#define UART_BRK_INT_FLAG BIT4 +#define UART_TRX_FIFO_EMPTY_FLAG BIT5 +#define UART_TRX_ALL_EMPTY_FLAG BIT6 // include fifo and shift reg +#define UART_RCV_ERR_FLAG BIT7 + +//send and receive message frame head +#define FRAME_FLAG 0x7E + +typedef enum { + UART_LINE_STATUS_INT_FLAG = 0x06, + UART_RCV_FIFO_INT_FLAG = 0x04, + UART_RCV_TMOUT_INT_FLAG = 0x0C, + UART_TXBUFF_EMPTY_INT_FLAG = 0x02 +} UartIntType; //consider bit0 for int_flag + +typedef enum { + RCV_ONE_BYTE = 0x0, + RCV_FOUR_BYTE = 0x1, + RCV_EIGHT_BYTE = 0x2, + RCV_FOURTEEN_BYTE = 0x3 +} UartRcvFifoTrgLvl; + +typedef enum { + FIVE_BITS = 0x0, + SIX_BITS = 0x1, + SEVEN_BITS = 0x2, + EIGHT_BITS = 0x3 +} UartBitsNum4Char; + +typedef enum { + ONE_STOP_BIT = 1, + ONE_HALF_STOP_BIT = 2, + TWO_STOP_BIT = 3 +} UartStopBitsNum; + +typedef enum { + NONE_BITS = 0, + ODD_BITS = 2, + EVEN_BITS = 3 + +} UartParityMode; + +typedef enum { + STICK_PARITY_DIS = 0, + STICK_PARITY_EN = 2 +} UartExistParity; + +typedef enum { + BIT_RATE_9600 = 9600, + BIT_RATE_19200 = 19200, + BIT_RATE_38400 = 38400, + BIT_RATE_57600 = 57600, + BIT_RATE_115200 = 115200, + BIT_RATE_230400 = 230400, + BIT_RATE_460800 = 460800, + BIT_RATE_921600 = 921600 +} UartBautRate; + +typedef enum { + NONE_CTRL, + HARDWARE_CTRL, + XON_XOFF_CTRL +} UartFlowCtrl; + +typedef enum { + EMPTY, + UNDER_WRITE, + WRITE_OVER +} RcvMsgBuffState; + +typedef struct { + uint8_t *pRcvMsgBuff; + uint8_t *pWritePos; + uint8_t *pReadPos; + uint8_t TrigLvl; + RcvMsgBuffState BuffState; +} RcvMsgBuff; + +typedef struct { + uint32_t TrxBuffSize; + uint8_t *pTrxBuff; +} TrxMsgBuff; + +typedef enum { + BAUD_RATE_DET, + WAIT_SYNC_FRM, + SRCH_MSG_HEAD, + RCV_MSG_BODY, + RCV_ESC_CHAR, +} RcvMsgState; + +typedef struct { + UartBautRate baut_rate; + UartBitsNum4Char data_bits; + UartExistParity exist_parity; + UartParityMode parity; // chip size in byte + UartStopBitsNum stop_bits; + UartFlowCtrl flow_ctrl; + uint8_t buff_uart_no; //indicate which uart use tx/rx buffer + RcvMsgBuff rcv_buff; +// TrxMsgBuff trx_buff; + RcvMsgState rcv_state; + int received; +} UartDevice; + +/** + * @brief Init uart device struct value and reset uart0/uart1 rx. + * Please do not call this function in SDK. + * + * @param rxBuffer, must be a pointer to RX_BUFF_SIZE bytes or NULL + * + * @return None + */ +void uartAttach(void *rxBuffer); + +/** + * @brief Init uart0 or uart1 for UART download booting mode. + * Please do not call this function in SDK. + * + * @param uint8_t uart_no : 0 for UART0, else for UART1. + * + * @param uint32_t clock : clock used by uart module, to adjust baudrate. + * + * @return None + */ +void Uart_Init(uint8_t uart_no, uint32_t clock); + +/** + * @brief Modify uart baudrate. + * This function will reset RX/TX fifo for uart. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @param uint32_t DivLatchValue : (clock << 4)/baudrate. + * + * @return None + */ +void uart_div_modify(uint8_t uart_no, uint32_t DivLatchValue); + +/** + * @brief Init uart0 or uart1 for UART download booting mode. + * Please do not call this function in SDK. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @param uint8_t is_sync : 0, only one UART module, easy to detect, wait until detected; + * 1, two UART modules, hard to detect, detect and return. + * + * @return None + */ +int uart_baudrate_detect(uint8_t uart_no, uint8_t is_sync); + +/** + * @brief Switch printf channel of uart_tx_one_char. + * Please do not call this function when printf. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @return None + */ +void uart_tx_switch(uint8_t uart_no); + +/** + * @brief Switch message exchange channel for UART download booting. + * Please do not call this function in SDK. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @return None + */ +void uart_buff_switch(uint8_t uart_no); + +/** + * @brief Output a char to printf channel, wait until fifo not full. + * + * @param None + * + * @return OK. + */ +STATUS uart_tx_one_char(uint8_t TxChar); + +/** + * @brief Output a char to message exchange channel, wait until fifo not full. + * Please do not call this function in SDK. + * + * @param None + * + * @return OK. + */ +STATUS uart_tx_one_char2(uint8_t TxChar); + +/** + * @brief Wait until uart tx full empty. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @return None. + */ +void uart_tx_flush(uint8_t uart_no); + +/** + * @brief Wait until uart tx full empty and the last char send ok. + * + * @param uart_no : 0 for UART0, 1 for UART1, 2 for UART2 + * + * The function defined in ROM code has a bug, so we define the correct version + * here for compatibility. + */ +void uart_tx_wait_idle(uint8_t uart_no); + +/** + * @brief Get an input char from message channel. + * Please do not call this function in SDK. + * + * @param uint8_t *pRxChar : the pointer to store the char. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS uart_rx_one_char(uint8_t *pRxChar); + +/** + * @brief Get an input char from message channel, wait until successful. + * Please do not call this function in SDK. + * + * @param None + * + * @return char : input char value. + */ +char uart_rx_one_char_block(void); + +/** + * @brief Get an input string line from message channel. + * Please do not call this function in SDK. + * + * @param uint8_t *pString : the pointer to store the string. + * + * @param uint8_t MaxStrlen : the max string length, incude '\0'. + * + * @return OK. + */ +STATUS UartRxString(uint8_t *pString, uint8_t MaxStrlen); + +/** + * @brief Process uart recevied information in the interrupt handler. + * Please do not call this function in SDK. + * + * @param void *para : the message receive buffer. + * + * @return None + */ +void uart_rx_intr_handler(void *para); + +/** + * @brief Get an char from receive buffer. + * Please do not call this function in SDK. + * + * @param RcvMsgBuff *pRxBuff : the pointer to the struct that include receive buffer. + * + * @param uint8_t *pRxByte : the pointer to store the char. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS uart_rx_readbuff( RcvMsgBuff *pRxBuff, uint8_t *pRxByte); + +/** + * @brief Get all chars from receive buffer. + * Please do not call this function in SDK. + * + * @param uint8_t *pCmdLn : the pointer to store the string. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS UartGetCmdLn(uint8_t *pCmdLn); + +/** + * @brief Get uart configuration struct. + * Please do not call this function in SDK. + * + * @param None + * + * @return UartDevice * : uart configuration struct pointer. + */ +UartDevice *GetUartDevice(void); + +/** + * @brief Send an packet to download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *p : the pointer to output string. + * + * @param int len : the string length. + * + * @return None. + */ +void send_packet(uint8_t *p, int len); + +/** + * @brief Receive an packet from download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *p : the pointer to input string. + * + * @param int len : If string length > len, the string will be truncated. + * + * @param uint8_t is_sync : 0, only one UART module; + * 1, two UART modules. + * + * @return int : the length of the string. + */ +int recv_packet(uint8_t *p, int len, uint8_t is_sync); + +/** + * @brief Send an packet to download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *pData : the pointer to input string. + * + * @param uint16_t DataLen : the string length. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS SendMsg(uint8_t *pData, uint16_t DataLen); + +/** + * @brief Receive an packet from download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *pData : the pointer to input string. + * + * @param uint16_t MaxDataLen : If string length > MaxDataLen, the string will be truncated. + * + * @param uint8_t is_sync : 0, only one UART module; + * 1, two UART modules. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS RcvMsg(uint8_t *pData, uint16_t MaxDataLen, uint8_t is_sync); + +/** + * @brief Check if this UART is in download connection. + * Please do not call this function in SDK. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @return ETS_NO_BOOT = 0 for no. + * SEL_UART_BOOT = BIT(1) for yes. + */ +uint8_t UartConnCheck(uint8_t uart_no); + +/** + * @brief Initialize the USB ACM UART + * Needs to be fed a buffer of at least 128 bytes, plus any rx buffer you may want to have. + * + * @param cdc_acm_work_mem Pointer to work mem for CDC-ACM code + * @param cdc_acm_work_mem_len Length of work mem + */ +void Uart_Init_USB(void *cdc_acm_work_mem, int cdc_acm_work_mem_len); + + +/** + * @brief Install handler to reset the chip when a RTS change has been detected on the CDC-ACM 'UART'. + */ +void uart_usb_enable_reset_on_rts(void); + + +extern UartDevice UartDev; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_UART_H_ */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/digital_signature.h b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/digital_signature.h index 1f8a943d4..9f23a5d6b 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/digital_signature.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/digital_signature.h @@ -145,4 +145,3 @@ ets_ds_result_t ets_ds_encrypt_params(ets_ds_data_t *data, const void *iv, const #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/libc_stubs.h b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/libc_stubs.h index 0c2a4b83a..5e514e180 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/libc_stubs.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/libc_stubs.h @@ -25,7 +25,7 @@ extern "C" { #endif -/* +/* ESP32-S2 ROM code contains implementations of some of C library functions. Whenever a function in ROM needs to use a syscall, it calls a pointer to the corresponding syscall implementation defined in the following struct. @@ -39,7 +39,7 @@ application must allocate syscall table structure for each CPU being used, and p to actual implementations of corresponding syscalls. */ -struct syscall_stub_table +struct syscall_stub_table { struct _reent* (*__getreent)(void); void* (*_malloc_r)(struct _reent *r, size_t); diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/miniz.h b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/miniz.h index ed79beb2c..b9b9202aa 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/miniz.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/miniz.h @@ -671,7 +671,7 @@ size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void // Compresses an image to a compressed PNG file in memory. // On entry: -// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. +// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. // The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory. // level may range from [0,10], use MZ_NO_COMPRESSION, MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc. or a decent default is MZ_DEFAULT_LEVEL // If flip is true, the image will be flipped on the Y axis (useful for OpenGL apps). @@ -774,4 +774,3 @@ mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int #endif #endif // MINIZ_HEADER_INCLUDED - diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/rtc.h b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/rtc.h index c91916fa3..535dc64a9 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/rtc.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/rtc.h @@ -216,4 +216,3 @@ void software_reset_cpu(int cpu_no); #endif #endif /* _ROM_RTC_H_ */ - diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/spi_flash.h b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/spi_flash.h index 2cf631666..c93b4e27c 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/spi_flash.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/spi_flash.h @@ -554,11 +554,20 @@ esp_rom_spiflash_result_t esp_rom_spiflash_wait_idle(esp_rom_spiflash_chip_t *sp */ void esp_rom_spiflash_select_qio_pins(uint8_t wp_gpio_num, uint32_t spiconfig); +/** + * @brief Clear WEL bit unconditionally. + * + * @return always ESP_ROM_SPIFLASH_RESULT_OK + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_disable(void); + /** @brief Global esp_rom_spiflash_chip_t structure used by ROM functions * */ extern esp_rom_spiflash_chip_t g_rom_flashchip; +extern uint8_t g_rom_spiflash_dummy_len_plus[]; + /** * @} */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_descriptor.h b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_descriptor.h index 942a1968c..1b20ef80f 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_descriptor.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_descriptor.h @@ -31,4 +31,4 @@ bool usb_get_descriptor(uint16_t type_index, uint16_t lang_id, #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_device.h b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_device.h index 51801b5d5..5564d41e9 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_device.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s2/rom/usb/usb_device.h @@ -399,4 +399,3 @@ int usb_dev_get_configuration(void); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/esp_rom/include/esp32s3/rom/spi_flash.h b/tools/sdk/esp32/include/esp_rom/include/esp32s3/rom/spi_flash.h index 44d447e93..63768168a 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp32s3/rom/spi_flash.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp32s3/rom/spi_flash.h @@ -541,6 +541,13 @@ esp_rom_spiflash_result_t esp_rom_spiflash_wait_idle(esp_rom_spiflash_chip_t *sp */ void esp_rom_spiflash_select_qio_pins(uint8_t wp_gpio_num, uint32_t spiconfig); +/** + * @brief Clear WEL bit unconditionally. + * + * @return always ESP_ROM_SPIFLASH_RESULT_OK + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_disable(void); + /** @brief Global esp_rom_spiflash_chip_t structure used by ROM functions * */ diff --git a/tools/sdk/esp32/include/esp_rom/include/esp_rom_sys.h b/tools/sdk/esp32/include/esp_rom/include/esp_rom_sys.h index 68a538b1b..130c30701 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp_rom_sys.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp_rom_sys.h @@ -40,7 +40,7 @@ void esp_rom_delay_us(uint32_t us); /** * @brief esp_rom_printf can print message to different channels simultaneously. * This function can help install the low level putc function for esp_rom_printf. - * + * * @param channel Channel number (startting from 1) * @param putc Function pointer to the putc implementation. Set NULL can disconnect esp_rom_printf with putc. */ @@ -51,6 +51,11 @@ void esp_rom_install_channel_putc(int channel, void (*putc)(char c)); */ void esp_rom_disable_logging(void); +/** + * @brief Install UART1 as the default console channel, equivalent to `esp_rom_install_channel_putc(1, esp_rom_uart_putc)` + */ +void esp_rom_install_uart_printf(void); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/esp_rom/include/esp_rom_uart.h b/tools/sdk/esp32/include/esp_rom/include/esp_rom_uart.h index a944fc6b1..a07740c14 100644 --- a/tools/sdk/esp32/include/esp_rom/include/esp_rom_uart.h +++ b/tools/sdk/esp32/include/esp_rom/include/esp_rom_uart.h @@ -64,7 +64,7 @@ int esp_rom_uart_tx_one_char(uint8_t c); /** * @brief Transmit one character to the console channel. * @note This function is a wrapper over esp_rom_uart_tx_one_char, it can help handle line ending issue by replacing '\n' with '\r\n'. - * + * * @param c Character to send */ void esp_rom_uart_putc(char c); diff --git a/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl.h b/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl.h index 100e86a16..82e91778d 100644 --- a/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl.h +++ b/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl.h @@ -210,5 +210,3 @@ esp_err_t essl_get_intr_ena(essl_handle_t handle, uint32_t *ena_mask_o, uint32_t * - One of the error codes from SDMMC host controller */ esp_err_t essl_send_slave_intr(essl_handle_t handle, uint32_t intr_mask, uint32_t wait_ms); - - diff --git a/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl_spi.h b/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl_spi.h index 179fa5552..b78891009 100644 --- a/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl_spi.h +++ b/tools/sdk/esp32/include/esp_serial_slave_link/include/esp_serial_slave_link/essl_spi.h @@ -162,4 +162,4 @@ esp_err_t essl_spi_wrdma_done(spi_device_handle_t spi, uint32_t flags); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32c3_defs.h b/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32c3_defs.h new file mode 100644 index 000000000..3dfd4a14b --- /dev/null +++ b/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32c3_defs.h @@ -0,0 +1,38 @@ +// Copyright 2010-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. + + +#pragma once + +// NOTE: From the view of master +#define CMD_HD_WRBUF_REG 0x01 +#define CMD_HD_RDBUF_REG 0x02 +#define CMD_HD_WRDMA_REG 0x03 +#define CMD_HD_RDDMA_REG 0x04 + +#define CMD_HD_ONEBIT_MODE 0x00 +#define CMD_HD_DOUT_MODE 0x10 +#define CMD_HD_QOUT_MODE 0x20 +#define CMD_HD_DIO_MODE 0x50 +#define CMD_HD_QIO_MODE 0xA0 + +#define CMD_HD_SEG_END_REG 0x05 +#define CMD_HD_EN_QPI_REG 0x06 +#define CMD_HD_WR_END_REG 0x07 +#define CMD_HD_INT0_REG 0x08 +#define CMD_HD_INT1_REG 0x09 +#define CMD_HD_INT2_REG 0x0A +#define CMD_HD_EX_QPI_REG 0xDD + +#define SPI_SLAVE_HD_BUFFER_SIZE 64 diff --git a/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s2_defs.h b/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s2_defs.h index d2856fd15..49ba82ddf 100644 --- a/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s2_defs.h +++ b/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s2_defs.h @@ -35,4 +35,4 @@ #define CMD_HD_INT2_REG 0x0A #define CMD_HD_EX_QPI_REG 0xDD -#define SPI_SLAVE_HD_BUFFER_SIZE 72 \ No newline at end of file +#define SPI_SLAVE_HD_BUFFER_SIZE 72 diff --git a/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s3_defs.h b/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s3_defs.h index 1de97d642..3dfd4a14b 100644 --- a/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s3_defs.h +++ b/tools/sdk/esp32/include/esp_serial_slave_link/include/essl_spi/esp32s3_defs.h @@ -35,4 +35,4 @@ #define CMD_HD_INT2_REG 0x0A #define CMD_HD_EX_QPI_REG 0xDD -#define SPI_SLAVE_HD_BUFFER_SIZE 64 \ No newline at end of file +#define SPI_SLAVE_HD_BUFFER_SIZE 64 diff --git a/tools/sdk/esp32/include/esp_system/include/esp_intr_alloc.h b/tools/sdk/esp32/include/esp_system/include/esp_intr_alloc.h index ace95cbb5..6c9963c17 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_intr_alloc.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_intr_alloc.h @@ -297,13 +297,13 @@ void esp_intr_noniram_enable(void); /** * @brief enable the interrupt source based on its number * @param inum interrupt number from 0 to 31 - */ + */ void esp_intr_enable_source(int inum); /** * @brief disable the interrupt source based on its number * @param inum interrupt number from 0 to 31 - */ + */ void esp_intr_disable_source(int inum); /**@}*/ diff --git a/tools/sdk/esp32/include/esp_system/include/esp_private/panic_internal.h b/tools/sdk/esp32/include/esp_system/include/esp_private/panic_internal.h index 583d3eba7..d43a705ab 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_private/panic_internal.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_private/panic_internal.h @@ -16,14 +16,20 @@ #include #include + +#include "soc/soc_caps.h" + #include "sdkconfig.h" + #ifdef __cplusplus extern "C" { #endif extern bool g_panic_abort; +extern void *g_exc_frames[SOC_CPU_CORES_NUM]; + // Function to print longer amounts of information such as the details // and backtrace field of panic_info_t. These functions should limit themselves // to printing to the console and should do other more involved processing, @@ -72,6 +78,20 @@ void panic_print_hex(int h); void __attribute__((noreturn)) panic_abort(const char *details); +void panic_arch_fill_info(void *frame, panic_info_t *info); + +void panic_soc_fill_info(void *frame, panic_info_t *info); + +void panic_print_registers(const void *frame, int core); + +void panic_print_backtrace(const void *frame, int core); + +uint32_t panic_get_address(const void* frame); + +void panic_set_address(void *frame, uint32_t addr); + +uint32_t panic_get_cause(const void* frame); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h b/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h index fc91b0fa8..42b901cbf 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_private/startup_internal.h @@ -52,7 +52,7 @@ typedef struct { /* * Declare an component initialization function that will execute on the specified cores (ex. if BIT0 == 1, will execute * on CORE0, CORE1 if BIT1 and so on). - * + * * @note Initialization functions should be placed in a compilation unit where at least one other * symbol is referenced 'meaningfully' in another compilation unit, otherwise this gets discarded during linking. (By * 'meaningfully' we mean the reference should not itself get optimized out by the compiler/discarded by the linker). @@ -61,14 +61,13 @@ typedef struct { static void __attribute__((used)) __VA_ARGS__ __esp_system_init_fn_##f(void); \ static __attribute__((used)) esp_system_init_fn_t _SECTION_ATTR_IMPL(".esp_system_init_fn", f) \ esp_system_init_fn_##f = { .fn = ( __esp_system_init_fn_##f), .cores = (c) }; \ -static __attribute__((used)) __VA_ARGS__ void __esp_system_init_fn_##f(void) // [refactor-todo] this can be made public API if we allow components to declare init functions, +static __attribute__((used)) __VA_ARGS__ void __esp_system_init_fn_##f(void) // [refactor-todo] this can be made public API if we allow components to declare init functions, // instead of calling them explicitly -extern uint64_t g_startup_time; // Startup time that serves as the point of origin for system time. Should be set by the entry +extern uint64_t g_startup_time; // Startup time that serves as the point of origin for system time. Should be set by the entry // function in the port layer. May be 0 as well if this is not backed by a persistent counter, in which case // startup time = system time = 0 at the point the entry function sets this variable. #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/esp_system/include/esp_sleep.h b/tools/sdk/esp32/include/esp_system/include/esp_sleep.h index 8e5e4b39d..5b90614cc 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_sleep.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_sleep.h @@ -68,6 +68,7 @@ typedef enum { ESP_SLEEP_WAKEUP_WIFI, //!< Wakeup caused by WIFI (light sleep only) ESP_SLEEP_WAKEUP_COCPU, //!< Wakeup caused by COCPU int ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG, //!< Wakeup caused by COCPU crash + ESP_SLEEP_WAKEUP_BT, //!< Wakeup caused by BT (light sleep only) } esp_sleep_source_t; /* Leave this type define for compatibility */ @@ -93,9 +94,9 @@ esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source); /** * @brief Enable wakeup by ULP coprocessor - * @note In revisions 0 and 1 of the ESP32, ULP wakeup source + * @note In revisions 0 and 1 of the ESP32, ULP wakeup source * cannot be used when RTC_PERIPH power domain is forced - * to be powered on (ESP_PD_OPTION_ON) or when + * to be powered on (ESP_PD_OPTION_ON) or when * ext0 wakeup source is used. * @return * - ESP_OK on success @@ -140,6 +141,17 @@ esp_err_t esp_sleep_enable_touchpad_wakeup(void); */ touch_pad_t esp_sleep_get_touchpad_wakeup_status(void); +/** + * @brief Returns true if a GPIO number is valid for use as wakeup source. + * + * @note For SoCs with RTC IO capability, this can be any valid RTC IO input pin. + * + * @param gpio_num Number of the GPIO to test for wakeup source capability + * + * @return True if this GPIO number will be accepted as a sleep wakeup source. + */ +bool esp_sleep_is_valid_wakeup_gpio(gpio_num_t gpio_num); + /** * @brief Enable wakeup using a pin * diff --git a/tools/sdk/esp32/include/esp_system/include/esp_system.h b/tools/sdk/esp32/include/esp_system/include/esp_system.h index 9be72c3e0..c251b4163 100644 --- a/tools/sdk/esp32/include/esp_system/include/esp_system.h +++ b/tools/sdk/esp32/include/esp_system/include/esp_system.h @@ -42,6 +42,8 @@ typedef enum { #define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES #elif CONFIG_IDF_TARGET_ESP32S2 #define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES +#elif CONFIG_IDF_TARGET_ESP32C3 +#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES #endif /** @endcond */ @@ -250,7 +252,7 @@ esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac) /** * @brief Trigger a software abort - * + * * @param details Details that will be displayed during panic handling. */ void __attribute__((noreturn)) esp_system_abort(const char* details); @@ -262,6 +264,7 @@ typedef enum { CHIP_ESP32 = 1, //!< ESP32 CHIP_ESP32S2 = 2, //!< ESP32-S2 CHIP_ESP32S3 = 4, //!< ESP32-S3 + CHIP_ESP32C3 = 5, //!< ESP32-C3 } esp_chip_model_t; /* Chip feature flags, used in esp_chip_info_t */ diff --git a/tools/sdk/esp32/include/esp_timer/include/esp_timer.h b/tools/sdk/esp32/include/esp_timer/include/esp_timer.h index 79766d615..f77222bf8 100644 --- a/tools/sdk/esp32/include/esp_timer/include/esp_timer.h +++ b/tools/sdk/esp32/include/esp_timer/include/esp_timer.h @@ -41,6 +41,7 @@ #include #include +#include #include "esp_err.h" #ifdef __cplusplus @@ -81,6 +82,7 @@ typedef struct { void* arg; //!< Argument to pass to the callback esp_timer_dispatch_t dispatch_method; //!< Call the callback from task or from ISR const char* name; //!< Timer name, used in esp_timer_dump function + bool skip_unhandled_events; //!< Skip unhandled events for periodic timers } esp_timer_create_args_t; /** @@ -229,4 +231,3 @@ esp_err_t esp_timer_dump(FILE* stream); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/esp_websocket_client/include/esp_websocket_client.h b/tools/sdk/esp32/include/esp_websocket_client/include/esp_websocket_client.h index 8bfb2ce24..55a580a9e 100644 --- a/tools/sdk/esp32/include/esp_websocket_client/include/esp_websocket_client.h +++ b/tools/sdk/esp32/include/esp_websocket_client/include/esp_websocket_client.h @@ -133,7 +133,7 @@ esp_err_t esp_websocket_client_start(esp_websocket_client_handle_t client); * using esp_websocket_client_close(). * * Notes: - * - Cannot be called from the websocket event handler + * - Cannot be called from the websocket event handler * * @param[in] client The client * @@ -149,7 +149,7 @@ esp_err_t esp_websocket_client_stop(esp_websocket_client_handle_t client); * * Notes: * - Cannot be called from the websocket event handler - * + * * @param[in] client The client * * @return esp_err_t @@ -208,7 +208,7 @@ int esp_websocket_client_send_text(esp_websocket_client_handle_t client, const c * * Client is stopped the same way as by the `esp_websocket_client_stop()` * * Notes: - * - Cannot be called from the websocket event handler + * - Cannot be called from the websocket event handler * * @param[in] client The client * @param[in] timeout Timeout in RTOS ticks for waiting @@ -222,7 +222,7 @@ esp_err_t esp_websocket_client_close(esp_websocket_client_handle_t client, TickT * Closing sequence is the same as for esp_websocket_client_close() * * Notes: - * - Cannot be called from the websocket event handler + * - Cannot be called from the websocket event handler * * @param[in] client The client * @param[in] code Close status code as defined in RFC6455 section-7.4 diff --git a/tools/sdk/esp32/include/esp_wifi/esp32/include/phy_init_data.h b/tools/sdk/esp32/include/esp_wifi/esp32/include/phy_init_data.h index 3b9a71c45..6c725fa41 100644 --- a/tools/sdk/esp32/include/esp_wifi/esp32/include/phy_init_data.h +++ b/tools/sdk/esp32/include/esp_wifi/esp32/include/phy_init_data.h @@ -83,7 +83,7 @@ static const esp_phy_init_data_t phy_init_data= { { 0x18, 0x18, 0x18, - LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 78), + LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 84), LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 72), LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 66), LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 40, 60), @@ -152,7 +152,7 @@ static const char phy_init_magic_post[] = PHY_INIT_MAGIC; #if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN /** - * @brief PHY init data control infomation structure + * @brief PHY init data control infomation structure */ typedef struct { uint8_t control_info_checksum[4]; /*!< 4-byte control infomation checksum */ @@ -173,4 +173,3 @@ typedef struct { } phy_country_to_bin_type_t; #endif #endif /* PHY_INIT_DATA_H */ - diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_adapter.h b/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_adapter.h index ecf5f6e67..eaac86d0c 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_adapter.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_coexist_adapter.h @@ -41,7 +41,7 @@ typedef struct { int32_t (*_semphr_give_from_isr)(void *semphr, void *hptw); int32_t (*_semphr_take)(void *semphr, uint32_t block_time_tick); int32_t (*_semphr_give)(void *semphr); - int32_t (* _is_in_isr)(void); + int (* _is_in_isr)(void); void * (* _malloc_internal)(size_t size); void (* _free)(void *p); #if CONFIG_IDF_TARGET_ESP32 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 848e6d11a..d6b64c6f0 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 @@ -126,7 +126,7 @@ int coex_wifi_channel_set(uint8_t primary, uint8_t secondary); * @brief Get coexistence event duration. * * @param event : Coexistence event - * @param duration: Coexistence event duration + * @param duration: Coexistence event duration * @return : 0 - success, other - failed */ int coex_event_duration_get(uint32_t event, uint32_t *duration); @@ -150,7 +150,7 @@ void coex_schm_status_bit_set(uint32_t type, uint32_t status); /** * @brief Set coexistence scheme interval. * - * @param interval : Coexistence scheme interval + * @param interval : Coexistence scheme interval * @return : 0 - success, other - failed */ int coex_schm_interval_set(uint32_t interval); @@ -165,21 +165,21 @@ uint32_t coex_schm_interval_get(void); /** * @brief Get current coexistence scheme period. * - * @return : Coexistence scheme period + * @return : Coexistence scheme period */ uint8_t coex_schm_curr_period_get(void); /** * @brief Get current coexistence scheme phase. * - * @return : Coexistence scheme phase + * @return : Coexistence scheme phase */ void * coex_schm_curr_phase_get(void); /** * @brief Set current coexistence scheme phase index. * - * @param interval : Coexistence scheme phase index + * @param interval : Coexistence scheme phase index * @return : 0 - success, other - failed */ int coex_schm_curr_phase_idx_set(int idx); diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_now.h b/tools/sdk/esp32/include/esp_wifi/include/esp_now.h index 981c9001e..2f20c5d39 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_now.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_now.h @@ -252,7 +252,7 @@ esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer); esp_err_t esp_now_get_peer(const uint8_t *peer_addr, esp_now_peer_info_t *peer); /** - * @brief Fetch a peer from peer list + * @brief Fetch a peer from peer list. Only return the peer which address is unicast, for the multicast/broadcast address, the function will ignore and try to find the next in the peer list. * * @param from_head fetch from head of list or not * @param peer peer information diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_phy_init.h b/tools/sdk/esp32/include/esp_wifi/include/esp_phy_init.h index 6bc0601fa..6e273ba74 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_phy_init.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_phy_init.h @@ -144,8 +144,8 @@ esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_da /** * @brief Erase PHY calibration data which is stored in the NVS * - * This is a function which can be used to trigger full calibration as a last-resort remedy - * if partial calibration is used. It can be called in the application based on some conditions + * This is a function which can be used to trigger full calibration as a last-resort remedy + * if partial calibration is used. It can be called in the application based on some conditions * (e.g. an option provided in some diagnostic mode). * * @return ESP_OK on success @@ -203,7 +203,7 @@ int64_t esp_phy_rf_get_on_ts(void); esp_err_t esp_phy_update_country_info(const char *country); #if CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN -/** +/** * @brief Apply PHY init bin to PHY * @return ESP_OK on success. * @return ESP_FAIL on fail. @@ -211,7 +211,12 @@ esp_err_t esp_phy_update_country_info(const char *country); esp_err_t esp_phy_apply_phy_init_data(uint8_t *init_data); #endif +/** + * @brief Get PHY lib version + * @return PHY lib version. + */ +char * get_phy_version_str(void); + #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi.h b/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi.h index 3bd4488f5..459650f87 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi.h @@ -13,12 +13,12 @@ // limitations under the License. /* - * All the APIs declared here are internal only APIs, it can only be used by - * espressif internal modules, such as SSC, LWIP, TCPIP adapter etc, espressif + * All the APIs declared here are internal only APIs, it can only be used by + * espressif internal modules, such as SSC, LWIP, TCPIP adapter etc, espressif * customers are not recommended to use them. * * If someone really want to use specified APIs declared in here, please contact - * espressif AE/developer to make sure you know the limitations or risk of + * espressif AE/developer to make sure you know the limitations or risk of * the API, otherwise you may get unexpected behavior!!! * */ @@ -60,7 +60,7 @@ typedef enum { WIFI_LOG_DEBUG, /*can be set in menuconfig*/ WIFI_LOG_VERBOSE, /*can be set in menuconfig*/ } wifi_log_level_t; - + /** * @brief WiFi log module definition * @@ -146,7 +146,7 @@ void esp_wifi_internal_free_rx_buffer(void* buffer); * - ESP_ERR_WIFI_NOT_STARTED : WiFi is not started * - ESP_ERR_WIFI_STATE : WiFi internal state is not ready, e.g. WiFi is not started * - ESP_ERR_WIFI_NOT_ASSOC : WiFi is not associated - * - ESP_ERR_WIFI_TX_DISALLOW : WiFi TX is disallowed, e.g. WiFi hasn't pass the authentication + * - ESP_ERR_WIFI_TX_DISALLOW : WiFi TX is disallowed, e.g. WiFi hasn't pass the authentication * - ESP_ERR_WIFI_POST : caller fails to post event to WiFi task */ int esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, uint16_t len); @@ -170,7 +170,7 @@ typedef void (*wifi_netstack_buf_free_cb_t)(void *netstack_buf); * then forwards the buffer to WiFi driver. The WiFi driver will free the buffer * after processing it. Use esp_wifi_internal_tx() if the uplayer buffer doesn't * supports reference counter. - * + * * @param wifi_if : wifi interface id * @param buffer : the buffer to be tansmit * @param len : the length of buffer @@ -185,7 +185,7 @@ typedef void (*wifi_netstack_buf_free_cb_t)(void *netstack_buf); * - ESP_ERR_WIFI_NOT_STARTED : WiFi is not started * - ESP_ERR_WIFI_STATE : WiFi internal state is not ready, e.g. WiFi is not started * - ESP_ERR_WIFI_NOT_ASSOC : WiFi is not associated - * - ESP_ERR_WIFI_TX_DISALLOW : WiFi TX is disallowed, e.g. WiFi hasn't pass the authentication + * - ESP_ERR_WIFI_TX_DISALLOW : WiFi TX is disallowed, e.g. WiFi hasn't pass the authentication * - ESP_ERR_WIFI_POST : caller fails to post event to WiFi task */ esp_err_t esp_wifi_internal_tx_by_ref(wifi_interface_t ifx, void *buffer, size_t len, void *netstack_buf); @@ -379,7 +379,7 @@ typedef esp_err_t (* wifi_mac_time_update_cb_t)( uint32_t time_delta ); esp_err_t esp_wifi_internal_update_mac_time( uint32_t time_delta ); /** - * @brief Set current WiFi log level + * @brief Set current WiFi log level * * @param level Log level. * @@ -408,7 +408,7 @@ esp_err_t esp_wifi_internal_set_log_level(wifi_log_level_t level); esp_err_t esp_wifi_internal_set_log_mod(wifi_log_module_t module, uint32_t submodule, bool enable); /** - * @brief Get current WiFi log info + * @brief Get current WiFi log info * * @param log_level the return log level. * @param log_mod the return log module and submodule @@ -424,56 +424,56 @@ esp_err_t esp_wifi_internal_get_log(wifi_log_level_t *log_level, uint32_t *log_m * @param cmd : ioctl command type * @param cfg : configuration for the command * - * @return + * @return * - ESP_OK: succeed * - others: failed */ esp_err_t esp_wifi_internal_ioctl(int cmd, wifi_ioctl_config_t *cfg); /** - * @brief Get the user-configured channel info + * @brief Get the user-configured channel info * - * @param ifx : WiFi interface - * @param primary : store the configured primary channel + * @param ifx : WiFi interface + * @param primary : store the configured primary channel * @param second : store the configured second channel * - * @return + * @return * - ESP_OK: succeed */ esp_err_t esp_wifi_internal_get_config_channel(wifi_interface_t ifx, uint8_t *primary, uint8_t *second); /** - * @brief Get the negotiated channel info after WiFi connection established + * @brief Get the negotiated channel info after WiFi connection established * - * @param ifx : WiFi interface - * @param aid : the connection number when a STA connects to the softAP - * @param primary : store the negotiated primary channel + * @param ifx : WiFi interface + * @param aid : the connection number when a STA connects to the softAP + * @param primary : store the negotiated primary channel * @param second : store the negotiated second channel - * @attention the aid param is only works when the ESP32 in softAP/softAP+STA mode + * @attention the aid param is only works when the ESP32 in softAP/softAP+STA mode * - * @return + * @return * - ESP_OK: succeed */ esp_err_t esp_wifi_internal_get_negotiated_channel(wifi_interface_t ifx, uint8_t aid, uint8_t *primary, uint8_t *second); /** - * @brief Get the negotiated bandwidth info after WiFi connection established + * @brief Get the negotiated bandwidth info after WiFi connection established * - * @param ifx : WiFi interface - * @param bw : store the negotiated bandwidth + * @param ifx : WiFi interface + * @param bw : store the negotiated bandwidth * - * @return + * @return * - ESP_OK: succeed */ esp_err_t esp_wifi_internal_get_negotiated_bandwidth(wifi_interface_t ifx, uint8_t aid, uint8_t *bw); #if CONFIG_IDF_TARGET_ESP32S2 /** - * @brief Check if WiFi TSF is active + * @brief Check if WiFi TSF is active * - * @return - * - true: Active - * - false: Not active + * @return + * - true: Active + * - false: Not active */ bool esp_wifi_internal_is_tsf_active(void); #endif diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi_os_adapter.h b/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi_os_adapter.h index b3011b9a2..b583e9162 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi_os_adapter.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_private/wifi_os_adapter.h @@ -66,7 +66,7 @@ typedef struct { void (* _event_group_delete)(void *event); uint32_t (* _event_group_set_bits)(void *event, uint32_t bits); uint32_t (* _event_group_clear_bits)(void *event, uint32_t bits); - uint32_t (* _event_group_wait_bits)(void *event, uint32_t bits_to_wait_for, int32_t clear_on_exit, int32_t wait_for_all_bits, uint32_t block_time_tick); + uint32_t (* _event_group_wait_bits)(void *event, uint32_t bits_to_wait_for, int clear_on_exit, int wait_for_all_bits, uint32_t block_time_tick); int32_t (* _task_create_pinned_to_core)(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id); int32_t (* _task_create)(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle); void (* _task_delete)(void *task_handle); @@ -74,7 +74,7 @@ typedef struct { int32_t (* _task_ms_to_tick)(uint32_t ms); void *(* _task_get_current_task)(void); int32_t (* _task_get_max_priority)(void); - void *(* _malloc)(uint32_t size); + void *(* _malloc)(unsigned int size); void (* _free)(void *p); int32_t (* _event_post)(const char* event_base, int32_t event_id, void* event_data, size_t event_data_size, uint32_t ticks_to_wait); uint32_t (* _get_free_heap_size)(void); @@ -89,8 +89,8 @@ typedef struct { void (* _phy_common_clock_enable)(void); void (* _phy_common_clock_disable)(void); #endif - int32_t (* _phy_update_country_info)(const char* country); - int32_t (* _read_mac)(uint8_t* mac, uint32_t type); + int (* _phy_update_country_info)(const char* country); + int (* _read_mac)(uint8_t* mac, uint32_t type); void (* _timer_arm)(void *timer, uint32_t tmout, bool repeat); void (* _timer_disarm)(void *timer); void (* _timer_done)(void *ptimer); @@ -102,20 +102,20 @@ typedef struct { void (* _wifi_rtc_enable_iso)(void); void (* _wifi_rtc_disable_iso)(void); int64_t (* _esp_timer_get_time)(void); - int32_t (* _nvs_set_i8)(uint32_t handle, const char* key, int8_t value); - int32_t (* _nvs_get_i8)(uint32_t handle, const char* key, int8_t* out_value); - int32_t (* _nvs_set_u8)(uint32_t handle, const char* key, uint8_t value); - int32_t (* _nvs_get_u8)(uint32_t handle, const char* key, uint8_t* out_value); - int32_t (* _nvs_set_u16)(uint32_t handle, const char* key, uint16_t value); - int32_t (* _nvs_get_u16)(uint32_t handle, const char* key, uint16_t* out_value); - int32_t (* _nvs_open)(const char* name, uint32_t open_mode, uint32_t *out_handle); - void (* _nvs_close)(uint32_t handle); - int32_t (* _nvs_commit)(uint32_t handle); - int32_t (* _nvs_set_blob)(uint32_t handle, const char* key, const void* value, size_t length); - int32_t (* _nvs_get_blob)(uint32_t handle, const char* key, void* out_value, size_t* length); - int32_t (* _nvs_erase_key)(uint32_t handle, const char* key); - int32_t (* _get_random)(uint8_t *buf, size_t len); - int32_t (* _get_time)(void *t); + int (* _nvs_set_i8)(uint32_t handle, const char* key, int8_t value); + int (* _nvs_get_i8)(uint32_t handle, const char* key, int8_t* out_value); + int (* _nvs_set_u8)(uint32_t handle, const char* key, uint8_t value); + int (* _nvs_get_u8)(uint32_t handle, const char* key, uint8_t* out_value); + int (* _nvs_set_u16)(uint32_t handle, const char* key, uint16_t value); + int (* _nvs_get_u16)(uint32_t handle, const char* key, uint16_t* out_value); + int (* _nvs_open)(const char* name, uint32_t open_mode, uint32_t *out_handle); + void (* _nvs_close)(uint32_t handle); + int (* _nvs_commit)(uint32_t handle); + int (* _nvs_set_blob)(uint32_t handle, const char* key, const void* value, size_t length); + int (* _nvs_get_blob)(uint32_t handle, const char* key, void* out_value, size_t* length); + int (* _nvs_erase_key)(uint32_t handle, const char* key); + int (* _get_random)(uint8_t *buf, size_t len); + int (* _get_time)(void *t); unsigned long (* _random)(void); #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 uint32_t (* _slowclk_cal_get)(void); @@ -131,7 +131,7 @@ typedef struct { void * (* _wifi_realloc)(void *ptr, size_t size); void * (* _wifi_calloc)(size_t n, size_t size); void * (* _wifi_zalloc)(size_t size); - void * (* _wifi_create_queue)(int32_t queue_len, int32_t item_size); + void * (* _wifi_create_queue)(int queue_len, int item_size); void (* _wifi_delete_queue)(void * queue); int (* _coex_init)(void); void (* _coex_deinit)(void); @@ -139,8 +139,8 @@ typedef struct { void (* _coex_disable)(void); uint32_t (* _coex_status_get)(void); void (* _coex_condition_set)(uint32_t type, bool dissatisfy); - int32_t (* _coex_wifi_request)(uint32_t event, uint32_t latency, uint32_t duration); - int32_t (* _coex_wifi_release)(uint32_t event); + int (* _coex_wifi_request)(uint32_t event, uint32_t latency, uint32_t duration); + int (* _coex_wifi_release)(uint32_t event); int (* _coex_wifi_channel_set)(uint8_t primary, uint8_t secondary); int (* _coex_event_duration_get)(uint32_t event, uint32_t *duration); int (* _coex_pti_get)(uint32_t event, uint8_t *pti); diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_wifi.h b/tools/sdk/esp32/include/esp_wifi/include/esp_wifi.h index 4dad75b9a..0741fa261 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_wifi.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_wifi.h @@ -86,7 +86,7 @@ extern "C" { #define ESP_ERR_WIFI_NOT_CONNECT (ESP_ERR_WIFI_BASE + 15) /*!< Station still in disconnect status */ #define ESP_ERR_WIFI_POST (ESP_ERR_WIFI_BASE + 18) /*!< Failed to post the event to WiFi task */ -#define ESP_ERR_WIFI_INIT_STATE (ESP_ERR_WIFI_BASE + 19) /*!< Invalod WiFi state when init/deinit is called */ +#define ESP_ERR_WIFI_INIT_STATE (ESP_ERR_WIFI_BASE + 19) /*!< Invalid WiFi state when init/deinit is called */ #define ESP_ERR_WIFI_STOP_STATE (ESP_ERR_WIFI_BASE + 20) /*!< Returned when WiFi is stopping */ #define ESP_ERR_WIFI_NOT_ASSOC (ESP_ERR_WIFI_BASE + 21) /*!< The WiFi connection is not associated */ #define ESP_ERR_WIFI_TX_DISALLOW (ESP_ERR_WIFI_BASE + 22) /*!< The WiFi TX is disallowed */ @@ -229,7 +229,7 @@ extern uint64_t g_wifi_feature_caps; * @attention 2. Always use WIFI_INIT_CONFIG_DEFAULT macro to init the config to default values, this can * guarantee all the fields got correct value when more fields are added into wifi_init_config_t * in future release. If you want to set your owner initial values, overwrite the default values - * which are set by WIFI_INIT_CONFIG_DEFAULT, please be notified that the field 'magic' of + * which are set by WIFI_INIT_CONFIG_DEFAULT, please be notified that the field 'magic' of * wifi_init_config_t should always be WIFI_INIT_CONFIG_MAGIC! * * @param config pointer to WiFi init configuration structure; can point to a temporary variable. @@ -247,7 +247,7 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config); * * @attention 1. This API should be called if you want to remove WiFi driver from the system * - * @return + * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init */ @@ -313,7 +313,7 @@ esp_err_t esp_wifi_stop(void); * @brief Restore WiFi stack persistent settings to default values * * This function will reset settings made using the following APIs: - * - esp_wifi_get_auto_connect, + * - esp_wifi_set_bandwidth, * - esp_wifi_set_protocol, * - esp_wifi_set_config related * - esp_wifi_set_mode @@ -332,11 +332,11 @@ esp_err_t esp_wifi_restore(void); * @attention 3. The scanning triggered by esp_wifi_start_scan() will not be effective until connection between ESP32 and the AP is established. * If ESP32 is scanning and connecting at the same time, ESP32 will abort scanning and return a warning message and error * number ESP_ERR_WIFI_STATE. - * If you want to do reconnection after ESP32 received disconnect event, remember to add the maximum retry time, otherwise the called + * If you want to do reconnection after ESP32 received disconnect event, remember to add the maximum retry time, otherwise the called * scan will not work. This is especially true when the AP doesn't exist, and you still try reconnection after ESP32 received disconnect * event with the reason code WIFI_REASON_NO_AP_FOUND. - * - * @return + * + * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init * - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start @@ -431,7 +431,7 @@ esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number); /** * @brief Get AP list found in last scan * - * @param[inout] number As input param, it stores max AP number ap_records can hold. + * @param[inout] number As input param, it stores max AP number ap_records can hold. * As output param, it receives the actual AP number this API returns. * @param ap_records wifi_ap_record_t array to hold the found APs * @@ -448,6 +448,8 @@ esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_re /** * @brief Get information of AP which the ESP32 station is associated with * + * @attention When the obtained country information is empty, it means that the AP does not carry country information + * * @param ap_info the wifi_ap_record_t to hold AP information * sta can get the connected ap's phy mode info through the struct member * phy_11b,phy_11g,phy_11n,phy_lr in the wifi_ap_record_t struct. @@ -456,7 +458,7 @@ esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_re * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_CONN: The station interface don't initialized - * - ESP_ERR_WIFI_NOT_CONNECT: The station is in disconnect status + * - ESP_ERR_WIFI_NOT_CONNECT: The station is in disconnect status */ esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info); @@ -554,7 +556,7 @@ esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); * @attention 1. This API should be called after esp_wifi_start() * @attention 2. When ESP32 is in STA mode, this API should not be called when STA is scanning or connecting to an external AP * @attention 3. When ESP32 is in softAP mode, this API should not be called when softAP has connected to external STAs - * @attention 4. When ESP32 is in STA+softAP mode, this API should not be called when in the scenarios described above + * @attention 4. When ESP32 is in STA+softAP mode, this API should not be called when in the scenarios described above * * @param primary for HT20, primary is the channel number, for HT40, primary is the primary channel * @param second for HT20, second is ignored, for HT40, second is the second channel @@ -596,7 +598,7 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second); * @attention 4. When the country info is changed because of configuration or because the station connects to a different * external AP, the country IE in probe response/beacon of the soft-AP is changed also. * @attention 5. The country configuration is stored into flash. - * @attention 6. This API doesn't validate the per-country rules, it's up to the user to fill in all fields according to + * @attention 6. This API doesn't validate the per-country rules, it's up to the user to fill in all fields according to * local regulations. * @attention 7. When this API is called, the PHY init data will switch to the PHY init data type corresponding to the * country info. @@ -660,7 +662,7 @@ esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]); /** - * @brief The RX callback function in the promiscuous mode. + * @brief The RX callback function in the promiscuous mode. * Each time a packet is received, the callback function will be called. * * @param buf Data received. Type of data in buffer (wifi_promiscuous_pkt_t or wifi_pkt_rx_ctrl_t) indicated by 'type' parameter. @@ -887,34 +889,10 @@ esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); * @attention 1. Maximum power before wifi startup is limited by PHY init data bin. * @attention 2. The value set by this API will be mapped to the max_tx_power of the structure wifi_country_t variable. * @attention 3. Mapping Table {Power, max_tx_power} = {{8, 2}, {20, 5}, {28, 7}, {34, 8}, {44, 11}, - * {52, 13}, {56, 14}, {60, 15}, {66, 16}, {72, 18}, {78, 20}}. - * @attention 4. Param power unit is 0.25dBm, range is [8, 78] corresponding to 2dBm - 20dBm. - * @attention 5. Relationship between set value and actual value. As follows: - * +------------+--------------+ - * | set value | actual value | - * +============+==============+ - * | [8, 19] | 8 | - * +------------+--------------+ - * | [20, 27] | 20 | - * +------------+--------------+ - * | [28, 33] | 28 | - * +------------+--------------+ - * | [34, 43] | 34 | - * +------------+--------------+ - * | [44, 51] | 44 | - * +------------+--------------+ - * | [52, 55] | 52 | - * +------------+--------------+ - * | [56, 59] | 56 | - * +------------+--------------+ - * | [60, 65] | 60 | - * +------------+--------------+ - * | [66, 71] | 66 | - * +------------+--------------+ - * | [72, 77] | 72 | - * +------------+--------------+ - * | 78 | 78 | - * +------------+--------------+ + * {52, 13}, {56, 14}, {60, 15}, {66, 16}, {72, 18}, {80, 20}}. + * @attention 4. Param power unit is 0.25dBm, range is [8, 84] corresponding to 2dBm - 20dBm. + * @attention 5. Relationship between set value and actual value. As follows: {set value range, actual value} = {{[8, 19],8}, {[20, 27],20}, {[28, 33],28}, {[34, 43],34}, {[44, 51],44}, {[52, 55],52}, {[56, 59],56}, {[60, 65],60}, {[66, 71],66}, {[72, 79],72}, {[80, 84],80}}. + * * @param power Maximum WiFi transmitting power. * * @return @@ -972,14 +950,14 @@ esp_err_t esp_wifi_get_event_mask(uint32_t *mask); * * @attention Currently only support for sending beacon/probe request/probe response/action and non-QoS * data frame - * + * * @param ifx interface if the Wi-Fi mode is Station, the ifx should be WIFI_IF_STA. If the Wi-Fi - * mode is SoftAP, the ifx should be WIFI_IF_AP. If the Wi-Fi mode is Station+SoftAP, the + * mode is SoftAP, the ifx should be WIFI_IF_AP. If the Wi-Fi mode is Station+SoftAP, the * ifx should be WIFI_IF_STA or WIFI_IF_AP. If the ifx is wrong, the API returns ESP_ERR_WIFI_IF. * @param buffer raw ieee80211 buffer * @param len the length of raw buffer, the len must be <= 1500 Bytes and >= 24 Bytes - * @param en_sys_seq indicate whether use the internal sequence number. If en_sys_seq is false, the - * sequence in raw buffer is unchanged, otherwise it will be overwritten by WiFi driver with + * @param en_sys_seq indicate whether use the internal sequence number. If en_sys_seq is false, the + * sequence in raw buffer is unchanged, otherwise it will be overwritten by WiFi driver with * the system sequence number. * Generally, if esp_wifi_80211_tx is called before the Wi-Fi connection has been set up, both * en_sys_seq==true and en_sys_seq==false are fine. However, if the API is called after the Wi-Fi @@ -995,12 +973,12 @@ esp_err_t esp_wifi_get_event_mask(uint32_t *mask); esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq); /** - * @brief The RX callback function of Channel State Information(CSI) data. + * @brief The RX callback function of Channel State Information(CSI) data. * * Each time a CSI data is received, the callback function will be called. * - * @param ctx context argument, passed to esp_wifi_set_csi_rx_cb() when registering callback function. - * @param data CSI data received. The memory that it points to will be deallocated after callback function returns. + * @param ctx context argument, passed to esp_wifi_set_csi_rx_cb() when registering callback function. + * @param data CSI data received. The memory that it points to will be deallocated after callback function returns. * */ typedef void (* wifi_csi_cb_t)(void *ctx, wifi_csi_info_t *data); @@ -1025,7 +1003,7 @@ esp_err_t esp_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); * @brief Set CSI data configuration * * @param config configuration - * + * * return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init @@ -1153,6 +1131,20 @@ esp_err_t esp_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); */ esp_err_t esp_wifi_statis_dump(uint32_t modules); +/** + * @brief Set RSSI threshold below which APP will get an event + * + * @attention This API needs to be called every time after WIFI_EVENT_STA_BSS_RSSI_LOW event is received. + * + * @param rssi threshold value in dbm between -100 to 0 + * + * @return + * - ESP_OK: succeed + * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init + * - ESP_ERR_WIFI_ARG: invalid argument + */ +esp_err_t esp_wifi_set_rssi_threshold(int32_t rssi); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_netif.h b/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_netif.h index 203b63c61..2c2243b4e 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_netif.h +++ b/tools/sdk/esp32/include/esp_wifi/include/esp_wifi_netif.h @@ -88,4 +88,4 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t } #endif -#endif //_ESP_WIFI_NETIF_H \ No newline at end of file +#endif //_ESP_WIFI_NETIF_H 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 d54e97d25..879392099 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 @@ -30,10 +30,10 @@ typedef enum { WIFI_MODE_MAX } wifi_mode_t; -typedef esp_interface_t wifi_interface_t; - -#define WIFI_IF_STA ESP_IF_WIFI_STA -#define WIFI_IF_AP ESP_IF_WIFI_AP +typedef enum { + WIFI_IF_STA = ESP_IF_WIFI_STA, + WIFI_IF_AP = ESP_IF_WIFI_AP, +} wifi_interface_t; typedef enum { WIFI_COUNTRY_POLICY_AUTO, /**< Country policy is auto, use the country info of AP to which the station is connected */ @@ -95,6 +95,7 @@ typedef enum { WIFI_REASON_HANDSHAKE_TIMEOUT = 204, WIFI_REASON_CONNECTION_FAIL = 205, WIFI_REASON_AP_TSF_RESET = 206, + WIFI_REASON_ROAMING = 207, } wifi_err_reason_t; typedef enum { @@ -214,19 +215,19 @@ typedef struct { /** @brief Soft-AP configuration settings for the ESP32 */ typedef struct { uint8_t ssid[32]; /**< SSID of ESP32 soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */ - uint8_t password[64]; /**< Password of ESP32 soft-AP. Null terminated string. */ + uint8_t password[64]; /**< Password of ESP32 soft-AP. */ uint8_t ssid_len; /**< Optional length of SSID field. */ uint8_t channel; /**< Channel of ESP32 soft-AP */ wifi_auth_mode_t authmode; /**< Auth mode of ESP32 soft-AP. Do not support AUTH_WEP in soft-AP mode */ uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */ uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 10 */ - uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 ms */ + uint16_t beacon_interval; /**< Beacon interval which should be multiples of 100. Unit: TU(time unit, 1 TU = 1024 us). Range: 100 ~ 60000. Default value: 100 */ } wifi_ap_config_t; /** @brief STA configuration settings for the ESP32 */ typedef struct { - uint8_t ssid[32]; /**< SSID of target AP. Null terminated string. */ - uint8_t password[64]; /**< Password of target AP. Null terminated string.*/ + uint8_t ssid[32]; /**< SSID of target AP. */ + uint8_t password[64]; /**< Password of target AP. */ wifi_scan_method_t scan_method; /**< do all channel scan or fast scan */ bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/ uint8_t bssid[6]; /**< MAC address of target AP*/ @@ -235,6 +236,9 @@ typedef struct { wifi_sort_method_t sort_method; /**< sort the connect AP in the list by rssi or security mode */ wifi_scan_threshold_t threshold; /**< When sort_method is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used. */ 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 */ } wifi_sta_config_t; /** @brief Configuration data for ESP32 AP or STA. @@ -388,6 +392,7 @@ typedef enum { #define WIFI_PROMIS_FILTER_MASK_MISC (1<<3) /**< filter the packets with type of WIFI_PKT_MISC */ #define WIFI_PROMIS_FILTER_MASK_DATA_MPDU (1<<4) /**< filter the MPDU which is a kind of WIFI_PKT_DATA */ #define WIFI_PROMIS_FILTER_MASK_DATA_AMPDU (1<<5) /**< filter the AMPDU which is a kind of WIFI_PKT_DATA */ +#define WIFI_PROMIS_FILTER_MASK_FCSFAIL (1<<6) /**< filter the FCS failed packets, do not open it in general */ #define WIFI_PROMIS_CTRL_FILTER_MASK_ALL (0xFF800000) /**< filter all control packets */ #define WIFI_PROMIS_CTRL_FILTER_MASK_WRAPPER (1<<23) /**< filter the control packets with subtype of Control Wrapper */ @@ -541,6 +546,9 @@ typedef enum { WIFI_EVENT_FTM_REPORT, /**< Receive report of FTM procedure */ + /* Add next events after this only */ + WIFI_EVENT_STA_BSS_RSSI_LOW, /**< AP's RSSI crossed configured threshold */ + WIFI_EVENT_MAX, /**< Invalid WiFi event ID */ } wifi_event_t; @@ -622,6 +630,11 @@ typedef struct { uint8_t mac[6]; /**< MAC address of the station which send probe request */ } wifi_event_ap_probe_req_rx_t; +/** Argument structure for WIFI_EVENT_STA_BSS_RSSI_LOW event */ +typedef struct { + int32_t rssi; /**< RSSI value of bss */ +} wifi_event_bss_rssi_low_t; + #define WIFI_STATIS_BUFFER (1<<0) #define WIFI_STATIS_RXTX (1<<1) #define WIFI_STATIS_HW (1<<2) diff --git a/tools/sdk/esp32/include/esp_wifi/include/phy.h b/tools/sdk/esp32/include/esp_wifi/include/phy.h index 74eae0e6c..a33b63751 100644 --- a/tools/sdk/esp32/include/esp_wifi/include/phy.h +++ b/tools/sdk/esp32/include/esp_wifi/include/phy.h @@ -74,4 +74,3 @@ void phy_close_rf(void); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h b/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h index 2a6c10932..022bde951 100644 --- a/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h +++ b/tools/sdk/esp32/include/espcoredump/include/esp_core_dump.h @@ -16,7 +16,6 @@ #include #include "esp_err.h" -#include "freertos/xtensa_context.h" #include "esp_private/panic_internal.h" /**************************************************************************************/ @@ -80,7 +79,7 @@ void esp_core_dump_to_uart(panic_info_t *info); * This function is always available, even when core dump is disabled in menuconfig. * * @param out_addr pointer to store image address in flash. - * @param out_size pointer to store image size in flash (including CRC). In bytes. + * @param out_size pointer to store image size in flash (including checksum). In bytes. * * @return ESP_OK on success, otherwise \see esp_err_t */ diff --git a/tools/sdk/esp32/include/fatfs/diskio/diskio_impl.h b/tools/sdk/esp32/include/fatfs/diskio/diskio_impl.h index 1e5614c55..9d7e01248 100644 --- a/tools/sdk/esp32/include/fatfs/diskio/diskio_impl.h +++ b/tools/sdk/esp32/include/fatfs/diskio/diskio_impl.h @@ -70,4 +70,3 @@ esp_err_t ff_diskio_get_drive(BYTE* out_pdrv); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/fatfs/diskio/diskio_sdmmc.h b/tools/sdk/esp32/include/fatfs/diskio/diskio_sdmmc.h index 539b3b89a..538a9c6da 100644 --- a/tools/sdk/esp32/include/fatfs/diskio/diskio_sdmmc.h +++ b/tools/sdk/esp32/include/fatfs/diskio/diskio_sdmmc.h @@ -40,4 +40,3 @@ BYTE ff_diskio_get_pdrv_card(const sdmmc_card_t* card); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/fatfs/diskio/diskio_wl.h b/tools/sdk/esp32/include/fatfs/diskio/diskio_wl.h index af3f14797..619cb6b8f 100644 --- a/tools/sdk/esp32/include/fatfs/diskio/diskio_wl.h +++ b/tools/sdk/esp32/include/fatfs/diskio/diskio_wl.h @@ -23,7 +23,7 @@ extern "C" { /** - * Register spi flash partition + * Register spi flash partition * * @param pdrv drive number * @param flash_handle handle of the wear levelling partition. diff --git a/tools/sdk/esp32/include/fatfs/src/ffconf.h b/tools/sdk/esp32/include/fatfs/src/ffconf.h index 79792beef..6578122c5 100644 --- a/tools/sdk/esp32/include/fatfs/src/ffconf.h +++ b/tools/sdk/esp32/include/fatfs/src/ffconf.h @@ -44,7 +44,7 @@ /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ -#define FF_USE_FASTSEEK 0 +#define FF_USE_FASTSEEK CONFIG_FATFS_USE_FASTSEEK /* This option switches fast seek function. (0:Disable or 1:Enable) */ diff --git a/tools/sdk/esp32/include/freemodbus/common/include/esp_modbus_common.h b/tools/sdk/esp32/include/freemodbus/common/include/esp_modbus_common.h index b6836ba74..398af0ba9 100644 --- a/tools/sdk/esp32/include/freemodbus/common/include/esp_modbus_common.h +++ b/tools/sdk/esp32/include/freemodbus/common/include/esp_modbus_common.h @@ -153,4 +153,3 @@ typedef esp_err_t (*iface_start)(void); /*!< Interface method start */ #endif #endif // _MB_IFACE_COMMON_H - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/FreeRTOS.h b/tools/sdk/esp32/include/freertos/include/freertos/FreeRTOS.h index 46ec68c57..2c9c5b13d 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/FreeRTOS.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/FreeRTOS.h @@ -1327,4 +1327,3 @@ typedef StaticStreamBuffer_t StaticMessageBuffer_t; #endif #endif /* INC_FREERTOS_H */ - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/atomic.h b/tools/sdk/esp32/include/freertos/include/freertos/atomic.h index 2b388775f..df52a0f01 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/atomic.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/atomic.h @@ -29,9 +29,9 @@ * @file atomic.h * @brief FreeRTOS atomic operation support. * - * This file implements atomic by disabling interrupts globally. - * Implementation with architecture specific atomic instructions - * are to be provided under each compiler directory. + * This file implements atomic by disabling interrupts globally. + * Implementation with architecture specific atomic instructions + * are to be provided under each compiler directory. */ #ifndef ATOMIC_H @@ -71,14 +71,14 @@ extern "C" { #endif /* portSET_INTERRUPT_MASK_FROM_ISR() */ -/* Port specific definition -- "always inline". - * Inline is compiler specific, and may not always get inlined depending on your optimization level. - * Also, inline is considerred as performance optimization for atomic. +/* Port specific definition -- "always inline". + * Inline is compiler specific, and may not always get inlined depending on your optimization level. + * Also, inline is considerred as performance optimization for atomic. * Thus, if portFORCE_INLINE is not provided by portmacro.h, instead of resulting error, - * simply define it. + * simply define it. */ #ifndef portFORCE_INLINE - #define portFORCE_INLINE + #define portFORCE_INLINE #endif #define ATOMIC_COMPARE_AND_SWAP_SUCCESS 0x1U /**< Compare and swap succeeded, swapped. */ diff --git a/tools/sdk/esp32/include/freertos/include/freertos/deprecated_definitions.h b/tools/sdk/esp32/include/freertos/include/freertos/deprecated_definitions.h index 9cece988f..70fc403bd 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/deprecated_definitions.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/deprecated_definitions.h @@ -276,4 +276,3 @@ projects should not use them. */ #endif #endif /* DEPRECATED_DEFINITIONS_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 3aa839fc4..5773e8d90 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/event_groups.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/event_groups.h @@ -695,5 +695,3 @@ void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToCl #endif #endif /* EVENT_GROUPS_H */ - - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/list.h b/tools/sdk/esp32/include/freertos/include/freertos/list.h index 73b4f3aa9..d06481e29 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/list.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/list.h @@ -409,4 +409,3 @@ UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) PRIVILEGED_FUNCTIO #endif #endif - 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 83869582d..a49324da4 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/message_buffer.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/message_buffer.h @@ -106,7 +106,7 @@ typedef void * MessageBufferHandle_t; * buffer. * * Example use: - * @code{c} + * @code{c} * * void vAFunction( void ) * { @@ -129,7 +129,7 @@ typedef void * MessageBufferHandle_t; * // The message buffer was created successfully and can now be used. * } * - * @endcode + * @endcode * \ingroup MessageBufferManagement */ #define xMessageBufferCreate( xBufferSizeBytes ) ( MessageBufferHandle_t ) xStreamBufferGenericCreate( xBufferSizeBytes, ( size_t ) 0, pdTRUE ) @@ -159,7 +159,7 @@ typedef void * MessageBufferHandle_t; * pxStaticmessageBuffer are NULL then NULL is returned. * * Example use: - * @code{c} + * @code{c} * * // Used to dimension the array used to hold the messages. The available space * // will actually be one less than this, so 999. @@ -187,7 +187,7 @@ typedef void * MessageBufferHandle_t; * // Other code that uses the message buffer can go here. * } * - * @endcode + * @endcode * \ingroup MessageBufferManagement */ #define xMessageBufferCreateStatic( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer ) ( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer ) @@ -248,7 +248,7 @@ typedef void * MessageBufferHandle_t; * time out then xDataLengthBytes is returned. * * Example use: - * @code{c} + * @code{c} * void vAFunction( MessageBufferHandle_t xMessageBuffer ) * { * size_t xBytesSent; @@ -276,7 +276,7 @@ typedef void * MessageBufferHandle_t; * // not enough free space in the buffer. * } * } - * @endcode + * @endcode * \ingroup MessageBufferManagement */ #define xMessageBufferSend( xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) xStreamBufferSend( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) @@ -338,7 +338,7 @@ typedef void * MessageBufferHandle_t; * then 0 is returned, otherwise xDataLengthBytes is returned. * * Example use: - * @code{c} + * @code{c} * // A message buffer that has already been created. * MessageBufferHandle_t xMessageBuffer; * @@ -370,7 +370,7 @@ typedef void * MessageBufferHandle_t; * // documentation for the port in use for port specific instructions. * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } - * @endcode + * @endcode * \ingroup MessageBufferManagement */ #define xMessageBufferSendFromISR( xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) xStreamBufferSendFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) @@ -427,7 +427,7 @@ typedef void * MessageBufferHandle_t; * zero is returned. * * Example use: - * @code{c} + * @code{c} * void vAFunction( MessageBuffer_t xMessageBuffer ) * { * uint8_t ucRxData[ 20 ]; @@ -448,7 +448,7 @@ typedef void * MessageBufferHandle_t; * // the message here.... * } * } - * @endcode + * @endcode * \ingroup MessageBufferManagement */ #define xMessageBufferReceive( xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait ) xStreamBufferReceive( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait ) @@ -507,7 +507,7 @@ typedef void * MessageBufferHandle_t; * any. * * Example use: - * @code{c} + * @code{c} * // A message buffer that has already been created. * MessageBuffer_t xMessageBuffer; * @@ -539,7 +539,7 @@ typedef void * MessageBufferHandle_t; * // documentation for the port in use for port specific instructions. * portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); * } - * @endcode + * @endcode * \ingroup MessageBufferManagement */ #define xMessageBufferReceiveFromISR( xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) xStreamBufferReceiveFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) diff --git a/tools/sdk/esp32/include/freertos/include/freertos/mpu_wrappers.h b/tools/sdk/esp32/include/freertos/include/freertos/mpu_wrappers.h index 121ce75f7..7cbad5da0 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/mpu_wrappers.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/mpu_wrappers.h @@ -184,4 +184,3 @@ only for ports that are using the MPU. */ #endif /* MPU_WRAPPERS_H */ - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/portable.h b/tools/sdk/esp32/include/freertos/include/freertos/portable.h index dce07473f..0c39bb9f6 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/portable.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/portable.h @@ -201,4 +201,3 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; #endif #endif /* PORTABLE_H */ - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/projdefs.h b/tools/sdk/esp32/include/freertos/include/freertos/projdefs.h index 03e042f88..ce647fb6f 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/projdefs.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/projdefs.h @@ -124,6 +124,3 @@ itself. */ #endif /* PROJDEFS_H */ - - - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/queue.h b/tools/sdk/esp32/include/freertos/include/freertos/queue.h index 4916d9b6d..8c3546531 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/queue.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/queue.h @@ -857,7 +857,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; #define xQueueSendToFrontFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_FRONT ) -/** +/** * This is a macro that calls xQueueGenericSendFromISR(). * * Post an item to the back of a queue. It is safe to use this macro from @@ -1478,4 +1478,3 @@ uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; #endif #endif /* QUEUE_H */ - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/semphr.h b/tools/sdk/esp32/include/freertos/include/freertos/semphr.h index b9eaf89a4..971d74d49 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/semphr.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/semphr.h @@ -1091,5 +1091,3 @@ typedef QueueHandle_t SemaphoreHandle_t; #define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) ) #endif /* SEMAPHORE_H */ - - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/stack_macros.h b/tools/sdk/esp32/include/freertos/include/freertos/stack_macros.h index 2c77d090b..b8eca4246 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/stack_macros.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/stack_macros.h @@ -138,4 +138,3 @@ #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ #endif /* STACK_MACROS_H */ - 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 365c6c270..1a3d8f519 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/stream_buffer.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/stream_buffer.h @@ -174,7 +174,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * // Defines the memory that will actually hold the streams within the stream * // buffer. * static uint8_t ucStorageBuffer[ STORAGE_SIZE_BYTES ]; - * + * * // The variable used to hold the stream buffer structure. * StaticStreamBuffer_t xStreamBufferStruct; * @@ -187,7 +187,7 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t; * xTriggerLevel, * ucBufferStorage, * &xStreamBufferStruct ); - * + * * // As neither the pucStreamBufferStorageArea or pxStaticStreamBuffer * // parameters were NULL, xStreamBuffer will not be NULL, and can be used to * // reference the created stream buffer in other stream buffer API calls. @@ -359,7 +359,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, * // There was not enough free space in the stream buffer for the entire * // string to be written, ut xBytesSent bytes were written. * } - * + * * // If xHigherPriorityTaskWoken was set to pdTRUE inside * // xStreamBufferSendFromISR() then a task that has a priority above the * // priority of the currently executing task was unblocked and a context diff --git a/tools/sdk/esp32/include/freertos/include/freertos/task.h b/tools/sdk/esp32/include/freertos/include/freertos/task.h index 1b467d678..0012cc600 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/task.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/task.h @@ -249,7 +249,8 @@ is used in assert() statements. */ * in SMP system. * * @param pvTaskCode Pointer to the task entry function. Tasks - * must be implemented to never return (i.e. continuous loop). + * must be implemented to never return (i.e. continuous loop), or should be + * terminated using vTaskDelete function. * * @param pcName A descriptive name for the task. This is mainly used to * facilitate debugging. Max length defined by configMAX_TASK_NAME_LEN - default @@ -314,7 +315,8 @@ is used in assert() statements. */ * xTaskCreateRestricted(). * * @param pvTaskCode Pointer to the task entry function. Tasks - * must be implemented to never return (i.e. continuous loop). + * must be implemented to never return (i.e. continuous loop), or should be + * terminated using vTaskDelete function. * * @param pcName A descriptive name for the task. This is mainly used to * facilitate debugging. Max length defined by configMAX_TASK_NAME_LEN - default @@ -400,7 +402,8 @@ is used in assert() statements. */ * task affinity in an SMP system. * * @param pvTaskCode Pointer to the task entry function. Tasks - * must be implemented to never return (i.e. continuous loop). + * must be implemented to never return (i.e. continuous loop), or should be + * terminated using vTaskDelete function. * * @param pcName A descriptive name for the task. This is mainly used to * facilitate debugging. The maximum length of the string is defined by @@ -460,7 +463,8 @@ is used in assert() statements. */ * using any dynamic memory allocation. * * @param pvTaskCode Pointer to the task entry function. Tasks - * must be implemented to never return (i.e. continuous loop). + * must be implemented to never return (i.e. continuous loop), or should be + * terminated using vTaskDelete function. * * @param pcName A descriptive name for the task. This is mainly used to * facilitate debugging. The maximum length of the string is defined by @@ -629,7 +633,7 @@ is used in assert() statements. */ /* * xTaskCreateRestrictedStatic() should only be used in systems that include an * MPU implementation. - * + * * Only available when configSUPPORT_STATIC_ALLOCATION is set to 1. * * Internally, within the FreeRTOS implementation, tasks use two blocks of @@ -702,7 +706,7 @@ is used in assert() statements. */ * // and/or timer task. * for( ;; ); * } - * @endcode + * @endcode * \ingroup Tasks */ #if( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) @@ -920,7 +924,7 @@ BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; /** * Obtain the priority of any task. - * + * * INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available. * See the configuration section for more information. * @@ -1036,8 +1040,8 @@ eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ) PRIVILEGED_FUNCTION; /** - * Set the priority of any task. - * + * Set the priority of any task. + * * INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available. * See the configuration section for more information. * @@ -1912,8 +1916,8 @@ uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION; * updated. ulValue is not used and xTaskNotify() always returns pdPASS in * this case. * - * @param pulPreviousNotificationValue Can be used to pass out the subject - * task's notification value before any bits are modified by the notify + * @param pulPreviousNotificationValue Can be used to pass out the subject + * task's notification value before any bits are modified by the notify * function. * * @return Dependent on the value of eAction. See the description of the @@ -1995,10 +1999,10 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNo * The task receives a notification without its notification value being * updated. ulValue is not used and xTaskNotify() always returns pdPASS in * this case. - * - * @param pulPreviousNotificationValue Can be used to pass out the subject task's + * + * @param pulPreviousNotificationValue Can be used to pass out the subject task's * notification value before any bits are modified by the notify function. - * + * * @param pxHigherPriorityTaskWoken xTaskNotifyFromISR() will set * *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the * task to which the notification was sent to leave the Blocked state, and the @@ -2263,7 +2267,7 @@ uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait * * @return pdTRUE if the task's notification state was set to * eNotWaitingNotification, otherwise pdFALSE. - * + * * \ingroup TaskNotifications */ BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask ); @@ -2539,6 +2543,3 @@ UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray, co } #endif #endif /* INC_TASK_H */ - - - diff --git a/tools/sdk/esp32/include/freertos/include/freertos/timers.h b/tools/sdk/esp32/include/freertos/include/freertos/timers.h index 92ffc31fe..9a5e23385 100644 --- a/tools/sdk/esp32/include/freertos/include/freertos/timers.h +++ b/tools/sdk/esp32/include/freertos/include/freertos/timers.h @@ -1247,6 +1247,3 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommand } #endif #endif /* TIMERS_H */ - - - diff --git a/tools/sdk/esp32/include/freertos/xtensa/include/freertos/FreeRTOSConfig.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/FreeRTOSConfig.h similarity index 99% rename from tools/sdk/esp32/include/freertos/xtensa/include/freertos/FreeRTOSConfig.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/FreeRTOSConfig.h index be7cdb807..7b7d69437 100644 --- a/tools/sdk/esp32/include/freertos/xtensa/include/freertos/FreeRTOSConfig.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/FreeRTOSConfig.h @@ -127,6 +127,8 @@ int xt_clock_freq(void) __attribute__((deprecated)); #include "esp32s2/rom/ets_sys.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/ets_sys.h" #endif #if defined(CONFIG_FREERTOS_ASSERT_DISABLE) @@ -289,7 +291,7 @@ int xt_clock_freq(void) __attribute__((deprecated)); #define configUSE_NEWLIB_REENTRANT 1 #define configSUPPORT_DYNAMIC_ALLOCATION 1 -#define configSUPPORT_STATIC_ALLOCATION CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION +#define configSUPPORT_STATIC_ALLOCATION 1 #ifndef __ASSEMBLER__ #if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP @@ -338,4 +340,3 @@ extern void vPortCleanUpTCB ( void *pxTCB ); #endif #endif /* FREERTOS_CONFIG_H */ - diff --git a/tools/sdk/esp32/include/freertos/xtensa/include/freertos/portbenchmark.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portbenchmark.h similarity index 100% rename from tools/sdk/esp32/include/freertos/xtensa/include/freertos/portbenchmark.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portbenchmark.h diff --git a/tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/portmacro.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h similarity index 77% rename from tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/portmacro.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h index e144bc08c..563b4188f 100644 --- a/tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/portmacro.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h @@ -1,68 +1,29 @@ /* - 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! -*/ - + * FreeRTOS Kernel V10.2.1 + * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ #ifndef PORTMACRO_H #define PORTMACRO_H @@ -108,8 +69,11 @@ extern "C" { *----------------------------------------------------------- */ -/* Type definitions. */ +#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 @@ -136,6 +100,7 @@ typedef unsigned portBASE_TYPE UBaseType_t; #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. @@ -170,7 +135,7 @@ This all assumes that interrupts are either entirely disabled or enabled. Interr will break this scheme. Remark: For the ESP32, portENTER_CRITICAL and portENTER_CRITICAL_ISR both alias vTaskEnterCritical, meaning -that either function can be called both from ISR as well as task context. This is not standard FreeRTOS +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) */ @@ -179,21 +144,21 @@ typedef spinlock_t portMUX_TYPE; #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 +#define portMUX_INITIALIZER_UNLOCKED SPINLOCK_INITIALIZER #define portCRITICAL_NESTING_IN_TCB 0 -static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux) +static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux) { spinlock_initialize(mux); } -static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux) +static inline void __attribute__((always_inline)) vPortCPUAcquireMutex(portMUX_TYPE *mux) { spinlock_acquire(mux, portMUX_NO_TIMEOUT); } -static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout) +static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout) { return (spinlock_acquire(mux, timeout)); } @@ -217,8 +182,8 @@ BaseType_t xPortInIsrContext(void); static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(portMUX_TYPE *mux) { - if(!xPortInIsrContext()) { - vPortEnterCritical(mux); + if(!xPortInIsrContext()) { + vPortEnterCritical(mux); } else { esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, __FUNCTION__); @@ -228,8 +193,8 @@ static inline void __attribute__((always_inline)) vPortEnterCriticalCompliance(p static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(portMUX_TYPE *mux) { - if(!xPortInIsrContext()) { - vPortExitCritical(mux); + if(!xPortInIsrContext()) { + vPortExitCritical(mux); } else { esp_rom_printf("%s:%d (%s)- port*_CRITICAL called from ISR context!\n", __FILE__, __LINE__, __FUNCTION__); @@ -242,7 +207,7 @@ static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(po * If the parent function is called from both ISR and Non-ISR context then call port*_CRITICAL_SAFE */ #define portENTER_CRITICAL(mux) vPortEnterCriticalCompliance(mux) -#define portEXIT_CRITICAL(mux) vPortExitCriticalCompliance(mux) +#define portEXIT_CRITICAL(mux) vPortExitCriticalCompliance(mux) #else #define portENTER_CRITICAL(mux) vPortEnterCritical(mux) #define portEXIT_CRITICAL(mux) vPortExitCritical(mux) @@ -253,20 +218,20 @@ static inline void __attribute__((always_inline)) vPortExitCriticalCompliance(po static inline void __attribute__((always_inline)) vPortEnterCriticalSafe(portMUX_TYPE *mux) { - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(mux); - } else { - portENTER_CRITICAL(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); - } + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(mux); + } else { + portEXIT_CRITICAL(mux); + } } #define portENTER_CRITICAL_SAFE(mux) vPortEnterCriticalSafe(mux) @@ -313,11 +278,11 @@ static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint #endif -static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { -#ifdef CONFIG_SPIRAM +#ifdef CONFIG_SPIRAM compare_and_set_extram(addr, compare, set); -#endif +#endif } @@ -344,9 +309,9 @@ void vPortYield( void ); void vPortEvaluateYieldFromISR(int argc, ...); void _frxt_setup_switch( void ); /** - * Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with, + * Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with, * or without arguments. - */ + */ #define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0, ##__VA_ARGS__,1,0) #define portGET_ARGUMENT_COUNT_INNER(zero, one, count, ...) count @@ -356,7 +321,7 @@ _Static_assert(portGET_ARGUMENT_COUNT(1) == 1, "portGET_ARGUMENT_COUNT() result #define portYIELD() vPortYield() /** - * @note The macro below could be used when passing a single argument, or without any argument, + * @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 */ @@ -523,4 +488,3 @@ void exit(int); #endif #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 new file mode 100644 index 000000000..843456b5a --- /dev/null +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro_priv.h @@ -0,0 +1,78 @@ +/* + 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/freertos/xtensa/include/freertos/xtensa_api.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_api.h similarity index 80% rename from tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_api.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_api.h index bdfd7151c..bd2bfeb20 100644 --- a/tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_api.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_api.h @@ -1,2 +1,2 @@ -/* This header file has been moved, please include in future */ +/* This header file has been moved, please include in future */ #include diff --git a/tools/sdk/esp32/include/freertos/xtensa/include/freertos/xtensa_config.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_config.h similarity index 99% rename from tools/sdk/esp32/include/freertos/xtensa/include/freertos/xtensa_config.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_config.h index 58baee2da..be8125c46 100644 --- a/tools/sdk/esp32/include/freertos/xtensa/include/freertos/xtensa_config.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_config.h @@ -59,26 +59,26 @@ extern "C" { * If this is not true, i.e. one or more interrupt handlers make deep calls then * the minimum must be increased. * -* If the Xtensa processor configuration includes coprocessors, then space is +* If the Xtensa processor configuration includes coprocessors, then space is * allocated to save the coprocessor state on the stack. * * If thread safety is enabled for the C runtime library, (XT_USE_THREAD_SAFE_CLIB * is defined) then space is allocated to save the C library context in the TCB. -* +* * Allocating insufficient stack space is a common source of hard-to-find errors. * During development, it is best to enable the FreeRTOS stack checking features. * * Usage: -* +* * XT_USE_THREAD_SAFE_CLIB -- Define this to a nonzero value to enable thread-safe * use of the C library. This will require extra stack * space to be allocated for tasks that use the C library * reentrant functions. See below for more information. -* +* * NOTE: The Xtensa toolchain supports multiple C libraries and not all of them * support thread safety. Check your core configuration to see which C library * was chosen for your system. -* +* * XT_STACK_MIN_SIZE -- The minimum stack size for any task. It is recommended * that you do not use a stack smaller than this for any * task. In case you want to use stacks smaller than this @@ -143,4 +143,3 @@ extern "C" { #endif #endif /* XTENSA_CONFIG_H */ - diff --git a/tools/sdk/esp32/include/freertos/xtensa/include/freertos/xtensa_context.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_context.h similarity index 78% rename from tools/sdk/esp32/include/freertos/xtensa/include/freertos/xtensa_context.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_context.h index c30701907..45c427286 100644 --- a/tools/sdk/esp32/include/freertos/xtensa/include/freertos/xtensa_context.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_context.h @@ -1,2 +1,2 @@ -/* This header file has been moved, please include in future */ +/* This header file has been moved, please include in future */ #include diff --git a/tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_rtos.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_rtos.h similarity index 99% rename from tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_rtos.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_rtos.h index e0e447595..d1b402379 100644 --- a/tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_rtos.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_rtos.h @@ -31,8 +31,8 @@ and macros for use primarily by Xtensa assembly coded source files. Macros in this header map callouts from generic Xtensa files to specific RTOS functions. It may also be included in C source files. -Xtensa RTOS ports support all RTOS-compatible configurations of the Xtensa -architecture, using the Xtensa hardware abstraction layer (HAL) to deal +Xtensa RTOS ports support all RTOS-compatible configurations of the Xtensa +architecture, using the Xtensa hardware abstraction layer (HAL) to deal with configuration specifics. Should be included by all Xtensa generic and RTOS port-specific sources. @@ -116,7 +116,7 @@ Some of these functions may call back to generic functions in xtensa_context.h . *******************************************************************************/ /* -Inform RTOS of entry into an interrupt handler that will affect it. +Inform RTOS of entry into an interrupt handler that will affect it. Allows RTOS to manage switch to any system stack and count nesting level. Called after minimal context has been saved, with interrupts disabled. RTOS port can call0 _xt_context_save to save the rest of the context. @@ -149,12 +149,12 @@ RTOS may optionally define XT_TICK_PER_SEC in its own way (eg. macro). #define XT_TICK_PER_SEC configTICK_RATE_HZ /* -Return in a15 the base address of the co-processor state save area for the +Return in a15 the base address of the co-processor state save area for the thread that triggered a co-processor exception, or 0 if no thread was running. -The state save area is structured as defined in xtensa_context.h and has size +The state save area is structured as defined in xtensa_context.h and has size XT_CP_SIZE. Co-processor instructions should only be used in thread code, never in interrupt handlers or the RTOS kernel. May only be called from assembly code -and by the 'call0' instruction. A result of 0 indicates an unrecoverable error. +and by the 'call0' instruction. A result of 0 indicates an unrecoverable error. The implementation may use only a2-4, a15 (all other regs must be preserved). */ // void* XT_RTOS_CP_STATE(void) @@ -170,7 +170,7 @@ and interrupt handlers to facilitate automated testing where each test case can install its own handler for user exceptions and each interrupt priority (level). This consists of an array of function pointers indexed by interrupt priority, with index 0 being the user exception handler hook. -Each entry in the array is initially 0, and may be replaced by a function +Each entry in the array is initially 0, and may be replaced by a function pointer of type XT_INTEXC_HOOK. A handler may be uninstalled by installing 0. The handler for low and medium priority obeys ABI conventions so may be coded @@ -229,4 +229,3 @@ Xtensa Port Version. #define XTENSA_PORT_VERSION_STRING "1.4.2" #endif /* XTENSA_RTOS_H */ - diff --git a/tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_timer.h b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_timer.h similarity index 98% rename from tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_timer.h rename to tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_timer.h index 473298352..b7f8dc703 100644 --- a/tools/sdk/esp32s2/include/freertos/xtensa/include/freertos/xtensa_timer.h +++ b/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/xtensa_timer.h @@ -52,9 +52,9 @@ and the Xtensa core configuration need not have a timer. #include "freertos/FreeRTOSConfig.h" /* -Select timer to use for periodic tick, and determine its interrupt number +Select timer to use for periodic tick, and determine its interrupt number and priority. User may specify a timer by defining XT_TIMER_INDEX with -D, -in which case its validity is checked (it must exist in this core and must +in which case its validity is checked (it must exist in this core and must not be on a high priority interrupt - an error will be reported in invalid). Otherwise select the first low or medium priority interrupt timer available. */ @@ -111,16 +111,16 @@ Otherwise select the first low or medium priority interrupt timer available. Set processor clock frequency, used to determine clock divisor for timer tick. User should BE SURE TO ADJUST THIS for the Xtensa platform being used. If using a supported board via the board-independent API defined in xtbsp.h, -this may be left undefined and frequency and tick divisor will be computed +this may be left undefined and frequency and tick divisor will be computed and cached during run-time initialization. NOTE ON SIMULATOR: -Under the Xtensa instruction set simulator, the frequency can only be estimated +Under the Xtensa instruction set simulator, the frequency can only be estimated because it depends on the speed of the host and the version of the simulator. Also because it runs much slower than hardware, it is not possible to achieve real-time performance for most applications under the simulator. A frequency too low does not allow enough time between timer interrupts, starving threads. -To obtain a more convenient but non-real-time tick duration on the simulator, +To obtain a more convenient but non-real-time tick duration on the simulator, compile with xt-xcc option "-DXT_SIMULATOR". Adjust this frequency to taste (it's not real-time anyway!). */ @@ -156,4 +156,3 @@ extern void _xt_tick_divisor_init(void); #endif #endif /* XTENSA_TIMER_H */ - diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal.h b/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal.h index 37200a19c..50e3c9138 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal.h @@ -69,4 +69,4 @@ int adc_hal_hall_convert(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal_conf.h b/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal_conf.h index dd0e64dfe..46af19887 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal_conf.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/adc_hal_conf.h @@ -28,4 +28,4 @@ #define SOC_ADC_SAR_CLK_DIV_DEFAULT(PERIPH_NUM) (2) -#define SOC_ADC_DIGI_SAR_CLK_DIV_DEFAULT (16) \ No newline at end of file +#define SOC_ADC_DIGI_SAR_CLK_DIV_DEFAULT (16) diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/adc_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/adc_ll.h index 8e1980b2e..ac8e9bd39 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/adc_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/adc_ll.h @@ -2,6 +2,7 @@ #include "soc/adc_periph.h" #include "hal/adc_types.h" +#include "soc/rtc_io_struct.h" #include #ifdef __cplusplus @@ -657,4 +658,4 @@ static inline void adc_ll_vref_output(adc_ll_num_t adc, adc_channel_t channel, b #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/aes_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/aes_ll.h new file mode 100644 index 000000000..8283397dd --- /dev/null +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/aes_ll.h @@ -0,0 +1,137 @@ +// 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. + +#pragma once + +#include "soc/hwcrypto_reg.h" +#include "soc/dport_access.h" +#include "hal/aes_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief State of AES accelerator, busy or idle + * + */ +typedef enum { + ESP_AES_STATE_BUSY = 0, /* Transform in progress */ + ESP_AES_STATE_IDLE, /* AES accelerator is idle */ +} esp_aes_state_t; + + +/** + * @brief Write the encryption/decryption key to hardware + * + * @param key Key to be written to the AES hardware + * @param key_word_len Number of words in the key + * + * @return Number of bytes written to hardware, used for fault injection check, + * if a write was skipped then this sum is likely to be wrong + */ +static inline uint8_t aes_ll_write_key(const uint8_t *key, size_t key_word_len) +{ + /* This variable is used for fault injection checks, so marked volatile to avoid optimisation */ + volatile uint8_t key_bytes_in_hardware = 0; + uint32_t *key_words = (uint32_t *)key; + + for (int i = 0; i < key_word_len; i++) { + DPORT_REG_WRITE(AES_KEY_BASE + i * 4, *(key_words + i)); + key_bytes_in_hardware += 4; + } + return key_bytes_in_hardware; +} + +/** + * @brief Sets the mode + * + * @param mode ESP_AES_ENCRYPT = 1, or ESP_AES_DECRYPT = 0 + * @param key_bytes Number of bytes in the key + */ +static inline void aes_ll_set_mode(int mode, uint8_t key_bytes) +{ + const uint32_t MODE_DECRYPT_BIT = 4; + unsigned mode_reg_base = (mode == ESP_AES_ENCRYPT) ? 0 : MODE_DECRYPT_BIT; + + /* See TRM for the mapping between keylength and mode bit */ + DPORT_REG_WRITE(AES_MODE_REG, mode_reg_base + ((key_bytes / 8) - 2)); +} + +/** + * @brief Writes message block to AES hardware + * + * @param input Block to be written + */ +static inline void aes_ll_write_block(const uint8_t *input) +{ + const uint32_t *input_words = (const uint32_t *)input; + uint32_t i0; + uint32_t i1; + uint32_t i2; + uint32_t i3; + + /* Storing i0,i1,i2,i3 in registers not an array + helps a lot with optimisations at -Os level */ + i0 = input_words[0]; + DPORT_REG_WRITE(AES_TEXT_BASE, i0); + + i1 = input_words[1]; + DPORT_REG_WRITE(AES_TEXT_BASE + 4, i1); + + i2 = input_words[2]; + DPORT_REG_WRITE(AES_TEXT_BASE + 8, i2); + + i3 = input_words[3]; + DPORT_REG_WRITE(AES_TEXT_BASE + 12, i3); +} + +/** + * @brief Read the AES block + * + * @note If a transform was ran then this is the output + * + * @param output the output of the transform, length = AES_BLOCK_BYTES + */ +static inline void aes_ll_read_block(void *output) +{ + uint32_t *output_words = (uint32_t *)output; + esp_dport_access_read_buffer(output_words, AES_TEXT_BASE, AES_BLOCK_WORDS); +} + + +/** + * @brief Starts block transform + * + */ +static inline void aes_ll_start_transform(void) +{ + DPORT_REG_WRITE(AES_START_REG, 1); +} + + +/** + * @brief Read state of AES accelerator + * + * @return esp_aes_state_t + */ +static inline esp_aes_state_t aes_ll_get_state(void) +{ + return DPORT_REG_READ(AES_IDLE_REG); +} + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/clk_gate_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/clk_gate_ll.h index 9c332dafe..b28295563 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/clk_gate_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/clk_gate_ll.h @@ -269,4 +269,4 @@ static inline bool IRAM_ATTR periph_ll_periph_enabled(periph_module_t periph) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h index 289be9849..2d3c510bb 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/gpio_ll.h @@ -414,4 +414,4 @@ static inline void gpio_ll_iomux_out(gpio_dev_t *hw, uint8_t gpio_num, int func, #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/i2c_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/i2c_ll.h index 7795c8cf7..557b563b0 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/i2c_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/i2c_ll.h @@ -67,6 +67,13 @@ typedef struct { uint16_t tout; /*!< I2C bus timeout period */ } i2c_clk_cal_t; +// I2C operation mode command +#define I2C_LL_CMD_RESTART 0 /*!fifo_conf.fifo_addr_cfg_en = 0; } +/** + * @brief Update I2C configuration + * + * @param hw Beginning address of the peripheral registers + * + * @return None + */ +static inline void i2c_ll_update(i2c_dev_t *hw) +{ + ;// ESP32 do not support +} + #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/i2s_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/i2s_ll.h index 0b2af70ef..96d4a3f8e 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/i2s_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/i2s_ll.h @@ -797,7 +797,7 @@ static inline void i2s_ll_set_tx_pdm_en(i2s_dev_t *hw, bool pdm_en) * * @param hw Peripheral I2S hardware instance address. * @param fp The fp value of TX PDM filter module group0. - * @param fs The fs value of TX PDM filter module group0. + * @param fs The fs value of TX PDM filter module group0. */ static inline void i2s_ll_tx_pdm_cfg(i2s_dev_t *hw, uint32_t fp, uint32_t fs) { diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/interrupt_controller_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/interrupt_controller_ll.h index 3c3d59814..b61fa47db 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/interrupt_controller_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/interrupt_controller_ll.h @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#pragma once +#pragma once #include #include "soc/soc_caps.h" @@ -25,18 +25,18 @@ extern "C" { /** * @brief enable interrupts specified by the mask - * - * @param mask bitmask of interrupts that needs to be enabled + * + * @param mask bitmask of interrupts that needs to be enabled */ -static inline void intr_cntrl_ll_enable_interrupts(uint32_t mask) +static inline void intr_cntrl_ll_enable_interrupts(uint32_t mask) { xt_ints_on(mask); } /** * @brief disable interrupts specified by the mask - * - * @param mask bitmask of interrupts that needs to be disabled + * + * @param mask bitmask of interrupts that needs to be disabled */ static inline void intr_cntrl_ll_disable_interrupts(uint32_t mask) { @@ -45,10 +45,10 @@ static inline void intr_cntrl_ll_disable_interrupts(uint32_t mask) /** * @brief checks if given interrupt number has a valid handler - * + * * @param intr interrupt number ranged from 0 to 31 * @param cpu cpu number ranged betweeen 0 to SOC_CPU_CORES_NUM - 1 - * @return true for valid handler, false otherwise + * @return true for valid handler, false otherwise */ static inline bool intr_cntrl_ll_has_handler(uint8_t intr, uint8_t cpu) { @@ -56,8 +56,8 @@ static inline bool intr_cntrl_ll_has_handler(uint8_t intr, uint8_t cpu) } /** - * @brief sets interrupt handler and optional argument of a given interrupt number - * + * @brief sets interrupt handler and optional argument of a given interrupt number + * * @param intr interrupt number ranged from 0 to 31 * @param handler handler invoked when an interrupt occurs * @param arg optional argument to pass to the handler @@ -68,10 +68,10 @@ static inline void intr_cntrl_ll_set_int_handler(uint8_t intr, interrupt_handler } /** - * @brief Gets argument passed to handler of a given interrupt number - * + * @brief Gets argument passed to handler of a given interrupt number + * * @param intr interrupt number ranged from 0 to 31 - * + * * @return argument used by handler of passed interrupt number */ static inline void * intr_cntrl_ll_get_int_handler_arg(uint8_t intr) @@ -81,18 +81,18 @@ static inline void * intr_cntrl_ll_get_int_handler_arg(uint8_t intr) /** * @brief Disables interrupts that are not located in iram - * + * * @param newmask mask of interrupts needs to be disabled * @return oldmask where to store old interrupts state */ -static inline uint32_t intr_cntrl_ll_disable_int_mask(uint32_t newmask) +static inline uint32_t intr_cntrl_ll_disable_int_mask(uint32_t newmask) { return xt_int_disable_mask(newmask); } /** * @brief Enables interrupts that are not located in iram - * + * * @param newmask mask of interrupts needs to be disabled */ static inline void intr_cntrl_ll_enable_int_mask(uint32_t newmask) @@ -102,4 +102,4 @@ static inline void intr_cntrl_ll_enable_int_mask(uint32_t newmask) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/ledc_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/ledc_ll.h index 4bbd90e88..f7331872b 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/ledc_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/ledc_ll.h @@ -463,4 +463,4 @@ static inline void ledc_ll_get_channel_timer(ledc_dev_t *hw, ledc_mode_t speed_m #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/mcpwm_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/mcpwm_ll.h index d31a810b2..350c5da18 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/mcpwm_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/mcpwm_ll.h @@ -732,4 +732,4 @@ static inline mcpwm_intr_t mcpwm_ll_get_cap_intr_def(int bit) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/mpu_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/mpu_ll.h index 08c230cdf..fc491e2b8 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/mpu_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/mpu_ll.h @@ -59,4 +59,4 @@ static inline void mpu_ll_set_region_illegal(uint32_t addr) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/pcnt_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/pcnt_ll.h index 0dce4bfe5..b5b20ff49 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/pcnt_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/pcnt_ll.h @@ -343,4 +343,4 @@ static inline void pcnt_ll_filter_disable(pcnt_dev_t *hw, pcnt_unit_t unit) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/rmt_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/rmt_ll.h index ebae2587d..e6435f18e 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/rmt_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/rmt_ll.h @@ -24,47 +24,14 @@ extern "C" { #define RMT_LL_HW_BASE (&RMT) #define RMT_LL_MEM_BASE (&RMTMEM) +// Note: TX and RX channel number are all index from zero in the LL driver +// i.e. tx_channel belongs to [0,7], and rx_channel belongs to [0,7] + static inline void rmt_ll_enable_drive_clock(rmt_dev_t *dev, bool enable) { dev->conf_ch[0].conf0.clk_en = enable; } -static inline void rmt_ll_reset_counter_clock_div(rmt_dev_t *dev, uint32_t channel) -{ - dev->conf_ch[channel].conf1.ref_cnt_rst = 1; - dev->conf_ch[channel].conf1.ref_cnt_rst = 0; -} - -static inline void rmt_ll_reset_tx_pointer(rmt_dev_t *dev, uint32_t channel) -{ - dev->conf_ch[channel].conf1.mem_rd_rst = 1; - dev->conf_ch[channel].conf1.mem_rd_rst = 0; -} - -static inline void rmt_ll_reset_rx_pointer(rmt_dev_t *dev, uint32_t channel) -{ - dev->conf_ch[channel].conf1.mem_wr_rst = 1; - dev->conf_ch[channel].conf1.mem_wr_rst = 0; -} - -static inline void rmt_ll_start_tx(rmt_dev_t *dev, uint32_t channel) -{ - dev->conf_ch[channel].conf1.tx_start = 1; -} - -static inline void rmt_ll_stop_tx(rmt_dev_t *dev, uint32_t channel) -{ - RMTMEM.chan[channel].data32[0].val = 0; - dev->conf_ch[channel].conf1.tx_start = 0; - dev->conf_ch[channel].conf1.mem_rd_rst = 1; - dev->conf_ch[channel].conf1.mem_rd_rst = 0; -} - -static inline void rmt_ll_enable_rx(rmt_dev_t *dev, uint32_t channel, bool enable) -{ - dev->conf_ch[channel].conf1.rx_en = enable; -} - static inline void rmt_ll_power_down_mem(rmt_dev_t *dev, bool enable) { dev->conf_ch[0].conf0.mem_pd = enable; // Only conf0 register of channel0 has `mem_pd` @@ -75,78 +42,12 @@ static inline bool rmt_ll_is_mem_power_down(rmt_dev_t *dev) return dev->conf_ch[0].conf0.mem_pd; // Only conf0 register of channel0 has `mem_pd` } -static inline void rmt_ll_set_mem_blocks(rmt_dev_t *dev, uint32_t channel, uint8_t block_num) -{ - dev->conf_ch[channel].conf0.mem_size = block_num; -} - -static inline uint32_t rmt_ll_get_mem_blocks(rmt_dev_t *dev, uint32_t channel) -{ - return dev->conf_ch[channel].conf0.mem_size; -} - -static inline void rmt_ll_set_counter_clock_div(rmt_dev_t *dev, uint32_t channel, uint32_t div) -{ - dev->conf_ch[channel].conf0.div_cnt = div; -} - -static inline uint32_t rmt_ll_get_counter_clock_div(rmt_dev_t *dev, uint32_t channel) -{ - uint32_t div = dev->conf_ch[channel].conf0.div_cnt; - return div == 0 ? 256 : div; -} - -static inline void rmt_ll_enable_tx_pingpong(rmt_dev_t *dev, bool enable) -{ - dev->apb_conf.mem_tx_wrap_en = enable; -} - static inline void rmt_ll_enable_mem_access(rmt_dev_t *dev, bool enable) { dev->apb_conf.fifo_mask = enable; } -static inline void rmt_ll_set_rx_idle_thres(rmt_dev_t *dev, uint32_t channel, uint32_t thres) -{ - dev->conf_ch[channel].conf0.idle_thres = thres; -} - -static inline uint32_t rmt_ll_get_rx_idle_thres(rmt_dev_t *dev, uint32_t channel) -{ - return dev->conf_ch[channel].conf0.idle_thres; -} - -static inline void rmt_ll_set_mem_owner(rmt_dev_t *dev, uint32_t channel, uint8_t owner) -{ - dev->conf_ch[channel].conf1.mem_owner = owner; -} - -static inline uint32_t rmt_ll_get_mem_owner(rmt_dev_t *dev, uint32_t channel) -{ - return dev->conf_ch[channel].conf1.mem_owner; -} - -static inline void rmt_ll_enable_tx_loop(rmt_dev_t *dev, uint32_t channel, bool enable) -{ - dev->conf_ch[channel].conf1.tx_conti_mode = enable; -} - -static inline bool rmt_ll_is_tx_loop_enabled(rmt_dev_t *dev, uint32_t channel) -{ - return dev->conf_ch[channel].conf1.tx_conti_mode; -} - -static inline void rmt_ll_enable_rx_filter(rmt_dev_t *dev, uint32_t channel, bool enable) -{ - dev->conf_ch[channel].conf1.rx_filter_en = enable; -} - -static inline void rmt_ll_set_rx_filter_thres(rmt_dev_t *dev, uint32_t channel, uint32_t thres) -{ - dev->conf_ch[channel].conf1.rx_filter_thres = thres; -} - -static inline void rmt_ll_set_counter_clock_src(rmt_dev_t *dev, uint32_t channel, uint8_t src) +static inline void rmt_ll_set_counter_clock_src(rmt_dev_t *dev, uint32_t channel, uint8_t src, uint8_t div_num, uint8_t div_a, uint8_t div_b) { dev->conf_ch[channel].conf1.ref_always_on = src; } @@ -156,7 +57,136 @@ static inline uint32_t rmt_ll_get_counter_clock_src(rmt_dev_t *dev, uint32_t cha return dev->conf_ch[channel].conf1.ref_always_on; } -static inline void rmt_ll_enable_tx_idle(rmt_dev_t *dev, uint32_t channel, bool enable) +static inline void rmt_ll_tx_reset_counter_clock_div(rmt_dev_t *dev, uint32_t channel) +{ + dev->conf_ch[channel].conf1.ref_cnt_rst = 1; + dev->conf_ch[channel].conf1.ref_cnt_rst = 0; +} + +static inline void rmt_ll_rx_reset_counter_clock_div(rmt_dev_t *dev, uint32_t channel) +{ + dev->conf_ch[channel].conf1.ref_cnt_rst = 1; + dev->conf_ch[channel].conf1.ref_cnt_rst = 0; +} + +static inline void rmt_ll_tx_reset_pointer(rmt_dev_t *dev, uint32_t channel) +{ + dev->conf_ch[channel].conf1.mem_rd_rst = 1; + dev->conf_ch[channel].conf1.mem_rd_rst = 0; +} + +static inline void rmt_ll_rx_reset_pointer(rmt_dev_t *dev, uint32_t channel) +{ + dev->conf_ch[channel].conf1.mem_wr_rst = 1; + dev->conf_ch[channel].conf1.mem_wr_rst = 0; +} + +static inline void rmt_ll_tx_start(rmt_dev_t *dev, uint32_t channel) +{ + dev->conf_ch[channel].conf1.tx_start = 1; +} + +static inline void rmt_ll_tx_stop(rmt_dev_t *dev, uint32_t channel) +{ + RMTMEM.chan[channel].data32[0].val = 0; + dev->conf_ch[channel].conf1.tx_start = 0; + dev->conf_ch[channel].conf1.mem_rd_rst = 1; + dev->conf_ch[channel].conf1.mem_rd_rst = 0; +} + +static inline void rmt_ll_rx_enable(rmt_dev_t *dev, uint32_t channel, bool enable) +{ + dev->conf_ch[channel].conf1.rx_en = enable; +} + +static inline void rmt_ll_tx_set_mem_blocks(rmt_dev_t *dev, uint32_t channel, uint8_t block_num) +{ + dev->conf_ch[channel].conf0.mem_size = block_num; +} + +static inline void rmt_ll_rx_set_mem_blocks(rmt_dev_t *dev, uint32_t channel, uint8_t block_num) +{ + dev->conf_ch[channel].conf0.mem_size = block_num; +} + +static inline uint32_t rmt_ll_tx_get_mem_blocks(rmt_dev_t *dev, uint32_t channel) +{ + return dev->conf_ch[channel].conf0.mem_size; +} + +static inline uint32_t rmt_ll_rx_get_mem_blocks(rmt_dev_t *dev, uint32_t channel) +{ + return dev->conf_ch[channel].conf0.mem_size; +} + +static inline void rmt_ll_tx_set_counter_clock_div(rmt_dev_t *dev, uint32_t channel, uint32_t div) +{ + dev->conf_ch[channel].conf0.div_cnt = div; +} + +static inline void rmt_ll_rx_set_counter_clock_div(rmt_dev_t *dev, uint32_t channel, uint32_t div) +{ + dev->conf_ch[channel].conf0.div_cnt = div; +} + +static inline uint32_t rmt_ll_tx_get_counter_clock_div(rmt_dev_t *dev, uint32_t channel) +{ + uint32_t div = dev->conf_ch[channel].conf0.div_cnt; + return div == 0 ? 256 : div; +} + +static inline uint32_t rmt_ll_rx_get_counter_clock_div(rmt_dev_t *dev, uint32_t channel) +{ + uint32_t div = dev->conf_ch[channel].conf0.div_cnt; + return div == 0 ? 256 : div; +} + +static inline void rmt_ll_tx_enable_pingpong(rmt_dev_t *dev, uint32_t channel, bool enable) +{ + dev->apb_conf.mem_tx_wrap_en = enable; +} + +static inline void rmt_ll_rx_set_idle_thres(rmt_dev_t *dev, uint32_t channel, uint32_t thres) +{ + dev->conf_ch[channel].conf0.idle_thres = thres; +} + +static inline uint32_t rmt_ll_rx_get_idle_thres(rmt_dev_t *dev, uint32_t channel) +{ + return dev->conf_ch[channel].conf0.idle_thres; +} + +static inline void rmt_ll_rx_set_mem_owner(rmt_dev_t *dev, uint32_t channel, uint8_t owner) +{ + dev->conf_ch[channel].conf1.mem_owner = owner; +} + +static inline uint32_t rmt_ll_rx_get_mem_owner(rmt_dev_t *dev, uint32_t channel) +{ + return dev->conf_ch[channel].conf1.mem_owner; +} + +static inline void rmt_ll_tx_enable_loop(rmt_dev_t *dev, uint32_t channel, bool enable) +{ + dev->conf_ch[channel].conf1.tx_conti_mode = enable; +} + +static inline bool rmt_ll_is_tx_loop_enabled(rmt_dev_t *dev, uint32_t channel) +{ + return dev->conf_ch[channel].conf1.tx_conti_mode; +} + +static inline void rmt_ll_rx_enable_filter(rmt_dev_t *dev, uint32_t channel, bool enable) +{ + dev->conf_ch[channel].conf1.rx_filter_en = enable; +} + +static inline void rmt_ll_rx_set_filter_thres(rmt_dev_t *dev, uint32_t channel, uint32_t thres) +{ + dev->conf_ch[channel].conf1.rx_filter_thres = thres; +} + +static inline void rmt_ll_tx_enable_idle(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->conf_ch[channel].conf1.idle_out_en = enable; } @@ -166,22 +196,27 @@ static inline bool rmt_ll_is_tx_idle_enabled(rmt_dev_t *dev, uint32_t channel) return dev->conf_ch[channel].conf1.idle_out_en; } -static inline void rmt_ll_set_tx_idle_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) +static inline void rmt_ll_tx_set_idle_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) { dev->conf_ch[channel].conf1.idle_out_lv = level; } -static inline uint32_t rmt_ll_get_tx_idle_level(rmt_dev_t *dev, uint32_t channel) +static inline uint32_t rmt_ll_tx_get_idle_level(rmt_dev_t *dev, uint32_t channel) { return dev->conf_ch[channel].conf1.idle_out_lv; } -static inline uint32_t rmt_ll_get_channel_status(rmt_dev_t *dev, uint32_t channel) +static inline uint32_t rmt_ll_rx_get_channel_status(rmt_dev_t *dev, uint32_t channel) { return dev->status_ch[channel]; } -static inline void rmt_ll_set_tx_limit(rmt_dev_t *dev, uint32_t channel, uint32_t limit) +static inline uint32_t rmt_ll_tx_get_channel_status(rmt_dev_t *dev, uint32_t channel) +{ + return dev->status_ch[channel]; +} + +static inline void rmt_ll_tx_set_limit(rmt_dev_t *dev, uint32_t channel, uint32_t limit) { dev->tx_lim_ch[channel].limit = limit; } @@ -198,7 +233,13 @@ static inline void rmt_ll_enable_rx_end_interrupt(rmt_dev_t *dev, uint32_t chann dev->int_ena.val |= (enable << (channel * 3 + 1)); } -static inline void rmt_ll_enable_err_interrupt(rmt_dev_t *dev, uint32_t channel, bool enable) +static inline void rmt_ll_enable_tx_err_interrupt(rmt_dev_t *dev, uint32_t channel, bool enable) +{ + dev->int_ena.val &= ~(1 << (channel * 3 + 2)); + dev->int_ena.val |= (enable << (channel * 3 + 2)); +} + +static inline void rmt_ll_enable_rx_err_interrupt(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->int_ena.val &= ~(1 << (channel * 3 + 2)); dev->int_ena.val |= (enable << (channel * 3 + 2)); @@ -220,7 +261,12 @@ static inline void rmt_ll_clear_rx_end_interrupt(rmt_dev_t *dev, uint32_t channe dev->int_clr.val = (1 << (channel * 3 + 1)); } -static inline void rmt_ll_clear_err_interrupt(rmt_dev_t *dev, uint32_t channel) +static inline void rmt_ll_clear_tx_err_interrupt(rmt_dev_t *dev, uint32_t channel) +{ + dev->int_clr.val = (1 << (channel * 3 + 2)); +} + +static inline void rmt_ll_clear_rx_err_interrupt(rmt_dev_t *dev, uint32_t channel) { dev->int_clr.val = (1 << (channel * 3 + 2)); } @@ -244,7 +290,14 @@ static inline uint32_t rmt_ll_get_rx_end_interrupt_status(rmt_dev_t *dev) ((status & 0x2000) >> 9) | ((status & 0x10000) >> 11) | ((status & 0x80000) >> 13) | ((status & 0x400000) >> 15); } -static inline uint32_t rmt_ll_get_err_interrupt_status(rmt_dev_t *dev) +static inline uint32_t rmt_ll_get_tx_err_interrupt_status(rmt_dev_t *dev) +{ + uint32_t status = dev->int_st.val; + return ((status & 0x04) >> 2) | ((status & 0x20) >> 4) | ((status & 0x100) >> 6) | ((status & 0x800) >> 8) | + ((status & 0x4000) >> 10) | ((status & 0x20000) >> 12) | ((status & 0x100000) >> 14) | ((status & 0x800000) >> 16); +} + +static inline uint32_t rmt_ll_get_rx_err_interrupt_status(rmt_dev_t *dev) { uint32_t status = dev->int_st.val; return ((status & 0x04) >> 2) | ((status & 0x20) >> 4) | ((status & 0x100) >> 6) | ((status & 0x800) >> 8) | @@ -257,24 +310,24 @@ static inline uint32_t rmt_ll_get_tx_thres_interrupt_status(rmt_dev_t *dev) return (status & 0xFF000000) >> 24; } -static inline void rmt_ll_set_tx_carrier_high_low_ticks(rmt_dev_t *dev, uint32_t channel, uint32_t high_ticks, uint32_t low_ticks) +static inline void rmt_ll_tx_set_carrier_high_low_ticks(rmt_dev_t *dev, uint32_t channel, uint32_t high_ticks, uint32_t low_ticks) { dev->carrier_duty_ch[channel].high = high_ticks; dev->carrier_duty_ch[channel].low = low_ticks; } -static inline void rmt_ll_get_carrier_high_low_ticks(rmt_dev_t *dev, uint32_t channel, uint32_t *high_ticks, uint32_t *low_ticks) +static inline void rmt_ll_tx_get_carrier_high_low_ticks(rmt_dev_t *dev, uint32_t channel, uint32_t *high_ticks, uint32_t *low_ticks) { *high_ticks = dev->carrier_duty_ch[channel].high; *low_ticks = dev->carrier_duty_ch[channel].low; } -static inline void rmt_ll_enable_carrier(rmt_dev_t *dev, uint32_t channel, bool enable) +static inline void rmt_ll_tx_enable_carrier_modulation(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->conf_ch[channel].conf0.carrier_en = enable; } -static inline void rmt_ll_set_carrier_on_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) +static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) { dev->conf_ch[channel].conf0.carrier_out_lv = level; } @@ -288,8 +341,12 @@ static inline void rmt_ll_write_memory(rmt_mem_t *mem, uint32_t channel, const r } } +static inline void rmt_ll_config_update(rmt_dev_t *dev, uint32_t channel) +{ +} + /************************************************************************************************ - * Following Low Level APIs only used for backward compatible, will be deprecated in the future! + * Following Low Level APIs only used for backward compatible, will be deprecated in the IDF v5.0 ***********************************************************************************************/ static inline void rmt_ll_set_intr_enable_mask(uint32_t mask) diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_cntl_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_cntl_ll.h index 3c77d4c0c..f026da853 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_cntl_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_cntl_ll.h @@ -52,4 +52,4 @@ static inline void rtc_cntl_ll_ulp_wakeup_enable(void) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_io_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_io_ll.h index 284e1f3ac..3e5a1af8f 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_io_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/rtc_io_ll.h @@ -365,4 +365,4 @@ static inline void rtcio_ll_ext0_set_wakeup_pin(int rtcio_num, int level) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/sigmadelta_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/sigmadelta_ll.h index 2e605ee59..929546fe0 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/sigmadelta_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/sigmadelta_ll.h @@ -70,4 +70,4 @@ static inline void sigmadelta_ll_set_prescale(gpio_sd_dev_t *hw, sigmadelta_chan #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/soc_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/soc_ll.h index 93f4bbf64..234248368 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/soc_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/soc_ll.h @@ -51,4 +51,4 @@ static inline void soc_ll_reset_core(int core) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/spi_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/spi_ll.h index 9c410d3de..a2973e3f1 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/spi_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/spi_ll.h @@ -39,7 +39,8 @@ extern "C" { #define SPI_LL_UNUSED_INT_MASK (SPI_INT_EN | SPI_SLV_WR_STA_DONE | SPI_SLV_RD_STA_DONE | SPI_SLV_WR_BUF_DONE | SPI_SLV_RD_BUF_DONE) /// Swap the bit order to its correct place to send #define HAL_SPI_SWAP_DATA_TX(data, len) HAL_SWAP32((uint32_t)data<<(32-len)) - +/// This is the expected clock frequency +#define SPI_LL_PERIPH_CLK_FREQ (80 * 1000000) #define SPI_LL_GET_HW(ID) ((ID)==0? &SPI1:((ID)==1? &SPI2 : &SPI3)) /** @@ -153,11 +154,11 @@ static inline uint32_t spi_ll_get_running_cmd(spi_dev_t *hw) } /** - * Reset SPI CPU FIFO + * Reset SPI CPU TX FIFO * * @param hw Beginning address of the peripheral registers. */ -static inline void spi_ll_cpu_fifo_reset(spi_dev_t *hw) +static inline void spi_ll_cpu_tx_fifo_reset(spi_dev_t *hw) { //This is not used in esp32 } @@ -167,7 +168,32 @@ static inline void spi_ll_cpu_fifo_reset(spi_dev_t *hw) * * @param hw Beginning address of the peripheral registers. */ -static inline void spi_ll_dma_fifo_reset(spi_dev_t *hw) +static inline void spi_ll_cpu_rx_fifo_reset(spi_dev_t *hw) +{ + //This is not used in esp32 +} + +/** + * Reset SPI DMA TX FIFO + * + * On ESP32, this function is not seperated + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_dma_tx_fifo_reset(spi_dev_t *hw) +{ + hw->dma_conf.val |= SPI_LL_DMA_FIFO_RST_MASK; + hw->dma_conf.val &= ~SPI_LL_DMA_FIFO_RST_MASK; +} + +/** + * Reset SPI DMA RX FIFO + * + * On ESP32, this function is not seperated + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_dma_rx_fifo_reset(spi_dev_t *hw) { hw->dma_conf.val |= SPI_LL_DMA_FIFO_RST_MASK; hw->dma_conf.val &= ~SPI_LL_DMA_FIFO_RST_MASK; @@ -175,7 +201,7 @@ static inline void spi_ll_dma_fifo_reset(spi_dev_t *hw) /** * Clear in fifo full error - * + * * @param hw Beginning address of the peripheral registers. */ static inline void spi_ll_infifo_full_clr(spi_dev_t *hw) @@ -185,7 +211,7 @@ static inline void spi_ll_infifo_full_clr(spi_dev_t *hw) /** * Clear out fifo empty error - * + * * @param hw Beginning address of the peripheral registers. */ static inline void spi_ll_outfifo_empty_clr(spi_dev_t *hw) @@ -219,6 +245,17 @@ static inline void spi_ll_dma_tx_enable(spi_dev_t *hw, bool enable) //This is not used in esp32 } +/** + * Configuration of RX DMA EOF interrupt generation way + * + * @param hw Beginning address of the peripheral registers. + * @param enable 1: spi_dma_inlink_eof is set when the number of dma pushed data bytes is equal to the value of spi_slv/mst_dma_rd_bytelen[19:0] in spi dma transition. 0: spi_dma_inlink_eof is set by spi_trans_done in non-seg-trans or spi_dma_seg_trans_done in seg-trans. + */ +static inline void spi_ll_dma_set_rx_eof_generation(spi_dev_t *hw, bool enable) +{ + //This is not used in esp32 +} + /*------------------------------------------------------------------------------ * Buffer *----------------------------------------------------------------------------*/ @@ -902,7 +939,7 @@ static inline void spi_ll_enable_int(spi_dev_t *hw) } /*------------------------------------------------------------------------------ - * DMA: + * DMA: * RX DMA (Peripherals->DMA->RAM) * TX DMA (RAM->DMA->Peripherals) *----------------------------------------------------------------------------*/ @@ -913,7 +950,7 @@ static inline void spi_ll_enable_int(spi_dev_t *hw) */ static inline void spi_dma_ll_rx_reset(spi_dma_dev_t *dma_in) { - //Reset RX DMA peripheral + //Reset RX DMA peripheral dma_in->dma_conf.in_rst = 1; dma_in->dma_conf.in_rst = 0; } @@ -936,7 +973,7 @@ static inline void spi_dma_ll_rx_start(spi_dma_dev_t *dma_in, lldesc_t *addr) * @param dma_in Beginning address of the DMA peripheral registers which stores the data received from a peripheral into RAM. * @param enable True to enable, false to disable */ -static inline void spi_dma_ll_rx_enable_burst_data(spi_dma_dev_t *dma_out, bool enable) +static inline void spi_dma_ll_rx_enable_burst_data(spi_dma_dev_t *dma_in, bool enable) { //This is not supported in esp32 } @@ -952,17 +989,6 @@ static inline void spi_dma_ll_rx_enable_burst_desc(spi_dma_dev_t *dma_in, bool e dma_in->dma_conf.indscr_burst_en = enable; } -/** - * Configuration of RX DMA EOF interrupt generation way - * - * @param dma_in Beginning address of the DMA peripheral registers which stores the data received from a peripheral into RAM. - * @param enable 1: spi_dma_inlink_eof is set when the number of dma pushed data bytes is equal to the value of spi_slv/mst_dma_rd_bytelen[19:0] in spi dma transition. 0: spi_dma_inlink_eof is set by spi_trans_done in non-seg-trans or spi_dma_seg_trans_done in seg-trans. - */ -static inline void spi_dma_ll_set_rx_eof_generation(spi_dma_dev_t *dma_in, bool enable) -{ - //does not available in ESP32 -} - /** * Reset TX DMA which transmits the data from RAM to a peripheral. * @@ -1009,6 +1035,17 @@ static inline void spi_dma_ll_tx_enable_burst_desc(spi_dma_dev_t *dma_out, bool dma_out->dma_conf.outdscr_burst_en = enable; } +/** + * Configuration of OUT EOF flag generation way + * + * @param dma_out Beginning address of the DMA peripheral registers which transmits the data from RAM to a peripheral. + * @param enable 1: when dma pop all data from fifo 0:when ahb push all data to fifo. + */ +static inline void spi_dma_ll_set_out_eof_generation(spi_dma_dev_t *dma_out, bool enable) +{ + dma_out->dma_conf.out_eof_mode = enable; +} + /** * Enable automatic outlink-writeback * @@ -1025,4 +1062,4 @@ static inline void spi_dma_ll_enable_out_auto_wrback(spi_dma_dev_t *dma_out, boo #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/timer_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/timer_ll.h index adfe26616..447f3fded 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/timer_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/timer_ll.h @@ -103,6 +103,7 @@ static inline void timer_ll_set_counter_value(timg_dev_t *hw, timer_idx_t timer_ FORCE_INLINE_ATTR void timer_ll_get_counter_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *timer_val) { hw->hw_timer[timer_num].update = 1; + while (hw->hw_timer[timer_num].update) {} *timer_val = ((uint64_t) hw->hw_timer[timer_num].cnt_high << 32) | (hw->hw_timer[timer_num].cnt_low); } @@ -302,7 +303,7 @@ FORCE_INLINE_ATTR void timer_ll_clear_intr_status(timg_dev_t *hw, timer_idx_t ti */ FORCE_INLINE_ATTR void timer_ll_get_intr_status(timg_dev_t *hw, uint32_t *intr_status) { - *intr_status = hw->int_st_timers.val; + *intr_status = hw->int_st_timers.val & 0x03; } /** @@ -316,7 +317,7 @@ FORCE_INLINE_ATTR void timer_ll_get_intr_status(timg_dev_t *hw, uint32_t *intr_s FORCE_INLINE_ATTR void timer_ll_get_intr_raw_status(timer_group_t group_num, uint32_t *intr_raw_status) { timg_dev_t *hw = TIMER_LL_GET_HW(group_num); - *intr_raw_status = hw->int_raw.val; + *intr_raw_status = hw->int_raw.val & 0x03; } /** diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_hal.h b/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_hal.h index 276153022..64c988f4e 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_hal.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_hal.h @@ -132,4 +132,4 @@ void touch_hal_get_wakeup_status(touch_pad_t *pad_num); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_ll.h index b65120b68..0b876039b 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/touch_sensor_ll.h @@ -233,6 +233,7 @@ static inline void touch_ll_get_tie_option(touch_pad_t touch_num, touch_tie_opt_ */ static inline void touch_ll_set_fsm_mode(touch_fsm_mode_t mode) { + SENS.sar_touch_ctrl2.touch_start_fsm_en = 1; SENS.sar_touch_ctrl2.touch_start_en = 0; SENS.sar_touch_ctrl2.touch_start_force = mode; } diff --git a/tools/sdk/esp32/include/hal/esp32/include/hal/uart_ll.h b/tools/sdk/esp32/include/hal/esp32/include/hal/uart_ll.h index 905c149c4..47ed21abf 100644 --- a/tools/sdk/esp32/include/hal/esp32/include/hal/uart_ll.h +++ b/tools/sdk/esp32/include/hal/esp32/include/hal/uart_ll.h @@ -58,27 +58,63 @@ typedef enum { UART_INTR_CMD_CHAR_DET = (0x1<<18), } uart_intr_t; +/** + * @brief Set the UART source clock. + * + * @param hw Beginning address of the peripheral registers. + * @param source_clk The UART source clock. The source clock can be APB clock or REF_TICK. + * If the source clock is REF_TICK, the UART can still work when the APB changes. + * + * @return None. + */ +static inline void uart_ll_set_sclk(uart_dev_t *hw, uart_sclk_t source_clk) +{ + hw->conf0.tick_ref_always_on = (source_clk == UART_SCLK_APB) ? 1 : 0; +} + +/** + * @brief Get the UART source clock type. + * + * @param hw Beginning address of the peripheral registers. + * @param source_clk The pointer to accept the UART source clock type. + * + * @return None. + */ +static inline void uart_ll_get_sclk(uart_dev_t *hw, uart_sclk_t* source_clk) +{ + *source_clk = hw->conf0.tick_ref_always_on ? UART_SCLK_APB : UART_SCLK_REF_TICK; +} + +/** + * @brief Get the UART source clock frequency. + * + * @param hw Beginning address of the peripheral registers. + * + * @return Current source clock frequency + */ +static inline uint32_t uart_ll_get_sclk_freq(uart_dev_t *hw) +{ + return (hw->conf0.tick_ref_always_on) ? APB_CLK_FREQ : REF_CLK_FREQ; +} /** * @brief Configure the baud-rate. * * @param hw Beginning address of the peripheral registers. * @param baud The baud-rate to be set. When the source clock is APB, the max baud-rate is `UART_LL_BITRATE_MAX` - * @param source_clk The UART source clock. The source clock can be APB clock or REF_TICK. - * If the source clock is REF_TICK, the UART can still work when the APB changes. - * + * @return None */ -static inline void uart_ll_set_baudrate(uart_dev_t *hw, uart_sclk_t source_clk, uint32_t baud) +static inline void uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud) { - uint32_t sclk_freq = (source_clk == UART_SCLK_APB) ? APB_CLK_FREQ : REF_CLK_FREQ; - uint32_t clk_div = ((sclk_freq) << 4) / baud; + uint32_t sclk_freq, clk_div; + + sclk_freq = uart_ll_get_sclk_freq(hw); + clk_div = ((sclk_freq) << 4) / baud; // The baud-rate configuration register is divided into // an integer part and a fractional part. hw->clk_div.div_int = clk_div >> 4; hw->clk_div.div_frag = clk_div & 0xf; - // Configure the UART source clock. - hw->conf0.tick_ref_always_on = (source_clk == UART_SCLK_APB); } /** @@ -90,9 +126,9 @@ static inline void uart_ll_set_baudrate(uart_dev_t *hw, uart_sclk_t source_clk, */ static inline uint32_t uart_ll_get_baudrate(uart_dev_t *hw) { - uint32_t src_clk = hw->conf0.tick_ref_always_on ? APB_CLK_FREQ : REF_CLK_FREQ; + uint32_t sclk_freq = uart_ll_get_sclk_freq(hw); typeof(hw->clk_div) div_reg = hw->clk_div; - return ((src_clk << 4)) / ((div_reg.div_int << 4) | div_reg.div_frag); + return ((sclk_freq << 4)) / ((div_reg.div_int << 4) | div_reg.div_frag); } /** @@ -526,19 +562,6 @@ static inline void uart_ll_set_data_bit_num(uart_dev_t *hw, uart_word_length_t d hw->conf0.bit_num = data_bit; } -/** - * @brief Get the UART source clock. - * - * @param hw Beginning address of the peripheral registers. - * @param source_clk The pointer to accept the UART source clock configuration. - * - * @return None. - */ -static inline void uart_ll_get_sclk(uart_dev_t *hw, uart_sclk_t* source_clk) -{ - *source_clk = hw->conf0.tick_ref_always_on ? UART_SCLK_APB : UART_SCLK_REF_TICK; -} - /** * @brief Set the rts active level. * diff --git a/tools/sdk/esp32/include/hal/include/hal/adc_hal.h b/tools/sdk/esp32/include/hal/include/hal/adc_hal.h index 3a0a5a5c5..ea952b647 100644 --- a/tools/sdk/esp32/include/hal/include/hal/adc_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/adc_hal.h @@ -185,11 +185,6 @@ int adc_hal_convert(adc_ll_num_t adc_n, int channel, int *value); /*--------------------------------------------------------------- Digital controller setting ---------------------------------------------------------------*/ -/** - * Digital controller initialization. - */ -void adc_hal_digi_init(void); - /** * Digital controller deinitialization. */ @@ -208,3 +203,74 @@ void adc_hal_digi_controller_config(const adc_digi_config_t *cfg); * @param adc_n ADC unit. */ #define adc_hal_digi_clear_pattern_table(adc_n) adc_ll_digi_clear_pattern_table(adc_n) + +#if CONFIG_IDF_TARGET_ESP32C3 +/*--------------------------------------------------------------- + DMA setting +---------------------------------------------------------------*/ +#include "soc/gdma_struct.h" +#include "hal/gdma_ll.h" +#include "hal/dma_types.h" +#include "hal/adc_ll.h" +#include "hal/dma_types.h" + +typedef struct adc_dma_hal_context_t { + gdma_dev_t *dev; //address of the general DMA +} adc_dma_hal_context_t; + +typedef struct adc_dma_hal_config_t { + dma_descriptor_t *rx_desc; //dma descriptor + dma_descriptor_t *cur_desc_ptr; //pointer to the current descriptor + uint32_t desc_max_num; //number of the descriptors linked once + uint32_t desc_cnt; + uint32_t dma_chan; +} adc_dma_hal_config_t; + +void adc_hal_digi_dma_multi_descriptor(adc_dma_hal_config_t *dma_config, uint8_t *data_buf, uint32_t size, uint32_t num); + +void adc_hal_digi_rxdma_start(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config); + +void adc_hal_digi_rxdma_stop(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config); + +void adc_hal_digi_ena_intr(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config, uint32_t mask); + +void adc_hal_digi_clr_intr(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config, uint32_t mask); + +void adc_hal_digi_dis_intr(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config, uint32_t mask); + +void adc_hal_digi_set_eof_num(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config, uint32_t num); + +void adc_hal_digi_start(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config); + +void adc_hal_digi_stop(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config); + +void adc_hal_digi_init(adc_dma_hal_context_t *adc_dma_ctx, adc_dma_hal_config_t *dma_config); + +/*--------------------------------------------------------------- + Single Read +---------------------------------------------------------------*/ +void adc_hal_onetime_start(adc_digi_config_t *adc_digi_config); + +void adc_hal_adc1_onetime_sample_enable(bool enable); + +void adc_hal_adc2_onetime_sample_enable(bool enable); + +void adc_hal_onetime_channel(adc_ll_num_t unit, adc_channel_t channel); + +void adc_hal_set_onetime_atten(adc_atten_t atten); + +uint32_t adc_hal_adc1_read(void); + +uint32_t adc_hal_adc2_read(void); + +void adc_hal_intr_enable(adc_event_t event); + +void adc_hal_intr_disable(adc_event_t event); + +void adc_hal_intr_clear(adc_event_t event); + +bool adc_hal_intr_get_raw(adc_event_t event); + +bool adc_hal_intr_get_status(adc_event_t event); + +#endif //#if CONFIG_IDF_TARGET_ESP32C3 diff --git a/tools/sdk/esp32/include/hal/include/hal/adc_types.h b/tools/sdk/esp32/include/hal/include/hal/adc_types.h index b6e77b809..dea8ab0ec 100644 --- a/tools/sdk/esp32/include/hal/include/hal/adc_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/adc_types.h @@ -81,20 +81,20 @@ typedef enum { /** * @brief ADC resolution setting option. * - * @note For ESP32-S2. Only 13 bit resolution is supported. - * For ESP32. 13 bit resolution is not supported. */ typedef enum { - ADC_WIDTH_BIT_9 = 0, /*!< ADC capture width is 9Bit. Only ESP32 is supported. */ - ADC_WIDTH_BIT_10 = 1, /*!< ADC capture width is 10Bit. Only ESP32 is supported. */ - ADC_WIDTH_BIT_11 = 2, /*!< ADC capture width is 11Bit. Only ESP32 is supported. */ - ADC_WIDTH_BIT_12 = 3, /*!< ADC capture width is 12Bit. Only ESP32 is supported. */ -#if !CONFIG_IDF_TARGET_ESP32 - ADC_WIDTH_BIT_13 = 4, /*!< ADC capture width is 13Bit. Only ESP32-S2 is supported. */ +#if CONFIG_IDF_TARGET_ESP32 + ADC_WIDTH_BIT_9 = 0, /*!< ADC capture width is 9Bit. */ + ADC_WIDTH_BIT_10 = 1, /*!< ADC capture width is 10Bit. */ + ADC_WIDTH_BIT_11 = 2, /*!< ADC capture width is 11Bit. */ + ADC_WIDTH_BIT_12 = 3, /*!< ADC capture width is 12Bit. */ +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 + ADC_WIDTH_BIT_13 = 4, /*!< ADC capture width is 13Bit. */ #endif ADC_WIDTH_MAX, } adc_bits_width_t; + /** * @brief ADC digital controller (DMA mode) work mode. * @@ -123,18 +123,23 @@ typedef struct { 1: measurement range 0 - 1100mV, 2: measurement range 0 - 1350mV, 3: measurement range 0 - 2600mV. */ -#ifdef CONFIG_IDF_TARGET_ESP32 +#if CONFIG_IDF_TARGET_ESP32 uint8_t bit_width: 2; /*!< ADC resolution. - 0: 9 bit; - 1: 10 bit; - 2: 11 bit; - 3: 12 bit. */ -#elif CONFIG_IDF_TARGET_ESP32S2 + int8_t channel: 4; /*!< ADC channel index. */ +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 + uint8_t reserved: 2; /*!< reserved0 */ + uint8_t channel: 4; /*!< ADC channel index. */ +#elif CONFIG_IDF_TARGET_ESP32C3 + uint8_t channel: 3; /*!< ADC channel index. */ + uint8_t unit: 1; /*!< ADC unit index. */ uint8_t reserved: 2; /*!< reserved0 */ #endif - uint8_t channel: 4; /*!< ADC channel index. */ }; - uint8_t val; + uint8_t val; /*! ADC_CHANNEL_MAX), The data is invalid. */ + uint32_t unit: 1; /*! +#include +#include "soc/lldesc.h" +#include "soc/soc_caps.h" +#include "hal/aes_types.h" +#include "hal/aes_ll.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Sets the key used for AES encryption/decryption + * + * @param key pointer to the key + * @param key_bytes number of bytes in key + * @param mode key mode, 0 : decrypt, 1: encrypt + * + * @return uint8_t number of key bytes written to hardware, used for fault injection check + */ +uint8_t aes_hal_setkey(const uint8_t *key, size_t key_bytes, int mode); + +/** + * @brief encrypts/decrypts a single block + * + * @param input_block input block, size of AES_BLOCK_BYTES + * @param output_block output block, size of AES_BLOCK_BYTES + */ +void aes_hal_transform_block(const void *input_block, void *output_block); + +#if SOC_AES_SUPPORT_DMA +/** + * @brief Inits the AES mode of operation + * + * @param mode mode of operation, e.g. CTR or CBC + */ +void aes_hal_mode_init(esp_aes_mode_t mode); + +/** + * @brief Sets the initialization vector for the transform + * + * @note The same IV must never be reused with the same key + * + * @param iv the initialization vector, length = IV_BYTES (16 bytes) + */ +void aes_hal_set_iv(const uint8_t *iv); + +/** + * @brief Reads the initialization vector + * + * @param iv initialization vector read from HW, length = IV_BYTES (16 bytes) + */ +void aes_hal_read_iv(uint8_t *iv); + +/** + * @brief Busy waits until the DMA operation is done (descriptor owner is CPU) + * + * @param output pointer to inlink descriptor + */ +void aes_hal_wait_dma_done(lldesc_t *output); + +/** + * @brief Starts an already configured AES DMA transform + * + * @param input outlink descriptor for data to be written to the peripheral + * @param output inlink descriptor for data to be read from the peripheral + * @param num_blocks Number of blocks to transform + */ +void aes_hal_transform_dma_start(const lldesc_t *input, const lldesc_t *output, size_t num_blocks); + +/** + * @brief Finish up a AES DMA conversion, release DMA + * + */ +void aes_hal_transform_dma_finish(void); + +/** + * @brief Enable or disable transform completed interrupt + * + * @param enable true to enable, false to disable. + */ +#define aes_hal_interrupt_enable(enable) aes_ll_interrupt_enable(enable) + +/** + * @brief Clears the interrupt + * + */ +#define aes_hal_interrupt_clear() aes_ll_interrupt_clear() + +#if SOC_AES_SUPPORT_GCM +/** + * @brief Calculates the Hash sub-key H0 needed to start AES-GCM + * + * @param gcm_hash the Hash sub-key H0 output + */ +void aes_hal_gcm_calc_hash(uint8_t *gcm_hash); + +/** + * @brief Initializes the AES hardware for AES-GCM + * + * @param aad_num_blocks the number of Additional Authenticated Data (AAD) blocks + * @param num_valid_bit the number of effective bits of incomplete blocks in plaintext/cipertext + */ +void aes_hal_gcm_init(size_t aad_num_blocks, size_t num_valid_bit); + +/** + * @brief Starts a AES-GCM transform + * + * @param input outlink descriptor for data to be written to the peripheral + * @param output inlink descriptor for data to be read from the perihperal + * @param num_blocks Number of blocks to transform + */ +void aes_hal_transform_dma_gcm_start(const lldesc_t *input, const lldesc_t *output, size_t num_blocks); + +/** + * @brief Sets the J0 value, for more information see the GCM subchapter in the TRM + * + * @note Only affects AES-GCM + * + * @param j0 J0 value + */ +#define aes_hal_gcm_set_j0(j0) aes_ll_gcm_set_j0(j0) + +/** + * @brief Read the tag after a AES-GCM transform + * + * @param tag Pointer to where to store the result + * @param tag_length number of bytes to read into tag + */ +void aes_hal_gcm_read_tag(uint8_t *tag, size_t tag_len); + +#endif //SOC_AES_SUPPORT_GCM + +#endif //SOC_AES_SUPPORT_DMA + + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/aes_types.h b/tools/sdk/esp32/include/hal/include/hal/aes_types.h new file mode 100644 index 000000000..e12d510c6 --- /dev/null +++ b/tools/sdk/esp32/include/hal/include/hal/aes_types.h @@ -0,0 +1,48 @@ +// 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. +#pragma once + +/* padlock.c and aesni.c rely on these values! */ +#define ESP_AES_ENCRYPT 1 +#define ESP_AES_DECRYPT 0 + + +/* DMA AES working modes*/ +typedef enum { + ESP_AES_BLOCK_MODE_ECB = 0, + ESP_AES_BLOCK_MODE_CBC, + ESP_AES_BLOCK_MODE_OFB, + ESP_AES_BLOCK_MODE_CTR, + ESP_AES_BLOCK_MODE_CFB8, + ESP_AES_BLOCK_MODE_CFB128, + ESP_AES_BLOCK_MODE_GCM, + ESP_AES_BLOCK_MODE_MAX, +} esp_aes_mode_t; + +/* Number of bytes in an AES block */ +#define AES_BLOCK_BYTES (16) +/* Number of words in an AES block */ +#define AES_BLOCK_WORDS (4) +/* Number of bytes in an IV */ +#define IV_BYTES (16) +/* Number of words in an IV */ +#define IV_WORDS (4) +/* Number of bytes in a GCM tag block */ +#define TAG_BYTES (16) +/* Number of words in a GCM tag block */ +#define TAG_WORDS (4) + +#define AES_128_KEY_BYTES (128/8) +#define AES_192_KEY_BYTES (192/8) +#define AES_256_KEY_BYTES (256/8) diff --git a/tools/sdk/esp32/include/hal/include/hal/cpu_hal.h b/tools/sdk/esp32/include/hal/include/hal/cpu_hal.h index fb6be55b3..faa054208 100644 --- a/tools/sdk/esp32/include/hal/include/hal/cpu_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/cpu_hal.h @@ -118,4 +118,4 @@ void cpu_hal_set_vecbase(const void* base); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/cpu_types.h b/tools/sdk/esp32/include/hal/include/hal/cpu_types.h index aee44f6ac..d61a47c9c 100644 --- a/tools/sdk/esp32/include/hal/include/hal/cpu_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/cpu_types.h @@ -18,4 +18,4 @@ typedef enum { WATCHPOINT_TRIGGER_ON_RO, // on read WATCHPOINT_TRIGGER_ON_WO, // on write WATCHPOINT_TRIGGER_ON_RW // on either read or write -} watchpoint_trigger_t; \ No newline at end of file +} watchpoint_trigger_t; diff --git a/tools/sdk/esp32/include/hal/include/hal/dac_hal.h b/tools/sdk/esp32/include/hal/include/hal/dac_hal.h index 04dccc5cd..aeecf4858 100644 --- a/tools/sdk/esp32/include/hal/include/hal/dac_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/dac_hal.h @@ -77,4 +77,4 @@ void dac_hal_cw_generator_config(dac_cw_config_t *cw); /** * Enable/disable DAC output data from DMA. */ -#define dac_hal_digi_enable_dma(enable) dac_ll_digi_enable_dma(enable) \ No newline at end of file +#define dac_hal_digi_enable_dma(enable) dac_ll_digi_enable_dma(enable) diff --git a/tools/sdk/esp32/include/hal/include/hal/dac_types.h b/tools/sdk/esp32/include/hal/include/hal/dac_types.h index c693deb6f..4fe322269 100644 --- a/tools/sdk/esp32/include/hal/include/hal/dac_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/dac_types.h @@ -64,4 +64,4 @@ typedef struct { Note: The clocks of the DAC digital controller use the ADC digital controller clock divider. */ } dac_digi_config_t; -#endif //CONFIG_IDF_TARGET_ESP32S2 \ No newline at end of file +#endif //CONFIG_IDF_TARGET_ESP32S2 diff --git a/tools/sdk/esp32/include/hal/include/hal/dma_types.h b/tools/sdk/esp32/include/hal/include/hal/dma_types.h index 1c5823613..7583bf6f0 100644 --- a/tools/sdk/esp32/include/hal/include/hal/dma_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/dma_types.h @@ -22,7 +22,7 @@ extern "C" { /** * @brief Type of DMA descriptor - * + * */ typedef struct dma_descriptor_s { struct { diff --git a/tools/sdk/esp32/include/hal/include/hal/gdma_hal.h b/tools/sdk/esp32/include/hal/include/hal/gdma_hal.h index 2a67d26a7..65d03da9b 100644 --- a/tools/sdk/esp32/include/hal/include/hal/gdma_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/gdma_hal.h @@ -32,4 +32,4 @@ typedef struct { #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h b/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h index c013b5de9..f951caf09 100644 --- a/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/gpio_hal.h @@ -339,4 +339,4 @@ void gpio_hal_intr_disable(gpio_hal_context_t *hal, gpio_num_t gpio_num); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/gpio_types.h b/tools/sdk/esp32/include/hal/include/hal/gpio_types.h index 4c5cd2270..31a5ed108 100644 --- a/tools/sdk/esp32/include/hal/include/hal/gpio_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/gpio_types.h @@ -26,8 +26,6 @@ typedef enum { GPIO_PORT_MAX, } gpio_port_t; -/** @cond */ //Doxy command to hide preprocessor definitions from docs */ - #define GPIO_SEL_0 (BIT(0)) /*!< Pin 0 selected */ #define GPIO_SEL_1 (BIT(1)) /*!< Pin 1 selected */ #define GPIO_SEL_2 (BIT(2)) /*!< Pin 2 selected */ @@ -108,12 +106,10 @@ typedef enum { #define GPIO_PIN_REG_25 IO_MUX_GPIO25_REG #define GPIO_PIN_REG_26 IO_MUX_GPIO26_REG #define GPIO_PIN_REG_27 IO_MUX_GPIO27_REG -#if CONFIG_IDF_TARGET_ESP32S2 #define GPIO_PIN_REG_28 IO_MUX_GPIO28_REG #define GPIO_PIN_REG_29 IO_MUX_GPIO29_REG #define GPIO_PIN_REG_30 IO_MUX_GPIO30_REG #define GPIO_PIN_REG_31 IO_MUX_GPIO31_REG -#endif #define GPIO_PIN_REG_32 IO_MUX_GPIO32_REG #define GPIO_PIN_REG_33 IO_MUX_GPIO33_REG #define GPIO_PIN_REG_34 IO_MUX_GPIO34_REG @@ -122,7 +118,6 @@ typedef enum { #define GPIO_PIN_REG_37 IO_MUX_GPIO37_REG #define GPIO_PIN_REG_38 IO_MUX_GPIO38_REG #define GPIO_PIN_REG_39 IO_MUX_GPIO39_REG -#if SOC_GPIO_PIN_COUNT > 40 #define GPIO_PIN_REG_40 IO_MUX_GPIO40_REG #define GPIO_PIN_REG_41 IO_MUX_GPIO41_REG #define GPIO_PIN_REG_42 IO_MUX_GPIO42_REG @@ -130,10 +125,8 @@ typedef enum { #define GPIO_PIN_REG_44 IO_MUX_GPIO44_REG #define GPIO_PIN_REG_45 IO_MUX_GPIO45_REG #define GPIO_PIN_REG_46 IO_MUX_GPIO46_REG -#endif - -/** @endcond */ +#if CONFIG_IDF_TARGET_ESP32 typedef enum { GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ @@ -158,13 +151,9 @@ typedef enum { GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ -#if CONFIG_IDF_TARGET_ESP32 GPIO_NUM_22 = 22, /*!< GPIO22, input and output */ GPIO_NUM_23 = 23, /*!< GPIO23, input and output */ - GPIO_NUM_25 = 25, /*!< GPIO25, input and output */ -#endif - /* Note: The missing IO is because it is used inside the chip. */ GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ @@ -173,13 +162,54 @@ typedef enum { GPIO_NUM_31 = 31, /*!< GPIO31, input and output */ GPIO_NUM_32 = 32, /*!< GPIO32, input and output */ GPIO_NUM_33 = 33, /*!< GPIO33, input and output */ - GPIO_NUM_34 = 34, /*!< GPIO34, input mode only(ESP32) / input and output(ESP32-S2) */ - GPIO_NUM_35 = 35, /*!< GPIO35, input mode only(ESP32) / input and output(ESP32-S2) */ - GPIO_NUM_36 = 36, /*!< GPIO36, input mode only(ESP32) / input and output(ESP32-S2) */ - GPIO_NUM_37 = 37, /*!< GPIO37, input mode only(ESP32) / input and output(ESP32-S2) */ - GPIO_NUM_38 = 38, /*!< GPIO38, input mode only(ESP32) / input and output(ESP32-S2) */ - GPIO_NUM_39 = 39, /*!< GPIO39, input mode only(ESP32) / input and output(ESP32-S2) */ -#if SOC_GPIO_PIN_COUNT > 40 + GPIO_NUM_34 = 34, /*!< GPIO34, input mode only */ + GPIO_NUM_35 = 35, /*!< GPIO35, input mode only */ + GPIO_NUM_36 = 36, /*!< GPIO36, input mode only */ + GPIO_NUM_37 = 37, /*!< GPIO37, input mode only */ + GPIO_NUM_38 = 38, /*!< GPIO38, input mode only */ + GPIO_NUM_39 = 39, /*!< GPIO39, input mode only */ + GPIO_NUM_MAX, +/** @endcond */ +} gpio_num_t; +#elif CONFIG_IDF_TARGET_ESP32S2 +typedef enum { + GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ + GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ + GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ + GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ + GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ + GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ + GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ + GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ + GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ + GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ + GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ + GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ + GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ + GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ + GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ + GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ + GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ + GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ + GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ + GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ + GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ + GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ + GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ + GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ + GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ + GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ + GPIO_NUM_29 = 29, /*!< GPIO29, input and output */ + GPIO_NUM_30 = 30, /*!< GPIO30, input and output */ + GPIO_NUM_31 = 31, /*!< GPIO31, input and output */ + GPIO_NUM_32 = 32, /*!< GPIO32, input and output */ + GPIO_NUM_33 = 33, /*!< GPIO33, input and output */ + GPIO_NUM_34 = 34, /*!< GPIO34, input and output */ + GPIO_NUM_35 = 35, /*!< GPIO35, input and output */ + GPIO_NUM_36 = 36, /*!< GPIO36, input and output */ + GPIO_NUM_37 = 37, /*!< GPIO37, input and output */ + GPIO_NUM_38 = 38, /*!< GPIO38, input and output */ + GPIO_NUM_39 = 39, /*!< GPIO39, input and output */ GPIO_NUM_40 = 40, /*!< GPIO40, input and output */ GPIO_NUM_41 = 41, /*!< GPIO41, input and output */ GPIO_NUM_42 = 42, /*!< GPIO42, input and output */ @@ -187,10 +217,89 @@ typedef enum { GPIO_NUM_44 = 44, /*!< GPIO44, input and output */ GPIO_NUM_45 = 45, /*!< GPIO45, input and output */ GPIO_NUM_46 = 46, /*!< GPIO46, input mode only */ -#endif GPIO_NUM_MAX, /** @endcond */ } gpio_num_t; +#elif CONFIG_IDF_TARGET_ESP32S3 +typedef enum { + GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ + GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ + GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ + GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ + GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ + GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ + GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ + GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ + GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ + GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ + GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ + GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ + GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ + GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ + GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ + GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ + GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ + GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ + GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ + GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ + GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ + GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ + GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ + GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ + GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ + GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ + GPIO_NUM_29 = 29, /*!< GPIO29, input and output */ + GPIO_NUM_30 = 30, /*!< GPIO30, input and output */ + GPIO_NUM_31 = 31, /*!< GPIO31, input and output */ + GPIO_NUM_32 = 32, /*!< GPIO32, input and output */ + GPIO_NUM_33 = 33, /*!< GPIO33, input and output */ + GPIO_NUM_34 = 34, /*!< GPIO34, input and output */ + GPIO_NUM_35 = 35, /*!< GPIO35, input and output */ + GPIO_NUM_36 = 36, /*!< GPIO36, input and output */ + GPIO_NUM_37 = 37, /*!< GPIO37, input and output */ + GPIO_NUM_38 = 38, /*!< GPIO38, input and output */ + GPIO_NUM_39 = 39, /*!< GPIO39, input and output */ + GPIO_NUM_40 = 40, /*!< GPIO40, input and output */ + GPIO_NUM_41 = 41, /*!< GPIO41, input and output */ + GPIO_NUM_42 = 42, /*!< GPIO42, input and output */ + GPIO_NUM_43 = 43, /*!< GPIO43, input and output */ + GPIO_NUM_44 = 44, /*!< GPIO44, input and output */ + GPIO_NUM_45 = 45, /*!< GPIO45, input and output */ + GPIO_NUM_46 = 46, /*!< GPIO46, input mode only */ + GPIO_NUM_47 = 47, /*!< GPIO47, input and output */ + GPIO_NUM_MAX, +/** @endcond */ +} gpio_num_t; +#elif CONFIG_IDF_TARGET_ESP32C3 +typedef enum { + GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ + GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ + GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ + GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ + GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ + GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ + GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ + GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ + GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ + GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ + GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ + GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ + GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ + GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ + GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ + GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ + GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ + GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ + GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ + GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ + // TODO: ESP32C3 IDF-2463 + GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ + GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ + GPIO_NUM_22 = 22, /*!< GPIO22, input and output */ + GPIO_NUM_MAX, +/** @endcond */ +} gpio_num_t; +#endif typedef enum { GPIO_INTR_DISABLE = 0, /*!< Disable GPIO interrupt */ diff --git a/tools/sdk/esp32/include/hal/include/hal/i2c_hal.h b/tools/sdk/esp32/include/hal/include/hal/i2c_hal.h index 9e38d358d..829cd92d5 100644 --- a/tools/sdk/esp32/include/hal/include/hal/i2c_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/i2c_hal.h @@ -521,4 +521,14 @@ void i2c_hal_master_handle_rx_event(i2c_hal_context_t *hal, i2c_intr_event_t *ev * * @return None */ -void i2c_hal_slave_handle_event(i2c_hal_context_t *hal, i2c_intr_event_t *event); \ No newline at end of file +void i2c_hal_slave_handle_event(i2c_hal_context_t *hal, i2c_intr_event_t *event); + +/** + * @brief Synchronize I2C status + * + * @param hal Context of the HAL layer + * + * @return None + * + */ +void i2c_hal_update_config(i2c_hal_context_t *hal); diff --git a/tools/sdk/esp32/include/hal/include/hal/i2c_types.h b/tools/sdk/esp32/include/hal/include/hal/i2c_types.h index cc1c231e5..3d5864dc1 100644 --- a/tools/sdk/esp32/include/hal/include/hal/i2c_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/i2c_types.h @@ -38,14 +38,6 @@ typedef enum { I2C_MASTER_READ, /*!< I2C read data */ } i2c_rw_t; -typedef enum{ - I2C_CMD_RESTART = 0, /*! #include "hal/interrupt_controller_types.h" #include "hal/interrupt_controller_ll.h" +#include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { @@ -31,7 +32,7 @@ __attribute__((pure)) const int_desc_t *interrupt_controller_hal_desc_table(voi /** * @brief Gets the interrupt type given an interrupt number. - * + * * @param interrupt_number Interrupt number 0 to 31 * @return interrupt type */ @@ -39,7 +40,7 @@ __attribute__((pure)) int_type_t interrupt_controller_hal_desc_type(int interru /** * @brief Gets the interrupt level given an interrupt number. - * + * * @param interrupt_number Interrupt number 0 to 31 * @return interrupt level bitmask */ @@ -47,27 +48,45 @@ __attribute__((pure)) int interrupt_controller_hal_desc_level(int interrupt_num /** * @brief Gets the cpu flags given the interrupt number and target cpu. - * + * * @param interrupt_number Interrupt number 0 to 31 * @param cpu_number CPU number between 0 and SOC_CPU_CORES_NUM - 1 - * @return flags for that interrupt number + * @return flags for that interrupt number */ -__attribute__((pure)) uint32_t interrupt_controller_hal_desc_flags(int interrupt_number, int cpu_number); +__attribute__((pure)) int_desc_flag_t interrupt_controller_hal_desc_flags(int interrupt_number, int cpu_number); + +#if SOC_INTERRUPT_LEVEL_CAN_SET +/** + * @brief Set the interrupt level given an interrupt number. + * + * @param interrupt_number number of the interrupt + * @param level new level for this interrupt + */ +void interrupt_controller_hal_set_level(int interrupt_number, int level); + +/** + * @brief Set the interrupt type given an interrupt number. + * + * @param interrupt_number number of the interrupt + * @param type new type for this interrupt + */ +void interrupt_controller_hal_set_type(int interrupt_number, int_type_t type); +#endif /** * @brief Gets the interrupt type given an interrupt number. - * + * * @param interrupt_number Interrupt number 0 to 31 * @return interrupt type */ static inline int_type_t interrupt_controller_hal_get_type(int interrupt_number) { return interrupt_controller_hal_desc_type(interrupt_number); -} +} /** * @brief Gets the interrupt level given an interrupt number. - * + * * @param interrupt_number Interrupt number 0 to 31 * @return interrupt level bitmask */ @@ -78,10 +97,10 @@ static inline int interrupt_controller_hal_get_level(int interrupt_number) /** * @brief Gets the cpu flags given the interrupt number and target cpu. - * + * * @param interrupt_number Interrupt number 0 to 31 * @param cpu_number CPU number between 0 and SOC_CPU_CORES_NUM - 1 - * @return flags for that interrupt number + * @return flags for that interrupt number */ static inline uint32_t interrupt_controller_hal_get_cpu_desc_flags(int interrupt_number, int cpu_number) { @@ -90,18 +109,18 @@ static inline uint32_t interrupt_controller_hal_get_cpu_desc_flags(int interrupt /** * @brief enable interrupts specified by the mask - * - * @param mask bitmask of interrupts that needs to be enabled + * + * @param mask bitmask of interrupts that needs to be enabled */ -static inline void interrupt_controller_hal_enable_interrupts(uint32_t mask) +static inline void interrupt_controller_hal_enable_interrupts(uint32_t mask) { intr_cntrl_ll_enable_interrupts(mask); } /** * @brief disable interrupts specified by the mask - * - * @param mask bitmask of interrupts that needs to be disabled + * + * @param mask bitmask of interrupts that needs to be disabled */ static inline void interrupt_controller_hal_disable_interrupts(uint32_t mask) { @@ -110,57 +129,57 @@ static inline void interrupt_controller_hal_disable_interrupts(uint32_t mask) /** * @brief checks if given interrupt number has a valid handler - * + * * @param intr interrupt number ranged from 0 to 31 * @param cpu cpu number ranged betweeen 0 to SOC_CPU_CORES_NUM - 1 - * @return true for valid handler, false otherwise + * @return true for valid handler, false otherwise */ static inline bool interrupt_controller_hal_has_handler(int intr, int cpu) { return intr_cntrl_ll_has_handler(intr, cpu); -} +} /** - * @brief sets interrupt handler and optional argument of a given interrupt number - * + * @brief sets interrupt handler and optional argument of a given interrupt number + * * @param intr interrupt number ranged from 0 to 31 * @param handler handler invoked when an interrupt occurs * @param arg optional argument to pass to the handler */ -static inline void interrupt_controller_hal_set_int_handler(uint8_t intr, interrupt_handler_t handler, void *arg) +static inline void interrupt_controller_hal_set_int_handler(uint8_t intr, interrupt_handler_t handler, void *arg) { intr_cntrl_ll_set_int_handler(intr, handler, arg); } /** - * @brief Gets argument passed to handler of a given interrupt number - * + * @brief Gets argument passed to handler of a given interrupt number + * * @param intr interrupt number ranged from 0 to 31 - * + * * @return argument used by handler of passed interrupt number */ -static inline void * interrupt_controller_hal_get_int_handler_arg(uint8_t intr) +static inline void * interrupt_controller_hal_get_int_handler_arg(uint8_t intr) { return intr_cntrl_ll_get_int_handler_arg(intr); } /** * @brief Disables interrupts that are not located in iram - * + * * @param newmask mask of interrupts needs to be disabled * @return oldmask where to store old interrupts state */ static inline uint32_t interrupt_controller_hal_disable_int_mask(uint32_t newmask) { - return intr_cntrl_ll_disable_int_mask(newmask); + return intr_cntrl_ll_disable_int_mask(newmask); } /** * @brief Enables interrupts that are not located in iram - * + * * @param newmask mask of interrupts needs to be disabled */ -static inline void interrupt_controller_hal_enable_int_mask(uint32_t newmask) +static inline void interrupt_controller_hal_enable_int_mask(uint32_t newmask) { intr_cntrl_ll_enable_int_mask(newmask); } diff --git a/tools/sdk/esp32/include/hal/include/hal/interrupt_controller_types.h b/tools/sdk/esp32/include/hal/include/hal/interrupt_controller_types.h index 639317f47..bf9be1fd1 100644 --- a/tools/sdk/esp32/include/hal/include/hal/interrupt_controller_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/interrupt_controller_types.h @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#pragma once +#pragma once #include "soc/soc_caps.h" #include "soc/soc.h" @@ -24,7 +24,7 @@ extern "C" { typedef enum { INTDESC_NORMAL=0, INTDESC_RESVD, - INTDESC_SPECIAL + INTDESC_SPECIAL } int_desc_flag_t; typedef enum { @@ -43,4 +43,4 @@ typedef void (*interrupt_handler_t)(void *arg); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/ledc_types.h b/tools/sdk/esp32/include/hal/include/hal/ledc_types.h index 9abf4f8e8..fa05ef41b 100644 --- a/tools/sdk/esp32/include/hal/include/hal/ledc_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/ledc_types.h @@ -84,8 +84,10 @@ typedef enum { LEDC_CHANNEL_3, /*!< LEDC channel 3 */ LEDC_CHANNEL_4, /*!< LEDC channel 4 */ LEDC_CHANNEL_5, /*!< LEDC channel 5 */ +#if SOC_LEDC_CHANNEL_NUM > 6 LEDC_CHANNEL_6, /*!< LEDC channel 6 */ LEDC_CHANNEL_7, /*!< LEDC channel 7 */ +#endif LEDC_CHANNEL_MAX, } ledc_channel_t; @@ -104,12 +106,14 @@ typedef enum { LEDC_TIMER_12_BIT, /*!< LEDC PWM duty resolution of 12 bits */ LEDC_TIMER_13_BIT, /*!< LEDC PWM duty resolution of 13 bits */ LEDC_TIMER_14_BIT, /*!< LEDC PWM duty resolution of 14 bits */ +#if SOC_LEDC_TIMER_BIT_WIDE_NUM > 14 LEDC_TIMER_15_BIT, /*!< LEDC PWM duty resolution of 15 bits */ LEDC_TIMER_16_BIT, /*!< LEDC PWM duty resolution of 16 bits */ LEDC_TIMER_17_BIT, /*!< LEDC PWM duty resolution of 17 bits */ LEDC_TIMER_18_BIT, /*!< LEDC PWM duty resolution of 18 bits */ LEDC_TIMER_19_BIT, /*!< LEDC PWM duty resolution of 19 bits */ LEDC_TIMER_20_BIT, /*!< LEDC PWM duty resolution of 20 bits */ +#endif LEDC_TIMER_BIT_MAX, } ledc_timer_bit_t; diff --git a/tools/sdk/esp32/include/hal/include/hal/mpu_hal.h b/tools/sdk/esp32/include/hal/include/hal/mpu_hal.h index 0614de9eb..f1a7103fc 100644 --- a/tools/sdk/esp32/include/hal/include/hal/mpu_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/mpu_hal.h @@ -24,7 +24,7 @@ extern "C" { /** * Specify the type of access allowed on a memory region. - * + * * @param id index to the region table; on targets not SOC_MPU_CONFIGURABLE_REGIONS_SUPPORTED, * the region divisions is predefined in hardware which is likely reflected in LL implementation. * @param access type of access allowed @@ -33,4 +33,4 @@ void mpu_hal_set_region_access(int id, mpu_access_t access); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/mpu_types.h b/tools/sdk/esp32/include/hal/include/hal/mpu_types.h index 14675a726..b6445eed2 100644 --- a/tools/sdk/esp32/include/hal/include/hal/mpu_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/mpu_types.h @@ -30,4 +30,4 @@ typedef enum { MPU_REGION_RW, // read-write MPU_REGION_X, // executable MPU_REGION_RWX // read-write-executable -} mpu_access_t; \ No newline at end of file +} mpu_access_t; diff --git a/tools/sdk/esp32/include/hal/include/hal/pcnt_hal.h b/tools/sdk/esp32/include/hal/include/hal/pcnt_hal.h index 416af3fa8..8d2253e46 100644 --- a/tools/sdk/esp32/include/hal/include/hal/pcnt_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/pcnt_hal.h @@ -220,4 +220,4 @@ void pcnt_hal_init(pcnt_hal_context_t *hal, int pcnt_num); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/pcnt_types.h b/tools/sdk/esp32/include/hal/include/hal/pcnt_types.h index 66a87a84d..e96406298 100644 --- a/tools/sdk/esp32/include/hal/include/hal/pcnt_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/pcnt_types.h @@ -43,7 +43,7 @@ typedef enum { PCNT_UNIT_7 = 7, /*!< PCNT unit 7 */ #endif PCNT_UNIT_MAX, -} pcnt_unit_t; +} pcnt_unit_t; /** * @brief Selection of available modes that determine the counter's action depending on the state of the control signal's input GPIO @@ -106,4 +106,4 @@ typedef struct { #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/rmt_hal.h b/tools/sdk/esp32/include/hal/include/hal/rmt_hal.h index 8a21ac9dd..0576718e4 100644 --- a/tools/sdk/esp32/include/hal/include/hal/rmt_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/rmt_hal.h @@ -41,12 +41,20 @@ typedef struct { void rmt_hal_init(rmt_hal_context_t *hal); /** - * @brief Reset RMT Channel specific HAL driver + * @brief Reset RMT TX Channel * * @param hal: RMT HAL context * @param channel: RMT channel number */ -void rmt_hal_channel_reset(rmt_hal_context_t *hal, uint32_t channel); +void rmt_hal_tx_channel_reset(rmt_hal_context_t *hal, uint32_t channel); + +/** + * @brief Reset RMT TX Channel + * + * @param hal: RMT HAL context + * @param channel: RMT channel number + */ +void rmt_hal_rx_channel_reset(rmt_hal_context_t *hal, uint32_t channel); /** * @brief Set counter clock for RMT channel @@ -56,17 +64,7 @@ void rmt_hal_channel_reset(rmt_hal_context_t *hal, uint32_t channel); * @param base_clk_hz: base clock for RMT internal channel (counter clock will divide from it) * @param counter_clk_hz: target counter clock */ -void rmt_hal_set_counter_clock(rmt_hal_context_t *hal, uint32_t channel, uint32_t base_clk_hz, uint32_t counter_clk_hz); - -/** - * @brief Get counter clock for RMT channel - * - * @param hal: RMT HAL context - * @param channel: RMT channel number - * @param base_clk_hz: base clock for RMT internal channel (counter clock will divide from it) - * @return counter clock in Hz - */ -uint32_t rmt_hal_get_counter_clock(rmt_hal_context_t *hal, uint32_t channel, uint32_t base_clk_hz); +void rmt_hal_tx_set_counter_clock(rmt_hal_context_t *hal, uint32_t channel, uint32_t base_clk_hz, uint32_t counter_clk_hz); /** * @brief Set carrier clock for RMT channel @@ -79,17 +77,6 @@ uint32_t rmt_hal_get_counter_clock(rmt_hal_context_t *hal, uint32_t channel, uin */ void rmt_hal_set_carrier_clock(rmt_hal_context_t *hal, uint32_t channel, uint32_t base_clk_hz, uint32_t carrier_clk_hz, float carrier_clk_duty); -/** - * @brief Get carrier clock for RMT channel - * - * @param hal: RMT HAL context - * @param channel: RMT channel number - * @param base_clk_hz: base clock for RMT carrier generation - * @param carrier_clk_hz: target carrier clock - * @param carrier_clk_duty: duty ratio of carrier clock - */ -void rmt_hal_get_carrier_clock(rmt_hal_context_t *hal, uint32_t channel, uint32_t base_clk_hz, uint32_t *carrier_clk_hz, float *carrier_clk_duty); - /** * @brief Set filter threshold for RMT Receive channel * @@ -120,18 +107,6 @@ void rmt_hal_set_rx_idle_thres(rmt_hal_context_t *hal, uint32_t channel, uint32_ */ uint32_t rmt_hal_receive(rmt_hal_context_t *hal, uint32_t channel, rmt_item32_t *buf); -/** - * @brief Transmit a from by RMT - * - * @param hal: RMT HAL context - * @param channel: RMT channel number - * @param src: RMT items to transmit - * @param length: length of RMT items to transmit - * @param offset: offset of RMT internal memory to store the items. - * Note: the caller should ensure that (length + offset) <= (memory block * SOC_RMT_CHANNEL_MEM_WORDS). - */ -void rmt_hal_transmit(rmt_hal_context_t *hal, uint32_t channel, const rmt_item32_t *src, uint32_t length, uint32_t offset); - #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/hal/include/hal/rmt_types.h b/tools/sdk/esp32/include/hal/include/hal/rmt_types.h index 37d79ea22..478629bcc 100644 --- a/tools/sdk/esp32/include/hal/include/hal/rmt_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/rmt_types.h @@ -53,8 +53,13 @@ typedef enum { * */ typedef enum { - RMT_BASECLK_REF, /*!< RMT source clock is REF_TICK, 1MHz by default */ - RMT_BASECLK_APB, /*!< RMT source clock is APB CLK, 80Mhz by default */ +#if SOC_RMT_SUPPORT_REF_TICK + RMT_BASECLK_REF = 0, /*!< RMT source clock is REF_TICK, 1MHz by default */ +#endif + RMT_BASECLK_APB = 1, /*!< RMT source clock is APB CLK, 80Mhz by default */ +#if SOC_RMT_SUPPORT_XTAL + RMT_BASECLK_XTAL = 3, /*!< RMT source clock is XTAL clock, 40Mhz by default */ +#endif RMT_BASECLK_MAX, } rmt_source_clk_t; diff --git a/tools/sdk/esp32/include/hal/include/hal/rtc_hal.h b/tools/sdk/esp32/include/hal/include/hal/rtc_hal.h index a700c90a9..94c016c56 100644 --- a/tools/sdk/esp32/include/hal/include/hal/rtc_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/rtc_hal.h @@ -30,4 +30,3 @@ * Enable wakeup from ULP coprocessor. */ #define rtc_hal_ulp_wakeup_enable() rtc_cntl_ll_ulp_wakeup_enable() - diff --git a/tools/sdk/esp32/include/hal/include/hal/rtc_io_hal.h b/tools/sdk/esp32/include/hal/include/hal/rtc_io_hal.h index 742085591..2ed0782db 100644 --- a/tools/sdk/esp32/include/hal/include/hal/rtc_io_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/rtc_io_hal.h @@ -22,6 +22,7 @@ #pragma once +#include "soc/soc_caps.h" #include "hal/rtc_io_ll.h" #include @@ -38,6 +39,8 @@ extern "C" { */ #define rtcio_hal_function_select(rtcio_num, func) rtcio_ll_function_select(rtcio_num, func) +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + /** * Enable rtcio output. * @@ -164,6 +167,10 @@ void rtcio_hal_set_direction_in_sleep(int rtcio_num, rtc_gpio_mode_t mode); */ #define rtcio_hal_pulldown_disable(rtcio_num) rtcio_ll_pulldown_disable(rtcio_num) +#endif // SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + +#if SOC_RTCIO_HOLD_SUPPORTED + /** * Enable force hold function for RTC IO pad. * @@ -204,6 +211,10 @@ void rtcio_hal_set_direction_in_sleep(int rtcio_num, rtc_gpio_mode_t mode); */ #define rtcio_hal_unhold_all() rtcio_ll_force_unhold_all() +#endif // SOC_RTCIO_HOLD_SUPPORTED + +#if SOC_RTCIO_WAKE_SUPPORTED + /** * Enable wakeup function and set wakeup type from light sleep status for rtcio. * @@ -227,6 +238,10 @@ void rtcio_hal_set_direction_in_sleep(int rtcio_num, rtc_gpio_mode_t mode); */ #define rtcio_hal_ext0_set_wakeup_pin(rtcio_num, level) rtcio_ll_ext0_set_wakeup_pin(rtcio_num, level) +#endif + +#if SOC_RTCIO_HOLD_SUPPORTED || SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + /** * Helper function to disconnect internal circuits from an RTC IO * This function disables input, output, pullup, pulldown, and enables @@ -242,6 +257,8 @@ void rtcio_hal_set_direction_in_sleep(int rtcio_num, rtc_gpio_mode_t mode); */ void rtcio_hal_isolate(int rtc_num); +#endif + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32/include/hal/include/hal/rtc_io_types.h b/tools/sdk/esp32/include/hal/include/hal/rtc_io_types.h index 82b358d86..9f010aeff 100644 --- a/tools/sdk/esp32/include/hal/include/hal/rtc_io_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/rtc_io_types.h @@ -22,4 +22,4 @@ typedef enum { RTC_GPIO_MODE_DISABLED, /*!< Pad (output + input) disable */ RTC_GPIO_MODE_OUTPUT_OD, /*!< Pad open-drain output */ RTC_GPIO_MODE_INPUT_OUTPUT_OD, /*!< Pad input + open-drain output */ -} rtc_gpio_mode_t; \ No newline at end of file +} rtc_gpio_mode_t; diff --git a/tools/sdk/esp32/include/hal/include/hal/sdio_slave_hal.h b/tools/sdk/esp32/include/hal/include/hal/sdio_slave_hal.h index 52975c5ec..5b252ea9b 100644 --- a/tools/sdk/esp32/include/hal/include/hal/sdio_slave_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/sdio_slave_hal.h @@ -526,4 +526,3 @@ uint8_t sdio_slave_hal_host_get_reg(sdio_slave_context_t *hal, int pos); * @param reg Value to set. */ void sdio_slave_hal_host_set_reg(sdio_slave_context_t *hal, int pos, uint8_t reg); - diff --git a/tools/sdk/esp32/include/hal/include/hal/sdio_slave_ll.h b/tools/sdk/esp32/include/hal/include/hal/sdio_slave_ll.h index e013f5f11..77fe87831 100644 --- a/tools/sdk/esp32/include/hal/include/hal/sdio_slave_ll.h +++ b/tools/sdk/esp32/include/hal/include/hal/sdio_slave_ll.h @@ -479,4 +479,3 @@ static inline void sdio_slave_ll_slvint_fetch_clear(slc_dev_t *slc, sdio_slave_l *out_slv_int = slv_int; slc->slc0_int_clr.val = slv_int; } - diff --git a/tools/sdk/esp32/include/hal/include/hal/sdio_slave_types.h b/tools/sdk/esp32/include/hal/include/hal/sdio_slave_types.h index fd3e4050e..60e08456f 100644 --- a/tools/sdk/esp32/include/hal/include/hal/sdio_slave_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/sdio_slave_types.h @@ -44,4 +44,4 @@ typedef enum { typedef enum { SDIO_SLAVE_SEND_STREAM = 0, ///< Stream mode, all packets to send will be combined as one if possible SDIO_SLAVE_SEND_PACKET = 1, ///< Packet mode, one packets will be sent one after another (only increase packet_len if last packet sent). -} sdio_slave_sending_mode_t; \ No newline at end of file +} sdio_slave_sending_mode_t; diff --git a/tools/sdk/esp32/include/hal/include/hal/sha_hal.h b/tools/sdk/esp32/include/hal/include/hal/sha_hal.h index ff3e7e233..6a3cf1be4 100644 --- a/tools/sdk/esp32/include/hal/include/hal/sha_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/sha_hal.h @@ -22,7 +22,7 @@ #include #include -#include "soc/sha_caps.h" +#include "soc/soc_caps.h" #include "soc/lldesc.h" #include "hal/sha_types.h" diff --git a/tools/sdk/esp32/include/hal/include/hal/sha_types.h b/tools/sdk/esp32/include/hal/include/hal/sha_types.h index c50382276..3b8807fa8 100644 --- a/tools/sdk/esp32/include/hal/include/hal/sha_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/sha_types.h @@ -26,6 +26,9 @@ typedef SHA_TYPE esp_sha_type; #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/sha.h" typedef SHA_TYPE esp_sha_type; +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/sha.h" +typedef SHA_TYPE esp_sha_type; #endif #ifdef __cplusplus @@ -35,4 +38,4 @@ extern "C" { #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/sigmadelta_hal.h b/tools/sdk/esp32/include/hal/include/hal/sigmadelta_hal.h index 58cb4c218..4deeec9bf 100644 --- a/tools/sdk/esp32/include/hal/include/hal/sigmadelta_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/sigmadelta_hal.h @@ -68,4 +68,4 @@ void sigmadelta_hal_init(sigmadelta_hal_context_t *hal, int sigmadelta_num); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/soc_hal.h b/tools/sdk/esp32/include/hal/include/hal/soc_hal.h index e4400d0e0..74359fc97 100644 --- a/tools/sdk/esp32/include/hal/include/hal/soc_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/soc_hal.h @@ -72,4 +72,4 @@ void soc_hal_unstall_core(int core); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/spi_hal.h b/tools/sdk/esp32/include/hal/include/hal/spi_hal.h index 479a91bd3..35dbcfc7b 100644 --- a/tools/sdk/esp32/include/hal/include/hal/spi_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/spi_hal.h @@ -46,8 +46,8 @@ typedef struct { uint32_t no_compensate; ///< No need to add dummy to compensate the timing, device specific uint32_t clock_speed_hz; ///< Desired frequency. uint32_t duty_cycle; ///< Desired duty cycle of SPI clock - uint32_t input_delay_ns; /**< Maximum delay between SPI launch clock and the data to be valid. - * This is used to compensate/calculate the maximum frequency allowed. + uint32_t input_delay_ns; /**< Maximum delay between SPI launch clock and the data to be valid. + * This is used to compensate/calculate the maximum frequency allowed. * Left 0 if not known. */ bool use_gpio; ///< True if the GPIO matrix is used, otherwise false @@ -67,7 +67,7 @@ typedef struct { /** * DMA configuration structure * Should be set by driver at initialization - */ + */ typedef struct { spi_dma_dev_t *dma_in; ///< Input DMA(DMA -> RAM) peripheral register address spi_dma_dev_t *dma_out; ///< Output DMA(RAM -> DMA) peripheral register address @@ -116,7 +116,7 @@ typedef struct { /** * Device configuration structure, this should be initialised by driver based on different devices respectively. - * All these parameters will be updated to the peripheral only when ``spi_hal_setup_device``. + * All these parameters will be updated to the peripheral only when ``spi_hal_setup_device``. * They may not get updated when ``spi_hal_setup_trans``. */ typedef struct { @@ -250,4 +250,3 @@ void spi_hal_cal_timing(int eff_clk, bool gpio_is_used, int input_delay_ns, int * allowed. Left 0 if not known. */ int spi_hal_get_freq_limit(bool gpio_is_used, int input_delay_ns); - diff --git a/tools/sdk/esp32/include/hal/include/hal/spi_types.h b/tools/sdk/esp32/include/hal/include/hal/spi_types.h index 39aa2682d..0dd2ab334 100644 --- a/tools/sdk/esp32/include/hal/include/hal/spi_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/spi_types.h @@ -49,8 +49,8 @@ FLAG_ATTR(spi_event_t) #define SPI_HOST SPI1_HOST #define HSPI_HOST SPI2_HOST #define VSPI_HOST SPI3_HOST -#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 -// SPI_HOST (SPI1_HOST) is not supported by the SPI Master and SPI Slave driver on ESP32-S2 +#else // !CONFIG_IDF_TARGET_ESP32 +// SPI_HOST (SPI1_HOST) is not supported by the SPI Master and SPI Slave driver on ESP32-S2 and later #define SPI_HOST SPI1_HOST #define FSPI_HOST SPI2_HOST #define HSPI_HOST SPI3_HOST diff --git a/tools/sdk/esp32/include/hal/include/hal/systimer_hal.h b/tools/sdk/esp32/include/hal/include/hal/systimer_hal.h index e070f686b..1c3dba395 100644 --- a/tools/sdk/esp32/include/hal/include/hal/systimer_hal.h +++ b/tools/sdk/esp32/include/hal/include/hal/systimer_hal.h @@ -36,10 +36,15 @@ uint64_t systimer_hal_get_counter_value(systimer_counter_id_t counter_id); */ uint64_t systimer_hal_get_time(systimer_counter_id_t counter_id); -/** - * @brief set alarm time +/* + * @brief set alarm target value (used in one-shot mode) */ -void systimer_hal_set_alarm_value(systimer_alarm_id_t alarm_id, uint64_t timestamp); +void systimer_hal_set_alarm_target(systimer_alarm_id_t alarm_id, uint64_t target); + +/** + * @brief set alarm period value (used in period mode) + */ +void systimer_hal_set_alarm_period(systimer_alarm_id_t alarm_id, uint32_t period); /** * @brief get alarm time diff --git a/tools/sdk/esp32/include/hal/include/hal/systimer_types.h b/tools/sdk/esp32/include/hal/include/hal/systimer_types.h index 02e65daf3..cf88a00f2 100644 --- a/tools/sdk/esp32/include/hal/include/hal/systimer_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/systimer_types.h @@ -71,4 +71,4 @@ typedef enum { #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32/include/hal/include/hal/timer_types.h b/tools/sdk/esp32/include/hal/include/hal/timer_types.h index e35009fab..962fae043 100644 --- a/tools/sdk/esp32/include/hal/include/hal/timer_types.h +++ b/tools/sdk/esp32/include/hal/include/hal/timer_types.h @@ -29,7 +29,9 @@ extern "C" { */ typedef enum { TIMER_GROUP_0 = 0, /*! 1 TIMER_GROUP_1 = 1, /*! 1 TIMER_1 = 1, /*! 1 + TIMER_INTR_T1 = BIT(1), /*!< interrupt of timer 1 */ TIMER_INTR_WDT = BIT(2), /*!< interrupt of watchdog */ +#else + TIMER_INTR_WDT = BIT(1), /*!< interrupt of watchdog */ +#endif TIMER_INTR_NONE = 0 } timer_intr_t; FLAG_ATTR(timer_intr_t) @@ -85,7 +93,6 @@ typedef enum { */ typedef enum { TIMER_INTR_LEVEL = 0, /*!< Interrupt mode: level mode*/ - //TIMER_INTR_EDGE = 1, /*!< Interrupt mode: edge mode, Not supported Now*/ TIMER_INTR_MAX } timer_intr_mode_t; diff --git a/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_hal.h b/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_hal.h index 98cdfc791..dc125c5ba 100644 --- a/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_hal.h +++ b/tools/sdk/esp32s2/include/hal/include/hal/touch_sensor_hal.h @@ -222,4 +222,4 @@ void touch_hal_config(touch_pad_t touch_num); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif 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 efea2b9ac..ec027bf87 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 @@ -132,7 +132,9 @@ typedef enum { #define TOUCH_TRIGGER_MODE_DEFAULT (TOUCH_TRIGGER_BELOW) /*! + +#define USB_CTRL_REQ_ATTR __attribute__((packed)) +#define USB_DESC_ATTR __attribute__((packed)) + +/* ----------------------------------------------------------------------------- +------------------------------ USB Protocol Enums ------------------------------ +----------------------------------------------------------------------------- */ + +/** + * @brief Enumeration of USB PHY type + */ +typedef enum { + USB_PHY_INTERNAL = 0, /**< Use the chip's internal USB PHY */ + USB_PHY_EXTERNAL, /**< Use an external USB PHY */ +} usb_phy_t; + +/** + * @brief The type of USB transfer + * + * @note The enum values need to match the bmAttributes field of an EP descriptor + */ +typedef enum { + USB_XFER_TYPE_CTRL = 0, + USB_XFER_TYPE_ISOCHRONOUS, + USB_XFER_TYPE_BULK, + USB_XFER_TYPE_INTR, +} usb_xfer_type_t; + +/** + * @brief USB Standard Speeds + */ +typedef enum { + USB_SPEED_LOW = 0, /**< USB Low Speed (1.5 Mbit/s) */ + USB_SPEED_FULL, /**< USB Full Speed (12 Mbit/s) */ +} usb_speed_t; + +/* ----------------------------------------------------------------------------- +-------------------------------- Control Request ------------------------------- +----------------------------------------------------------------------------- */ + +/** + * @brief Size of a USB control transfer setup packet in bytes + */ +#define USB_CTRL_REQ_SIZE 8 + +/** + * @brief Structure representing a USB control transfer setup packet + */ +typedef union { + struct { + uint8_t bRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; + } USB_CTRL_REQ_ATTR; + uint8_t val[USB_CTRL_REQ_SIZE]; +} usb_ctrl_req_t; +_Static_assert(sizeof(usb_ctrl_req_t) == USB_CTRL_REQ_SIZE, "Size of usb_ctrl_req_t incorrect"); + +/** + * @brief Bit masks pertaining to the bRequestType field of a setup packet + */ +#define USB_B_REQUEST_TYPE_DIR_OUT (0X00 << 7) +#define USB_B_REQUEST_TYPE_DIR_IN (0x01 << 7) +#define USB_B_REQUEST_TYPE_TYPE_STANDARD (0x00 << 5) +#define USB_B_REQUEST_TYPE_TYPE_CLASS (0x01 << 5) +#define USB_B_REQUEST_TYPE_TYPE_VENDOR (0x02 << 5) +#define USB_B_REQUEST_TYPE_TYPE_RESERVED (0x03 << 5) +#define USB_B_REQUEST_TYPE_TYPE_MASK (0x03 << 5) +#define USB_B_REQUEST_TYPE_RECIP_DEVICE (0x00 << 0) +#define USB_B_REQUEST_TYPE_RECIP_INTERFACE (0x01 << 0) +#define USB_B_REQUEST_TYPE_RECIP_ENDPOINT (0x02 << 0) +#define USB_B_REQUEST_TYPE_RECIP_OTHER (0x03 << 0) +#define USB_B_REQUEST_TYPE_RECIP_MASK (0x1f << 0) + +/** + * @brief Bit masks pertaining to the bRequest field of a setup packet + */ +#define USB_B_REQUEST_GET_STATUS 0x00 +#define USB_B_REQUEST_CLEAR_FEATURE 0x01 +#define USB_B_REQUEST_SET_FEATURE 0x03 +#define USB_B_REQUEST_SET_ADDRESS 0x05 +#define USB_B_REQUEST_GET_DESCRIPTOR 0x06 +#define USB_B_REQUEST_SET_DESCRIPTOR 0x07 +#define USB_B_REQUEST_GET_CONFIGURATION 0x08 +#define USB_B_REQUEST_SET_CONFIGURATION 0x09 +#define USB_B_REQUEST_GET_INTERFACE 0x0A +#define USB_B_REQUEST_SET_INTERFACE 0x0B +#define USB_B_REQUEST_SYNCH_FRAME 0x0C + +/** + * @brief Bit masks pertaining to the wValue field of a setup packet + */ +#define USB_W_VALUE_DT_DEVICE 0x01 +#define USB_W_VALUE_DT_CONFIG 0x02 +#define USB_W_VALUE_DT_STRING 0x03 +#define USB_W_VALUE_DT_INTERFACE 0x04 +#define USB_W_VALUE_DT_ENDPOINT 0x05 +#define USB_W_VALUE_DT_DEVICE_QUALIFIER 0x06 +#define USB_W_VALUE_DT_OTHER_SPEED_CONFIG 0x07 +#define USB_W_VALUE_DT_INTERFACE_POWER 0x08 + +/** + * @brief Initializer for a SET_ADDRESS request + * + * Sets the address of a connected device + */ +#define USB_CTRL_REQ_INIT_SET_ADDR(ctrl_req_ptr, addr) ({ \ + (ctrl_req_ptr)->bRequestType = USB_B_REQUEST_TYPE_DIR_OUT | USB_B_REQUEST_TYPE_TYPE_STANDARD |USB_B_REQUEST_TYPE_RECIP_DEVICE; \ + (ctrl_req_ptr)->bRequest = USB_B_REQUEST_SET_ADDRESS; \ + (ctrl_req_ptr)->wValue = (addr); \ + (ctrl_req_ptr)->wIndex = 0; \ + (ctrl_req_ptr)->wLength = 0; \ +}) + +/** + * @brief Initializer for a request to get a device's device descriptor + */ +#define USB_CTRL_REQ_INIT_GET_DEVC_DESC(ctrl_req_ptr) ({ \ + (ctrl_req_ptr)->bRequestType = USB_B_REQUEST_TYPE_DIR_IN | USB_B_REQUEST_TYPE_TYPE_STANDARD | USB_B_REQUEST_TYPE_RECIP_DEVICE; \ + (ctrl_req_ptr)->bRequest = USB_B_REQUEST_GET_DESCRIPTOR; \ + (ctrl_req_ptr)->wValue = (USB_W_VALUE_DT_DEVICE << 8); \ + (ctrl_req_ptr)->wIndex = 0; \ + (ctrl_req_ptr)->wLength = 18; \ +}) + +/** + * @brief Initializer for a request to get a device's current configuration number + */ +#define USB_CTRL_REQ_INIT_GET_CONFIG(ctrl_req_ptr) ({ \ + (ctrl_req_ptr)->bRequestType = USB_B_REQUEST_TYPE_DIR_IN | USB_B_REQUEST_TYPE_TYPE_STANDARD | USB_B_REQUEST_TYPE_RECIP_DEVICE; \ + (ctrl_req_ptr)->bRequest = USB_B_REQUEST_GET_CONFIGURATION; \ + (ctrl_req_ptr)->wValue = 0; \ + (ctrl_req_ptr)->wIndex = 0; \ + (ctrl_req_ptr)->wLength = 1; \ +}) + +/** + * @brief Initializer for a request to get one of the device's current configuration descriptor + * + * - desc_index indicates the configuration's index number + * - Number of bytes of the configuration descriptor to get + */ +#define USB_CTRL_REQ_INIT_GET_CFG_DESC(ctrl_req_ptr, desc_index, desc_len) ({ \ + (ctrl_req_ptr)->bRequestType = USB_B_REQUEST_TYPE_DIR_IN | USB_B_REQUEST_TYPE_TYPE_STANDARD | USB_B_REQUEST_TYPE_RECIP_DEVICE; \ + (ctrl_req_ptr)->bRequest = USB_B_REQUEST_GET_DESCRIPTOR; \ + (ctrl_req_ptr)->wValue = (USB_W_VALUE_DT_CONFIG << 8) | ((desc_index) & 0xFF); \ + (ctrl_req_ptr)->wIndex = 0; \ + (ctrl_req_ptr)->wLength = (desc_len); \ +}) + +/** + * @brief Initializer for a request to set a device's current configuration number + */ +#define USB_CTRL_REQ_INIT_SET_CONFIG(ctrl_req_ptr, config_num) ({ \ + (ctrl_req_ptr)->bRequestType = USB_B_REQUEST_TYPE_DIR_OUT | USB_B_REQUEST_TYPE_TYPE_STANDARD | USB_B_REQUEST_TYPE_RECIP_DEVICE; \ + (ctrl_req_ptr)->bRequest = USB_B_REQUEST_SET_CONFIGURATION; \ + (ctrl_req_ptr)->wValue = (config_num); \ + (ctrl_req_ptr)->wIndex = 0; \ + (ctrl_req_ptr)->wLength = 0; \ +}) + +/* ----------------------------------------------------------------------------- +---------------------------------- Descriptors --------------------------------- +----------------------------------------------------------------------------- */ + +// -------------------------- Device Descriptor -------------------------------- + +/** + * @brief Size of a USB device descriptor in bytes + */ +#define USB_DESC_DEV_SIZE 18 + +/** + * @brief Structure representing a USB device descriptor + */ +typedef union { + struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; + } USB_DESC_ATTR; + uint8_t val[USB_DESC_DEV_SIZE]; +} usb_desc_devc_t; +_Static_assert(sizeof(usb_desc_devc_t) == USB_DESC_DEV_SIZE, "Size of usb_desc_devc_t incorrect"); + +/** + * @brief Possible base class values of the bDeviceClass field of a USB device descriptor + */ +#define USB_CLASS_PER_INTERFACE 0x00 +#define USB_CLASS_AUDIO 0x01 +#define USB_CLASS_COMM 0x02 +#define USB_CLASS_HID 0x03 +#define USB_CLASS_PHYSICAL 0x05 +#define USB_CLASS_STILL_IMAGE 0x06 +#define USB_CLASS_PRINTER 0x07 +#define USB_CLASS_MASS_STORAGE 0x08 +#define USB_CLASS_HUB 0x09 +#define USB_CLASS_CDC_DATA 0x0a +#define USB_CLASS_CSCID 0x0b +#define USB_CLASS_CONTENT_SEC 0x0d +#define USB_CLASS_VIDEO 0x0e +#define USB_CLASS_WIRELESS_CONTROLLER 0xe0 +#define USB_CLASS_PERSONAL_HEALTHCARE 0x0f +#define USB_CLASS_AUDIO_VIDEO 0x10 +#define USB_CLASS_BILLBOARD 0x11 +#define USB_CLASS_USB_TYPE_C_BRIDGE 0x12 +#define USB_CLASS_MISC 0xef +#define USB_CLASS_APP_SPEC 0xfe +#define USB_CLASS_VENDOR_SPEC 0xff + +/** + * @brief Vendor specific subclass code + */ +#define USB_SUBCLASS_VENDOR_SPEC 0xff + +// ----------------------- Configuration Descriptor ---------------------------- + +/** + * @brief Size of a short USB configuration descriptor in bytes + * + * @note The size of a full USB configuration includes all the interface and endpoint + * descriptors of that configuration. + */ +#define USB_DESC_CFG_SIZE 9 + +/** + * @brief Structure representing a short USB configuration descriptor + * + * @note The full USB configuration includes all the interface and endpoint + * descriptors of that configuration. + */ +typedef union { + struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t bMaxPower; + } USB_DESC_ATTR; + uint8_t val[USB_DESC_CFG_SIZE]; +} usb_desc_cfg_t; +_Static_assert(sizeof(usb_desc_cfg_t) == USB_DESC_CFG_SIZE, "Size of usb_desc_cfg_t incorrect"); + +/** + * @brief Bit masks pertaining to the bmAttributes field of a configuration descriptor + */ +#define USB_BM_ATTRIBUTES_ONE (1 << 7) //Must be set +#define USB_BM_ATTRIBUTES_SELFPOWER (1 << 6) //Self powered +#define USB_BM_ATTRIBUTES_WAKEUP (1 << 5) //Can wakeup +#define USB_BM_ATTRIBUTES_BATTERY (1 << 4) //Battery powered + +// ------------------------- Interface Descriptor ------------------------------ + +/** + * @brief Size of a USB interface descriptor in bytes + */ +#define USB_DESC_INTF_SIZE 9 + +/** + * @brief Structure representing a USB interface descriptor + */ +typedef union { + struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; + } USB_DESC_ATTR; + uint8_t val[USB_DESC_INTF_SIZE]; +} usb_desc_intf_t; +_Static_assert(sizeof(usb_desc_intf_t) == USB_DESC_INTF_SIZE, "Size of usb_desc_intf_t incorrect"); + +// ------------------------- Endpoint Descriptor ------------------------------- + +/** + * @brief Size of a USB endpoint descriptor in bytes + */ +#define USB_DESC_EP_SIZE 7 + +/** + * @brief Structure representing a USB endp;oint descriptor + */ +typedef union { + struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint16_t wMaxPacketSize; + uint8_t bInterval; + } USB_DESC_ATTR; + uint8_t val[USB_DESC_EP_SIZE]; +} usb_desc_ep_t; +_Static_assert(sizeof(usb_desc_ep_t) == USB_DESC_EP_SIZE, "Size of usb_desc_ep_t incorrect"); + +/** + * @brief Bit masks pertaining to the bEndpointAddress field of an endpoint descriptor + */ +#define USB_B_ENDPOINT_ADDRESS_EP_NUM_MASK 0x0f +#define USB_B_ENDPOINT_ADDRESS_EP_DIR_MASK 0x80 + +/** + * @brief Bit masks pertaining to the bmAttributes field of an endpoint descriptor + */ +#define USB_BM_ATTRIBUTES_XFERTYPE_MASK 0x03 +#define USB_BM_ATTRIBUTES_XFER_CONTROL (0 << 0) +#define USB_BM_ATTRIBUTES_XFER_ISOC (1 << 0) +#define USB_BM_ATTRIBUTES_XFER_BULK (2 << 0) +#define USB_BM_ATTRIBUTES_XFER_INT (3 << 0) +#define USB_BM_ATTRIBUTES_SYNCTYPE_MASK 0x0C /* in bmAttributes */ +#define USB_BM_ATTRIBUTES_SYNC_NONE (0 << 2) +#define USB_BM_ATTRIBUTES_SYNC_ASYNC (1 << 2) +#define USB_BM_ATTRIBUTES_SYNC_ADAPTIVE (2 << 2) +#define USB_BM_ATTRIBUTES_SYNC_SYNC (3 << 2) +#define USB_BM_ATTRIBUTES_USAGETYPE_MASK 0x30 +#define USB_BM_ATTRIBUTES_USAGE_DATA (0 << 4) +#define USB_BM_ATTRIBUTES_USAGE_FEEDBACK (1 << 4) +#define USB_BM_ATTRIBUTES_USAGE_IMPLICIT_FB (2 << 4) + +/** + * @brief Macro helpers to get information about an endpoint from its descriptor + */ +#define USB_DESC_EP_GET_XFERTYPE(desc_ptr) ((usb_xfer_type_t) ((desc_ptr)->bmAttributes & USB_BM_ATTRIBUTES_XFERTYPE_MASK)) +#define USB_DESC_EP_GET_EP_NUM(desc_ptr) ((desc_ptr)->bEndpointAddress & USB_B_ENDPOINT_ADDRESS_EP_NUM_MASK) +#define USB_DESC_EP_GET_EP_DIR(desc_ptr) (((desc_ptr)->bEndpointAddress & USB_B_ENDPOINT_ADDRESS_EP_DIR_MASK) ? 1 : 0) +#define USB_DESC_EP_GET_MPS(desc_ptr) ((desc_ptr)->wMaxPacketSize & 0x7FF) + + +// --------------------------- String Descriptor ------------------------------- + +/** + * @brief Size of a short USB string descriptor in bytes + */ +#define USB_DESC_STR_SIZE 4 + +/** + * @brief Structure representing a USB string descriptor + */ +typedef union { + struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wData[1]; /* UTF-16LE encoded */ + } USB_DESC_ATTR; + uint8_t val[USB_DESC_STR_SIZE]; +} usb_desc_str_t; +_Static_assert(sizeof(usb_desc_str_t) == USB_DESC_STR_SIZE, "Size of usb_desc_str_t incorrect"); + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32s2/include/heap/include/esp_heap_caps.h b/tools/sdk/esp32s2/include/heap/include/esp_heap_caps.h index 13449340b..5d6a94727 100644 --- a/tools/sdk/esp32s2/include/heap/include/esp_heap_caps.h +++ b/tools/sdk/esp32s2/include/heap/include/esp_heap_caps.h @@ -40,6 +40,7 @@ extern "C" { #define MALLOC_CAP_INTERNAL (1<<11) ///< Memory must be internal; specifically it should not disappear when flash/spiram cache is switched off #define MALLOC_CAP_DEFAULT (1<<12) ///< Memory can be returned in a non-capability-specific memory allocation (e.g. malloc(), calloc()) call #define MALLOC_CAP_IRAM_8BIT (1<<13) ///< Memory must be in IRAM and allow unaligned access +#define MALLOC_CAP_RETENTION (1<<14) #define MALLOC_CAP_INVALID (1<<31) ///< Memory can't be used / list end marker @@ -48,14 +49,14 @@ extern "C" { * @param size in bytes of failed allocation * @param caps capabillites requested of failed allocation * @param function_name function which generated the failure - */ + */ typedef void (*esp_alloc_failed_hook_t) (size_t size, uint32_t caps, const char * function_name); /** * @brief registers a callback function to be invoked if a memory allocation operation fails * @param callback caller defined callback to be invoked * @return ESP_OK if callback was registered. - */ + */ esp_err_t heap_caps_register_failed_alloc_callback(esp_alloc_failed_hook_t callback); /** @@ -115,18 +116,18 @@ void *heap_caps_realloc( void *ptr, size_t size, int caps); * of memory to be returned * * @return A pointer to the memory allocated on success, NULL on failure - * - * + * + * */ void *heap_caps_aligned_alloc(size_t alignment, size_t size, int caps); /** * @brief Used to deallocate memory previously allocated with heap_caps_aligned_alloc - * + * * @param ptr Pointer to the memory allocated - * @note This function is deprecated, plase consider using heap_caps_free() instead + * @note This function is deprecated, plase consider using heap_caps_free() instead */ -void __attribute__((deprecated)) heap_caps_aligned_free(void *ptr); +void __attribute__((deprecated)) heap_caps_aligned_free(void *ptr); /** * @brief Allocate a aligned chunk of memory which has the given capabilities. The initialized value in the memory is set to zero. @@ -139,7 +140,7 @@ void __attribute__((deprecated)) heap_caps_aligned_free(void *ptr); * of memory to be returned * * @return A pointer to the memory allocated on success, NULL on failure - * + * */ void *heap_caps_aligned_calloc(size_t alignment, size_t n, size_t size, uint32_t caps); @@ -305,7 +306,7 @@ bool heap_caps_check_integrity(uint32_t caps, bool print_errors); bool heap_caps_check_integrity_addr(intptr_t addr, bool print_errors); /** - * @brief Enable malloc() in external memory and set limit below which + * @brief Enable malloc() in external memory and set limit below which * malloc() attempts are placed in internal memory. * * When external memory is in use, the allocation strategy is to initially try to @@ -386,13 +387,13 @@ void heap_caps_dump_all(void); /** * @brief Return the size that a particular pointer was allocated with. * - * @param ptr Pointer to currently allocated heap memory. Must be a pointer value previously + * @param ptr Pointer to currently allocated heap memory. Must be a pointer value previously * returned by heap_caps_malloc,malloc,calloc, etc. and not yet freed. * * @note The app will crash with an assertion failure if the pointer is not valid. - * + * * @return Size of the memory allocated at this block. - * + * */ size_t heap_caps_get_allocated_size( void *ptr ); diff --git a/tools/sdk/esp32s2/include/heap/include/esp_heap_caps_init.h b/tools/sdk/esp32s2/include/heap/include/esp_heap_caps_init.h index 1d16c490c..74e8cb901 100644 --- a/tools/sdk/esp32s2/include/heap/include/esp_heap_caps_init.h +++ b/tools/sdk/esp32s2/include/heap/include/esp_heap_caps_init.h @@ -77,7 +77,7 @@ esp_err_t heap_caps_add_region(intptr_t start, intptr_t end); * @param start Start address of new region. * @param end End address of new region. * - * @return + * @return * - ESP_OK on success * - ESP_ERR_INVALID_ARG if a parameter is invalid * - ESP_ERR_NO_MEM if no memory to register new heap. diff --git a/tools/sdk/esp32s2/include/heap/include/multi_heap.h b/tools/sdk/esp32s2/include/heap/include/multi_heap.h index df76e87de..622191fe0 100644 --- a/tools/sdk/esp32s2/include/heap/include/multi_heap.h +++ b/tools/sdk/esp32s2/include/heap/include/multi_heap.h @@ -30,8 +30,8 @@ extern "C" { typedef struct multi_heap_info *multi_heap_handle_t; /** - * @brief allocate a chunk of memory with specific alignment - * + * @brief allocate a chunk of memory with specific alignment + * * @param heap Handle to a registered heap. * @param size size in bytes of memory chunk * @param alignment how the memory must be aligned diff --git a/tools/sdk/esp32s2/include/idf_test/include/esp32/idf_performance_target.h b/tools/sdk/esp32s2/include/idf_test/include/esp32/idf_performance_target.h index 3002ece21..5328c3877 100644 --- a/tools/sdk/esp32s2/include/idf_test/include/esp32/idf_performance_target.h +++ b/tools/sdk/esp32s2/include/idf_test/include/esp32/idf_performance_target.h @@ -1,8 +1,21 @@ +// 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. + #pragma once // AES-CBC hardware throughput (accounts for worst-case performance with PSRAM workaround) #define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 8.2 -#define IDF_PERFORMANCE_MIN_AES_GCM_THROUGHPUT_MBSEC 0.5 // SHA256 hardware throughput at 240MHz, threshold set lower than worst case #define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 8.0 @@ -12,6 +25,8 @@ #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 19000 #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 190000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 33000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 360000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 90000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 870000 @@ -21,9 +36,23 @@ #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B 50600 #endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB (695*1000) +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B 24300 +#endif #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B 50300 #endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE 44300 +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B 23100 +#endif #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B 68900 diff --git a/tools/sdk/esp32s2/include/idf_test/include/esp32c3/idf_performance_target.h b/tools/sdk/esp32s2/include/idf_test/include/esp32c3/idf_performance_target.h new file mode 100644 index 000000000..21c0fa1e6 --- /dev/null +++ b/tools/sdk/esp32s2/include/idf_test/include/esp32c3/idf_performance_target.h @@ -0,0 +1,70 @@ +// 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. + +#pragma once + +#define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 14.4 + +// SHA256 hardware throughput at 160 MHz, threshold set lower than worst case +#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 90 +// esp_sha() time to process 32KB of input data from RAM +#define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 560 + +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 19000 +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 210000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 45000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 670000 + +#define IDF_PERFORMANCE_MAX_SPI_PER_TRANS_NO_POLLING 32 +#define IDF_PERFORMANCE_MAX_SPI_PER_TRANS_NO_POLLING_NO_DMA 30 + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B 53400 +#endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB (701*1000) +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B 27400 +#endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B 53600 +#endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE 44300 +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B 24400 +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B 64900 +#endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_RD_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_RD_4B (309*1000) +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_RD_2KB +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_RD_2KB (1697*1000) +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_ERASE +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_ERASE 76600 +#endif + +// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) +#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 +#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 diff --git a/tools/sdk/esp32s2/include/idf_test/include/esp32s2/idf_performance_target.h b/tools/sdk/esp32s2/include/idf_test/include/esp32s2/idf_performance_target.h index 7f3d6ac27..d5bbd83af 100644 --- a/tools/sdk/esp32s2/include/idf_test/include/esp32s2/idf_performance_target.h +++ b/tools/sdk/esp32s2/include/idf_test/include/esp32s2/idf_performance_target.h @@ -1,7 +1,22 @@ +// 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. + #pragma once #define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 43.0 -#define IDF_PERFORMANCE_MIN_AES_GCM_THROUGHPUT_MBSEC 2.1 +#define IDF_PERFORMANCE_MIN_AES_GCM_CRYPT_TAG_THROUGHPUT_MBSEC 30.0 +#define IDF_PERFORMANCE_MIN_AES_GCM_UPDATE_THROUGHPUT_MBSEC 2.1 // SHA256 hardware throughput at 240MHz, threshold set lower than worst case #define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 90.0 @@ -11,6 +26,8 @@ #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 13500 #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 130000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 36000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 400000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 62000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 800000 @@ -20,10 +37,23 @@ #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B 53400 #endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB (701*1000) +#endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B 27400 +#endif #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B 53600 #endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE 39900 +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B 24400 +#endif #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B 64900 diff --git a/tools/sdk/esp32s2/include/idf_test/include/esp32s3/idf_performance_target.h b/tools/sdk/esp32s2/include/idf_test/include/esp32s3/idf_performance_target.h index 67a1ae3e7..bc29a85e8 100644 --- a/tools/sdk/esp32s2/include/idf_test/include/esp32s3/idf_performance_target.h +++ b/tools/sdk/esp32s2/include/idf_test/include/esp32s3/idf_performance_target.h @@ -1,3 +1,17 @@ +// 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. + #pragma once #define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 14.4 @@ -10,6 +24,8 @@ #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 18000 #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 210000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 45000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 670000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 80000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 1500000 @@ -19,10 +35,23 @@ #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B 53400 #endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB (701*1000) +#endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B 27400 +#endif #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B 53600 #endif +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE 44300 +#endif + +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B 24400 +#endif #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B 68900 diff --git a/tools/sdk/esp32s2/include/idf_test/include/idf_performance.h b/tools/sdk/esp32s2/include/idf_test/include/idf_performance.h index 15a27a381..2ec2f8219 100644 --- a/tools/sdk/esp32s2/include/idf_test/include/idf_performance.h +++ b/tools/sdk/esp32s2/include/idf_test/include/idf_performance.h @@ -7,9 +7,6 @@ * above. Forgetting this will produce compile-time warnings. */ -#ifndef IDF_PERFORMANCE_MAX_HTTPS_REQUEST_BIN_SIZE -#define IDF_PERFORMANCE_MAX_HTTPS_REQUEST_BIN_SIZE 900 -#endif #ifndef IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP #define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP 200 #endif @@ -94,9 +91,7 @@ #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_4B 22200 #endif // IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_4B in target file -#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB -#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB (701*1000) -#endif +// IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_WR_2KB in target file #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_2KB #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_RD_2KB (7088*1000) #endif @@ -105,9 +100,7 @@ #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_LEGACY_ERASE 12000 #endif -#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B -#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B 27400 -#endif +// IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_4B in target file // IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_4B in target file #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_2KB #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_WR_2KB (694*1000) @@ -115,13 +108,9 @@ #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_2KB #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_RD_2KB (7797*1000) #endif -#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE -#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE 44300 -#endif +// IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_ERASE in target file -#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B -#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B 24400 -#endif +// IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_WR_4B in target file #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_RD_4B #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_SPI1_RD_4B 50100 #endif @@ -136,7 +125,9 @@ #endif // Some performance value based on the test against GD chip with single_core config. -// IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B in target file +#ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B +#define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_4B 64900 +#endif // IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_RD_4B in target file #ifndef IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_2KB #define IDF_PERFORMANCE_MIN_FLASH_SPEED_BYTE_PER_SEC_EXT_WR_2KB (475*1000) @@ -156,4 +147,3 @@ #ifndef IDF_PERFORMANCE_MAX_FREE_DEFAULT_AVERAGE_TIME #define IDF_PERFORMANCE_MAX_FREE_DEFAULT_AVERAGE_TIME 950 #endif - diff --git a/tools/sdk/esp32s2/include/log/include/esp_log.h b/tools/sdk/esp32s2/include/log/include/esp_log.h index a6ac60ea7..5a488936b 100644 --- a/tools/sdk/esp32s2/include/log/include/esp_log.h +++ b/tools/sdk/esp32s2/include/log/include/esp_log.h @@ -25,6 +25,8 @@ #include "esp32s2/rom/ets_sys.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/ets_sys.h" #endif #ifdef __cplusplus @@ -272,7 +274,7 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format, #define LOG_RESET_COLOR #endif //CONFIG_LOG_COLORS -#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n" +#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%u) %s: " format LOG_RESET_COLOR "\n" #define LOG_SYSTEM_TIME_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%s) %s: " format LOG_RESET_COLOR "\n" /** @endcond */ diff --git a/tools/sdk/esp32s2/include/log/include/esp_log_internal.h b/tools/sdk/esp32s2/include/log/include/esp_log_internal.h index 94ec34632..ee4b2ce54 100644 --- a/tools/sdk/esp32s2/include/log/include/esp_log_internal.h +++ b/tools/sdk/esp32s2/include/log/include/esp_log_internal.h @@ -21,4 +21,3 @@ void esp_log_buffer_char_internal(const char *tag, const void *buffer, uint16_t void esp_log_buffer_hexdump_internal( const char *tag, const void *buffer, uint16_t buff_len, esp_log_level_t log_level); #endif - diff --git a/tools/sdk/esp32s2/include/lwip/include/apps/dhcpserver/dhcpserver.h b/tools/sdk/esp32s2/include/lwip/include/apps/dhcpserver/dhcpserver.h index 1aef8aaca..39a58bbfa 100644 --- a/tools/sdk/esp32s2/include/lwip/include/apps/dhcpserver/dhcpserver.h +++ b/tools/sdk/esp32s2/include/lwip/include/apps/dhcpserver/dhcpserver.h @@ -72,12 +72,12 @@ typedef struct { typedef void (*dhcps_cb_t)(u8_t client_ip[4]); -static inline bool dhcps_router_enabled (dhcps_offer_t offer) +static inline bool dhcps_router_enabled (dhcps_offer_t offer) { return (offer & OFFER_ROUTER) != 0; } -static inline bool dhcps_dns_enabled (dhcps_offer_t offer) +static inline bool dhcps_dns_enabled (dhcps_offer_t offer) { return (offer & OFFER_DNS) != 0; } @@ -92,4 +92,3 @@ ip4_addr_t dhcps_dns_getserver(void); void dhcps_set_new_lease_cb(dhcps_cb_t cb); #endif - diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/cc.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/cc.h index 348cae35a..44dd94f34 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/cc.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/cc.h @@ -1,33 +1,33 @@ /* * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/perf.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/perf.h index 089facac1..4b9687be2 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/perf.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/perf.h @@ -1,33 +1,33 @@ /* * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/sys_arch.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/sys_arch.h index d6c5216ad..2c5c89961 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/sys_arch.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/arch/sys_arch.h @@ -102,4 +102,3 @@ sys_sem_t* sys_thread_sem_get(void); #endif #endif /* __SYS_ARCH_H__ */ - diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwip_default_hooks.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwip_default_hooks.h new file mode 100644 index 000000000..c882ddbd2 --- /dev/null +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwip_default_hooks.h @@ -0,0 +1,51 @@ +// 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. + +#ifndef _LWIP_DEFAULT_HOOKS_H_ +#define _LWIP_DEFAULT_HOOKS_H_ +#include "lwip/ip_addr.h" +#include "lwip/arch.h" +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT +void lwip_init_tcp_isn(u32_t boot_time, const u8_t *secret_16_bytes); +#endif +#if defined(CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM) || defined(CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT) +u32_t lwip_hook_tcp_isn(const ip_addr_t *local_ip, u16_t local_port, + const ip_addr_t *remote_ip, u16_t remote_port); +#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn +#endif /* CONFIG_LWIP_HOOK_TCP_ISN... */ + +#if defined(CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM) || defined(CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT) +struct netif * +lwip_hook_ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest); + +#define LWIP_HOOK_IP6_ROUTE lwip_hook_ip6_route +#endif /* CONFIG_LWIP_HOOK_IP6_ROUTE... */ + +#if defined(CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM) || defined(CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT) +int lwip_hook_netconn_external_resolve(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err); + +#define LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE lwip_hook_netconn_external_resolve +#endif /* CONFIG_LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LWIP_DEFAULT_HOOKS_H_ */ diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h index 709730afa..3480ef0cb 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/lwipopts.h @@ -420,17 +420,6 @@ */ #define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME -/** - * Set TCP hook for Initial Sequence Number (ISN) - */ -#ifdef CONFIG_LWIP_TCP_ISN_HOOK -#include -struct ip_addr; -u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, - const struct ip_addr *remote_ip, u16_t remote_port); -#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn -#endif - /* ---------------------------------- ---------- Pbuf options ---------- @@ -778,7 +767,9 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, ---------- Hook options --------------- --------------------------------------- */ +#define LWIP_HOOK_FILENAME "lwip_default_hooks.h" #define LWIP_HOOK_IP4_ROUTE_SRC ip4_route_src_hook + /* --------------------------------------- ---------- Debugging options ---------- @@ -846,6 +837,15 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, #define ICMP6_DEBUG LWIP_DBG_OFF #endif +/** + * DHCP_DEBUG: Enable debugging in dhcp.c. + */ +#ifdef CONFIG_LWIP_DHCP_DEBUG +#define DHCP_DEBUG LWIP_DBG_ON +#else +#define DHCP_DEBUG LWIP_DBG_OFF +#endif + /** * IP_DEBUG: Enable debugging for IP. */ @@ -856,7 +856,7 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, #endif /** - * IP_DEBUG: Enable debugging for IP. + * IP6_DEBUG: Enable debugging for IP6. */ #ifdef CONFIG_LWIP_IP6_DEBUG #define IP6_DEBUG LWIP_DBG_ON @@ -864,6 +864,15 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, #define IP6_DEBUG LWIP_DBG_OFF #endif +/** + * TCP_DEBUG: Enable debugging for TCP. + */ +#ifdef CONFIG_LWIP_TCP_DEBUG +#define TCP_DEBUG LWIP_DBG_ON +#else +#define TCP_DEBUG LWIP_DBG_OFF +#endif + /** * MEMP_DEBUG: Enable debugging in memp.c. */ @@ -884,6 +893,11 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, */ #define TCPIP_DEBUG LWIP_DBG_OFF +/** + * TCP_OOSEQ_DEBUG: Enable debugging in tcpin.c for OOSEQ. + */ +#define TCP_OOSEQ_DEBUG LWIP_DBG_OFF + /** * ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be * updated with the source MAC and IP addresses supplied in the packet. @@ -966,14 +980,13 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, #define TCP_WND CONFIG_LWIP_TCP_WND_DEFAULT /** - * DHCP_DEBUG: Enable debugging in dhcp.c. + * LWIP_DEBUG: Enable lwip debugging in other modules. */ -#define DHCP_DEBUG LWIP_DBG_OFF #define LWIP_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define CHECKSUM_CHECK_UDP 0 -#define CHECKSUM_CHECK_IP 0 +#define CHECKSUM_CHECK_UDP CONFIG_LWIP_CHECKSUM_CHECK_UDP +#define CHECKSUM_CHECK_IP CONFIG_LWIP_CHECKSUM_CHECK_IP +#define CHECKSUM_CHECK_ICMP CONFIG_LWIP_CHECKSUM_CHECK_ICMP #define LWIP_NETCONN_FULLDUPLEX 1 #define LWIP_NETCONN_SEM_PER_THREAD 1 diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/netdb.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/netdb.h index 7f5d67a46..3054fdca2 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/netdb.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/netdb.h @@ -35,7 +35,7 @@ #ifdef __cplusplus extern "C" { #endif - + #ifdef ESP_PLATFORM int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen, diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/netif/dhcp_state.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/netif/dhcp_state.h index b03dabbe7..44e5d4a30 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/netif/dhcp_state.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/netif/dhcp_state.h @@ -30,4 +30,4 @@ void dhcp_ip_addr_erase(void *esp_netif); } #endif -#endif /* _DHCP_STATE_H_ */ \ No newline at end of file +#endif /* _DHCP_STATE_H_ */ diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/include/netinet/tcp.h b/tools/sdk/esp32s2/include/lwip/port/esp32/include/netinet/tcp.h index f2555cfb4..a4d4d9769 100644 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/include/netinet/tcp.h +++ b/tools/sdk/esp32s2/include/lwip/port/esp32/include/netinet/tcp.h @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _NETINET_TCP_H -#define _NETINET_TCP_H +#ifndef _NETINET_TCP_H +#define _NETINET_TCP_H #include "lwip/tcp.h" diff --git a/tools/sdk/esp32s2/include/lwip/port/esp32/tcp_isn/tcp_isn.h b/tools/sdk/esp32s2/include/lwip/port/esp32/tcp_isn/tcp_isn.h deleted file mode 100644 index a40c4a1ad..000000000 --- a/tools/sdk/esp32s2/include/lwip/port/esp32/tcp_isn/tcp_isn.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016 The MINIX 3 Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * Author: David van Moolenbroek - */ - -#ifndef LWIP_TCP_ISN_H -#define LWIP_TCP_ISN_H - -#include "lwip/opt.h" -#include "lwip/ip_addr.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void lwip_init_tcp_isn(u32_t boot_time, const u8_t *secret_16_bytes); -u32_t lwip_hook_tcp_isn(const ip_addr_t *local_ip, u16_t local_port, - const ip_addr_t *remote_ip, u16_t remote_port); - -#ifdef __cplusplus -} -#endif - -#endif /* LWIP_TCP_ISN_H */ diff --git a/tools/sdk/esp32s2/include/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h b/tools/sdk/esp32s2/include/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h index 38fff5463..33fb98b99 100644 --- a/tools/sdk/esp32s2/include/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h +++ b/tools/sdk/esp32s2/include/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h @@ -60,6 +60,7 @@ void esp_crt_bundle_detach(mbedtls_ssl_config *conf); */ void esp_crt_bundle_set(const uint8_t *x509_bundle); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aes.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aes.h index d20cdbd6d..4468b6623 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aes.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aes.h @@ -21,7 +21,7 @@ */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -62,8 +62,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_AES_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aesni.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aesni.h index 91a4e0f11..9b63a0010 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aesni.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aesni.h @@ -7,7 +7,7 @@ * functions; you must not call them directly. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -48,8 +48,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_AESNI_H #define MBEDTLS_AESNI_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/arc4.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/arc4.h index ecaf31012..6334a9cc1 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/arc4.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/arc4.h @@ -7,7 +7,7 @@ * security risk. We recommend considering stronger ciphers instead. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -49,8 +49,6 @@ * * ********** * - * This file is part of mbed TLS (https://tls.mbed.org) - * */ #ifndef MBEDTLS_ARC4_H #define MBEDTLS_ARC4_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aria.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aria.h index 66f2668bf..13763d420 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aria.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/aria.h @@ -10,7 +10,7 @@ * and also described by the IETF in RFC 5794. */ /* - * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -51,8 +51,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ARIA_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1.h index c64038cdb..0e596bca2 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1.h @@ -4,7 +4,7 @@ * \brief Generic ASN.1 parsing */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ASN1_H #define MBEDTLS_ASN1_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1write.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1write.h index 4fed59371..3c7cdd6b4 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1write.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/asn1write.h @@ -4,7 +4,7 @@ * \brief ASN.1 buffer writing functionality */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ASN1_WRITE_H #define MBEDTLS_ASN1_WRITE_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/base64.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/base64.h index 215255e62..cbed6887e 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/base64.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/base64.h @@ -4,7 +4,7 @@ * \brief RFC 1521 base64 encoding/decoding */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BASE64_H #define MBEDTLS_BASE64_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bignum.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bignum.h index 1e41d7024..3deedfedd 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bignum.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bignum.h @@ -4,7 +4,7 @@ * \brief Multi-precision integer library */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BIGNUM_H #define MBEDTLS_BIGNUM_H @@ -90,12 +88,12 @@ * Maximum window size used for modular exponentiation. Default: 6 * Minimum value: 1. Maximum value: 6. * - * Result is an array of ( 2 << MBEDTLS_MPI_WINDOW_SIZE ) MPIs used + * Result is an array of ( 2 ** MBEDTLS_MPI_WINDOW_SIZE ) MPIs used * for the sliding window calculation. (So 64 by default) * * Reduction in size, reduces speed. */ -#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum windows size used. */ +#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum window size used. */ #endif /* !MBEDTLS_MPI_WINDOW_SIZE */ #if !defined(MBEDTLS_MPI_MAX_SIZE) diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/blowfish.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/blowfish.h index d2a1ebdbf..945bd426a 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/blowfish.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/blowfish.h @@ -4,7 +4,7 @@ * \brief Blowfish block cipher */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_BLOWFISH_H #define MBEDTLS_BLOWFISH_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bn_mul.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bn_mul.h index 42339b7b7..9615090f9 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bn_mul.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/bn_mul.h @@ -4,7 +4,7 @@ * \brief Multi-precision integer library */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ /* * Multiply source vector [s] with b, add result diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/camellia.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/camellia.h index 41d6f955b..38871288e 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/camellia.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/camellia.h @@ -4,7 +4,7 @@ * \brief Camellia block cipher */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CAMELLIA_H #define MBEDTLS_CAMELLIA_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ccm.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ccm.h index 3647d5094..d50c6ec99 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ccm.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ccm.h @@ -28,7 +28,7 @@ * consistent with RFC 3610. */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -69,8 +69,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CCM_H @@ -177,7 +175,7 @@ void mbedtls_ccm_free( mbedtls_ccm_context *ctx ); * than zero, \p output must be a writable buffer of at least * that length. * \param tag The buffer holding the authentication field. This must be a - * readable buffer of at least \p tag_len Bytes. + * writable buffer of at least \p tag_len Bytes. * \param tag_len The length of the authentication field to generate in Bytes: * 4, 6, 8, 10, 12, 14 or 16. * @@ -222,7 +220,7 @@ int mbedtls_ccm_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length, * than zero, \p output must be a writable buffer of at least * that length. * \param tag The buffer holding the authentication field. This must be a - * readable buffer of at least \p tag_len Bytes. + * writable buffer of at least \p tag_len Bytes. * \param tag_len The length of the authentication field to generate in Bytes: * 0, 4, 6, 8, 10, 12, 14 or 16. * diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/certs.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/certs.h index 2a645ad0d..8472a6f38 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/certs.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/certs.h @@ -4,7 +4,7 @@ * \brief Sample certificates and DHM parameters for testing */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CERTS_H #define MBEDTLS_CERTS_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chacha20.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chacha20.h index e2950e1a0..8c9c2af6f 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chacha20.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chacha20.h @@ -13,7 +13,7 @@ */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -54,8 +54,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CHACHA20_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chachapoly.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chachapoly.h index bee5a3ab0..5f6cb6e03 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chachapoly.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/chachapoly.h @@ -13,7 +13,7 @@ */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -54,8 +54,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CHACHAPOLY_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/check_config.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/check_config.h index 8ce73ceff..2bbd7a80f 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/check_config.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/check_config.h @@ -4,7 +4,7 @@ * \brief Consistency checks for configuration options */ /* - * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ /* @@ -199,6 +197,16 @@ #error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites" #endif +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define MBEDTLS_HAS_MEMSAN +#endif +#endif +#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN) +#error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer" +#endif +#undef MBEDTLS_HAS_MEMSAN + #if defined(MBEDTLS_TEST_NULL_ENTROPY) && \ ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) ) #error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites" diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher.h index 8672dd2b9..1f41b528c 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher.h @@ -8,7 +8,7 @@ * \author Adriaan de Jong */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -49,8 +49,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CIPHER_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher_internal.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher_internal.h index 558be52a7..88282ec9d 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher_internal.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cipher_internal.h @@ -6,7 +6,7 @@ * \author Adriaan de Jong */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -47,8 +47,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CIPHER_WRAP_H #define MBEDTLS_CIPHER_WRAP_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cmac.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cmac.h index 207474756..5a7c9b246 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cmac.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/cmac.h @@ -7,7 +7,7 @@ * Authentication is defined in RFC-4493: The AES-CMAC Algorithm. */ /* - * Copyright (C) 2015-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -48,8 +48,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CMAC_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/compat-1.3.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/compat-1.3.h index 71cc4f4d9..45e5a1cf7 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/compat-1.3.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/compat-1.3.h @@ -7,7 +7,7 @@ * \deprecated Use the new names directly instead */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -48,8 +48,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/config.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/config.h index f7e55aef5..6b45021d0 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/config.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/config.h @@ -8,7 +8,7 @@ * memory footprint. */ /* - * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -49,8 +49,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CONFIG_H @@ -551,6 +549,42 @@ //#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT //#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT +/** + * \def MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN + * + * Enable testing of the constant-flow nature of some sensitive functions with + * clang's MemorySanitizer. This causes some existing tests to also test + * this non-functional property of the code under test. + * + * This setting requires compiling with clang -fsanitize=memory. The test + * suites can then be run normally. + * + * \warning This macro is only used for extended testing; it is not considered + * part of the library's API, so it may change or disappear at any time. + * + * Uncomment to enable testing of the constant-flow nature of selected code. + */ +//#define MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN + +/** + * \def MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND + * + * Enable testing of the constant-flow nature of some sensitive functions with + * valgrind's memcheck tool. This causes some existing tests to also test + * this non-functional property of the code under test. + * + * This setting requires valgrind headers for building, and is only useful for + * testing if the tests suites are run with valgrind's memcheck. This can be + * done for an individual test suite with 'valgrind ./test_suite_xxx', or when + * using CMake, this can be done for all test suites with 'make memcheck'. + * + * \warning This macro is only used for extended testing; it is not considered + * part of the library's API, so it may change or disappear at any time. + * + * Uncomment to enable testing of the constant-flow nature of selected code. + */ +//#define MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND + /** * \def MBEDTLS_TEST_NULL_ENTROPY * @@ -3092,7 +3126,7 @@ */ /* MPI / BIGNUM options */ -//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum windows size used. */ +//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum window size used. */ //#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */ /* CTR_DRBG options */ diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ctr_drbg.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ctr_drbg.h index 894fa1713..278fbbbb7 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ctr_drbg.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ctr_drbg.h @@ -38,7 +38,7 @@ * - \c 32 if \c MBEDTLS_ENTROPY_FORCE_SHA256 is enabled at compile time. */ /* - * Copyright (C) 2006-2019, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -79,8 +79,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_CTR_DRBG_H @@ -226,6 +224,11 @@ mbedtls_ctr_drbg_context; * and prepares it for mbedtls_ctr_drbg_seed() * or mbedtls_ctr_drbg_free(). * + * \note The reseed interval is + * #MBEDTLS_CTR_DRBG_RESEED_INTERVAL by default. + * You can override it by calling + * mbedtls_ctr_drbg_set_reseed_interval(). + * * \param ctx The CTR_DRBG context to initialize. */ void mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *ctx ); @@ -307,7 +310,8 @@ int mbedtls_ctr_drbg_seed( mbedtls_ctr_drbg_context *ctx, size_t len ); /** - * \brief This function clears CTR_CRBG context data. + * \brief This function resets CTR_DRBG context to the state immediately + * after initial call of mbedtls_ctr_drbg_init(). * * \param ctx The CTR_DRBG context to clear. */ diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/debug.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/debug.h index 11928e981..abc2d4f07 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/debug.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/debug.h @@ -4,7 +4,7 @@ * \brief Functions for controlling and providing debug output from the library. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_DEBUG_H #define MBEDTLS_DEBUG_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/des.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/des.h index 4c6441d7d..ee24f6594 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/des.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/des.h @@ -8,7 +8,7 @@ * instead. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -50,8 +50,6 @@ * * ********** * - * This file is part of mbed TLS (https://tls.mbed.org) - * */ #ifndef MBEDTLS_DES_H #define MBEDTLS_DES_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/dhm.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/dhm.h index 5c04ed19f..11042efb5 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/dhm.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/dhm.h @@ -44,7 +44,7 @@ * */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -85,8 +85,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_DHM_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdh.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdh.h index a0052df47..b9324bc49 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdh.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdh.h @@ -13,7 +13,7 @@ * Cryptography. */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -54,8 +54,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECDH_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdsa.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdsa.h index bc219dcad..da02b2786 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdsa.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecdsa.h @@ -11,7 +11,7 @@ * */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -52,8 +52,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECDSA_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecjpake.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecjpake.h index 1b6c6ac24..a9b68d00c 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecjpake.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecjpake.h @@ -4,7 +4,7 @@ * \brief Elliptic curve J-PAKE */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECJPAKE_H #define MBEDTLS_ECJPAKE_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp.h index 8db206060..bdc750eb2 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp.h @@ -15,7 +15,7 @@ */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -56,8 +56,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ECP_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp_internal.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp_internal.h index 4e9445ae4..0047bd4ef 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp_internal.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ecp_internal.h @@ -5,7 +5,7 @@ * point arithmetic. */ /* - * Copyright (C) 2016, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -46,8 +46,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ /* diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy.h index fd70cd7e9..1e1d3f56e 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy.h @@ -4,7 +4,7 @@ * \brief Entropy accumulator implementation */ /* - * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ENTROPY_H #define MBEDTLS_ENTROPY_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy_poll.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy_poll.h index 9843a9e46..c348fe52d 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy_poll.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/entropy_poll.h @@ -4,7 +4,7 @@ * \brief Platform-specific and custom entropy polling functions */ /* - * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ENTROPY_POLL_H #define MBEDTLS_ENTROPY_POLL_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/error.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/error.h index 3ee7bbba8..fa8582a39 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/error.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/error.h @@ -4,7 +4,7 @@ * \brief Error to string translation */ /* - * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_ERROR_H #define MBEDTLS_ERROR_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/gcm.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/gcm.h index 52d03b0ce..1201fbd4f 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/gcm.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/gcm.h @@ -12,7 +12,7 @@ * */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -53,8 +53,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_GCM_H @@ -184,7 +182,7 @@ int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx, * than zero, this must be a writable buffer of at least that * size in Bytes. * \param tag_len The length of the tag to generate. - * \param tag The buffer for holding the tag. This must be a readable + * \param tag The buffer for holding the tag. This must be a writable * buffer of at least \p tag_len Bytes. * * \return \c 0 if the encryption or decryption was performed @@ -312,7 +310,7 @@ int mbedtls_gcm_update( mbedtls_gcm_context *ctx, * tag. The tag can have a maximum length of 16 Bytes. * * \param ctx The GCM context. This must be initialized. - * \param tag The buffer for holding the tag. This must be a readable + * \param tag The buffer for holding the tag. This must be a writable * buffer of at least \p tag_len Bytes. * \param tag_len The length of the tag to generate. This must be at least * four. diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/havege.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/havege.h index 75ab3cb96..e90839dde 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/havege.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/havege.h @@ -4,7 +4,7 @@ * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HAVEGE_H #define MBEDTLS_HAVEGE_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hkdf.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hkdf.h index a8db554d9..07ffe83b2 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hkdf.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hkdf.h @@ -7,7 +7,7 @@ * specified by RFC 5869. */ /* - * Copyright (C) 2016-2019, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -48,8 +48,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HKDF_H #define MBEDTLS_HKDF_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hmac_drbg.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hmac_drbg.h index 231fb459b..970c033c1 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hmac_drbg.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/hmac_drbg.h @@ -8,7 +8,7 @@ * Deterministic Random Bit Generators. */ /* - * Copyright (C) 2006-2019, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -49,8 +49,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_HMAC_DRBG_H #define MBEDTLS_HMAC_DRBG_H @@ -140,6 +138,10 @@ typedef struct mbedtls_hmac_drbg_context * This function makes the context ready for mbedtls_hmac_drbg_seed(), * mbedtls_hmac_drbg_seed_buf() or mbedtls_hmac_drbg_free(). * + * \note The reseed interval is #MBEDTLS_HMAC_DRBG_RESEED_INTERVAL + * by default. Override this value by calling + * mbedtls_hmac_drbg_set_reseed_interval(). + * * \param ctx HMAC_DRBG context to be initialized. */ void mbedtls_hmac_drbg_init( mbedtls_hmac_drbg_context *ctx ); @@ -363,7 +365,8 @@ int mbedtls_hmac_drbg_random_with_add( void *p_rng, int mbedtls_hmac_drbg_random( void *p_rng, unsigned char *output, size_t out_len ); /** - * \brief Free an HMAC_DRBG context + * \brief This function resets HMAC_DRBG context to the state immediately + * after initial call of mbedtls_hmac_drbg_init(). * * \param ctx The HMAC_DRBG context to free. */ diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md.h index 6a21f0590..2ba8d9e7a 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md.h @@ -6,7 +6,7 @@ * \author Adriaan de Jong */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -47,8 +47,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md2.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md2.h index 6d563b41b..9607df66b 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md2.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md2.h @@ -8,7 +8,7 @@ * instead. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -50,8 +50,6 @@ * * ********** * - * This file is part of mbed TLS (https://tls.mbed.org) - * */ #ifndef MBEDTLS_MD2_H #define MBEDTLS_MD2_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md4.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md4.h index 3f4bcdc60..6ceaf7a2f 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md4.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md4.h @@ -8,7 +8,7 @@ * instead. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -50,8 +50,6 @@ * * ********** * - * This file is part of mbed TLS (https://tls.mbed.org) - * */ #ifndef MBEDTLS_MD4_H #define MBEDTLS_MD4_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md5.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md5.h index 34279c721..b9d0ca929 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md5.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md5.h @@ -8,7 +8,7 @@ * digests instead. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -49,8 +49,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD5_H #define MBEDTLS_MD5_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md_internal.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md_internal.h index 154b8bbc2..847f50aa0 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md_internal.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/md_internal.h @@ -8,7 +8,7 @@ * \author Adriaan de Jong */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -49,8 +49,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MD_WRAP_H #define MBEDTLS_MD_WRAP_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/memory_buffer_alloc.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/memory_buffer_alloc.h index c1e0926b1..89c061749 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/memory_buffer_alloc.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/memory_buffer_alloc.h @@ -4,7 +4,7 @@ * \brief Buffer-based memory allocator */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_MEMORY_BUFFER_ALLOC_H #define MBEDTLS_MEMORY_BUFFER_ALLOC_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net.h index bba4a3594..6c7a49d3b 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net.h @@ -6,7 +6,7 @@ * \deprecated Superseded by mbedtls/net_sockets.h */ /* - * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -47,8 +47,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #if !defined(MBEDTLS_CONFIG_FILE) #include "config.h" diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net_sockets.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net_sockets.h index d4d23fe9d..00fea7db1 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net_sockets.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/net_sockets.h @@ -20,7 +20,7 @@ * */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -61,8 +61,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_NET_SOCKETS_H #define MBEDTLS_NET_SOCKETS_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/nist_kw.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/nist_kw.h index f2b9cebf9..943565699 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/nist_kw.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/nist_kw.h @@ -16,7 +16,7 @@ * */ /* - * Copyright (C) 2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -57,8 +57,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_NIST_KW_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/oid.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/oid.h index 7fe4b3862..4a7e3b4b3 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/oid.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/oid.h @@ -4,7 +4,7 @@ * \brief Object Identifier (OID) database */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_OID_H #define MBEDTLS_OID_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/padlock.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/padlock.h index bd476f5f3..d8246e2cd 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/padlock.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/padlock.h @@ -8,7 +8,7 @@ * functions; you must not call them directly. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -49,8 +49,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PADLOCK_H #define MBEDTLS_PADLOCK_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pem.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pem.h index 16b610141..c9df7ca6e 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pem.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pem.h @@ -4,7 +4,7 @@ * \brief Privacy Enhanced Mail (PEM) decoding */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PEM_H #define MBEDTLS_PEM_H @@ -139,17 +137,27 @@ void mbedtls_pem_free( mbedtls_pem_context *ctx ); * \brief Write a buffer of PEM information from a DER encoded * buffer. * - * \param header header string to write - * \param footer footer string to write - * \param der_data DER data to write - * \param der_len length of the DER data - * \param buf buffer to write to - * \param buf_len length of output buffer - * \param olen total length written / required (if buf_len is not enough) + * \param header The header string to write. + * \param footer The footer string to write. + * \param der_data The DER data to encode. + * \param der_len The length of the DER data \p der_data in Bytes. + * \param buf The buffer to write to. + * \param buf_len The length of the output buffer \p buf in Bytes. + * \param olen The address at which to store the total length written + * or required (if \p buf_len is not enough). * - * \return 0 on success, or a specific PEM or BASE64 error code. On - * MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL olen is the required - * size. + * \note You may pass \c NULL for \p buf and \c 0 for \p buf_len + * to request the length of the resulting PEM buffer in + * `*olen`. + * + * \note This function may be called with overlapping \p der_data + * and \p buf buffers. + * + * \return \c 0 on success. + * \return #MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL if \p buf isn't large + * enough to hold the PEM buffer. In this case, `*olen` holds + * the required minimum size of \p buf. + * \return Another PEM or BASE64 error code on other kinds of failure. */ int mbedtls_pem_write_buffer( const char *header, const char *footer, const unsigned char *der_data, size_t der_len, diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk.h index 408f7baee..20d51d4f3 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk.h @@ -4,7 +4,7 @@ * \brief Public Key abstraction layer */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PK_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk_internal.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk_internal.h index 1cd05943b..3f84cdf74 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk_internal.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pk_internal.h @@ -4,7 +4,7 @@ * \brief Public Key abstraction layer: wrapper functions */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PK_WRAP_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs11.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs11.h index e1446120c..3874d4a05 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs11.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs11.h @@ -6,7 +6,7 @@ * \author Adriaan de Jong */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -47,8 +47,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS11_H #define MBEDTLS_PKCS11_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs12.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs12.h index c418e8f24..9cbcb1730 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs12.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs12.h @@ -4,7 +4,7 @@ * \brief PKCS#12 Personal Information Exchange Syntax */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS12_H #define MBEDTLS_PKCS12_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs5.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs5.h index c3f645aff..328633c49 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs5.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/pkcs5.h @@ -6,7 +6,7 @@ * \author Mathias Olsson */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -47,8 +47,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PKCS5_H #define MBEDTLS_PKCS5_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform.h index dcb5a88ee..689cfc6ec 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform.h @@ -13,7 +13,7 @@ * dynamically configured at runtime. */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -54,8 +54,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PLATFORM_H #define MBEDTLS_PLATFORM_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_time.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_time.h index a45870c3a..e132f6a68 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_time.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_time.h @@ -4,7 +4,7 @@ * \brief mbed TLS Platform time abstraction */ /* - * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PLATFORM_TIME_H #define MBEDTLS_PLATFORM_TIME_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_util.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_util.h index f10574afe..426afaf04 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_util.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/platform_util.h @@ -5,7 +5,7 @@ * library. */ /* - * Copyright (C) 2018, Arm Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -46,8 +46,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_PLATFORM_UTIL_H #define MBEDTLS_PLATFORM_UTIL_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/poly1305.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/poly1305.h index 6e45b2c2b..b337aa841 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/poly1305.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/poly1305.h @@ -13,7 +13,7 @@ */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved. + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -54,8 +54,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_POLY1305_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ripemd160.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ripemd160.h index 505c39252..31c6637d6 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ripemd160.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ripemd160.h @@ -4,7 +4,7 @@ * \brief RIPE MD-160 message digest */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_RIPEMD160_H #define MBEDTLS_RIPEMD160_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa.h index cd22fc4c1..188c37cf3 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa.h @@ -10,7 +10,7 @@ * */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -51,8 +51,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_RSA_H #define MBEDTLS_RSA_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa_internal.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa_internal.h index 2464e6b08..953cb7b81 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa_internal.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/rsa_internal.h @@ -35,7 +35,7 @@ * */ /* - * Copyright (C) 2006-2017, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -77,8 +77,6 @@ * * ********** * - * This file is part of mbed TLS (https://tls.mbed.org) - * */ #ifndef MBEDTLS_RSA_INTERNAL_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha1.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha1.h index e69db8a15..60c514a49 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha1.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha1.h @@ -11,7 +11,7 @@ * digests instead. */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -52,8 +52,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA1_H #define MBEDTLS_SHA1_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha256.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha256.h index 5b03bc31d..b1881e183 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha256.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha256.h @@ -7,7 +7,7 @@ * hash functions are defined in FIPS 180-4: Secure Hash Standard (SHS). */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -48,8 +48,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA256_H #define MBEDTLS_SHA256_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha512.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha512.h index 2fbc69f80..5e5a15e00 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha512.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/sha512.h @@ -6,7 +6,7 @@ * hash functions are defined in FIPS 180-4: Secure Hash Standard (SHS). */ /* - * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -47,8 +47,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SHA512_H #define MBEDTLS_SHA512_H @@ -154,8 +152,7 @@ int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx, /** * \brief This function finishes the SHA-512 operation, and writes - * the result to the output buffer. This function is for - * internal use only. + * the result to the output buffer. * * \param ctx The SHA-512 context. This must be initialized * and have a hash operation started. @@ -171,6 +168,7 @@ int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx, /** * \brief This function processes a single data block within * the ongoing SHA-512 computation. + * This function is for internal use only. * * \param ctx The SHA-512 context. This must be initialized. * \param data The buffer holding one block of data. This diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl.h index 6f5698356..fe33ac8d5 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl.h @@ -4,7 +4,7 @@ * \brief SSL/TLS functions. */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_H #define MBEDTLS_SSL_H @@ -1411,7 +1409,7 @@ void mbedtls_ssl_conf_dbg( mbedtls_ssl_config *conf, * \note For DTLS, you need to provide either a non-NULL * f_recv_timeout callback, or a f_recv that doesn't block. * - * \note See the documentations of \c mbedtls_ssl_sent_t, + * \note See the documentations of \c mbedtls_ssl_send_t, * \c mbedtls_ssl_recv_t and \c mbedtls_ssl_recv_timeout_t for * the conventions those callbacks must follow. * diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cache.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cache.h index e987c29e1..612d81776 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cache.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cache.h @@ -4,7 +4,7 @@ * \brief SSL session cache implementation */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_CACHE_H #define MBEDTLS_SSL_CACHE_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ciphersuites.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ciphersuites.h index 896914116..ab8e601db 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ciphersuites.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ciphersuites.h @@ -4,7 +4,7 @@ * \brief SSL Ciphersuites for mbed TLS */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_CIPHERSUITES_H #define MBEDTLS_SSL_CIPHERSUITES_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cookie.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cookie.h index 71e056781..9c2d5b62a 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cookie.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_cookie.h @@ -4,7 +4,7 @@ * \brief DTLS cookie callbacks implementation */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_COOKIE_H #define MBEDTLS_SSL_COOKIE_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_internal.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_internal.h index b371094f1..6ba6c2af0 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_internal.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_internal.h @@ -4,7 +4,7 @@ * \brief Internal functions shared by the SSL modules */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_INTERNAL_H #define MBEDTLS_SSL_INTERNAL_H @@ -152,6 +150,24 @@ #define MBEDTLS_SSL_RETRANS_WAITING 2 #define MBEDTLS_SSL_RETRANS_FINISHED 3 +/* This macro determines whether CBC is supported. */ +#if defined(MBEDTLS_CIPHER_MODE_CBC) && \ + ( defined(MBEDTLS_AES_C) || \ + defined(MBEDTLS_CAMELLIA_C) || \ + defined(MBEDTLS_ARIA_C) || \ + defined(MBEDTLS_DES_C) ) +#define MBEDTLS_SSL_SOME_SUITES_USE_CBC +#endif + +/* This macro determines whether the CBC construct used in TLS 1.0-1.2 (as + * opposed to the very different CBC construct used in SSLv3) is supported. */ +#if defined(MBEDTLS_SSL_SOME_SUITES_USE_CBC) && \ + ( defined(MBEDTLS_SSL_PROTO_TLS1) || \ + defined(MBEDTLS_SSL_PROTO_TLS1_1) || \ + defined(MBEDTLS_SSL_PROTO_TLS1_2) ) +#define MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC +#endif + /* * Allow extra bytes for record, authentication and encryption overhead: * counter (8) + header (5) + IV(16) + MAC (16-48) + padding (0-256) @@ -843,6 +859,73 @@ int mbedtls_ssl_get_key_exchange_md_tls1_2( mbedtls_ssl_context *ssl, #endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \ MBEDTLS_SSL_PROTO_TLS1_2 */ +#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) +/** \brief Compute the HMAC of variable-length data with constant flow. + * + * This function computes the HMAC of the concatenation of \p add_data and \p + * data, and does with a code flow and memory access pattern that does not + * depend on \p data_len_secret, but only on \p min_data_len and \p + * max_data_len. In particular, this function always reads exactly \p + * max_data_len bytes from \p data. + * + * \param ctx The HMAC context. It must have keys configured + * with mbedtls_md_hmac_starts() and use one of the + * following hashes: SHA-384, SHA-256, SHA-1 or MD-5. + * It is reset using mbedtls_md_hmac_reset() after + * the computation is complete to prepare for the + * next computation. + * \param add_data The additional data prepended to \p data. This + * must point to a readable buffer of \p add_data_len + * bytes. + * \param add_data_len The length of \p add_data in bytes. + * \param data The data appended to \p add_data. This must point + * to a readable buffer of \p max_data_len bytes. + * \param data_len_secret The length of the data to process in \p data. + * This must be no less than \p min_data_len and no + * greater than \p max_data_len. + * \param min_data_len The minimal length of \p data in bytes. + * \param max_data_len The maximal length of \p data in bytes. + * \param output The HMAC will be written here. This must point to + * a writable buffer of sufficient size to hold the + * HMAC value. + * + * \retval 0 + * Success. + * \retval MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED + * The hardware accelerator failed. + */ +int mbedtls_ssl_cf_hmac( + mbedtls_md_context_t *ctx, + const unsigned char *add_data, size_t add_data_len, + const unsigned char *data, size_t data_len_secret, + size_t min_data_len, size_t max_data_len, + unsigned char *output ); + +/** \brief Copy data from a secret position with constant flow. + * + * This function copies \p len bytes from \p src_base + \p offset_secret to \p + * dst, with a code flow and memory access pattern that does not depend on \p + * offset_secret, but only on \p offset_min, \p offset_max and \p len. + * + * \param dst The destination buffer. This must point to a writable + * buffer of at least \p len bytes. + * \param src_base The base of the source buffer. This must point to a + * readable buffer of at least \p offset_max + \p len + * bytes. + * \param offset_secret The offset in the source buffer from which to copy. + * This must be no less than \p offset_min and no greater + * than \p offset_max. + * \param offset_min The minimal value of \p offset_secret. + * \param offset_max The maximal value of \p offset_secret. + * \param len The number of bytes to copy. + */ +void mbedtls_ssl_cf_memcpy_offset( unsigned char *dst, + const unsigned char *src_base, + size_t offset_secret, + size_t offset_min, size_t offset_max, + size_t len ); +#endif /* MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC */ + #ifdef __cplusplus } #endif diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ticket.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ticket.h index ac3be0433..a10a43413 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ticket.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/ssl_ticket.h @@ -4,7 +4,7 @@ * \brief TLS server ticket callbacks implementation */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_TICKET_H #define MBEDTLS_SSL_TICKET_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/threading.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/threading.h index b6ec4df8e..a8183a6ef 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/threading.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/threading.h @@ -4,7 +4,7 @@ * \brief Threading abstraction layer */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_THREADING_H #define MBEDTLS_THREADING_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/timing.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/timing.h index 149ccfb66..8611ba9a4 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/timing.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/timing.h @@ -4,7 +4,7 @@ * \brief Portable interface to timeouts and to the CPU cycle counter */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_TIMING_H #define MBEDTLS_TIMING_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/version.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/version.h index 2bff31d51..5f0a8f114 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/version.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/version.h @@ -4,7 +4,7 @@ * \brief Run-time version information */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ /* * This set of compile-time defines and run-time variables can be used to @@ -67,16 +65,16 @@ */ #define MBEDTLS_VERSION_MAJOR 2 #define MBEDTLS_VERSION_MINOR 16 -#define MBEDTLS_VERSION_PATCH 7 +#define MBEDTLS_VERSION_PATCH 9 /** * The single version number has the following structure: * MMNNPP00 * Major version | Minor version | Patch version */ -#define MBEDTLS_VERSION_NUMBER 0x02100700 -#define MBEDTLS_VERSION_STRING "2.16.7" -#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.16.7" +#define MBEDTLS_VERSION_NUMBER 0x02100900 +#define MBEDTLS_VERSION_STRING "2.16.9" +#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.16.9" #if defined(MBEDTLS_VERSION_C) diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509.h index e9f2fc602..5bb9b0029 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509.h @@ -4,7 +4,7 @@ * \brief X.509 generic defines and structures */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_H #define MBEDTLS_X509_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crl.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crl.h index 0e37f65e8..2ade47c89 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crl.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crl.h @@ -4,7 +4,7 @@ * \brief X.509 certificate revocation list parsing */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CRL_H #define MBEDTLS_X509_CRL_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crt.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crt.h index 4aae923ea..c38e0c055 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crt.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_crt.h @@ -4,7 +4,7 @@ * \brief X.509 certificate parsing and writing */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CRT_H #define MBEDTLS_X509_CRT_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_csr.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_csr.h index 8ba2cda0d..5dfb4213e 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_csr.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/x509_csr.h @@ -4,7 +4,7 @@ * \brief X.509 certificate signing request parsing and writing */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_X509_CSR_H #define MBEDTLS_X509_CSR_H diff --git a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/xtea.h b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/xtea.h index d37211021..cd6d3753d 100644 --- a/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/xtea.h +++ b/tools/sdk/esp32s2/include/mbedtls/mbedtls/include/mbedtls/xtea.h @@ -4,7 +4,7 @@ * \brief XTEA block cipher (32-bit) */ /* - * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * * This file is provided under the Apache License 2.0, or the @@ -45,8 +45,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** - * - * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_XTEA_H #define MBEDTLS_XTEA_H diff --git a/tools/sdk/esp32/include/mbedtls/port/include/esp32s3/aes.h b/tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes.h similarity index 90% rename from tools/sdk/esp32/include/mbedtls/port/include/esp32s3/aes.h rename to tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes.h index 904a0ecdf..c9c431696 100644 --- a/tools/sdk/esp32/include/mbedtls/port/include/esp32s3/aes.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes.h @@ -1,9 +1,9 @@ /** - * \brief AES block cipher, ESP32 hardware accelerated version + * \brief AES block cipher, ESP hardware accelerated version * Based on mbedTLS FIPS-197 compliant version. * * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved - * Additions Copyright (C) 2016-2020, Espressif Systems (Shanghai) PTE Ltd + * Additions Copyright (C) 2016, Espressif Systems (Shanghai) PTE Ltd * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -21,31 +21,23 @@ * */ -#ifndef ESP_AES_H -#define ESP_AES_H +#pragma once #include "esp_types.h" -#include "esp32s3/rom/aes.h" +#include "hal/aes_types.h" #ifdef __cplusplus extern "C" { #endif -/* padlock.c and aesni.c rely on these values! */ -#define ESP_AES_ENCRYPT 1 -#define ESP_AES_DECRYPT 0 + #define ERR_ESP_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */ #define ERR_ESP_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */ - /** * \brief AES context structure * - * \note buf is able to hold 32 extra bytes, which can be used: - * - for alignment purposes if VIA padlock is used, and/or - * - to simplify key expansion in the 256-bit case by - * generating an extra round key */ typedef struct { uint8_t key_bytes; @@ -53,17 +45,20 @@ typedef struct { uint8_t key[32]; } esp_aes_context; - /** * \brief The AES XTS context-type definition. */ -typedef struct { +typedef struct +{ esp_aes_context crypt; /*!< The AES context to use for AES block encryption or decryption. */ esp_aes_context tweak; /*!< The AES context used for tweak computation. */ } esp_aes_xts_context; + + + /** * \brief Lock access to AES hardware unit * @@ -99,7 +94,7 @@ void esp_aes_init( esp_aes_context *ctx ); */ void esp_aes_free( esp_aes_context *ctx ); -/* +/** * \brief This function initializes the specified AES XTS context. * * It must be the first API called before using @@ -116,16 +111,6 @@ void esp_aes_xts_init( esp_aes_xts_context *ctx ); */ void esp_aes_xts_free( esp_aes_xts_context *ctx ); -/** - * \brief AES set key schedule (encryption or decryption) - * - * \param ctx AES context to be initialized - * \param key encryption key - * \param keybits must be 128, 192 or 256 - * - * \return 0 if successful, or ERR_AES_INVALID_KEY_LENGTH - */ - /** * \brief AES set key schedule (encryption or decryption) * @@ -313,21 +298,26 @@ int esp_aes_crypt_ofb( esp_aes_context *ctx, * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. */ int esp_aes_xts_setkey_enc( esp_aes_xts_context *ctx, - const unsigned char *key, - unsigned int keybits ); + const unsigned char *key, + unsigned int keybits ); /** - * \brief Internal AES block encryption function - * (Only exposed to allow overriding it, - * see AES_ENCRYPT_ALT) + * \brief This function prepares an XTS context for decryption and + * sets the decryption key. * - * \param ctx AES context - * \param input Plaintext block - * \param output Output (ciphertext) block + * \param ctx The AES XTS context to which the key should be bound. + * \param key The decryption key. This is comprised of the XTS key1 + * concatenated with the XTS key2. + * \param keybits The size of \p key passed in bits. Valid options are: + *
  • 256 bits (each of key1 and key2 is a 128-bit key)
  • + *
  • 512 bits (each of key1 and key2 is a 256-bit key)
+ * + * \return \c 0 on success. + * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. */ int esp_aes_xts_setkey_dec( esp_aes_xts_context *ctx, - const unsigned char *key, - unsigned int keybits ); + const unsigned char *key, + unsigned int keybits ); /** @@ -341,9 +331,6 @@ int esp_aes_xts_setkey_dec( esp_aes_xts_context *ctx, */ int esp_internal_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ); -/** Deprecated, see esp_aes_internal_encrypt */ -void esp_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated)); - /** * \brief Internal AES block decryption function * (Only exposed to allow overriding it, @@ -355,15 +342,15 @@ void esp_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsig */ int esp_internal_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ); -/** Deprecated, see esp_aes_internal_decrypt */ -void esp_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated)); - /** AES-XTS buffer encryption/decryption */ int esp_aes_crypt_xts( esp_aes_xts_context *ctx, int mode, size_t length, const unsigned char data_unit[16], const unsigned char *input, unsigned char *output ); +/** Deprecated, see esp_aes_internal_decrypt */ +void esp_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated)); + +/** Deprecated, see esp_aes_internal_encrypt */ +void esp_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated)); #ifdef __cplusplus } #endif - -#endif /* aes.h */ diff --git a/tools/sdk/esp32/include/mbedtls/port/include/esp32s3/gcm.h b/tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes_gcm.h similarity index 95% rename from tools/sdk/esp32/include/mbedtls/port/include/esp32s3/gcm.h rename to tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes_gcm.h index 07c80ad5e..92c81205f 100644 --- a/tools/sdk/esp32/include/mbedtls/port/include/esp32s3/gcm.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes_gcm.h @@ -1,5 +1,5 @@ /** - * \brief AES block cipher, ESP32C hardware accelerated version + * \brief AES GCM block cipher, ESP hardware accelerated version * Based on mbedTLS FIPS-197 compliant version. * * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved @@ -21,11 +21,12 @@ * */ -#ifndef ESP_GCM_H -#define ESP_GCM_H +#pragma once -#include "aes.h" +#include "aes/esp_aes.h" #include "mbedtls/cipher.h" +#include "soc/lldesc.h" + #ifdef __cplusplus extern "C" { #endif @@ -36,6 +37,7 @@ extern "C" { typedef enum { ESP_AES_GCM_STATE_INIT, + ESP_AES_GCM_STATE_START, ESP_AES_GCM_STATE_UPDATE, ESP_AES_GCM_STATE_FINISH } esp_aes_gcm_state; @@ -59,6 +61,7 @@ typedef struct { esp_aes_gcm_state gcm_state; } esp_gcm_context; + /** * \brief This function initializes the specified GCM context * @@ -96,8 +99,8 @@ int esp_aes_gcm_setkey( esp_gcm_context *ctx, * \param iv The initialization vector. * \param iv_len The length of the IV. * \param add The buffer holding the additional data, or NULL - * if \p add_len is 0. - * \param add_len The length of the additional data. If 0, + * if \p aad_len is 0. + * \param aad_len The length of the additional data. If 0, * \p add is NULL. * * \return \c 0 on success. @@ -176,7 +179,7 @@ void esp_aes_gcm_free( esp_gcm_context *ctx); * \param iv The initialization vector. * \param iv_len The length of the IV. * \param add The buffer holding the additional data. - * \param add_len The length of the additional data. + * \param aad_len The length of the additional data. * \param input The buffer holding the input data. * \param output The buffer for holding the output data. * \param tag_len The length of the tag to generate. @@ -190,7 +193,7 @@ int esp_aes_gcm_crypt_and_tag( esp_gcm_context *ctx, const unsigned char *iv, size_t iv_len, const unsigned char *add, - size_t add_len, + size_t aad_len, const unsigned char *input, unsigned char *output, size_t tag_len, @@ -211,7 +214,7 @@ int esp_aes_gcm_crypt_and_tag( esp_gcm_context *ctx, * \param iv The initialization vector. * \param iv_len The length of the IV. * \param add The buffer holding the additional data. - * \param add_len The length of the additional data. + * \param aad_len The length of the additional data. * \param tag The buffer holding the tag. * \param tag_len The length of the tag. * \param input The buffer holding the input data. @@ -225,7 +228,7 @@ int esp_aes_gcm_auth_decrypt( esp_gcm_context *ctx, const unsigned char *iv, size_t iv_len, const unsigned char *add, - size_t add_len, + size_t aad_len, const unsigned char *tag, size_t tag_len, const unsigned char *input, @@ -234,5 +237,3 @@ int esp_aes_gcm_auth_decrypt( esp_gcm_context *ctx, #ifdef __cplusplus } #endif - -#endif /* gcm.h */ diff --git a/tools/sdk/esp32/include/mbedtls/port/include/esp32s3/crypto_dma.h b/tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes_internal.h similarity index 51% rename from tools/sdk/esp32/include/mbedtls/port/include/esp32s3/crypto_dma.h rename to tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes_internal.h index ce7d67efa..35a7d3935 100644 --- a/tools/sdk/esp32/include/mbedtls/port/include/esp32s3/crypto_dma.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/aes/esp_aes_internal.h @@ -1,4 +1,7 @@ /** + * \brief AES block cipher, ESP-IDF hardware accelerated version + * Based on mbedTLS FIPS-197 compliant version. + * * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved * Additions Copyright (C) 2016, Espressif Systems (Shanghai) PTE Ltd * SPDX-License-Identifier: Apache-2.0 @@ -15,26 +18,37 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * + * Internal API */ -#ifndef ESP_CRYPTO_DMA_H -#define ESP_CRYPTO_DMA_H +#pragma once -#include + +#include "aes/esp_aes.h" +#include "aes/esp_aes_gcm.h" +#include #ifdef __cplusplus extern "C" { #endif +bool valid_key_length(const esp_aes_context *ctx); -/* Since crypto DMA is shared between DMA-AES and SHA blocks - * Needs to be taken by respective blocks before using Crypto DMA + +/** + * @brief Run a AES-GCM conversion using DMA + * + * @param ctx Aes context + * @param input Pointer to input data + * @param output Pointer to output data + * @param len Length of the input data + * @param aad_desc GCM additional data DMA descriptor + * @param aad_len GCM additional data length + * @return int -1 on error */ -extern _lock_t crypto_dma_lock; +int esp_aes_process_dma_gcm(esp_aes_context *ctx, const unsigned char *input, unsigned char *output, size_t len, lldesc_t *aad_desc, size_t aad_len); + #ifdef __cplusplus } #endif - -#endif /* crypto_dma.h */ diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/aes_alt.h b/tools/sdk/esp32s2/include/mbedtls/port/include/aes_alt.h index f313d508b..2f8e958b2 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/aes_alt.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/aes_alt.h @@ -28,13 +28,7 @@ extern "C" { #endif #if defined(MBEDTLS_AES_ALT) -#if CONFIG_IDF_TARGET_ESP32 -#include "esp32/aes.h" -#elif CONFIG_IDF_TARGET_ESP32S2 -#include "esp32s2/aes.h" -#elif CONFIG_IDF_TARGET_ESP32S3 -#include "esp32s3/aes.h" -#endif +#include "aes/esp_aes.h" typedef esp_aes_context mbedtls_aes_context; diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/bignum_impl.h b/tools/sdk/esp32s2/include/mbedtls/port/include/bignum_impl.h index 6ca69bb7c..838a9d4af 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/bignum_impl.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/bignum_impl.h @@ -80,4 +80,4 @@ void esp_mpi_exp_mpi_mod_hw_op(const mbedtls_mpi *X, const mbedtls_mpi *Y, const #endif //ESP_MPI_USE_MONT_EXP -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/aes.h b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/aes.h index f423b8a7f..3eb87a78c 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/aes.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/aes.h @@ -24,330 +24,8 @@ #ifndef ESP_AES_H #define ESP_AES_H -#include "esp_types.h" -#include "esp32/rom/aes.h" +#warning "esp32/aes.h is deprecated, please use aes/esp_aes.h instead" -#ifdef __cplusplus -extern "C" { -#endif - -/* padlock.c and aesni.c rely on these values! */ -#define ESP_AES_ENCRYPT 1 -#define ESP_AES_DECRYPT 0 - -#define ERR_ESP_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */ -#define ERR_ESP_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */ - -/** - * \brief AES context structure - * - */ -typedef struct { - uint8_t key_bytes; - volatile uint8_t key_in_hardware; /* This variable is used for fault injection checks, so marked volatile to avoid optimisation */ - uint8_t key[32]; -} esp_aes_context; - -/** - * \brief The AES XTS context-type definition. - */ -typedef struct -{ - esp_aes_context crypt; /*!< The AES context to use for AES block - encryption or decryption. */ - esp_aes_context tweak; /*!< The AES context used for tweak - computation. */ -} esp_aes_xts_context; - - -/** - * \brief Lock access to AES hardware unit - * - * AES hardware unit can only be used by one - * consumer at a time. - * - * esp_aes_xxx API calls automatically manage locking & unlocking of - * hardware, this function is only needed if you want to call - * ets_aes_xxx functions directly. - */ -void esp_aes_acquire_hardware( void ); - -/** - * \brief Unlock access to AES hardware unit - * - * esp_aes_xxx API calls automatically manage locking & unlocking of - * hardware, this function is only needed if you want to call - * ets_aes_xxx functions directly. - */ -void esp_aes_release_hardware( void ); - -/** - * \brief Initialize AES context - * - * \param ctx AES context to be initialized - */ -void esp_aes_init( esp_aes_context *ctx ); - -/** - * \brief Clear AES context - * - * \param ctx AES context to be cleared - */ -void esp_aes_free( esp_aes_context *ctx ); - -/** - * \brief This function initializes the specified AES XTS context. - * - * It must be the first API called before using - * the context. - * - * \param ctx The AES XTS context to initialize. - */ -void esp_aes_xts_init( esp_aes_xts_context *ctx ); - -/** - * \brief This function releases and clears the specified AES XTS context. - * - * \param ctx The AES XTS context to clear. - */ -void esp_aes_xts_free( esp_aes_xts_context *ctx ); - -/** - * \brief AES set key schedule (encryption or decryption) - * - * \param ctx AES context to be initialized - * \param key encryption key - * \param keybits must be 128, 192 or 256 - * - * \return 0 if successful, or ERR_AES_INVALID_KEY_LENGTH - */ -int esp_aes_setkey( esp_aes_context *ctx, const unsigned char *key, unsigned int keybits ); - -/** - * \brief AES-ECB block encryption/decryption - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param input 16-byte input block - * \param output 16-byte output block - * - * \return 0 if successful - */ -int esp_aes_crypt_ecb( esp_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16] ); - -/** - * \brief AES-CBC buffer encryption/decryption - * Length should be a multiple of the block - * size (16 bytes) - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful, or ERR_AES_INVALID_INPUT_LENGTH - */ -int esp_aes_crypt_cbc( esp_aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - - -/** - * \brief AES-CFB128 buffer encryption/decryption. - * - * Note: Due to the nature of CFB you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * esp_aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv_off offset in IV (updated after use) - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful - */ -int esp_aes_crypt_cfb128( esp_aes_context *ctx, - int mode, - size_t length, - size_t *iv_off, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief AES-CFB8 buffer encryption/decryption. - * - * Note: Due to the nature of CFB you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * esp_aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful - */ -int esp_aes_crypt_cfb8( esp_aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief AES-CTR buffer encryption/decryption - * - * Warning: You have to keep the maximum use of your counter in mind! - * - * Note: Due to the nature of CTR you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * esp_aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * \param ctx AES context - * \param length The length of the data - * \param nc_off The offset in the current stream_block (for resuming - * within current cipher stream). The offset pointer to - * should be 0 at the start of a stream. - * \param nonce_counter The 128-bit nonce and counter. - * \param stream_block The saved stream-block for resuming. Is overwritten - * by the function. - * \param input The input data stream - * \param output The output data stream - * - * \return 0 if successful - */ -int esp_aes_crypt_ctr( esp_aes_context *ctx, - size_t length, - size_t *nc_off, - unsigned char nonce_counter[16], - unsigned char stream_block[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief This function prepares an XTS context for encryption and - * sets the encryption key. - * - * \param ctx The AES XTS context to which the key should be bound. - * \param key The encryption key. This is comprised of the XTS key1 - * concatenated with the XTS key2. - * \param keybits The size of \p key passed in bits. Valid options are: - *
  • 256 bits (each of key1 and key2 is a 128-bit key)
  • - *
  • 512 bits (each of key1 and key2 is a 256-bit key)
- * - * \return \c 0 on success. - * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. - */ -int esp_aes_xts_setkey_enc( esp_aes_xts_context *ctx, - const unsigned char *key, - unsigned int keybits ); - -/** - * \brief This function performs an AES-OFB (Output Feedback Mode) - * encryption or decryption operation. - * - * \param ctx The AES context to use for encryption or decryption. - * It must be initialized and bound to a key. - * \param length The length of the input data. - * \param iv_off The offset in IV (updated after use). - * It must point to a valid \c size_t. - * \param iv The initialization vector (updated after use). - * It must be a readable and writeable buffer of \c 16 Bytes. - * \param input The buffer holding the input data. - * It must be readable and of size \p length Bytes. - * \param output The buffer holding the output data. - * It must be writeable and of size \p length Bytes. - * - * \return \c 0 on success. - */ -int esp_aes_crypt_ofb( esp_aes_context *ctx, - size_t length, - size_t *iv_off, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief This function prepares an XTS context for decryption and - * sets the decryption key. - * - * \param ctx The AES XTS context to which the key should be bound. - * \param key The decryption key. This is comprised of the XTS key1 - * concatenated with the XTS key2. - * \param keybits The size of \p key passed in bits. Valid options are: - *
  • 256 bits (each of key1 and key2 is a 128-bit key)
  • - *
  • 512 bits (each of key1 and key2 is a 256-bit key)
- * - * \return \c 0 on success. - * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. - */ -int esp_aes_xts_setkey_dec( esp_aes_xts_context *ctx, - const unsigned char *key, - unsigned int keybits ); - - -/** - * \brief Internal AES block encryption function - * (Only exposed to allow overriding it, - * see AES_ENCRYPT_ALT) - * - * \param ctx AES context - * \param input Plaintext block - * \param output Output (ciphertext) block - */ -int esp_internal_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ); - -/** - * \brief Internal AES block decryption function - * (Only exposed to allow overriding it, - * see AES_DECRYPT_ALT) - * - * \param ctx AES context - * \param input Ciphertext block - * \param output Output (plaintext) block - */ -int esp_internal_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ); - -/** AES-XTS buffer encryption/decryption */ -int esp_aes_crypt_xts( esp_aes_xts_context *ctx, int mode, size_t length, const unsigned char data_unit[16], const unsigned char *input, unsigned char *output ); - -#ifdef __cplusplus -} -#endif +#include "aes/esp_aes.h" #endif /* aes.h */ diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/sha.h b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/sha.h index b99d613c9..14d39b3d6 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/sha.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32/sha.h @@ -17,4 +17,4 @@ #include "sha/sha_parallel_engine.h" -#warning esp32/sha.h is deprecated, please use sha_parallel_engine.h instead \ No newline at end of file +#warning esp32/sha.h is deprecated, please use sha_parallel_engine.h instead diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/aes.h b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/aes.h index 5f55fdce4..09a3b3d59 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/aes.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/aes.h @@ -24,346 +24,10 @@ #ifndef ESP_AES_H #define ESP_AES_H -#include "esp_types.h" -#include "esp32s2/rom/aes.h" -#ifdef __cplusplus -extern "C" { -#endif +//#warning "esp32s2/aes.h is deprecated, please use aes/esp_aes.h instead" -/* padlock.c and aesni.c rely on these values! */ -#define ESP_AES_ENCRYPT 1 -#define ESP_AES_DECRYPT 0 +#include "aes/esp_aes.h" -#define ERR_ESP_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */ -#define ERR_ESP_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */ - - -/** - * \brief AES context structure - * - * \note buf is able to hold 32 extra bytes, which can be used: - * - for alignment purposes if VIA padlock is used, and/or - * - to simplify key expansion in the 256-bit case by - * generating an extra round key - */ -typedef struct { - uint8_t key_bytes; - volatile uint8_t key_in_hardware; /* This variable is used for fault injection checks, so marked volatile to avoid optimisation */ - uint8_t key[32]; -} esp_aes_context; - - -/** - * \brief The AES XTS context-type definition. - */ -typedef struct { - esp_aes_context crypt; /*!< The AES context to use for AES block - encryption or decryption. */ - esp_aes_context tweak; /*!< The AES context used for tweak - computation. */ -} esp_aes_xts_context; - -/** - * \brief Lock access to AES hardware unit - * - * AES hardware unit can only be used by one - * consumer at a time. - * - * esp_aes_xxx API calls automatically manage locking & unlocking of - * hardware, this function is only needed if you want to call - * ets_aes_xxx functions directly. - */ -void esp_aes_acquire_hardware( void ); - -/** - * \brief Unlock access to AES hardware unit - * - * esp_aes_xxx API calls automatically manage locking & unlocking of - * hardware, this function is only needed if you want to call - * ets_aes_xxx functions directly. - */ -void esp_aes_release_hardware( void ); - -/** - * \brief Initialize AES context - * - * \param ctx AES context to be initialized - */ -void esp_aes_init( esp_aes_context *ctx ); - -/** - * \brief Clear AES context - * - * \param ctx AES context to be cleared - */ -void esp_aes_free( esp_aes_context *ctx ); - -/* - * \brief This function initializes the specified AES XTS context. - * - * It must be the first API called before using - * the context. - * - * \param ctx The AES XTS context to initialize. - */ -void esp_aes_xts_init( esp_aes_xts_context *ctx ); - -/** - * \brief This function releases and clears the specified AES XTS context. - * - * \param ctx The AES XTS context to clear. - */ -void esp_aes_xts_free( esp_aes_xts_context *ctx ); - -/** - * \brief AES set key schedule (encryption or decryption) - * - * \param ctx AES context to be initialized - * \param key encryption key - * \param keybits must be 128, 192 or 256 - * - * \return 0 if successful, or ERR_AES_INVALID_KEY_LENGTH - */ - -/** - * \brief AES set key schedule (encryption or decryption) - * - * \param ctx AES context to be initialized - * \param key encryption key - * \param keybits must be 128, 192 or 256 - * - * \return 0 if successful, or ERR_AES_INVALID_KEY_LENGTH - */ -int esp_aes_setkey( esp_aes_context *ctx, const unsigned char *key, unsigned int keybits ); - -/** - * \brief AES-ECB block encryption/decryption - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param input 16-byte input block - * \param output 16-byte output block - * - * \return 0 if successful - */ -int esp_aes_crypt_ecb( esp_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16] ); - -/** - * \brief AES-CBC buffer encryption/decryption - * Length should be a multiple of the block - * size (16 bytes) - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful, or ERR_AES_INVALID_INPUT_LENGTH - */ -int esp_aes_crypt_cbc( esp_aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - - -/** - * \brief AES-CFB128 buffer encryption/decryption. - * - * Note: Due to the nature of CFB you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * esp_aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv_off offset in IV (updated after use) - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful - */ -int esp_aes_crypt_cfb128( esp_aes_context *ctx, - int mode, - size_t length, - size_t *iv_off, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief AES-CFB8 buffer encryption/decryption. - * - * Note: Due to the nature of CFB you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * esp_aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * \note Upon exit, the content of the IV is updated so that you can - * call the function same function again on the following - * block(s) of data and get the same result as if it was - * encrypted in one call. This allows a "streaming" usage. - * If on the other hand you need to retain the contents of the - * IV, you should either save it manually or use the cipher - * module instead. - * - * \param ctx AES context - * \param mode AES_ENCRYPT or AES_DECRYPT - * \param length length of the input data - * \param iv initialization vector (updated after use) - * \param input buffer holding the input data - * \param output buffer holding the output data - * - * \return 0 if successful - */ -int esp_aes_crypt_cfb8( esp_aes_context *ctx, - int mode, - size_t length, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief AES-CTR buffer encryption/decryption - * - * Warning: You have to keep the maximum use of your counter in mind! - * - * Note: Due to the nature of CTR you should use the same key schedule for - * both encryption and decryption. So a context initialized with - * esp_aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT. - * - * \param ctx AES context - * \param length The length of the data - * \param nc_off The offset in the current stream_block (for resuming - * within current cipher stream). The offset pointer to - * should be 0 at the start of a stream. - * \param nonce_counter The 128-bit nonce and counter. - * \param stream_block The saved stream-block for resuming. Is overwritten - * by the function. - * \param input The input data stream - * \param output The output data stream - * - * \return 0 if successful - */ -int esp_aes_crypt_ctr( esp_aes_context *ctx, - size_t length, - size_t *nc_off, - unsigned char nonce_counter[16], - unsigned char stream_block[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief This function performs an AES-OFB (Output Feedback Mode) - * encryption or decryption operation. - * - * \param ctx The AES context to use for encryption or decryption. - * It must be initialized and bound to a key. - * \param length The length of the input data. - * \param iv_off The offset in IV (updated after use). - * It must point to a valid \c size_t. - * \param iv The initialization vector (updated after use). - * It must be a readable and writeable buffer of \c 16 Bytes. - * \param input The buffer holding the input data. - * It must be readable and of size \p length Bytes. - * \param output The buffer holding the output data. - * It must be writeable and of size \p length Bytes. - * - * \return \c 0 on success. - */ -int esp_aes_crypt_ofb( esp_aes_context *ctx, - size_t length, - size_t *iv_off, - unsigned char iv[16], - const unsigned char *input, - unsigned char *output ); - -/** - * \brief This function prepares an XTS context for encryption and - * sets the encryption key. - * - * \param ctx The AES XTS context to which the key should be bound. - * \param key The encryption key. This is comprised of the XTS key1 - * concatenated with the XTS key2. - * \param keybits The size of \p key passed in bits. Valid options are: - *
  • 256 bits (each of key1 and key2 is a 128-bit key)
  • - *
  • 512 bits (each of key1 and key2 is a 256-bit key)
- * - * \return \c 0 on success. - * \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure. - */ -int esp_aes_xts_setkey_enc( esp_aes_xts_context *ctx, - const unsigned char *key, - unsigned int keybits ); - -/** - * \brief Internal AES block encryption function - * (Only exposed to allow overriding it, - * see AES_ENCRYPT_ALT) - * - * \param ctx AES context - * \param input Plaintext block - * \param output Output (ciphertext) block - */ -int esp_aes_xts_setkey_dec( esp_aes_xts_context *ctx, - const unsigned char *key, - unsigned int keybits ); - - -/** - * \brief Internal AES block encryption function - * (Only exposed to allow overriding it, - * see AES_ENCRYPT_ALT) - * - * \param ctx AES context - * \param input Plaintext block - * \param output Output (ciphertext) block - */ -int esp_internal_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ); - -/** Deprecated, see esp_aes_internal_encrypt */ -void esp_aes_encrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated)); - -/** - * \brief Internal AES block decryption function - * (Only exposed to allow overriding it, - * see AES_DECRYPT_ALT) - * - * \param ctx AES context - * \param input Ciphertext block - * \param output Output (plaintext) block - */ -int esp_internal_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ); - -/** Deprecated, see esp_aes_internal_decrypt */ -void esp_aes_decrypt( esp_aes_context *ctx, const unsigned char input[16], unsigned char output[16] ) __attribute__((deprecated)); - -/** AES-XTS buffer encryption/decryption */ -int esp_aes_crypt_xts( esp_aes_xts_context *ctx, int mode, size_t length, const unsigned char data_unit[16], const unsigned char *input, unsigned char *output ); - - -#ifdef __cplusplus -} -#endif #endif /* aes.h */ diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/gcm.h b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/gcm.h index d1fd6bcd4..726783e8c 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/gcm.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/gcm.h @@ -20,220 +20,8 @@ * * */ +#pragma once -#ifndef ESP_GCM_H -#define ESP_GCM_H +#warning "esp32s2/gcm.h is deprecated, please use aes/esp_aes_gcm.h instead" -#include "aes.h" -#include "mbedtls/cipher.h" -#ifdef __cplusplus -extern "C" { -#endif - - -#define MBEDTLS_ERR_GCM_AUTH_FAILED -0x0012 /**< Authenticated decryption failed. */ -#define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014 /**< Bad input parameters to function.*/ - -typedef enum { - ESP_AES_GCM_STATE_INIT, - ESP_AES_GCM_STATE_START, - ESP_AES_GCM_STATE_UPDATE, - ESP_AES_GCM_STATE_FINISH -} esp_aes_gcm_state; -/** - * \brief The GCM context structure. - */ -typedef struct { - uint8_t H[16]; /*!< Initial hash value */ - uint8_t ghash[16]; /*!< GHASH value. */ - uint8_t J0[16]; - uint64_t HL[16]; /*!< Precalculated HTable low. */ - uint64_t HH[16]; /*!< Precalculated HTable high. */ - uint8_t ori_j0[16]; /*!< J0 from first iteration. */ - const uint8_t *iv; - size_t iv_len; /*!< The length of IV. */ - uint64_t aad_len; /*!< The total length of the additional data. */ - size_t data_len; - int mode; - const unsigned char *aad; /*!< The additional data. */ - esp_aes_context aes_ctx; - esp_aes_gcm_state gcm_state; -} esp_gcm_context; - -/** - * \brief This function initializes the specified GCM context - * - * \param ctx The GCM context to initialize. - */ -void esp_aes_gcm_init( esp_gcm_context *ctx); - -/** - * \brief This function associates a GCM context with a - * key. - * - * \param ctx The GCM context to initialize. - * \param cipher The 128-bit block cipher to use. - * \param key The encryption key. - * \param keybits The key size in bits. Valid options are: - *
  • 128 bits
  • - *
  • 192 bits
  • - *
  • 256 bits
- * - * \return \c 0 on success. - * \return A cipher-specific error code on failure. - */ -int esp_aes_gcm_setkey( esp_gcm_context *ctx, - mbedtls_cipher_id_t cipher, - const unsigned char *key, - unsigned int keybits ); - -/** - * \brief This function starts a GCM encryption or decryption - * operation. - * - * \param ctx The GCM context. - * \param mode The operation to perform: #MBEDTLS_GCM_ENCRYPT or - * #MBEDTLS_GCM_DECRYPT. - * \param iv The initialization vector. - * \param iv_len The length of the IV. - * \param add The buffer holding the additional data, or NULL - * if \p add_len is 0. - * \param add_len The length of the additional data. If 0, - * \p add is NULL. - * - * \return \c 0 on success. - */ -int esp_aes_gcm_starts( esp_gcm_context *ctx, - int mode, - const unsigned char *iv, - size_t iv_len, - const unsigned char *aad, - size_t aad_len ); - -/** - * \brief This function feeds an input buffer into an ongoing GCM - * encryption or decryption operation. - * - * ` The function expects input to be a multiple of 16 - * Bytes. Only the last call before calling - * mbedtls_gcm_finish() can be less than 16 Bytes. - * - * \note For decryption, the output buffer cannot be the same as - * input buffer. If the buffers overlap, the output buffer - * must trail at least 8 Bytes behind the input buffer. - * - * \param ctx The GCM context. - * \param length The length of the input data. This must be a multiple of - * 16 except in the last call before mbedtls_gcm_finish(). - * \param input The buffer holding the input data. - * \param output The buffer for holding the output data. - * - * \return \c 0 on success. - * \return #MBEDTLS_ERR_GCM_BAD_INPUT on failure. - */ -int esp_aes_gcm_update( esp_gcm_context *ctx, - size_t length, - const unsigned char *input, - unsigned char *output ); - -/** - * \brief This function finishes the GCM operation and generates - * the authentication tag. - * - * It wraps up the GCM stream, and generates the - * tag. The tag can have a maximum length of 16 Bytes. - * - * \param ctx The GCM context. - * \param tag The buffer for holding the tag. - * \param tag_len The length of the tag to generate. Must be at least four. - * - * \return \c 0 on success. - * \return #MBEDTLS_ERR_GCM_BAD_INPUT on failure. - */ -int esp_aes_gcm_finish( esp_gcm_context *ctx, - unsigned char *tag, - size_t tag_len ); - -/** - * \brief This function clears a GCM context - * - * \param ctx The GCM context to clear. - */ -void esp_aes_gcm_free( esp_gcm_context *ctx); - -/** - * \brief This function performs GCM encryption or decryption of a buffer. - * - * \note For encryption, the output buffer can be the same as the - * input buffer. For decryption, the output buffer cannot be - * the same as input buffer. If the buffers overlap, the output - * buffer must trail at least 8 Bytes behind the input buffer. - * - * \param ctx The GCM context to use for encryption or decryption. - * \param mode The operation to perform: #MBEDTLS_GCM_ENCRYPT or - * #MBEDTLS_GCM_DECRYPT. - * \param length The length of the input data. This must be a multiple of - * 16 except in the last call before mbedtls_gcm_finish(). - * \param iv The initialization vector. - * \param iv_len The length of the IV. - * \param add The buffer holding the additional data. - * \param add_len The length of the additional data. - * \param input The buffer holding the input data. - * \param output The buffer for holding the output data. - * \param tag_len The length of the tag to generate. - * \param tag The buffer for holding the tag. - * - * \return \c 0 on success. - */ -int esp_aes_gcm_crypt_and_tag( esp_gcm_context *ctx, - int mode, - size_t length, - const unsigned char *iv, - size_t iv_len, - const unsigned char *add, - size_t add_len, - const unsigned char *input, - unsigned char *output, - size_t tag_len, - unsigned char *tag ); - - -/** - * \brief This function performs a GCM authenticated decryption of a - * buffer. - * - * \note For decryption, the output buffer cannot be the same as - * input buffer. If the buffers overlap, the output buffer - * must trail at least 8 Bytes behind the input buffer. - * - * \param ctx The GCM context. - * \param length The length of the input data. This must be a multiple - * of 16 except in the last call before mbedtls_gcm_finish(). - * \param iv The initialization vector. - * \param iv_len The length of the IV. - * \param add The buffer holding the additional data. - * \param add_len The length of the additional data. - * \param tag The buffer holding the tag. - * \param tag_len The length of the tag. - * \param input The buffer holding the input data. - * \param output The buffer for holding the output data. - * - * \return 0 if successful and authenticated. - * \return #MBEDTLS_ERR_GCM_AUTH_FAILED if the tag does not match. - */ -int esp_aes_gcm_auth_decrypt( esp_gcm_context *ctx, - size_t length, - const unsigned char *iv, - size_t iv_len, - const unsigned char *add, - size_t add_len, - const unsigned char *tag, - size_t tag_len, - const unsigned char *input, - unsigned char *output ); - -#ifdef __cplusplus -} -#endif - -#endif /* gcm.h */ +#include "aes/esp_aes_gcm.h" diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/sha.h b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/sha.h index 12c6548d6..1e9e3f362 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/sha.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/esp32s2/sha.h @@ -17,5 +17,3 @@ #include "sha/sha_dma.h" #warning esp32s2/sha.h is deprecated, please use sha/sha_dma.h instead - - diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/gcm_alt.h b/tools/sdk/esp32s2/include/mbedtls/port/include/gcm_alt.h index 9a79850c0..7210d92b8 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/gcm_alt.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/gcm_alt.h @@ -23,14 +23,16 @@ #ifndef GCM_ALT_H #define GCM_ALT_H +#include "soc/soc_caps.h" + #ifdef __cplusplus extern "C" { #endif #if defined(MBEDTLS_GCM_ALT) -#if CONFIG_IDF_TARGET_ESP32S3 -#include "esp32s3/gcm.h" +#if SOC_AES_SUPPORT_GCM +#include "aes/esp_aes_gcm.h" typedef esp_gcm_context mbedtls_gcm_context; @@ -44,24 +46,7 @@ typedef esp_gcm_context mbedtls_gcm_context; #define mbedtls_gcm_auth_decrypt esp_aes_gcm_auth_decrypt #define mbedtls_gcm_crypt_and_tag esp_aes_gcm_crypt_and_tag -#endif // CONFIG_IDF_TARGET_ESP32S3 - -#if CONFIG_IDF_TARGET_ESP32S2 -#include "esp32s2/gcm.h" - - -typedef esp_gcm_context mbedtls_gcm_context; - -#define mbedtls_gcm_init esp_aes_gcm_init -#define mbedtls_gcm_free esp_aes_gcm_free -#define mbedtls_gcm_setkey esp_aes_gcm_setkey -#define mbedtls_gcm_starts esp_aes_gcm_starts -#define mbedtls_gcm_update esp_aes_gcm_update -#define mbedtls_gcm_finish esp_aes_gcm_finish -#define mbedtls_gcm_auth_decrypt esp_aes_gcm_auth_decrypt -#define mbedtls_gcm_crypt_and_tag esp_aes_gcm_crypt_and_tag - -#endif // CONFIG_IDF_TARGET_ESP32S2 +#endif // SOC_AES_SUPPORT_GCM #endif /* MBEDTLS_GCM_ALT */ diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/mbedtls/esp_config.h b/tools/sdk/esp32s2/include/mbedtls/port/include/mbedtls/esp_config.h index 60826e6c2..d1e6a910e 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/mbedtls/esp_config.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/mbedtls/esp_config.h @@ -29,6 +29,7 @@ #include "sdkconfig.h" #include "mbedtls/config.h" +#include "soc/soc_caps.h" /** * \name SECTION: System support @@ -130,7 +131,13 @@ #ifdef CONFIG_MBEDTLS_HARDWARE_SHA #define MBEDTLS_SHA1_ALT #define MBEDTLS_SHA256_ALT + +#if SOC_SHA_SUPPORT_SHA512 #define MBEDTLS_SHA512_ALT +#else +#undef MBEDTLS_SHA512_ALT +#endif + #else #undef MBEDTLS_SHA1_ALT #undef MBEDTLS_SHA256_ALT diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/rsa_sign_alt.h b/tools/sdk/esp32s2/include/mbedtls/port/include/rsa_sign_alt.h index a89311a7e..8eb355010 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/rsa_sign_alt.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/rsa_sign_alt.h @@ -36,4 +36,3 @@ extern "C" { #endif #endif - diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_dma.h b/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_dma.h index c71261d10..af12f23a5 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_dma.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_dma.h @@ -157,5 +157,3 @@ int esp_sha_512_t_init_hash(uint16_t t); #ifdef __cplusplus } #endif - - diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_parallel_engine.h b/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_parallel_engine.h index 51ac7add8..cf6f0607d 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_parallel_engine.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/sha/sha_parallel_engine.h @@ -203,5 +203,3 @@ void esp_sha_wait_idle(void); #ifdef __cplusplus } #endif - - diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/sha1_alt.h b/tools/sdk/esp32s2/include/mbedtls/port/include/sha1_alt.h index 7c145ae5f..f97c0e49b 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/sha1_alt.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/sha1_alt.h @@ -26,7 +26,7 @@ #if defined(MBEDTLS_SHA1_ALT) #include "hal/sha_types.h" -#include "soc/sha_caps.h" +#include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { @@ -78,4 +78,3 @@ typedef struct { #endif #endif - diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/sha256_alt.h b/tools/sdk/esp32s2/include/mbedtls/port/include/sha256_alt.h index 3a1f385e9..5d3b6135c 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/sha256_alt.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/sha256_alt.h @@ -26,7 +26,7 @@ #if defined(MBEDTLS_SHA256_ALT) #include "hal/sha_types.h" -#include "soc/sha_caps.h" +#include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { diff --git a/tools/sdk/esp32s2/include/mbedtls/port/include/sha512_alt.h b/tools/sdk/esp32s2/include/mbedtls/port/include/sha512_alt.h index 4f5cc005e..9472abcef 100644 --- a/tools/sdk/esp32s2/include/mbedtls/port/include/sha512_alt.h +++ b/tools/sdk/esp32s2/include/mbedtls/port/include/sha512_alt.h @@ -26,7 +26,7 @@ #if defined(MBEDTLS_SHA512_ALT) #include "hal/sha_types.h" -#include "soc/sha_caps.h" +#include "soc/soc_caps.h" #ifdef __cplusplus extern "C" { diff --git a/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_client.h b/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_client.h index e365cb846..67c082825 100644 --- a/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_client.h +++ b/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_client.h @@ -80,10 +80,17 @@ typedef enum { */ typedef enum { MQTT_ERROR_TYPE_NONE = 0, - MQTT_ERROR_TYPE_ESP_TLS, + MQTT_ERROR_TYPE_TCP_TRANSPORT, MQTT_ERROR_TYPE_CONNECTION_REFUSED, } esp_mqtt_error_type_t; +/** + * MQTT_ERROR_TYPE_TCP_TRANSPORT error type hold all sorts of transport layer errors, + * including ESP-TLS error, but in the past only the errors from MQTT_ERROR_TYPE_ESP_TLS layer + * were reported, so the ESP-TLS error type is re-defined here for backward compatibility + */ +#define MQTT_ERROR_TYPE_ESP_TLS MQTT_ERROR_TYPE_TCP_TRANSPORT + typedef enum { MQTT_TRANSPORT_UNKNOWN = 0x0, MQTT_TRANSPORT_OVER_TCP, /*!< MQTT over TCP, using scheme: ``mqtt`` */ @@ -110,7 +117,7 @@ typedef enum { * Use this structure directly checking error_type first and then appropriate error code depending on the source of the error: * * | error_type | related member variables | note | - * | MQTT_ERROR_TYPE_ESP_TLS | esp_tls_last_esp_err, esp_tls_stack_err, esp_tls_cert_verify_flags | Error reported from esp-tls | + * | MQTT_ERROR_TYPE_TCP_TRANSPORT | esp_tls_last_esp_err, esp_tls_stack_err, esp_tls_cert_verify_flags, sock_errno | Error reported from tcp_transport/esp-tls | * | MQTT_ERROR_TYPE_CONNECTION_REFUSED | connect_return_code | Internal error reported from MQTT broker on connection | */ typedef struct esp_mqtt_error_codes { @@ -121,6 +128,9 @@ typedef struct esp_mqtt_error_codes { /* esp-mqtt specific structure extension */ esp_mqtt_error_type_t error_type; /*!< error type referring to the source of the error */ esp_mqtt_connect_return_code_t connect_return_code; /*!< connection refused error code reported from MQTT broker on connection */ + /* tcp_transport extension */ + int esp_transport_sock_errno; /*!< errno from the underlying socket */ + } esp_mqtt_error_codes_t; /** @@ -179,7 +189,7 @@ typedef struct { int refresh_connection_after_ms; /*!< Refresh connection after this value (in milliseconds) */ const struct psk_key_hint* psk_hint_key; /*!< Pointer to PSK struct defined in esp_tls.h to enable PSK authentication (as alternative to certificate verification). If not NULL and server/client certificates are NULL, PSK is enabled */ bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which this bool is set. */ - int reconnect_timeout_ms; /*!< Reconnect to the broker after this value in miliseconds if auto reconnect is not disabled */ + int reconnect_timeout_ms; /*!< Reconnect to the broker after this value in miliseconds if auto reconnect is not disabled (defaults to 10s) */ const char **alpn_protos; /*!< NULL-terminated list of supported application protocols to be used for ALPN */ const char *clientkey_password; /*!< Client key decryption password string */ int clientkey_password_len; /*!< String length of the password pointed to by clientkey_password */ @@ -188,6 +198,8 @@ typedef struct { bool skip_cert_common_name_check; /*!< Skip any validation of server certificate CN field, this reduces the security of TLS and makes the mqtt client susceptible to MITM attacks */ bool use_secure_element; /*!< enable secure element for enabling SSL connection */ void *ds_data; /*!< carrier of handle for digital signature parameters */ + int network_timeout_ms; /*!< Abort network operation if it is not completed after this value, in milliseconds (defaults to 10s) */ + bool disable_keepalive; /*!< Set disable_keepalive=true to turn off keep-alive mechanism, false by default (keepalive is active by default). Note: setting the config value `keepalive` to `0` doesn't disable keepalive feature, but uses a default keepalive period */ } esp_mqtt_client_config_t; /** @@ -347,6 +359,14 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl */ esp_err_t esp_mqtt_client_register_event(esp_mqtt_client_handle_t client, esp_mqtt_event_id_t event, esp_event_handler_t event_handler, void* event_handler_arg); +/** + * @brief Get outbox size + * + * @param client mqtt client handle + * @return outbox size + */ +int esp_mqtt_client_get_outbox_size(esp_mqtt_client_handle_t client); + #ifdef __cplusplus } #endif //__cplusplus diff --git a/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_config.h b/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_config.h index e259a2a11..d9b64c759 100644 --- a/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_config.h +++ b/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_config.h @@ -84,8 +84,8 @@ #endif #endif -#ifdef CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS -#define OUTBOX_EXPIRED_TIMEOUT_MS CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS +#ifdef CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS +#define OUTBOX_EXPIRED_TIMEOUT_MS CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS #else #define OUTBOX_EXPIRED_TIMEOUT_MS (30*1000) #endif diff --git a/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_supported_features.h b/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_supported_features.h index 9f1acf2ff..eb7ad631c 100644 --- a/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_supported_features.h +++ b/tools/sdk/esp32s2/include/mqtt/esp-mqtt/include/mqtt_supported_features.h @@ -56,6 +56,7 @@ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0) // Features supported in 4.3 #define MQTT_SUPPORTED_FEATURE_DIGITAL_SIGNATURE +#define MQTT_SUPPORTED_FEATURE_TRANSPORT_SOCK_ERRNO_REPORTING #endif #endif /* ESP_IDF_VERSION */ diff --git a/tools/sdk/esp32s2/include/newlib/platform_include/assert.h b/tools/sdk/esp32s2/include/newlib/platform_include/assert.h index ba01c798c..77d4cf08f 100644 --- a/tools/sdk/esp32s2/include/newlib/platform_include/assert.h +++ b/tools/sdk/esp32s2/include/newlib/platform_include/assert.h @@ -26,16 +26,16 @@ #if defined(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT) && !defined(NDEBUG) #undef assert #define assert(__e) (likely(__e)) ? (void)0 : abort() -#else +#else /* moved part of toolchain provided assert to there then * we can tweak the original assert macro to perform likely - * before deliver it to original toolchain implementation + * before deliver it to original toolchain implementation */ #undef assert - #ifdef NDEBUG + #ifdef NDEBUG # define assert(__e) ((void)0) #else # define assert(__e) (likely(__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \ __ASSERT_FUNC, #__e)) - #endif + #endif #endif diff --git a/tools/sdk/esp32s2/include/newlib/platform_include/endian.h b/tools/sdk/esp32s2/include/newlib/platform_include/endian.h index dfc87536a..c5b0a3c71 100644 --- a/tools/sdk/esp32s2/include/newlib/platform_include/endian.h +++ b/tools/sdk/esp32s2/include/newlib/platform_include/endian.h @@ -24,7 +24,7 @@ #include /* - * All the code below is a rework of + * All the code below is a rework of * https://github.com/freebsd/freebsd/blob/master/sys/sys/endian.h * to import symbols defining non-standard endian handling functions. * The aforementioned source code license terms are included here. diff --git a/tools/sdk/esp32s2/include/newlib/platform_include/esp_newlib.h b/tools/sdk/esp32s2/include/newlib/platform_include/esp_newlib.h index c43d6ec20..fe06a3348 100644 --- a/tools/sdk/esp32s2/include/newlib/platform_include/esp_newlib.h +++ b/tools/sdk/esp32s2/include/newlib/platform_include/esp_newlib.h @@ -30,18 +30,22 @@ void esp_newlib_time_init(void); */ void esp_reent_init(struct _reent* r); -/** +/** * Clean up some of lazily allocated buffers in REENT structures. */ void esp_reent_cleanup(void); /** - * Function which sets up syscall table used by newlib functions in ROM. + * Function which sets up newlib in ROM for use with ESP-IDF + * + * Includes defining the syscall table, setting up any common locks, etc. * * Called from the startup code, not intended to be called from application * code. */ -void esp_setup_syscall_table(void); +void esp_newlib_init(void); + +void esp_setup_syscall_table(void) __attribute__((deprecated("Please call esp_newlib_init() in newer code"))); /** * Update current microsecond time from RTC @@ -53,4 +57,9 @@ void esp_set_time_from_rtc(void); */ void esp_sync_counters_rtc_and_frc(void); +/** + * Initialize newlib static locks + */ +void esp_newlib_locks_init(void); + #endif //__ESP_NEWLIB_H__ diff --git a/tools/sdk/esp32s2/include/newlib/platform_include/sys/dirent.h b/tools/sdk/esp32s2/include/newlib/platform_include/sys/dirent.h index 57b5be5ee..97e4bfed1 100644 --- a/tools/sdk/esp32s2/include/newlib/platform_include/sys/dirent.h +++ b/tools/sdk/esp32s2/include/newlib/platform_include/sys/dirent.h @@ -52,4 +52,3 @@ void seekdir(DIR* pdir, long loc); void rewinddir(DIR* pdir); int closedir(DIR* pdir); int readdir_r(DIR* pdir, struct dirent* entry, struct dirent** out_dirent); - diff --git a/tools/sdk/esp32s2/include/newlib/platform_include/sys/lock.h b/tools/sdk/esp32s2/include/newlib/platform_include/sys/lock.h new file mode 100644 index 000000000..1581a293e --- /dev/null +++ b/tools/sdk/esp32s2/include/newlib/platform_include/sys/lock.h @@ -0,0 +1,41 @@ +#pragma once + +#include_next + +#ifdef _RETARGETABLE_LOCKING + +/* Actual platfrom-specific definition of struct __lock. + * The size here should be sufficient for a FreeRTOS mutex. + * This is checked by a static assertion in locks.c + * + * Note 1: this might need to be made dependent on whether FreeRTOS + * is included in the build. + * + * Note 2: the size is made sufficient for the case when + * configUSE_TRACE_FACILITY is enabled. If it is disabled, + * this definition wastes 8 bytes. + */ +struct __lock { + int reserved[23]; +}; + +/* Compatibility definitions for the legacy ESP-specific locking implementation. + * These used to be provided by libc/sys/xtensa/sys/lock.h in newlib. + * Newer versions of newlib don't have this ESP-specific lock.h header, and are + * built with _RETARGETABLE_LOCKING enabled, instead. + */ + +typedef _LOCK_T _lock_t; + +void _lock_init(_lock_t *plock); +void _lock_init_recursive(_lock_t *plock); +void _lock_close(_lock_t *plock); +void _lock_close_recursive(_lock_t *plock); +void _lock_acquire(_lock_t *plock); +void _lock_acquire_recursive(_lock_t *plock); +int _lock_try_acquire(_lock_t *plock); +int _lock_try_acquire_recursive(_lock_t *plock); +void _lock_release(_lock_t *plock); +void _lock_release_recursive(_lock_t *plock); + +#endif // _RETARGETABLE_LOCKING diff --git a/tools/sdk/esp32s2/include/newlib/platform_include/sys/reent.h b/tools/sdk/esp32s2/include/newlib/platform_include/sys/reent.h new file mode 100644 index 000000000..f58eb0ed6 --- /dev/null +++ b/tools/sdk/esp32s2/include/newlib/platform_include/sys/reent.h @@ -0,0 +1,23 @@ +// 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. + +#pragma once + +#include_next + +/* This function is not part of the newlib API, it is defined in libc/stdio/local.h + * There is no nice way to get __cleanup member populated while avoiding __sinit, + * so extern declaration is used here. + */ +extern void _cleanup_r(struct _reent* r); diff --git a/tools/sdk/esp32s2/include/newlib/platform_include/time.h b/tools/sdk/esp32s2/include/newlib/platform_include/time.h index e633bd4ec..bbffaad8b 100644 --- a/tools/sdk/esp32s2/include/newlib/platform_include/time.h +++ b/tools/sdk/esp32s2/include/newlib/platform_include/time.h @@ -22,8 +22,12 @@ extern "C" { #include_next #define _POSIX_TIMERS 1 +#ifndef CLOCK_MONOTONIC #define CLOCK_MONOTONIC (clockid_t)4 +#endif +#ifndef CLOCK_BOOTTIME #define CLOCK_BOOTTIME (clockid_t)4 +#endif int clock_settime(clockid_t clock_id, const struct timespec *tp); int clock_gettime(clockid_t clock_id, struct timespec *tp); diff --git a/tools/sdk/esp32s2/include/nvs_flash/include/nvs.h b/tools/sdk/esp32s2/include/nvs_flash/include/nvs.h index 2f4aa551c..5f971a357 100644 --- a/tools/sdk/esp32s2/include/nvs_flash/include/nvs.h +++ b/tools/sdk/esp32s2/include/nvs_flash/include/nvs.h @@ -137,6 +137,7 @@ typedef struct nvs_opaque_iterator_t *nvs_iterator_t; * - ESP_ERR_NVS_NOT_FOUND id namespace doesn't exist yet and * mode is NVS_READONLY * - ESP_ERR_NVS_INVALID_NAME if namespace name doesn't satisfy constraints + * - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures * - other error codes from the underlying storage driver */ esp_err_t nvs_open(const char* name, nvs_open_mode_t open_mode, nvs_handle_t *out_handle); @@ -163,6 +164,7 @@ esp_err_t nvs_open(const char* name, nvs_open_mode_t open_mode, nvs_handle_t *ou * - ESP_ERR_NVS_NOT_FOUND id namespace doesn't exist yet and * mode is NVS_READONLY * - ESP_ERR_NVS_INVALID_NAME if namespace name doesn't satisfy constraints + * - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures * - other error codes from the underlying storage driver */ esp_err_t nvs_open_from_partition(const char *part_name, const char* name, nvs_open_mode_t open_mode, nvs_handle_t *out_handle); @@ -555,4 +557,3 @@ void nvs_release_iterator(nvs_iterator_t iterator); #endif #endif //ESP_NVS_H - diff --git a/tools/sdk/esp32s2/include/nvs_flash/include/nvs_flash.h b/tools/sdk/esp32s2/include/nvs_flash/include/nvs_flash.h index eb5f2f965..3817a1650 100644 --- a/tools/sdk/esp32s2/include/nvs_flash/include/nvs_flash.h +++ b/tools/sdk/esp32s2/include/nvs_flash/include/nvs_flash.h @@ -43,6 +43,7 @@ typedef struct { * - ESP_ERR_NVS_NO_FREE_PAGES if the NVS storage contains no empty pages * (which may happen if NVS partition was truncated) * - ESP_ERR_NOT_FOUND if no partition with label "nvs" is found in the partition table + * - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures * - one of the error codes from the underlying flash storage driver */ esp_err_t nvs_flash_init(void); @@ -57,6 +58,7 @@ esp_err_t nvs_flash_init(void); * - ESP_ERR_NVS_NO_FREE_PAGES if the NVS storage contains no empty pages * (which may happen if NVS partition was truncated) * - ESP_ERR_NOT_FOUND if specified partition is not found in the partition table + * - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures * - one of the error codes from the underlying flash storage driver */ esp_err_t nvs_flash_init_partition(const char *partition_label); @@ -71,6 +73,7 @@ esp_err_t nvs_flash_init_partition(const char *partition_label); * - ESP_ERR_NVS_NO_FREE_PAGES if the NVS storage contains no empty pages * (which may happen if NVS partition was truncated) * - ESP_ERR_INVALID_ARG in case partition is NULL + * - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures * - one of the error codes from the underlying flash storage driver */ esp_err_t nvs_flash_init_partition_ptr(const esp_partition_t *partition); @@ -166,6 +169,7 @@ esp_err_t nvs_flash_erase_partition_ptr(const esp_partition_t *partition); * - ESP_ERR_NVS_NO_FREE_PAGES if the NVS storage contains no empty pages * (which may happen if NVS partition was truncated) * - ESP_ERR_NOT_FOUND if no partition with label "nvs" is found in the partition table + * - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures * - one of the error codes from the underlying flash storage driver */ esp_err_t nvs_flash_secure_init(nvs_sec_cfg_t* cfg); @@ -183,6 +187,7 @@ esp_err_t nvs_flash_secure_init(nvs_sec_cfg_t* cfg); * - ESP_ERR_NVS_NO_FREE_PAGES if the NVS storage contains no empty pages * (which may happen if NVS partition was truncated) * - ESP_ERR_NOT_FOUND if specified partition is not found in the partition table + * - ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures * - one of the error codes from the underlying flash storage driver */ esp_err_t nvs_flash_secure_init_partition(const char *partition_label, nvs_sec_cfg_t* cfg); diff --git a/tools/sdk/esp32s2/include/nvs_flash/include/nvs_handle.hpp b/tools/sdk/esp32s2/include/nvs_flash/include/nvs_handle.hpp index 537d2f9f6..c830e19a6 100644 --- a/tools/sdk/esp32s2/include/nvs_flash/include/nvs_handle.hpp +++ b/tools/sdk/esp32s2/include/nvs_flash/include/nvs_handle.hpp @@ -269,4 +269,3 @@ esp_err_t NVSHandle::get_item(const char *key, T &value) { } // nvs #endif // NVS_HANDLE_HPP_ - diff --git a/tools/sdk/esp32s2/include/openssl/include/internal/ssl_pkey.h b/tools/sdk/esp32s2/include/openssl/include/internal/ssl_pkey.h index 0f361288f..a8cfa33df 100644 --- a/tools/sdk/esp32s2/include/openssl/include/internal/ssl_pkey.h +++ b/tools/sdk/esp32s2/include/openssl/include/internal/ssl_pkey.h @@ -120,7 +120,7 @@ void EVP_PKEY_free(EVP_PKEY *x); * * @return result * 0 : failed - * 1 : OK + * 1 : OK */ int SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len); diff --git a/tools/sdk/esp32s2/include/openssl/include/internal/ssl_x509.h b/tools/sdk/esp32s2/include/openssl/include/internal/ssl_x509.h index 88e46e2e2..454fbdcb2 100644 --- a/tools/sdk/esp32s2/include/openssl/include/internal/ssl_x509.h +++ b/tools/sdk/esp32s2/include/openssl/include/internal/ssl_x509.h @@ -117,7 +117,7 @@ int X509_STORE_add_cert(X509_STORE *store, X509 *x); /** * @brief load a character certification context into system context. * - * If '*cert' is pointed to the certification, then load certification + * If '*cert' is pointed to the certification, then load certification * into it, or create a new X509 certification object. * * @param bp - pointer to BIO diff --git a/tools/sdk/esp32s2/include/perfmon/include/perfmon.h b/tools/sdk/esp32s2/include/perfmon/include/perfmon.h index f45937964..4c23bd5be 100644 --- a/tools/sdk/esp32s2/include/perfmon/include/perfmon.h +++ b/tools/sdk/esp32s2/include/perfmon/include/perfmon.h @@ -26,4 +26,4 @@ #include "xtensa_perfmon_apis.h" #include "xtensa/xt_perf_consts.h" -#endif // _PERF_MON_H_ \ No newline at end of file +#endif // _PERF_MON_H_ diff --git a/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_access.h b/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_access.h index 4aa1acbc1..301b6e8ba 100644 --- a/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_access.h +++ b/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_access.h @@ -122,4 +122,4 @@ void xtensa_perfmon_dump(void); } #endif -#endif // _PERF_MON_ACCESS_H_ \ No newline at end of file +#endif // _PERF_MON_ACCESS_H_ diff --git a/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_apis.h b/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_apis.h index 3c4f8df0c..0b52f2ce8 100644 --- a/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_apis.h +++ b/tools/sdk/esp32s2/include/perfmon/include/xtensa_perfmon_apis.h @@ -35,8 +35,8 @@ typedef struct xtensa_perfmon_config { void (*call_function)(void *params); /*!< pointer to the function that have to be called */ void (*callback)(void *params, uint32_t select, uint32_t mask, uint32_t value); /*!< pointer to the function that will be called with result parameters */ void *callback_params; /*!< parameter that will be passed to the callback */ - int tracelevel; /*!< trace level for all counters. - In case of negative value, the filter will be ignored. + int tracelevel; /*!< trace level for all counters. + In case of negative value, the filter will be ignored. If it's >=0, then the perfmon will count only when interrupt level > tracelevel. It's useful to monitor interrupts. */ uint32_t counters_size;/*!< amount of counter in the list */ const uint32_t *select_mask; /*!< list of the select/mask parameters */ @@ -77,4 +77,4 @@ void xtensa_perfmon_view_cb(void *params, uint32_t select, uint32_t mask, uint32 } #endif -#endif // _xtensa_perfmon_apis_H_ \ No newline at end of file +#endif // _xtensa_perfmon_apis_H_ diff --git a/tools/sdk/esp32s2/include/pthread/include/esp_pthread.h b/tools/sdk/esp32s2/include/pthread/include/esp_pthread.h index 95e182c1f..874dc36f3 100644 --- a/tools/sdk/esp32s2/include/pthread/include/esp_pthread.h +++ b/tools/sdk/esp32s2/include/pthread/include/esp_pthread.h @@ -37,7 +37,7 @@ typedef struct { /** * @brief Creates a default pthread configuration based * on the values set via menuconfig. - * + * * @return * A default configuration structure. */ diff --git a/tools/sdk/esp32s2/include/sdmmc/include/sdmmc_cmd.h b/tools/sdk/esp32s2/include/sdmmc/include/sdmmc_cmd.h index 666f35560..6e2f98d90 100644 --- a/tools/sdk/esp32s2/include/sdmmc/include/sdmmc_cmd.h +++ b/tools/sdk/esp32s2/include/sdmmc/include/sdmmc_cmd.h @@ -62,7 +62,7 @@ esp_err_t sdmmc_write_sectors(sdmmc_card_t* card, const void* src, size_t start_sector, size_t sector_count); /** - * Write given number of sectors to SD/MMC card + * Read given number of sectors from the SD/MMC card * * @param card pointer to card information structure previously initialized * using sdmmc_card_init diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_ctrl_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_ctrl_reg.h index 68b26c2e2..21c8709c9 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_ctrl_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_ctrl_reg.h @@ -501,5 +501,3 @@ extern "C" { #endif /*_SOC_APB_CTRL_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_saradc_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_saradc_reg.h index 56f9c8c6f..e2743c51f 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_saradc_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/apb_saradc_reg.h @@ -614,5 +614,3 @@ extern "C" { #endif /*_SOC_APB_SARADC_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/bb_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/bb_reg.h index 69d2f43d2..62828b89e 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/bb_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/bb_reg.h @@ -39,4 +39,3 @@ #endif /* _SOC_BB_REG_H_ */ - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/cache_memory.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/cache_memory.h index c82401697..06de5a432 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/cache_memory.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/cache_memory.h @@ -135,5 +135,3 @@ extern "C" { #endif #endif /*_CACHE_MEMORY_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/crypto_dma_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/crypto_dma_reg.h index 58433ebb5..282d40b99 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/crypto_dma_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/crypto_dma_reg.h @@ -183,5 +183,3 @@ extern "C" { #endif /*_SOC_CRYPTO_DMA_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dedic_gpio_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dedic_gpio_reg.h index 7ad7022c7..5e9fecf97 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dedic_gpio_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dedic_gpio_reg.h @@ -748,4 +748,3 @@ extern "C" { #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dport_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dport_reg.h index 4ed935784..ff5b61631 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dport_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/dport_reg.h @@ -34,5 +34,3 @@ extern "C" { #endif #endif /*_SOC_DPORT_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/efuse_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/efuse_reg.h index 4f92f812b..4d76d1115 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/efuse_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/efuse_reg.h @@ -2310,5 +2310,3 @@ extern "C" { #endif /*_SOC_EFUSE_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/extmem_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/extmem_reg.h index f36554ca4..a1b4fbd32 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/extmem_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/extmem_reg.h @@ -1679,5 +1679,3 @@ extern "C" { #endif /*_SOC_EXTMEM_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_reg.h index a7fd4c623..4a435ad1f 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_reg.h @@ -9218,5 +9218,3 @@ extern "C" { #endif /*_SOC_GPIO_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_sd_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_sd_reg.h index f2bd9115f..12210cc45 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_sd_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/gpio_sd_reg.h @@ -168,5 +168,3 @@ extern "C" { #endif /*_SOC_GPIO_SD_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_reg.h index 7cdeca652..2f160b49e 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_reg.h @@ -1122,4 +1122,3 @@ extern "C" { #endif /*_SOC_I2C_REG_H_ */ - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_struct.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_struct.h index 3330d9303..e54038aae 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_struct.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2c_struct.h @@ -380,4 +380,4 @@ extern i2c_dev_t I2C1; } #endif -#endif /* _SOC_I2C_STRUCT_H_ */ \ No newline at end of file +#endif /* _SOC_I2C_STRUCT_H_ */ diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_reg.h index 62283f2b2..196800334 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_reg.h @@ -1442,5 +1442,3 @@ extern "C" { #endif /*_SOC_I2S_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_struct.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_struct.h index 23621505b..789f2c21c 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_struct.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/i2s_struct.h @@ -416,4 +416,4 @@ _Static_assert(sizeof(i2s_dev_t)==0x100, "invalid i2s_dev_t size"); } #endif -#endif /* _SOC_I2S_STRUCT_H_ */ \ No newline at end of file +#endif /* _SOC_I2S_STRUCT_H_ */ diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/interrupt_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/interrupt_reg.h index 1b4ba6097..c5161e220 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/interrupt_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/interrupt_reg.h @@ -832,5 +832,3 @@ extern "C" { #endif /*_SOC_INTERRUPT_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/ledc_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/ledc_reg.h index 15abacb87..07cb5a49b 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/ledc_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/ledc_reg.h @@ -1568,5 +1568,3 @@ extern "C" { #endif /*_SOC_LEDC_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/mmu.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/mmu.h new file mode 100644 index 000000000..44f716f21 --- /dev/null +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/mmu.h @@ -0,0 +1,42 @@ +// 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. +#pragma once + +#include +#include "soc/cache_memory.h" +#include "soc/soc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Defined for flash mmap */ +#define SOC_MMU_REGIONS_COUNT 6 +#define SOC_MMU_PAGES_PER_REGION 64 +#define SOC_MMU_IROM0_PAGES_START (PRO_CACHE_IBUS0_MMU_START / sizeof(uint32_t)) +#define SOC_MMU_IROM0_PAGES_END (PRO_CACHE_IBUS1_MMU_END / sizeof(uint32_t)) +#define SOC_MMU_DROM0_PAGES_START (PRO_CACHE_IBUS2_MMU_START / sizeof(uint32_t)) +#define SOC_MMU_DROM0_PAGES_END (PRO_CACHE_IBUS2_MMU_END / sizeof(uint32_t)) +#define SOC_MMU_INVALID_ENTRY_VAL MMU_TABLE_INVALID_VAL +#define SOC_MMU_ADDR_MASK MMU_ADDRESS_MASK +#define SOC_MMU_PAGE_IN_FLASH(page) ((page) | MMU_ACCESS_FLASH) +#define SOC_MMU_DPORT_PRO_FLASH_MMU_TABLE FLASH_MMU_TABLE +#define SOC_MMU_VADDR1_START_ADDR SOC_IROM_MASK_LOW +#define SOC_MMU_PRO_IRAM0_FIRST_USABLE_PAGE ((SOC_MMU_VADDR1_FIRST_USABLE_ADDR - SOC_MMU_VADDR1_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE + SOC_MMU_IROM0_PAGES_START) +#define SOC_MMU_VADDR0_START_ADDR SOC_DROM_LOW +#define SOC_MMU_VADDR1_FIRST_USABLE_ADDR SOC_IROM_LOW + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/pcnt_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/pcnt_reg.h index f28fc40ea..7195e1b1f 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/pcnt_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/pcnt_reg.h @@ -858,5 +858,3 @@ extern "C" { #endif /*_SOC_PCNT_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rmt_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rmt_reg.h index 5e786636f..0cd0aed5c 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rmt_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rmt_reg.h @@ -1714,5 +1714,3 @@ extern "C" { #endif /*_SOC_RMT_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h index 928695fbf..0ea0716e6 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc.h @@ -588,6 +588,29 @@ uint64_t rtc_deep_slp_time_get(void); */ void rtc_clk_wait_for_slow_cycle(void); +/** + * @brief Enable the rtc digital 8M clock + * + * This function is used to enable the digital rtc 8M clock to support peripherals. + * For enabling the analog 8M clock, using `rtc_clk_8M_enable` function above. + */ +void rtc_dig_clk8m_enable(void); + +/** + * @brief Disable the rtc digital 8M clock + * + * This function is used to disable the digital rtc 8M clock, which is only used to support peripherals. + */ +void rtc_dig_clk8m_disable(void); + +/** + * @brief Calculate the real clock value after the clock calibration + * + * @param cal_val Average slow clock period in microseconds, fixed point value as returned from `rtc_clk_cal` + * @return Frequency of the clock in Hz + */ +uint32_t rtc_clk_freq_cal(uint32_t cal_val); + /** * @brief Power down flags for rtc_sleep_pd function */ @@ -831,4 +854,3 @@ void rtc_vddsdio_set_config(rtc_vddsdio_config_t config); #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_cntl_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_cntl_reg.h index 8128c4825..bb769c935 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_cntl_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_cntl_reg.h @@ -3316,5 +3316,3 @@ extern "C" { #endif /*_SOC_RTC_CNTL_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_i2c_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_i2c_reg.h index 834ee0cc8..fcf89f02a 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_i2c_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_i2c_reg.h @@ -692,5 +692,3 @@ extern "C" { #endif /*_SOC_RTC_I2C_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_io_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_io_reg.h index 3561c4b31..53e439a77 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_io_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/rtc_io_reg.h @@ -2294,5 +2294,3 @@ extern "C" { #endif /*_SOC_RTC_IO_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sens_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sens_reg.h index 04e29f133..d76582d9f 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sens_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sens_reg.h @@ -1496,5 +1496,3 @@ extern "C" { #endif /*_SOC_SENS_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sensitive_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sensitive_reg.h index ce038e593..8eb4ee6e9 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sensitive_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sensitive_reg.h @@ -1294,5 +1294,3 @@ extern "C" { #endif /*_SOC_SENSITIVE_REG_H_ */ - - diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sha_caps.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sha_caps.h deleted file mode 100644 index 10118590e..000000000 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/sha_caps.h +++ /dev/null @@ -1,54 +0,0 @@ -// 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. - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -/* Max amount of bytes in a single DMA operation is 4095, - for SHA this means that the biggest safe amount of bytes is - 31 blocks of 128 bytes = 3968 -*/ -#define SOC_SHA_DMA_MAX_BUFFER_SIZE (3968) -#define SOC_SHA_SUPPORT_DMA (1) - -/* ESP32 style SHA engine, where multiple states can be stored in parallel */ -#define SOC_SHA_SUPPORT_PARALLEL_ENG (0) - -/* The SHA engine is able to resume hashing from a user */ -#define SOC_SHA_SUPPORT_RESUME (1) - -/* Has "crypto DMA", which is shared with AES */ -#define SOC_SHA_CRYPTO_DMA (1) - -/* Has a centralized DMA, which is shared with all peripherals */ -#define SOC_SHA_GENERAL_DMA (0) - -/* Supported HW algorithms */ -#define SOC_SHA_SUPPORT_SHA1 (1) -#define SOC_SHA_SUPPORT_SHA224 (1) -#define SOC_SHA_SUPPORT_SHA256 (1) -#define SOC_SHA_SUPPORT_SHA384 (1) -#define SOC_SHA_SUPPORT_SHA256 (1) -#define SOC_SHA_SUPPORT_SHA512 (1) -#define SOC_SHA_SUPPORT_SHA512_224 (1) -#define SOC_SHA_SUPPORT_SHA512_256 (1) -#define SOC_SHA_SUPPORT_SHA512_T (1) - - -#ifdef __cplusplus -} -#endif diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc.h index a1ff1edad..6325f311d 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc.h @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _ESP32_SOC_H_ -#define _ESP32_SOC_H_ +#pragma once #ifndef __ASSEMBLER__ #include @@ -359,5 +358,3 @@ //Invalid interrupt for number interrupt matrix #define ETS_INVALID_INUM 6 - -#endif /* _ESP32_SOC_H_ */ diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h index e1b18dcc2..7f19e8b5c 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/soc_caps.h @@ -37,16 +37,19 @@ #pragma once /*-------------------------- COMMON CAPS ---------------------------------------*/ -#define SOC_TWAI_SUPPORTED 1 -#define SOC_CP_DMA_SUPPORTED 1 -#define SOC_CPU_CORES_NUM 1 -#define SOC_DEDICATED_GPIO_SUPPORTED 1 -#define SOC_SUPPORTS_SECURE_DL_MODE 1 -#define SOC_RISCV_COPROC_SUPPORTED 1 -#define SOC_USB_SUPPORTED 1 -#define SOC_PCNT_SUPPORTED 1 +#define SOC_TWAI_SUPPORTED 1 +#define SOC_CP_DMA_SUPPORTED 1 +#define SOC_CPU_CORES_NUM 1 +#define SOC_DEDICATED_GPIO_SUPPORTED 1 +#define SOC_SUPPORTS_SECURE_DL_MODE 1 +#define SOC_RISCV_COPROC_SUPPORTED 1 +#define SOC_USB_SUPPORTED 1 +#define SOC_PCNT_SUPPORTED 1 +#define SOC_ULP_SUPPORTED 1 +#define SOC_RTC_SLOW_MEM_SUPPORTED 1 +#define SOC_CCOMP_TIMER_SUPPORTED 1 -#define SOC_CACHE_SUPPORT_WRAP 1 +#define SOC_CACHE_SUPPORT_WRAP 1 /*-------------------------- ADC CAPS ----------------------------------------*/ #define SOC_ADC_PERIPH_NUM (2) @@ -113,6 +116,9 @@ //ESP32-S2 support hardware clear bus #define SOC_I2C_SUPPORT_HW_CLR_BUS (1) +#define SOC_I2C_SUPPORT_REF_TICK (1) +#define SOC_I2C_SUPPORT_APB (1) + /*-------------------------- I2S CAPS ----------------------------------------*/ // ESP32-S2 have 2 I2S #define SOC_I2S_NUM (1) @@ -127,6 +133,8 @@ /*-------------------------- LEDC CAPS ---------------------------------------*/ #define SOC_LEDC_SUPPORT_XTAL_CLOCK (1) +#define SOC_LEDC_CHANNEL_NUM (8) +#define SOC_LEDC_TIMER_BIT_WIDE_NUM (14) /*-------------------------- MPU CAPS ----------------------------------------*/ //TODO: correct the caller and remove unsupported lines @@ -143,18 +151,26 @@ #define SOC_PCNT_UNIT_CHANNEL_NUM (2) /*-------------------------- RMT CAPS ----------------------------------------*/ -#define SOC_RMT_CHANNEL_MEM_WORDS (64) /*!< Each channel owns 64 words memory (1 word = 4 Bytes) */ -#define SOC_RMT_CHANNELS_NUM (4) /*!< Total 4 channels */ -#define SOC_RMT_SUPPORT_RX_PINGPONG (1) /*!< Support Ping-Pong mode on RX path */ -#define SOC_RMT_SUPPORT_RX_DEMODULATION (1) /*!< Support signal demodulation on RX path (i.e. remove carrier) */ -#define SOC_RMT_SUPPORT_TX_LOOP_COUNT (1) /*!< Support transmit specified number of cycles in loop mode */ -#define SOC_RMT_SUPPORT_TX_GROUP (1) /*!< Support a group of TX channels to transmit simultaneously */ +#define SOC_RMT_CHANNEL_MEM_WORDS (64) /*!< Each channel owns 64 words memory (1 word = 4 Bytes) */ +#define SOC_RMT_TX_CHANNELS_NUM (4) /*!< Number of channels that capable of Transmit */ +#define SOC_RMT_RX_CHANNELS_NUM (4) /*!< Number of channels that capable of Receive */ +#define SOC_RMT_CHANNELS_NUM (4) /*!< Total 4 channels (each channel can be configured to either TX or RX) */ +#define SOC_RMT_SUPPORT_RX_PINGPONG (1) /*!< Support Ping-Pong mode on RX path */ +#define SOC_RMT_SUPPORT_RX_DEMODULATION (1) /*!< Support signal demodulation on RX path (i.e. remove carrier) */ +#define SOC_RMT_SUPPORT_TX_LOOP_COUNT (1) /*!< Support transmit specified number of cycles in loop mode */ +#define SOC_RMT_SUPPORT_TX_GROUP (1) /*!< Support a group of TX channels to transmit simultaneously */ +#define SOC_RMT_SUPPORT_REF_TICK (1) /*!< Support set REF_TICK as the RMT clock source */ +#define SOC_RMT_SOURCE_CLK_INDEPENDENT (1) /*!< Can select different source clock for channels */ /*-------------------------- RTCIO CAPS --------------------------------------*/ #define SOC_RTCIO_PIN_COUNT 22 +#define SOC_RTCIO_INPUT_OUTPUT_SUPPORTED 1 +#define SOC_RTCIO_HOLD_SUPPORTED 1 +#define SOC_RTCIO_WAKE_SUPPORTED 1 + /*-------------------------- SIGMA DELTA CAPS --------------------------------*/ -#define SOC_SIGMADELTA_NUM (1) // 1 sigma-delta peripheral +#define SOC_SIGMADELTA_NUM 1 #define SOC_SIGMADELTA_CHANNEL_NUM (8) // 8 channels /*-------------------------- SPI CAPS ----------------------------------------*/ @@ -163,6 +179,7 @@ #define SOC_SPI_PERIPH_CS_NUM(i) (((i)==0)? 2: (((i)==1)? 6: 3)) #define SOC_SPI_MAXIMUM_BUFFER_SIZE 72 +#define SOC_SPI_MAX_PRE_DIVIDER 8192 //#define SOC_SPI_SUPPORT_AS_CS //don't support to toggle the CS while the clock toggles #define SOC_SPI_SUPPORT_DDRCLK 1 @@ -190,7 +207,14 @@ #define SOC_SYSTIMER_BIT_WIDTH_HI (32) // Bit width of systimer high part /*-------------------------- TIMER GROUP CAPS --------------------------------*/ -#define SOC_TIMER_GROUP_SUPPORT_XTAL 1 +#define SOC_TIMER_GROUP_SUPPORT_XTAL (1) +#define SOC_TIMER_GROUP_XTAL_MHZ (40) +#define SOC_TIMER_GROUP_COUNTER_BIT_WIDTH (64) +#define SOC_TIMER_GROUP_PRESCALE_BIT_WIDTH (16) +#define SOC_TIMER_GROUPS (2) +#define SOC_TIMER_GROUP_TIMERS_PER_GROUP (2) +#define SOC_TIMER_GROUP_TOTAL_TIMERS (SOC_TIMER_GROUPS * SOC_TIMER_GROUP_TIMERS_PER_GROUP) +#define SOC_TIMER_GROUP_LAYOUT {2,2} /*-------------------------- TOUCH SENSOR CAPS -------------------------------*/ #define SOC_TOUCH_SENSOR_NUM (15) /*! 15 Touch channels */ @@ -198,6 +222,7 @@ #define SOC_TOUCH_PAD_THRESHOLD_MAX (0x1FFFFF) /*! + +/* ---------------------------- Register Types ------------------------------ */ + +typedef union { + struct { + uint32_t sesreqscs: 1; + uint32_t sesreq: 1; + uint32_t vbvalidoven: 1; + uint32_t vbvalidovval: 1; + uint32_t avalidoven: 1; + uint32_t avalidovval: 1; + uint32_t bvalidoven: 1; + uint32_t bvalidovval: 1; + uint32_t hstnegscs: 1; + uint32_t hnpreq: 1; + uint32_t hstsethnpen: 1; + uint32_t devhnpen: 1; + uint32_t ehen: 1; + uint32_t reserved2: 2; + uint32_t dbncefltrbypass: 1; + uint32_t conidsts: 1; + uint32_t dbnctime: 1; + uint32_t asesvld: 1; + uint32_t bsesvld: 1; + uint32_t otgver: 1; + uint32_t curmod: 1; + uint32_t reserved10: 10; + }; + uint32_t val; +} usb_gotgctl_reg_t; + +typedef union { + struct { + uint32_t reserved2: 2; + uint32_t sesenddet: 1; + uint32_t reserved5: 5; + uint32_t sesreqsucstschng: 1; + uint32_t hstnegsucstschng: 1; + uint32_t reserved7: 7; + uint32_t hstnegdet: 1; + uint32_t adevtoutchg: 1; + uint32_t dbncedone: 1; + uint32_t reserved12: 12; + }; + uint32_t val; +} usb_gotgint_reg_t; + +typedef union { + struct { + uint32_t glbllntrmsk: 1; + uint32_t hbstlen: 4; + uint32_t dmaen: 1; + uint32_t reserved1: 1; + uint32_t nptxfemplvl: 1; + uint32_t ptxfemplvl: 1; + uint32_t reserved12: 12; + uint32_t remmemsupp: 1; + uint32_t notialldmawrit: 1; + uint32_t ahbsingle: 1; + uint32_t invdescendianess: 1; + uint32_t reserved7: 7; + }; + uint32_t val; + //Checked +} usb_gahbcfg_reg_t; + +typedef union { + struct { + uint32_t toutcal: 3; + uint32_t phyif: 1; + uint32_t reserved1a: 1; + uint32_t fsintf: 1; + uint32_t physel: 1; + uint32_t reserved1b: 1; + uint32_t srpcap: 1; + uint32_t hnpcap: 1; + uint32_t usbtrdtim: 4; + uint32_t reserved8: 8; + uint32_t termseldlpulse: 1; + uint32_t reserved5: 5; + uint32_t txenddelay: 1; + uint32_t forcehstmode: 1; + uint32_t forcedevmode: 1; + uint32_t corrupttxpkt: 1; + }; + uint32_t val; +} usb_gusbcfg_reg_t; + +typedef union { + struct { + uint32_t csftrst: 1; + uint32_t piufssftrst: 1; + uint32_t frmcntrrst: 1; + uint32_t reserved1: 1; + uint32_t rxfflsh: 1; + uint32_t txfflsh: 1; + uint32_t txfnum: 5; + uint32_t reserved19: 19; + uint32_t dmareq: 1; + uint32_t ahbidle: 1; + }; + uint32_t val; +} usb_grstctl_reg_t; + +typedef union { + struct { + uint32_t curmod_int: 1; + uint32_t modemis: 1; + uint32_t otgint: 1; + uint32_t sof: 1; + uint32_t rxflvi: 1; + uint32_t nptxfemp: 1; + uint32_t ginnakeff: 1; + uint32_t goutnakeff: 1; + uint32_t reserved2: 2; + uint32_t erlysusp: 1; + uint32_t usbsusp: 1; + uint32_t usbrst: 1; + uint32_t enumdone: 1; + uint32_t isooutdrop: 1; + uint32_t eopf: 1; + uint32_t reserved1a: 1; + uint32_t epmis: 1; + uint32_t iepint: 1; + uint32_t oepint: 1; + uint32_t incompisoin: 1; + uint32_t incompip: 1; + uint32_t fetsusp: 1; + uint32_t resetdet: 1; + uint32_t prtlnt: 1; + uint32_t hchlnt: 1; + uint32_t ptxfemp: 1; + uint32_t reserved1b: 1; + uint32_t conidstschng: 1; + uint32_t disconnint: 1; + uint32_t sessreqint: 1; + uint32_t wkupint: 1; + }; + uint32_t val; +} usb_gintsts_reg_t; + +typedef union { + struct { + uint32_t reserved1a: 1; + uint32_t modemismsk: 1; + uint32_t otgintmsk: 1; + uint32_t sofmsk: 1; + uint32_t rxflvimsk: 1; + uint32_t nptxfempmsk: 1; + uint32_t ginnakeffmsk: 1; + uint32_t goutnackeffmsk: 1; + uint32_t reserved2: 2; + uint32_t erlysuspmsk: 1; + uint32_t usbsuspmsk: 1; + uint32_t usbrstmsk: 1; + uint32_t enumdonemsk: 1; + uint32_t isooutdropmsk: 1; + uint32_t eopfmsk: 1; + uint32_t reserved1b: 1; + uint32_t epmismsk: 1; + uint32_t iepintmsk: 1; + uint32_t oepintmsk: 1; + uint32_t incompisoinmsk: 1; + uint32_t incompipmsk: 1; + uint32_t fetsuspmsk: 1; + uint32_t resetdetmsk: 1; + uint32_t prtlntmsk: 1; + uint32_t hchintmsk: 1; + uint32_t ptxfempmsk: 1; + uint32_t reserved1c: 1; + uint32_t conidstschngmsk: 1; + uint32_t disconnintmsk: 1; + uint32_t sessreqintmsk: 1; + uint32_t wkupintmsk: 1; + }; + uint32_t val; +} usb_gintmsk_reg_t; + +typedef union { + struct { + uint32_t g_chnum: 4; + uint32_t g_bcnt: 11; + uint32_t g_dpid: 2; + uint32_t g_pktsts: 4; + uint32_t g_fn: 4; + uint32_t reserved7: 7; + }; + uint32_t val; +} usb_grxstsr_reg_t; + +typedef union { + struct { + uint32_t chnum: 4; + uint32_t bcnt: 11; + uint32_t dpid: 2; + uint32_t pktsts: 4; + uint32_t fn: 4; + uint32_t reserved7: 7; + }; + uint32_t val; +} usb_grxstsp_reg_t; + +typedef union { + struct { + uint32_t rxfdep: 16; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_grxfsiz_reg_t; + +typedef union { + struct { + uint32_t nptxfstaddr: 16; + uint32_t nptxfdep: 16; + }; + uint32_t val; +} usb_gnptxfsiz_reg_t; + +typedef union { + struct { + uint32_t nptxfspcavail: 16; + uint32_t nptxqspcavail: 4; + uint32_t reserved4: 4; + uint32_t nptxqtop: 7; + uint32_t reserved1: 1; + }; + uint32_t val; +} usb_gnptxsts_reg_t; + +typedef union { + struct { + uint32_t synopsysid; + }; + uint32_t val; +} usb_gsnpsid_reg_t; + +typedef union { + struct { + uint32_t epdir; + }; + uint32_t val; +} usb_ghwcfg1_reg_t; + +typedef union { + struct { + uint32_t otgmode: 3; + uint32_t otgarch: 2; + uint32_t singpnt: 1; + uint32_t hsphytype: 2; + uint32_t fsphytype: 2; + uint32_t numdeveps: 4; + uint32_t numhstchnl: 4; + uint32_t periosupport: 1; + uint32_t dynfifosizing: 1; + uint32_t multiprocintrpt: 1; + uint32_t reserved1a: 1; + uint32_t nptxqdepth: 2; + uint32_t ptxqdepth: 2; + uint32_t tknqdepth: 5; + uint32_t reserved1b: 1; + }; + uint32_t val; +} usb_ghwcfg2_reg_t; + +typedef union { + struct { + uint32_t xfersizewidth: 4; + uint32_t pktsizewidth: 3; + uint32_t otgen: 1; + uint32_t i2cintsel: 1; + uint32_t vndctlsupt: 1; + uint32_t optfeature: 1; + uint32_t rsttype: 1; + uint32_t adpsupport: 1; + uint32_t hsicmode: 1; + uint32_t bcsupport: 1; + uint32_t lpmmode: 1; + uint32_t dfifodepth: 16; + }; + uint32_t val; +} usb_ghwcfg3_reg_t; + +typedef union { + struct { + uint32_t g_numdevperioeps: 4; + uint32_t g_partialpwrdn: 1; + uint32_t g_ahbfreq: 1; + uint32_t g_hibernation: 1; + uint32_t g_extendedhibernation: 1; + uint32_t reserved4: 4; + uint32_t g_acgsupt: 1; + uint32_t g_enhancedlpmsupt: 1; + uint32_t g_phydatawidth: 2; + uint32_t g_numctleps: 4; + uint32_t g_iddqfltr: 1; + uint32_t g_vbusvalidfltr: 1; + uint32_t g_avalidfltr: 1; + uint32_t g_bvalidfltr: 1; + uint32_t g_sessendfltr: 1; + uint32_t g_dedfifomode: 1; + uint32_t g_ineps: 4; + uint32_t g_descdmaenabled: 1; + uint32_t g_descdma: 1; + }; + uint32_t val; +} usb_ghwcfg4_reg_t; + +typedef union { + struct { + uint32_t gdfifocfg: 16; + uint32_t epinfobaseaddr: 16; + + }; + uint32_t val; +} usb_gdfifocfg_reg_t; + +typedef union { + struct { + uint32_t ptxfstaddr: 16; + uint32_t ptxfsize: 16; + }; + uint32_t val; +} usb_hptxfsiz_reg_t; + +typedef union { + struct { + uint32_t inepitxfstaddr: 16; + uint32_t inep1txfdep: 16; + }; + uint32_t val; +} usb_dieptxfi_reg_t; + +typedef union { + struct { + uint32_t fslspclksel: 2; + uint32_t fslssupp: 1; + uint32_t reserved4a: 4; + uint32_t ena32khzs: 1; + uint32_t resvalid: 8; + uint32_t reserved1: 1; + uint32_t reserved6: 6; + uint32_t descdma: 1; + uint32_t frlisten: 2; + uint32_t perschedena: 1; + uint32_t reserved4b: 4; + uint32_t modechtimen: 1; + }; + uint32_t val; +} usb_hcfg_reg_t; + +typedef union { + struct { + uint32_t frint: 16; + uint32_t hfirrldctrl: 1; + uint32_t reserved15: 15; + }; + uint32_t val; +} usb_hfir_reg_t; + +typedef union { + struct { + uint32_t frnum: 14; + uint32_t reserved: 2; + uint32_t frrem: 16; + }; + uint32_t val; +} usb_hfnum_reg_t; + +typedef union { + struct { + uint32_t ptxfspcavail: 16; + uint32_t ptxqspcavail: 5; + uint32_t reserved: 3; + uint32_t ptxqtop: 8; + }; + uint32_t val; +} usb_hptxsts_reg_t; + +typedef union { + struct { + uint32_t haint: 8; + uint32_t reserved24: 24; + }; + uint32_t val; +} usb_haint_reg_t; + +typedef union { + struct { + uint32_t haintmsk: 8; + uint32_t reserved24: 24; + }; + uint32_t val; +} usb_haintmsk_reg_t; + +typedef union { + struct { + uint32_t hflbaddr; + }; + uint32_t val; +} usb_hflbaddr_reg_t; + +typedef union { + struct { + uint32_t prtconnsts: 1; + uint32_t prtconndet: 1; + uint32_t prtena: 1; + uint32_t prtenchng: 1; + uint32_t prtovrcurract: 1; + uint32_t prtovrcurrchng: 1; + uint32_t prtres: 1; + uint32_t prtsusp: 1; + uint32_t prtrst: 1; + uint32_t reserved1: 1; + uint32_t prtlnsts: 2; + uint32_t prtpwr: 1; + uint32_t prttstctl: 4; + uint32_t prtspd: 2; + uint32_t reserved13: 13; + }; + uint32_t val; +} usb_hprt_reg_t; + +typedef union { + struct { + uint32_t mps: 11; + uint32_t epnum: 4; + uint32_t epdir: 1; + uint32_t reserved: 1; + uint32_t lspddev: 1; + uint32_t eptype: 2; + uint32_t ec: 2; + uint32_t devaddr: 7; + uint32_t oddfrm: 1; + uint32_t chdis: 1; + uint32_t chena: 1; + }; + uint32_t val; + //Checked with changes +} usb_hcchar_reg_t; + +typedef union { + struct { + uint32_t xfercompl: 1; + uint32_t chhltd: 1; + uint32_t ahberr: 1; + uint32_t stall: 1; + uint32_t nack: 1; + uint32_t ack: 1; + uint32_t nyet: 1; + uint32_t xacterr: 1; + uint32_t bblerr: 1; + uint32_t frmovrun: 1; + uint32_t datatglerr: 1; + uint32_t bnaintr: 1; + uint32_t xcs_xact_err: 1; + uint32_t desc_lst_rollintr: 1; + uint32_t reserved18: 18; + }; + uint32_t val; + //Checked +} usb_hcint_reg_t; + +typedef union { + struct { + uint32_t xfercomplmsk: 1; + uint32_t chhltdmsk: 1; + uint32_t ahberrmsk: 1; + uint32_t stallmsk: 1; + uint32_t nakmsk: 1; + uint32_t ackmsk: 1; + uint32_t nyetmsk: 1; + uint32_t xacterrmsk: 1; + uint32_t bblerrmsk: 1; + uint32_t frmovrunmsk: 1; + uint32_t datatglerrmsk: 1; + uint32_t bnaintrmsk: 1; + uint32_t reserved1: 1; + uint32_t desc_lst_rollintrmsk: 1; + uint32_t reserved18: 18; + }; + uint32_t val; + //Checked +} usb_hcintmsk_reg_t; + +typedef union { + struct { + uint32_t sched_info: 8; + uint32_t ntd: 8; + uint32_t reserved3: 3; + uint32_t reserved10: 10; + uint32_t pid: 2; + uint32_t dopng: 1; + }; + uint32_t val; + //Checked +} usb_hctsiz_reg_t; + +typedef union { + struct { + uint32_t reserved3: 3; + uint32_t ctd: 6; + uint32_t dmaaddr: 23; + } non_iso; + struct { + uint32_t reserved3: 3; + uint32_t dmaaddr_ctd: 29; + } iso; + uint32_t val; + //Checked +} usb_hcdma_reg_t; + +typedef union { + struct { + uint32_t hcdmab; + }; + uint32_t val; +} usb_hcdmab_reg_t; + +typedef union { + struct { + uint32_t reserved2a: 2; + uint32_t nzstsouthshk: 1; + uint32_t reserved1: 1; + uint32_t devaddr: 7; + uint32_t perfrlint: 2; + uint32_t endevoutnak: 1; + uint32_t xcvrdly: 1; + uint32_t erraticintmsk: 1; + uint32_t reserved2b: 2; + uint32_t epmiscnt: 5; + uint32_t descdma: 1; + uint32_t perschintvl: 2; + uint32_t resvalid: 6; + }; + uint32_t val; +} usb_dcfg_reg_t; + +typedef union { + struct { + uint32_t rmtwkupsig: 1; + uint32_t sftdiscon: 1; + uint32_t gnpinnaksts: 1; + uint32_t goutnaksts: 1; + uint32_t tstctl: 3; + uint32_t sgnpinnak: 1; + uint32_t cgnpinnak: 1; + uint32_t sgoutnak: 1; + uint32_t cgoutnak: 1; + uint32_t pwronprgdone: 1; + uint32_t reserved1: 1; + uint32_t gmc: 2; + uint32_t ignrfrmnum: 1; + uint32_t nakonbble: 1; + uint32_t encountonbna: 1; + uint32_t deepsleepbeslreject: 1; + uint32_t reserved3: 13; + }; + uint32_t val; +} usb_dctl_reg_t; + +typedef union { + struct { + uint32_t suspsts: 1; + uint32_t enumspd: 2; + uint32_t errticerr: 1; + uint32_t reserved4: 4; + uint32_t soffn: 14; + uint32_t devlnsts: 2; + uint32_t reserved8: 8; + }; + uint32_t val; +} usb_dsts_reg_t; + +typedef union { + struct { + uint32_t di_xfercomplmsk: 1; + uint32_t di_epdisbldmsk: 1; + uint32_t di_ahbermsk: 1; + uint32_t timeoutmsk: 1; + uint32_t intkntxfempmsk: 1; + uint32_t intknepmismsk: 1; + uint32_t inepnakeffmsk: 1; + uint32_t reserved1: 1; + uint32_t txfifoundrnmsk: 1; + uint32_t bnainintrmsk: 1; + uint32_t reserved3: 3; + uint32_t di_nakmsk: 1; + uint32_t reserved18: 18; + }; + uint32_t val; +} usb_diepmsk_reg_t; + +typedef union { + struct { + uint32_t xfercomplmsk: 1; + uint32_t epdisbldmsk: 1; + uint32_t ahbermsk: 1; + uint32_t setupmsk: 1; + uint32_t outtknepdismsk: 1; + uint32_t stsphsercvdmsk: 1; + uint32_t back2backsetup: 1; + uint32_t reserved1: 1; + uint32_t outpkterrmsk: 1; + uint32_t bnaoutintrmsk: 1; + uint32_t reserved2: 2; + uint32_t bbleerrmsk: 1; + uint32_t nakmsk: 1; + uint32_t nyetmsk: 1; + uint32_t reserved17: 17; + }; + uint32_t val; +} usb_doepmsk_reg_t; + +typedef union { + struct { + uint32_t inepint0: 1; + uint32_t inepint1: 1; + uint32_t inepint2: 1; + uint32_t inepint3: 1; + uint32_t inepint4: 1; + uint32_t inepint5: 1; + uint32_t inepint6: 1; + uint32_t reserved9a: 9; + uint32_t outepint0: 1; + uint32_t outepint1: 1; + uint32_t outepint2: 1; + uint32_t outepint3: 1; + uint32_t outepint4: 1; + uint32_t outepint5: 1; + uint32_t outepint6: 1; + uint32_t reserved9b: 9; + }; + uint32_t val; +} usb_daint_reg_t; + +typedef union { + struct { + uint32_t inepmsk0: 1; + uint32_t inepmsk1: 1; + uint32_t inepmsk2: 1; + uint32_t inepmsk3: 1; + uint32_t inepmsk4: 1; + uint32_t inepmsk5: 1; + uint32_t inepmsk6: 1; + uint32_t reserved9a: 9; + uint32_t outepmsk0: 1; + uint32_t outepmsk1: 1; + uint32_t outepmsk2: 1; + uint32_t outepmsk3: 1; + uint32_t outepmsk4: 1; + uint32_t outepmsk5: 1; + uint32_t outepmsk6: 1; + uint32_t reserved9b: 9; + }; + uint32_t val; +} usb_daintmsk_reg_t; + +typedef union { + struct { + uint32_t dvbusdis: 16; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_dvbusdis_reg_t; + +typedef union { + struct { + uint32_t dvbuspulse: 12; + uint32_t reserved20: 20; + }; + uint32_t val; +} usb_dvbuspulse_reg_t; + +typedef union { + struct { + uint32_t nonisothren: 1; + uint32_t isothren: 1; + uint32_t txthrlen: 9; + uint32_t ahbthrratio: 2; + uint32_t reserved3: 3; + uint32_t rxthren: 1; + uint32_t rxthrlen: 9; + uint32_t reserved1: 1; + uint32_t arbprken: 1; + uint32_t reserved4: 4; + }; + uint32_t val; +} usb_dthrctl_reg_t; + +typedef union { + struct { + uint32_t ineptxfernpmsk: 16; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_diepempmsk_reg_t; + +typedef union { + struct { + uint32_t mps0: 2; + uint32_t reserved9: 9; + uint32_t reserved4: 4; + uint32_t usbactep0: 1; + uint32_t reserved1a: 1; + uint32_t naksts0: 1; + uint32_t eptype0: 2; + uint32_t reserved1b: 1; + uint32_t stall0: 1; + uint32_t txfnum0: 4; + uint32_t cnak0: 1; + uint32_t snak0: 1; + uint32_t reserved2: 2; + uint32_t epdis0: 1; + uint32_t epena0: 1; + }; + uint32_t val; +} usb_diepctl0_reg_t; + +typedef union { + struct { + uint32_t xfercompl0: 1; + uint32_t epdisbld0: 1; + uint32_t ahberr0: 1; + uint32_t timeout0: 1; + uint32_t intkntxfemp0: 1; + uint32_t intknepmis0: 1; + uint32_t inepnakeff0: 1; + uint32_t txfemp0: 1; + uint32_t txfifoundrn0: 1; + uint32_t bnaintr0: 1; + uint32_t reserved1: 1; + uint32_t pktdrpsts0: 1; + uint32_t bbleerr0: 1; + uint32_t nakintrpt0: 1; + uint32_t nyetintrpt0: 1; + uint32_t reserved17: 17; + }; + uint32_t val; +} usb_diepint0_reg_t; + +typedef union { + struct { + uint32_t xfersize0: 7; + uint32_t reserved12: 12; + uint32_t pktcnt0: 2; + uint32_t reserved11: 11; + }; + uint32_t val; +} usb_dieptsiz0_reg_t; + +typedef union { + struct { + uint32_t dmaaddr0; + }; + uint32_t val; +} usb_diepdma0_reg_t; + +typedef union { + struct { + uint32_t ineptxfspcavail0: 16; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_dtxfsts0_reg_t; + +typedef union { + struct { + uint32_t dmabufferaddr0; + }; + uint32_t val; +} usb_diepdmab0_reg_t; + +typedef union { + struct { + uint32_t mps: 2; + uint32_t reserved9: 9; + uint32_t reserved4: 4; + uint32_t usbactep: 1; + uint32_t reserved1a: 1; + uint32_t naksts: 1; + uint32_t eptype: 2; + uint32_t reserved1b: 1; + uint32_t stall: 1; + uint32_t txfnum: 4; + uint32_t cnak: 1; + uint32_t snak: 1; + uint32_t setd0pid: 1; + uint32_t setd1pid: 1; + uint32_t epdis: 1; + uint32_t epena: 1; + }; + uint32_t val; +} usb_diepctl_reg_t; + +typedef union { + struct { + uint32_t xfercompl: 1; + uint32_t epdisbld: 1; + uint32_t ahberr: 1; + uint32_t timeout: 1; + uint32_t intkntxfemp: 1; + uint32_t intknepmis: 1; + uint32_t inepnakeff: 1; + uint32_t txfemp: 1; + uint32_t txfifoundrn: 1; + uint32_t bnaintr: 1; + uint32_t reserved1: 1; + uint32_t pktdrpsts: 1; + uint32_t bbleerr: 1; + uint32_t nakintrpt: 1; + uint32_t nyetintrpt: 1; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_diepint_reg_t; + +typedef union { + struct { + uint32_t xfersize: 7; + uint32_t reserved12: 12; + uint32_t pktcnt: 2; + uint32_t reserved11: 11; + }; + uint32_t val; +} usb_dieptsiz_reg_t; + +typedef union { + struct { + uint32_t dmaddr1; + }; + uint32_t val; +} usb_diepdma_reg_t; + +typedef union { + struct { + uint32_t ineptxfspcavail: 16; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_dtxfsts_reg_t; + +typedef union { + struct { + uint32_t dmabufferaddr1; + }; + uint32_t val; +} usb_diepdmab_reg_t; + +typedef union { + struct { + uint32_t mps0: 2; + uint32_t reserved13: 13; + uint32_t usbactep0: 1; + uint32_t reserved1: 1; + uint32_t naksts0: 1; + uint32_t eptype0: 2; + uint32_t snp0: 1; + uint32_t stall0: 1; + uint32_t reserved4: 4; + uint32_t cnak0: 1; + uint32_t snak0: 1; + uint32_t reserved2: 2; + uint32_t epdis0: 1; + uint32_t epena0: 1; + }; + uint32_t val; +} usb_doepctl0_reg_t; + +typedef union { + struct { + uint32_t xfercompl0: 1; + uint32_t epdisbld0: 1; + uint32_t ahberr0: 1; + uint32_t setup0: 1; + uint32_t outtknepdis0: 1; + uint32_t stsphsercvd0: 1; + uint32_t back2backsetup0: 1; + uint32_t reserved1a: 1; + uint32_t outpkterr0: 1; + uint32_t bnaintr0: 1; + uint32_t reserved1b: 1; + uint32_t pktdrpsts0: 1; + uint32_t bbleerr0: 1; + uint32_t nakintrpt0: 1; + uint32_t nyepintrpt0: 1; + uint32_t stuppktrcvd0: 1; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_doepint0_reg_t; + +typedef union { + struct { + uint32_t xfersize0: 7; + uint32_t reserved12: 12; + uint32_t pktcnt0: 1; + uint32_t reserved9: 9; + uint32_t supcnt0: 2; + uint32_t reserved1: 1; + }; + uint32_t val; +} usb_doeptsiz0_reg_t; + +typedef union { + struct { + uint32_t dmaaddr0; + }; + uint32_t val; +} usb_doepdma0_reg_t; + +typedef union { + struct { + uint32_t dmabufferaddr0; + }; + uint32_t val; +} usb_doepdmab0_reg_t; + +typedef union { + struct { + uint32_t mps: 11; + uint32_t reserved4a: 4; + uint32_t usbactep: 1; + uint32_t reserved1: 1; + uint32_t naksts: 1; + uint32_t eptype: 2; + uint32_t snp: 1; + uint32_t stall: 1; + uint32_t reserved4b: 4; + uint32_t cnak: 1; + uint32_t snak: 1; + uint32_t setd0pid: 1; + uint32_t setd1pid: 1; + uint32_t epdis: 1; + uint32_t epena: 1; + }; + uint32_t val; +} usb_doepctl_reg_t; + +typedef union { + struct { + uint32_t xfercompl: 1; + uint32_t epdisbld: 1; + uint32_t ahberr: 1; + uint32_t setup: 1; + uint32_t outtknepdis: 1; + uint32_t stsphsercvd: 1; + uint32_t back2backsetup: 1; + uint32_t reserved1a: 1; + uint32_t outpkterr: 1; + uint32_t bnaintr: 1; + uint32_t reserved1b: 1; + uint32_t pktdrpsts: 1; + uint32_t bbleerr: 1; + uint32_t nakintrpt: 1; + uint32_t nyepintrpt: 1; + uint32_t stuppktrcvd: 1; + uint32_t reserved16: 16; + }; + uint32_t val; +} usb_doepint_reg_t; + +typedef union { + struct { + uint32_t xfersize: 7; + uint32_t reserved12: 12; + uint32_t pktcnt: 1; + uint32_t reserved9: 9; + uint32_t supcnt: 2; + uint32_t reserved1: 1; + }; + uint32_t val; +} usb_doeptsiz_reg_t; + +typedef union { + struct { + uint32_t dmaaddr; + }; + uint32_t val; +} usb_doepdma_reg_t; + +typedef union { + struct { + uint32_t dmabufferaddr; + }; + uint32_t val; +} usb_doepdmab_reg_t; + +typedef union { + struct { + uint32_t stoppclk: 1; + uint32_t gatehclk: 1; + uint32_t pwrclmp: 1; + uint32_t rstpdwnmodule: 1; + uint32_t reserved2: 2; + uint32_t physleep: 1; + uint32_t l1suspended: 1; + uint32_t resetaftersusp: 1; + uint32_t reserved23: 23; + }; + uint32_t val; +} usb_pcgcctl_reg_t; + +/* --------------------------- Register Groups ------------------------------ */ + +typedef struct { + volatile usb_hcchar_reg_t hcchar_reg; //0x00 + uint32_t reserved_0x04_0x08[1]; //0x04 + volatile usb_hcint_reg_t hcint_reg; //0x08 + volatile usb_hcintmsk_reg_t hcintmsk_reg; //0x0c + volatile usb_hctsiz_reg_t hctsiz_reg; //0x10 + volatile usb_hcdma_reg_t hcdma_reg; //0x14 + uint32_t reserved_0x14_0x14[1]; //0x18* + volatile usb_hcdmab_reg_t hcdmab_reg; //0x1c +} usb_host_chan_regs_t; + +typedef struct { + volatile usb_diepctl_reg_t diepctl_reg; //0x00 + uint32_t reserved_0x04_0x08[1]; //0x04 + volatile usb_diepint_reg_t diepint_reg; //0x08 + uint32_t reserved_0x0c_0x10[1]; //0x0c + volatile usb_dieptsiz_reg_t dieptsiz_reg; //0x010 + volatile usb_diepdma_reg_t diepdma_reg; //0x14 + volatile usb_dtxfsts_reg_t dtxfsts_reg; //0x18 + volatile usb_diepdmab_reg_t diepdmab_reg; //0x1c +} usb_in_ep_regs_t; + +typedef struct { + volatile usb_doepctl_reg_t doepctl_reg; //0x00 + uint32_t reserved_0x04_0x08[1]; //0x04 + volatile usb_doepint_reg_t doepint_reg; //0x08 + uint32_t reserved_0x0c_0x10[1]; //0x0c + volatile usb_doeptsiz_reg_t doeptsiz_reg; //0x10 + volatile usb_doepdma_reg_t doepdma_reg; //0x14 + uint32_t reserved_0x18_0x1c[1]; //0x18 + volatile usb_doepdmab_reg_t doepdmab_reg; //0x1c +} usb_out_ep_regs_t; + +/* --------------------------- Register Layout ------------------------------ */ + +typedef struct { + //Global Registers + volatile usb_gotgctl_reg_t gotgctl_reg; //0x0000 + volatile usb_gotgint_reg_t gotgint_reg; //0x0004 + volatile usb_gahbcfg_reg_t gahbcfg_reg; //0x0008 + volatile usb_gusbcfg_reg_t gusbcfg_reg; //0x000c + volatile usb_grstctl_reg_t grstctl_reg; //0x0010 + volatile usb_gintsts_reg_t gintsts_reg; //0x0014 + volatile usb_gintmsk_reg_t gintmsk_reg; //0x0018 + volatile usb_grxstsr_reg_t grxstsr_reg; //0x001c + volatile usb_grxstsp_reg_t grxstsp_reg; //0x0020 + volatile usb_grxfsiz_reg_t grxfsiz_reg; //0x0024 + volatile usb_gnptxfsiz_reg_t gnptxfsiz_reg; //0x0028 + volatile usb_gnptxsts_reg_t gnptxsts_reg; //0x002c + uint32_t reserved_0x0030_0x0040[4]; //0x0030 to 0x0040 + volatile usb_gsnpsid_reg_t gsnpsid_reg; //0x0040 + volatile usb_ghwcfg1_reg_t ghwcfg1_reg; //0x0044 + volatile usb_ghwcfg2_reg_t ghwcfg2_reg; //0x0048 + volatile usb_ghwcfg3_reg_t ghwcfg3_reg; //0x004c + volatile usb_ghwcfg4_reg_t ghwcfg4_reg; //0x0050 + uint32_t reserved_0x0054_0x005c[2]; //0x0054 to 0x005c + + //FIFO Configurations + volatile usb_gdfifocfg_reg_t gdfifocfg_reg; //0x005c + uint32_t reserved_0x0060_0x0100[40]; //0x0060 to 0x0100 + volatile usb_hptxfsiz_reg_t hptxfsiz_reg; //0x0100 + volatile usb_dieptxfi_reg_t dieptxfi_regs[4]; //0x0104 to 0x0114 + usb_dieptxfi_reg_t reserved_0x0114_0x0140[11]; //0x0114 to 0x0140 + uint32_t reserved_0x140_0x400[176]; //0x0140 to 0x0400 + + //Host Mode Registers + volatile usb_hcfg_reg_t hcfg_reg; //0x0400 + volatile usb_hfir_reg_t hfir_reg; //0x0404 + volatile usb_hfnum_reg_t hfnum_reg; //0x0408 + uint32_t reserved_0x40c_0x410[1]; //0x040c to 0x0410 + volatile usb_hptxsts_reg_t hptxsts_reg; //0x0410 + volatile usb_haint_reg_t haint_reg; //0x0414 + volatile usb_haintmsk_reg_t haintmsk_reg; //0x0418 + volatile usb_hflbaddr_reg_t hflbaddr_reg; //0x041c + uint32_t reserved_0x420_0x440[8]; //0x0420 to 0x0440 + volatile usb_hprt_reg_t hprt_reg; //0x0440 + uint32_t reserved_0x0444_0x0500[47]; //0x0444 to 0x0500 + usb_host_chan_regs_t host_chans[8]; //0x0500 to 0x0600 + usb_host_chan_regs_t reserved_0x0600_0x0700[8]; //0x0600 to 0x0700 + uint32_t reserved_0x0700_0x0800[64]; //0x0700 to 0x0800 + volatile usb_dcfg_reg_t dcfg_reg; //0x0800 + volatile usb_dctl_reg_t dctl_reg; //0x0804 + volatile usb_dsts_reg_t dsts_reg; //0x0808 + uint32_t reserved_0x080c_0x0810[1]; //0x080c to 0x0810 + + //Device Mode Registers + volatile usb_diepmsk_reg_t diepmsk_reg; //0x810 + volatile usb_doepmsk_reg_t doepmsk_reg; //0x0814 + volatile usb_daint_reg_t daint_reg; //0x0818 + volatile usb_daintmsk_reg_t daintmsk_reg; //0x081c + uint32_t reserved_0x0820_0x0828[2]; //0x0820 to 0x0828 + volatile usb_dvbusdis_reg_t dvbusdis_reg; //0x0828 + volatile usb_dvbuspulse_reg_t dvbuspulse_reg; //0x082c + volatile usb_dthrctl_reg_t dthrctl_reg; //0x0830 + volatile usb_diepempmsk_reg_t diepempmsk_reg; //0x0834 + uint32_t reserved_0x0838_0x0900[50]; //0x0838 to 0x0900 + + //Deivce: IN EP0 reigsters + volatile usb_diepctl0_reg_t diepctl0_reg; //0x0900 + uint32_t reserved_0x0904_0x0908[1]; //0x0904 to 0x0908 + volatile usb_diepint0_reg_t diepint0_reg; //0x0908 + uint32_t reserved_0x090c_0x0910[1]; //0x090c to 0x0910 + volatile usb_dieptsiz0_reg_t dieptsiz0_reg; //0x0910 + volatile usb_diepdma0_reg_t diepdma0_reg; //0x0914 + volatile usb_dtxfsts0_reg_t dtxfsts0_reg; //0x0918 + volatile usb_diepdmab0_reg_t diepdmab0_reg; //0x091c + + //Deivce: IN EP registers + usb_in_ep_regs_t in_eps[6]; //0x0920 to 0x09e0 + usb_in_ep_regs_t reserved_0x09e0_0x0b00[9]; //0x09e0 to 0x0b00 + + //Device: OUT EP0 reigsters + volatile usb_doepctl0_reg_t doepctl0_reg; //0x0b00 + uint32_t reserved_0x0b04_0x0b08[1]; //0x0b04 to 0x0b08 + volatile usb_doepint0_reg_t doepint0_reg; //0b0b08 + uint32_t reserved_0x0b0c_0x0b10[1]; //0x0b0c to 0x0b10 + volatile usb_doeptsiz0_reg_t doeptsiz0_reg; //0x0b10 + volatile usb_doepdma0_reg_t doepdma0_reg; //0x0b14 + uint32_t reserved_0x0b18_0x0b1c[1]; //0x0b18 to 0x0b1c + volatile usb_doepdmab0_reg_t doepdmab0_reg; //0x0b1c + + //Deivce: OUT EP registers + usb_out_ep_regs_t out_eps[6]; //0xb1c + usb_out_ep_regs_t reserved_0x0be0_0x0d00[9]; //0x0be0 to 0x0d00 + uint32_t reserved_0x0d00_0x0e00[64]; //0x0d00 to 0x0e00 + volatile usb_pcgcctl_reg_t pcgcctl_reg; //0x0e00 + uint32_t reserved_0x0e04_0x0e08[1]; //0x0d00 to 0x0e00 +} usbh_dev_t; + + +_Static_assert(sizeof(usbh_dev_t) == 0xe08, "USB new struct should be 0xe08 large"); + +extern usbh_dev_t USBH; + + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/wdev_reg.h b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/wdev_reg.h index 21fb25a81..a1400e415 100644 --- a/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/wdev_reg.h +++ b/tools/sdk/esp32s2/include/soc/esp32s2/include/soc/wdev_reg.h @@ -16,6 +16,5 @@ #include "soc.h" -/* Hardware random number generator register */ +/* Hardware random number generator register */ #define WDEV_RND_REG 0x60035110 - diff --git a/tools/sdk/esp32s2/include/soc/include/soc/adc_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/adc_periph.h index d3504ebce..9cb75283e 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/adc_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/adc_periph.h @@ -15,10 +15,13 @@ #pragma once #include "soc/soc.h" +#include "soc/soc_caps.h" #include "soc/syscon_struct.h" #include "soc/sens_reg.h" #include "soc/sens_struct.h" +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED #include "soc/rtc_io_struct.h" +#endif #include "soc/rtc_cntl_struct.h" #include "soc/adc_channel.h" #include "soc/soc_caps.h" @@ -38,4 +41,4 @@ extern const int adc_channel_io_map[SOC_ADC_PERIPH_NUM][SOC_ADC_MAX_CHANNEL_NUM] #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/hwcrypto_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/hwcrypto_periph.h index 6cabdd38a..3c517879b 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/hwcrypto_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/hwcrypto_periph.h @@ -13,5 +13,13 @@ // limitations under the License. #pragma once + +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 +/* included here for ESP-IDF v4.x compatibility */ #include "soc/dport_reg.h" +#include "soc/dport_access.h" +#endif + #include "soc/hwcrypto_reg.h" diff --git a/tools/sdk/esp32s2/include/soc/include/soc/i2c_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/i2c_periph.h index f56fbe294..0da893cab 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/i2c_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/i2c_periph.h @@ -35,4 +35,4 @@ extern const i2c_signal_conn_t i2c_periph_signal[SOC_I2C_NUM]; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/ledc_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/ledc_periph.h index 7cf82c1fd..d90f22e79 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/ledc_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/ledc_periph.h @@ -36,4 +36,4 @@ extern const ledc_signal_conn_t ledc_periph_signal[1]; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/lldesc.h b/tools/sdk/esp32s2/include/soc/include/soc/lldesc.h index a991a95d1..31e02125c 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/lldesc.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/lldesc.h @@ -22,6 +22,8 @@ #include "esp32s2/rom/lldesc.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/lldesc.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/lldesc.h" #endif //the size field has 12 bits, but 0 not for 4096. diff --git a/tools/sdk/esp32s2/include/soc/include/soc/rmt_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/rmt_periph.h index a46a6f526..4f46d9255 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/rmt_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/rmt_periph.h @@ -1,4 +1,4 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD +// Copyright 2019-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. @@ -13,5 +13,27 @@ // limitations under the License. #pragma once -#include "soc/rmt_reg.h" -#include "soc/rmt_struct.h" + +#include "soc/soc_caps.h" +#include "soc/periph_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + struct { + struct { + const int tx_sig; + const int rx_sig; + }; + } channels[SOC_RMT_CHANNELS_NUM]; + const int irq; + const periph_module_t module; +} rmt_signal_conn_t; + +extern const rmt_signal_conn_t rmt_periph_signals; + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/rtc_io_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/rtc_io_periph.h index aca325f01..3bf77472c 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/rtc_io_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/rtc_io_periph.h @@ -17,9 +17,15 @@ #include "soc/soc.h" //include soc related (generated) definitions #include "soc/soc_caps.h" + +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + #include "soc/rtc_io_channel.h" #include "soc/rtc_io_reg.h" #include "soc/rtc_io_struct.h" + +#endif + #include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_struct.h" #include "soc/sens_struct.h" @@ -29,6 +35,8 @@ extern "C" { #endif +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED + /** * @brief Pin function information for a single RTCIO pad's. * @@ -100,10 +108,12 @@ typedef struct { * This is an internal function of the driver, and is not usually useful * for external use. */ -extern const rtc_gpio_desc_t rtc_gpio_desc[GPIO_PIN_COUNT]; +extern const rtc_gpio_desc_t rtc_gpio_desc[SOC_GPIO_PIN_COUNT]; -#endif // CONFIG_IDF_TARGET_ESP32 +#endif // CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC + +#endif // SOC_RTCIO_INPUT_OUTPUT_SUPPORTED #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/rtc_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/rtc_periph.h index 121dc597d..433f5cc42 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/rtc_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/rtc_periph.h @@ -15,6 +15,7 @@ #pragma once #include #include "rtc_io_periph.h" +#include "soc/rtc_cntl_reg.h" #include "soc/soc_caps.h" #ifdef __cplusplus diff --git a/tools/sdk/esp32s2/include/soc/include/soc/sigmadelta_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/sigmadelta_periph.h index 75e723c7d..695a78350 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/sigmadelta_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/sigmadelta_periph.h @@ -33,4 +33,4 @@ extern const sigma_delta_signal_conn_t sigma_delta_periph_signals; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/soc_memory_layout.h b/tools/sdk/esp32s2/include/soc/include/soc/soc_memory_layout.h index 01b13c51b..b967006c9 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/soc_memory_layout.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/soc_memory_layout.h @@ -18,6 +18,7 @@ #include #include "soc/soc.h" +#include "soc/soc_caps.h" #include "sdkconfig.h" #include "esp_attr.h" @@ -147,7 +148,7 @@ inline static bool IRAM_ATTR esp_ptr_dma_capable(const void *p) inline static bool IRAM_ATTR esp_ptr_dma_ext_capable(const void *p) { -#if CONFIG_IDF_TARGET_ESP32S2 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 return (intptr_t)p >= SOC_DMA_EXT_LOW && (intptr_t)p < SOC_DMA_EXT_HIGH; #else return false; @@ -176,7 +177,7 @@ inline static bool IRAM_ATTR esp_ptr_byte_accessible(const void *p) intptr_t ip = (intptr_t) p; bool r; r = (ip >= SOC_BYTE_ACCESSIBLE_LOW && ip < SOC_BYTE_ACCESSIBLE_HIGH); -#if CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP +#if CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP /* For ESP32 case, RTC fast memory is accessible to PRO cpu only and hence * for single core configuration (where it gets added to system heap) following * additional check is required */ @@ -196,7 +197,7 @@ inline static bool IRAM_ATTR esp_ptr_internal(const void *p) { bool r; r = ((intptr_t)p >= SOC_MEM_INTERNAL_LOW && (intptr_t)p < SOC_MEM_INTERNAL_HIGH); r |= ((intptr_t)p >= SOC_RTC_DATA_LOW && (intptr_t)p < SOC_RTC_DATA_HIGH); -#if CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP +#if CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP /* For ESP32 case, RTC fast memory is accessible to PRO cpu only and hence * for single core configuration (where it gets added to system heap) following * additional check is required */ @@ -207,7 +208,11 @@ inline static bool IRAM_ATTR esp_ptr_internal(const void *p) { inline static bool IRAM_ATTR esp_ptr_external_ram(const void *p) { +#if SOC_SPIRAM_SUPPORTED return ((intptr_t)p >= SOC_EXTRAM_DATA_LOW && (intptr_t)p < SOC_EXTRAM_DATA_HIGH); +#else + return false; // SoC has no external RAM +#endif } inline static bool IRAM_ATTR esp_ptr_in_iram(const void *p) { @@ -294,4 +299,3 @@ inline static bool IRAM_ATTR esp_stack_ptr_is_sane(uint32_t sp) return esp_stack_ptr_in_dram(sp); #endif } - diff --git a/tools/sdk/esp32s2/include/soc/include/soc/timer_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/timer_periph.h index 6b07378d3..a7da2da0f 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/timer_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/timer_periph.h @@ -13,5 +13,26 @@ // limitations under the License. #pragma once + +#include #include "soc/timer_group_reg.h" #include "soc/timer_group_struct.h" +#include "soc/soc_caps.h" +#include "soc/periph_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + struct { + const periph_module_t module; // Peripheral module + const int t0_irq_id; // Interrupt ID of the first timer in the group + } groups[SOC_TIMER_GROUPS]; +} timer_group_signal_conn_t; + +extern const timer_group_signal_conn_t timer_group_periph_signals; + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/touch_sensor_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/touch_sensor_periph.h index 653d30138..e38b18b05 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/touch_sensor_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/touch_sensor_periph.h @@ -20,7 +20,9 @@ #include "soc/rtc_cntl_struct.h" #include "soc/sens_reg.h" #include "soc/sens_struct.h" +#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED #include "soc/rtc_io_struct.h" +#endif #ifdef __cplusplus extern "C" { @@ -30,4 +32,4 @@ extern const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM]; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/soc/include/soc/uart_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/uart_periph.h index 61bd029ba..f7e470993 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/uart_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/uart_periph.h @@ -37,4 +37,3 @@ extern const uart_signal_conn_t uart_periph_signal[SOC_UART_NUM]; #ifdef __cplusplus } #endif - diff --git a/tools/sdk/esp32s2/include/soc/include/soc/uhci_periph.h b/tools/sdk/esp32s2/include/soc/include/soc/uhci_periph.h index cbfae2ac9..f75807c81 100644 --- a/tools/sdk/esp32s2/include/soc/include/soc/uhci_periph.h +++ b/tools/sdk/esp32s2/include/soc/include/soc/uhci_periph.h @@ -15,4 +15,4 @@ #include "soc/uhci_reg.h" #include "soc/uhci_struct.h" -#include "soc/periph_defs.h" \ No newline at end of file +#include "soc/periph_defs.h" diff --git a/tools/sdk/esp32s2/include/spi_flash/include/esp_flash.h b/tools/sdk/esp32s2/include/spi_flash/include/esp_flash.h index 1f64347c3..845d82f17 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/esp_flash.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/esp_flash.h @@ -65,8 +65,21 @@ typedef struct { /** Called for release temp buffer. */ void (*release_temp_buffer)(void* arg, void *temp_buf); + #define SPI_FLASH_YIELD_REQ_YIELD BIT(0) + #define SPI_FLASH_YIELD_REQ_SUSPEND BIT(1) + + /** Yield to other tasks. Called during erase operations. + * @return ESP_OK means yield needs to be called (got an event to handle), while ESP_ERR_TIMEOUT means skip yield.*/ + esp_err_t (*check_yield)(void *arg, uint32_t chip_status, uint32_t* out_request); + + #define SPI_FLASH_YIELD_STA_RESUME BIT(2) + /** Yield to other tasks. Called during erase operations. */ - esp_err_t (*yield)(void *arg); + esp_err_t (*yield)(void *arg, uint32_t* out_status); + + /** Called for get system time. */ + int64_t (*get_system_time)(void *arg); + } esp_flash_os_functions_t; /** @brief Structure to describe a SPI flash chip connected to the system. @@ -89,6 +102,8 @@ struct esp_flash_t { esp_flash_io_mode_t read_mode; ///< Configured SPI flash read mode. Set before ``esp_flash_init`` is called. uint32_t size; ///< Size of SPI flash in bytes. If 0, size will be detected during initialisation. uint32_t chip_id; ///< Detected chip id. + uint32_t busy :1; ///< This flag is used to verify chip's status. + uint32_t reserved_flags :31; ///< reserved. }; @@ -146,7 +161,10 @@ esp_err_t esp_flash_get_size(esp_flash_t *chip, uint32_t *out_size); * @param chip Pointer to identify flash chip. Must have been successfully initialised via esp_flash_init() * * - * @return ESP_OK on success, or a flash error code if operation failed. + * @return + * - ESP_OK on success, + * - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. + * - Other flash error code if operation failed. */ esp_err_t esp_flash_erase_chip(esp_flash_t *chip); @@ -163,7 +181,10 @@ esp_err_t esp_flash_erase_chip(esp_flash_t *chip); * chip->drv->block_erase_size field, typically 65536 bytes). Remaining sectors are erased using individual sector erase * commands. * - * @return ESP_OK on success, or a flash error code if operation failed. + * @return + * - ESP_OK on success, + * - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. + * - Other flash error code if operation failed. */ esp_err_t esp_flash_erase_region(esp_flash_t *chip, uint32_t start, uint32_t len); @@ -267,7 +288,10 @@ esp_err_t esp_flash_read(esp_flash_t *chip, void *buffer, uint32_t address, uint * * There are no alignment constraints on buffer, address or length. * - * @return ESP_OK on success, or a flash error code if operation failed. + * @return + * - ESP_OK on success, + * - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. + * - Other flash error code if operation failed. */ esp_err_t esp_flash_write(esp_flash_t *chip, const void *buffer, uint32_t address, uint32_t length); diff --git a/tools/sdk/esp32s2/include/spi_flash/include/esp_partition.h b/tools/sdk/esp32s2/include/spi_flash/include/esp_partition.h index 930f7d69a..24c1d3dfa 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/esp_partition.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/esp_partition.h @@ -256,9 +256,9 @@ esp_err_t esp_partition_write(const esp_partition_t* partition, size_t dst_offset, const void* src, size_t size); /** - * @brief Read data from the partition + * @brief Read data from the partition without any transformation/decryption. * - * @note This function is essentially the same as \c esp_partition_write() above. + * @note This function is essentially the same as \c esp_partition_read() above. * It just never decrypts data but returns it as is. * * @param partition Pointer to partition structure obtained using diff --git a/tools/sdk/esp32s2/include/spi_flash/include/esp_spi_flash.h b/tools/sdk/esp32s2/include/spi_flash/include/esp_spi_flash.h index 59d3679da..5e7b77de8 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/esp_spi_flash.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/esp_spi_flash.h @@ -20,6 +20,7 @@ #include #include "esp_err.h" #include "sdkconfig.h" +#include "esp_spi_flash_counters.h" #ifdef __cplusplus extern "C" { @@ -419,47 +420,9 @@ extern const spi_flash_guard_funcs_t g_flash_guard_default_ops; */ extern const spi_flash_guard_funcs_t g_flash_guard_no_os_ops; -#if CONFIG_SPI_FLASH_ENABLE_COUNTERS - -/** - * Structure holding statistics for one type of operation - */ -typedef struct { - uint32_t count; // number of times operation was executed - uint32_t time; // total time taken, in microseconds - uint32_t bytes; // total number of bytes -} spi_flash_counter_t; - -typedef struct { - spi_flash_counter_t read; - spi_flash_counter_t write; - spi_flash_counter_t erase; -} spi_flash_counters_t; - -/** - * @brief Reset SPI flash operation counters - */ -void spi_flash_reset_counters(void); - -/** - * @brief Print SPI flash operation counters - */ -void spi_flash_dump_counters(void); - -/** - * @brief Return current SPI flash operation counters - * - * @return pointer to the spi_flash_counters_t structure holding values - * of the operation counters - */ -const spi_flash_counters_t* spi_flash_get_counters(void); - -#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS - #ifdef __cplusplus } #endif #endif /* ESP_SPI_FLASH_H */ - diff --git a/tools/sdk/esp32s2/include/spi_flash/include/esp_spi_flash_counters.h b/tools/sdk/esp32s2/include/spi_flash/include/esp_spi_flash_counters.h new file mode 100644 index 000000000..ab8157c25 --- /dev/null +++ b/tools/sdk/esp32s2/include/spi_flash/include/esp_spi_flash_counters.h @@ -0,0 +1,65 @@ +// 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. + +#pragma once + +#include +#include +#include "esp_err.h" +#include "sdkconfig.h" + +#if CONFIG_SPI_FLASH_ENABLE_COUNTERS + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Structure holding statistics for one type of operation + */ +typedef struct { + uint32_t count; // number of times operation was executed + uint32_t time; // total time taken, in microseconds + uint32_t bytes; // total number of bytes +} spi_flash_counter_t; + +typedef struct { + spi_flash_counter_t read; + spi_flash_counter_t write; + spi_flash_counter_t erase; +} spi_flash_counters_t; + +/** + * @brief Reset SPI flash operation counters + */ +void spi_flash_reset_counters(void); + +/** + * @brief Print SPI flash operation counters + */ +void spi_flash_dump_counters(void); + +/** + * @brief Return current SPI flash operation counters + * + * @return pointer to the spi_flash_counters_t structure holding values + * of the operation counters + */ +const spi_flash_counters_t* spi_flash_get_counters(void); + +#ifdef __cplusplus +} +#endif + +#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS diff --git a/tools/sdk/esp32s2/include/spi_flash/include/memspi_host_driver.h b/tools/sdk/esp32s2/include/spi_flash/include/memspi_host_driver.h index 80cc55239..edc6c705e 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/memspi_host_driver.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/memspi_host_driver.h @@ -175,4 +175,4 @@ int memspi_host_read_data_slicer(spi_flash_host_inst_t *host, uint32_t address, * * @return Length that can actually be written in one `program_page` call in `spi_flash_host_driver_t`. */ -int memspi_host_write_data_slicer(spi_flash_host_inst_t *host, uint32_t address, uint32_t len, uint32_t *align_address, uint32_t page_size); \ No newline at end of file +int memspi_host_write_data_slicer(spi_flash_host_inst_t *host, uint32_t address, uint32_t len, uint32_t *align_address, uint32_t page_size); diff --git a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_driver.h b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_driver.h index 349adbe57..83668b0df 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_driver.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_driver.h @@ -182,6 +182,10 @@ struct spi_flash_chip_t { * Read the requested register (status, etc.). */ esp_err_t (*read_reg)(esp_flash_t *chip, spi_flash_register_t reg_id, uint32_t* out_reg); + + /** Yield to other tasks. Called during erase operations. */ + esp_err_t (*yield)(esp_flash_t *chip, uint32_t wip); + }; /* Pointer to an array of pointers to all known drivers for flash chips. This array is used diff --git a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_gd.h b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_gd.h index 0d52435a3..09e166117 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_gd.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_gd.h @@ -29,4 +29,8 @@ * chips, and GD25LQ chips, WRSR (01H) command is used; while WRSR2 (31H) is used for GD25Q32 - * GD25Q127 chips. */ +esp_err_t spi_flash_chip_gd_probe(esp_flash_t *chip, uint32_t flash_id); +esp_err_t spi_flash_chip_gd_set_io_mode(esp_flash_t *chip); +esp_err_t spi_flash_chip_gd_get_io_mode(esp_flash_t *chip, esp_flash_io_mode_t* out_io_mode); + extern const spi_flash_chip_t esp_flash_chip_gd; diff --git a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_generic.h b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_generic.h index 1c76ec1e4..0469a438a 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_generic.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_generic.h @@ -72,6 +72,7 @@ esp_err_t spi_flash_chip_generic_detect_size(esp_flash_t *chip, uint32_t *size); * * @return * - ESP_OK if success + * - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. * - or other error passed from the ``set_write_protect``, ``wait_idle`` or ``erase_chip`` function of host driver */ esp_err_t spi_flash_chip_generic_erase_chip(esp_flash_t *chip); @@ -84,6 +85,7 @@ esp_err_t spi_flash_chip_generic_erase_chip(esp_flash_t *chip); * * @return * - ESP_OK if success + * - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. * - or other error passed from the ``set_write_protect``, ``wait_idle`` or ``erase_sector`` function of host driver */ esp_err_t spi_flash_chip_generic_erase_sector(esp_flash_t *chip, uint32_t start_address); @@ -96,6 +98,7 @@ esp_err_t spi_flash_chip_generic_erase_sector(esp_flash_t *chip, uint32_t start_ * * @return * - ESP_OK if success + * - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. * - or other error passed from the ``set_write_protect``, ``wait_idle`` or ``erase_block`` function of host driver */ esp_err_t spi_flash_chip_generic_erase_block(esp_flash_t *chip, uint32_t start_address); @@ -129,6 +132,7 @@ esp_err_t spi_flash_chip_generic_read(esp_flash_t *chip, void *buffer, uint32_t * * @return * - ESP_OK if success + * - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. * - or other error passed from the ``wait_idle`` or ``program_page`` function of host driver */ esp_err_t @@ -381,5 +385,14 @@ esp_err_t spi_flash_common_set_io_mode(esp_flash_t *chip, esp_flash_wrsr_func_t */ esp_err_t spi_flash_chip_generic_config_host_io_mode(esp_flash_t *chip, bool addr_32bit); +/** + * @brief Handle explicit yield requests + * + * @param chip Pointer to SPI flash chip to use. If NULL, esp_flash_default_chip is substituted. + * @param wip Write (erase) in progress, `true` if this function is called during waiting idle of a erase/write command; else `false`. + * @return ESP_OK if success, otherwise failed. + */ +esp_err_t spi_flash_chip_generic_yield(esp_flash_t* chip, uint32_t wip); + /// Default timeout configuration used by most chips -const flash_chip_op_timeout_t spi_flash_chip_generic_timeout; \ No newline at end of file +const flash_chip_op_timeout_t spi_flash_chip_generic_timeout; diff --git a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_issi.h b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_issi.h index 2b1d41155..2f1b06353 100644 --- a/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_issi.h +++ b/tools/sdk/esp32s2/include/spi_flash/include/spi_flash_chip_issi.h @@ -24,4 +24,8 @@ * default autodetection, this is used as a catchall if a more specific chip_drv * is not found. */ +esp_err_t spi_flash_chip_issi_probe(esp_flash_t *chip, uint32_t flash_id); +esp_err_t spi_flash_chip_issi_set_io_mode(esp_flash_t *chip); +esp_err_t spi_flash_chip_issi_get_io_mode(esp_flash_t *chip, esp_flash_io_mode_t* out_io_mode); + extern const spi_flash_chip_t esp_flash_chip_issi; diff --git a/tools/sdk/esp32s2/include/spiffs/include/esp_spiffs.h b/tools/sdk/esp32s2/include/spiffs/include/esp_spiffs.h index bd733ac86..9cc120895 100644 --- a/tools/sdk/esp32s2/include/spiffs/include/esp_spiffs.h +++ b/tools/sdk/esp32s2/include/spiffs/include/esp_spiffs.h @@ -37,7 +37,7 @@ typedef struct { * * @param conf Pointer to esp_vfs_spiffs_conf_t configuration structure * - * @return + * @return * - ESP_OK if success * - ESP_ERR_NO_MEM if objects could not be allocated * - ESP_ERR_INVALID_STATE if already mounted or partition is encrypted @@ -51,7 +51,7 @@ esp_err_t esp_vfs_spiffs_register(const esp_vfs_spiffs_conf_t * conf); * * @param partition_label Same label as passed to esp_vfs_spiffs_register. * - * @return + * @return * - ESP_OK if successful * - ESP_ERR_INVALID_STATE already unregistered */ @@ -63,7 +63,7 @@ esp_err_t esp_vfs_spiffs_unregister(const char* partition_label); * @param partition_label Optional, label of the partition to check. * If not specified, first partition with subtype=spiffs is used. * - * @return + * @return * - true if mounted * - false if not mounted */ @@ -73,7 +73,7 @@ bool esp_spiffs_mounted(const char* partition_label); * Format the SPIFFS partition * * @param partition_label Same label as passed to esp_vfs_spiffs_register. - * @return + * @return * - ESP_OK if successful * - ESP_FAIL on error */ @@ -86,7 +86,7 @@ esp_err_t esp_spiffs_format(const char* partition_label); * @param[out] total_bytes Size of the file system * @param[out] used_bytes Current used bytes in the file system * - * @return + * @return * - ESP_OK if success * - ESP_ERR_INVALID_STATE if not mounted */ diff --git a/tools/sdk/esp32s2/include/spiffs/include/spiffs_config.h b/tools/sdk/esp32s2/include/spiffs/include/spiffs_config.h index a382ba6f9..ca7f0cc6f 100644 --- a/tools/sdk/esp32s2/include/spiffs/include/spiffs_config.h +++ b/tools/sdk/esp32s2/include/spiffs/include/spiffs_config.h @@ -51,12 +51,12 @@ #endif // needed types -typedef signed int s32_t; -typedef unsigned int u32_t; -typedef signed short s16_t; -typedef unsigned short u16_t; -typedef signed char s8_t; -typedef unsigned char u8_t; +typedef int32_t s32_t; +typedef uint32_t u32_t; +typedef int16_t s16_t; +typedef uint16_t u16_t; +typedef int8_t s8_t; +typedef uint8_t u8_t; struct spiffs_t; extern void spiffs_api_lock(struct spiffs_t *fs); diff --git a/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport.h b/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport.h index b13063691..3b65b998e 100644 --- a/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport.h +++ b/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport.h @@ -313,7 +313,22 @@ esp_err_t esp_transport_set_parent_transport_func(esp_transport_handle_t t, payl */ esp_tls_error_handle_t esp_transport_get_error_handle(esp_transport_handle_t t); - +/** + * @brief Get and clear last captured socket errno + * + * Socket errno is internally stored whenever any of public facing API + * for reading, writing, polling or connection fails returning negative return code. + * The error code corresponds to the `SO_ERROR` value retrieved from the underlying + * transport socket using `getsockopt()` API. After reading the captured errno, + * the internal value is cleared to 0. + * + * @param[in] t The transport handle + * + * @return + * - >=0 Last captured socket errno + * - -1 Invalid transport handle or invalid transport's internal error storage + */ +int esp_transport_get_errno(esp_transport_handle_t t); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h b/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h index 4d53d4d2e..12e7ede19 100644 --- a/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h +++ b/tools/sdk/esp32s2/include/tcp_transport/include/esp_transport_ssl.h @@ -169,4 +169,3 @@ void esp_transport_ssl_set_psk_key_hint(esp_transport_handle_t t, const psk_hint } #endif #endif /* _ESP_TRANSPORT_SSL_H_ */ - diff --git a/tools/sdk/esp32s2/include/tcpip_adapter/include/tcpip_adapter_types.h b/tools/sdk/esp32s2/include/tcpip_adapter/include/tcpip_adapter_types.h index 37daf4675..3442b691d 100644 --- a/tools/sdk/esp32s2/include/tcpip_adapter/include/tcpip_adapter_types.h +++ b/tools/sdk/esp32s2/include/tcpip_adapter/include/tcpip_adapter_types.h @@ -79,4 +79,4 @@ typedef esp_netif_sta_info_t tcpip_adapter_sta_info_t; } // extern "C" #endif -#endif // _TCPIP_ADAPTER_TYPES_H_ \ No newline at end of file +#endif // _TCPIP_ADAPTER_TYPES_H_ diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/audio/audio_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/audio/audio_device.h index d86232720..5061501ce 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/audio/audio_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/audio/audio_device.h @@ -384,11 +384,10 @@ static inline uint16_t tud_audio_int_ctr_write(uint8_t const* buffer, uint16_t b //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ -void audiod_init (void); -void audiod_reset (uint8_t rhport); -uint16_t audiod_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool audiod_control_request (uint8_t rhport, tusb_control_request_t const * request); -bool audiod_control_complete (uint8_t rhport, tusb_control_request_t const * request); +void audiod_init (void); +void audiod_reset (uint8_t rhport); +uint16_t audiod_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool audiod_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); bool audiod_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes); #ifdef __cplusplus diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/bth/bth_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/bth/bth_device.h index 5e5468084..1b90d0915 100755 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/bth/bth_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/bth/bth_device.h @@ -96,12 +96,11 @@ bool tud_bt_acl_data_send(void *acl_data, uint16_t data_len); //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ -void btd_init (void); -void btd_reset (uint8_t rhport); -uint16_t btd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool btd_control_request (uint8_t rhport, tusb_control_request_t const * request); -bool btd_control_complete (uint8_t rhport, tusb_control_request_t const * request); -bool btd_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes); +void btd_init (void); +void btd_reset (uint8_t rhport); +uint16_t btd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool btd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const *request); +bool btd_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/cdc/cdc_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/cdc/cdc_device.h index 3c679c48e..62dcd3c0a 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/cdc/cdc_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/cdc/cdc_device.h @@ -102,6 +102,9 @@ uint32_t tud_cdc_n_write_flush (uint8_t itf); // Return the number of bytes (characters) available for writing to TX FIFO buffer in a single n_write operation. uint32_t tud_cdc_n_write_available (uint8_t itf); +// Clear the transmit FIFO +bool tud_cdc_n_write_clear (uint8_t itf); + //--------------------------------------------------------------------+ // Application API (Single Port) //--------------------------------------------------------------------+ @@ -121,6 +124,7 @@ static inline uint32_t tud_cdc_write (void const* buffer, uint32_t buf static inline uint32_t tud_cdc_write_str (char const* str); static inline uint32_t tud_cdc_write_flush (void); static inline uint32_t tud_cdc_write_available (void); +static inline bool tud_cdc_write_clear (void); //--------------------------------------------------------------------+ // Application Callback API (weak is optional) @@ -230,18 +234,22 @@ static inline uint32_t tud_cdc_write_available(void) return tud_cdc_n_write_available(0); } +static inline bool tud_cdc_write_clear(void) +{ + return tud_cdc_n_write_clear(0); +} + /** @} */ /** @} */ //--------------------------------------------------------------------+ // INTERNAL USBD-CLASS DRIVER API //--------------------------------------------------------------------+ -void cdcd_init (void); -void cdcd_reset (uint8_t rhport); -uint16_t cdcd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool cdcd_control_request (uint8_t rhport, tusb_control_request_t const * request); -bool cdcd_control_complete (uint8_t rhport, tusb_control_request_t const * request); -bool cdcd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); +void cdcd_init (void); +void cdcd_reset (uint8_t rhport); +uint16_t cdcd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool cdcd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); +bool cdcd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/dfu/dfu_rt_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/dfu/dfu_rt_device.h index 91ead88c6..643e25d8f 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/dfu/dfu_rt_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/dfu/dfu_rt_device.h @@ -66,8 +66,7 @@ TU_ATTR_WEAK void tud_dfu_rt_reboot_to_dfu(void); // TODO rename to _cb conventi void dfu_rtd_init(void); void dfu_rtd_reset(uint8_t rhport); uint16_t dfu_rtd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool dfu_rtd_control_request(uint8_t rhport, tusb_control_request_t const * request); -bool dfu_rtd_control_complete(uint8_t rhport, tusb_control_request_t const * request); +bool dfu_rtd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); bool dfu_rtd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); #ifdef __cplusplus diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/hid/hid_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/hid/hid_device.h index d5b5b7296..456b011ba 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/hid/hid_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/hid/hid_device.h @@ -46,7 +46,7 @@ #endif #ifndef CFG_TUD_HID_EP_BUFSIZE - #define CFG_TUD_HID_EP_BUFSIZE 16 + #define CFG_TUD_HID_EP_BUFSIZE 64 #endif //--------------------------------------------------------------------+ @@ -359,12 +359,11 @@ static inline bool tud_hid_mouse_report(uint8_t report_id, uint8_t buttons, int8 //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ -void hidd_init (void); -void hidd_reset (uint8_t rhport); -uint16_t hidd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool hidd_control_request (uint8_t rhport, tusb_control_request_t const * request); -bool hidd_control_complete (uint8_t rhport, tusb_control_request_t const * request); -bool hidd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); +void hidd_init (void); +void hidd_reset (uint8_t rhport); +uint16_t hidd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool hidd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); +bool hidd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/midi/midi_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/midi/midi_device.h index b8fb55cc2..9235448f2 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/midi/midi_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/midi/midi_device.h @@ -142,12 +142,11 @@ static inline bool tud_midi_send (uint8_t const packet[4]) //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ -void midid_init (void); -void midid_reset (uint8_t rhport); -uint16_t midid_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool midid_control_request (uint8_t rhport, tusb_control_request_t const * request); -bool midid_control_complete (uint8_t rhport, tusb_control_request_t const * request); -bool midid_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes); +void midid_init (void); +void midid_reset (uint8_t rhport); +uint16_t midid_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool midid_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); +bool midid_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t result, uint32_t xferred_bytes); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc.h index cba8066b7..0bdc00692 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc.h @@ -255,7 +255,7 @@ typedef struct TU_ATTR_PACKED uint8_t : 3; uint8_t disable_block_descriptor : 1; - uint8_t : 0; + uint8_t : 4; uint8_t page_code : 6; uint8_t page_control : 2; diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc_device.h index 3aa93ffd7..469f2f2f7 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/msc/msc_device.h @@ -158,12 +158,11 @@ TU_ATTR_WEAK bool tud_msc_is_writable_cb(uint8_t lun); //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ -void mscd_init (void); -void mscd_reset (uint8_t rhport); -uint16_t mscd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool mscd_control_request (uint8_t rhport, tusb_control_request_t const * p_request); -bool mscd_control_complete (uint8_t rhport, tusb_control_request_t const * p_request); -bool mscd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); +void mscd_init (void); +void mscd_reset (uint8_t rhport); +uint16_t mscd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool mscd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * p_request); +bool mscd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/net/net_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/net/net_device.h index 795b2f9e3..38c47d647 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/net/net_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/net/net_device.h @@ -73,13 +73,12 @@ void tud_network_xmit(void *ref, uint16_t arg); //--------------------------------------------------------------------+ // INTERNAL USBD-CLASS DRIVER API //--------------------------------------------------------------------+ -void netd_init (void); -void netd_reset (uint8_t rhport); -uint16_t netd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); -bool netd_control_request (uint8_t rhport, tusb_control_request_t const * request); -bool netd_control_complete (uint8_t rhport, tusb_control_request_t const * request); -bool netd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); -void netd_report (uint8_t *buf, uint16_t len); +void netd_init (void); +void netd_reset (uint8_t rhport); +uint16_t netd_open (uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); +bool netd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); +bool netd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); +void netd_report (uint8_t *buf, uint16_t len); #ifdef __cplusplus } diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/usbtmc/usbtmc_device.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/usbtmc/usbtmc_device.h index a6b5e4cca..622800315 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/usbtmc/usbtmc_device.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/class/usbtmc/usbtmc_device.h @@ -111,8 +111,7 @@ bool tud_usbtmc_start_bus_read(void); uint16_t usbtmcd_open_cb(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len); void usbtmcd_reset_cb(uint8_t rhport); bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); -bool usbtmcd_control_request_cb(uint8_t rhport, tusb_control_request_t const * request); -bool usbtmcd_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request); +bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); void usbtmcd_init_cb(void); /************************************************************ diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/sys_queue.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/sys_queue.h deleted file mode 100644 index 443f01b22..000000000 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/sys_queue.h +++ /dev/null @@ -1,871 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - * $FreeBSD$ - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -#include - -/* - * This file defines four types of data structures: singly-linked lists, - * singly-linked tail queues, lists and tail queues. - * - * A singly-linked list is headed by a single forward pointer. The elements - * are singly linked for minimum space and pointer manipulation overhead at - * the expense of O(n) removal for arbitrary elements. New elements can be - * added to the list after an existing element or at the head of the list. - * Elements being removed from the head of the list should use the explicit - * macro for this purpose for optimum efficiency. A singly-linked list may - * only be traversed in the forward direction. Singly-linked lists are ideal - * for applications with large datasets and few or no removals or for - * implementing a LIFO queue. - * - * A singly-linked tail queue is headed by a pair of pointers, one to the - * head of the list and the other to the tail of the list. The elements are - * singly linked for minimum space and pointer manipulation overhead at the - * expense of O(n) removal for arbitrary elements. New elements can be added - * to the list after an existing element, at the head of the list, or at the - * end of the list. Elements being removed from the head of the tail queue - * should use the explicit macro for this purpose for optimum efficiency. - * A singly-linked tail queue may only be traversed in the forward direction. - * Singly-linked tail queues are ideal for applications with large datasets - * and few or no removals or for implementing a FIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may be traversed in either direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * For details on the use of these macros, see the queue(3) manual page. - * - * Below is a summary of implemented functions where: - * + means the macro is available - * - means the macro is not available - * s means the macro is available but is slow (runs in O(n) time) - * - * SLIST LIST STAILQ TAILQ - * _HEAD + + + + - * _CLASS_HEAD + + + + - * _HEAD_INITIALIZER + + + + - * _ENTRY + + + + - * _CLASS_ENTRY + + + + - * _INIT + + + + - * _EMPTY + + + + - * _FIRST + + + + - * _NEXT + + + + - * _PREV - + - + - * _LAST - - + + - * _LAST_FAST - - - + - * _FOREACH + + + + - * _FOREACH_FROM + + + + - * _FOREACH_SAFE + + + + - * _FOREACH_FROM_SAFE + + + + - * _FOREACH_REVERSE - - - + - * _FOREACH_REVERSE_FROM - - - + - * _FOREACH_REVERSE_SAFE - - - + - * _FOREACH_REVERSE_FROM_SAFE - - - + - * _INSERT_HEAD + + + + - * _INSERT_BEFORE - + - + - * _INSERT_AFTER + + + + - * _INSERT_TAIL - - + + - * _CONCAT s s + + - * _REMOVE_AFTER + - + - - * _REMOVE_HEAD + - + - - * _REMOVE s + s + - * _SWAP + + + + - * - */ -#ifdef QUEUE_MACRO_DEBUG -#warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH -#define QUEUE_MACRO_DEBUG_TRACE -#define QUEUE_MACRO_DEBUG_TRASH -#endif - -#ifdef QUEUE_MACRO_DEBUG_TRACE -/* Store the last 2 places the queue element or head was altered */ -struct qm_trace { - unsigned long lastline; - unsigned long prevline; - const char *lastfile; - const char *prevfile; -}; - -#define TRACEBUF struct qm_trace trace; -#define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } , - -#define QMD_TRACE_HEAD(head) do { \ - (head)->trace.prevline = (head)->trace.lastline; \ - (head)->trace.prevfile = (head)->trace.lastfile; \ - (head)->trace.lastline = __LINE__; \ - (head)->trace.lastfile = __FILE__; \ -} while (0) - -#define QMD_TRACE_ELEM(elem) do { \ - (elem)->trace.prevline = (elem)->trace.lastline; \ - (elem)->trace.prevfile = (elem)->trace.lastfile; \ - (elem)->trace.lastline = __LINE__; \ - (elem)->trace.lastfile = __FILE__; \ -} while (0) - -#else /* !QUEUE_MACRO_DEBUG_TRACE */ -#define QMD_TRACE_ELEM(elem) -#define QMD_TRACE_HEAD(head) -#define TRACEBUF -#define TRACEBUF_INITIALIZER -#endif /* QUEUE_MACRO_DEBUG_TRACE */ - -#ifdef QUEUE_MACRO_DEBUG_TRASH -#define TRASHIT(x) do {(x) = (void *)-1;} while (0) -#define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1) -#else /* !QUEUE_MACRO_DEBUG_TRASH */ -#define TRASHIT(x) -#define QMD_IS_TRASHED(x) 0 -#endif /* QUEUE_MACRO_DEBUG_TRASH */ - -#if defined(QUEUE_MACRO_DEBUG_TRACE) || defined(QUEUE_MACRO_DEBUG_TRASH) -#define QMD_SAVELINK(name, link) void **name = (void *)&(link) -#else /* !QUEUE_MACRO_DEBUG_TRACE && !QUEUE_MACRO_DEBUG_TRASH */ -#define QMD_SAVELINK(name, link) -#endif /* QUEUE_MACRO_DEBUG_TRACE || QUEUE_MACRO_DEBUG_TRASH */ - -#ifdef __cplusplus -/* - * In C++ there can be structure lists and class lists: - */ -#define QUEUE_TYPEOF(type) type -#else -#define QUEUE_TYPEOF(type) struct type -#endif - -/* - * Singly-linked List declarations. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_CLASS_HEAD(name, type) \ -struct name { \ - class type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -#define SLIST_CLASS_ENTRY(type) \ -struct { \ - class type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List functions. - */ -#if (defined(_KERNEL) && defined(INVARIANTS)) -#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \ - if (*(prevp) != (elm)) \ - panic("Bad prevptr *(%p) == %p != %p", \ - (prevp), *(prevp), (elm)); \ -} while (0) -#else -#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) -#endif - -#define SLIST_CONCAT(head1, head2, type, field) do { \ - QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \ - if (curelm == NULL) { \ - if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \ - SLIST_INIT(head2); \ - } else if (SLIST_FIRST(head2) != NULL) { \ - while (SLIST_NEXT(curelm, field) != NULL) \ - curelm = SLIST_NEXT(curelm, field); \ - SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \ - SLIST_INIT(head2); \ - } \ -} while (0) - -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) - -#define SLIST_FIRST(head) ((head)->slh_first) - -#define SLIST_FOREACH(var, head, field) \ - for ((var) = SLIST_FIRST((head)); \ - (var); \ - (var) = SLIST_NEXT((var), field)) - -#define SLIST_FOREACH_FROM(var, head, field) \ - for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ - (var); \ - (var) = SLIST_NEXT((var), field)) - -#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = SLIST_FIRST((head)); \ - (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ - for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ - (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ - for ((varp) = &SLIST_FIRST((head)); \ - ((var) = *(varp)) != NULL; \ - (varp) = &SLIST_NEXT((var), field)) - -#define SLIST_INIT(head) do { \ - SLIST_FIRST((head)) = NULL; \ -} while (0) - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ - SLIST_NEXT((slistelm), field) = (elm); \ -} while (0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ - SLIST_FIRST((head)) = (elm); \ -} while (0) - -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - QMD_SAVELINK(oldnext, (elm)->field.sle_next); \ - if (SLIST_FIRST((head)) == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \ - while (SLIST_NEXT(curelm, field) != (elm)) \ - curelm = SLIST_NEXT(curelm, field); \ - SLIST_REMOVE_AFTER(curelm, field); \ - } \ - TRASHIT(*oldnext); \ -} while (0) - -#define SLIST_REMOVE_AFTER(elm, field) do { \ - SLIST_NEXT(elm, field) = \ - SLIST_NEXT(SLIST_NEXT(elm, field), field); \ -} while (0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ -} while (0) - -#define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \ - QMD_SLIST_CHECK_PREVPTR(prevp, elm); \ - *(prevp) = SLIST_NEXT(elm, field); \ - TRASHIT((elm)->field.sle_next); \ -} while (0) - -#define SLIST_SWAP(head1, head2, type) do { \ - QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \ - SLIST_FIRST(head1) = SLIST_FIRST(head2); \ - SLIST_FIRST(head2) = swap_first; \ -} while (0) - -/* - * Singly-linked Tail queue declarations. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first;/* first element */ \ - struct type **stqh_last;/* addr of last next element */ \ -} - -#define STAILQ_CLASS_HEAD(name, type) \ -struct name { \ - class type *stqh_first; /* first element */ \ - class type **stqh_last; /* addr of last next element */ \ -} - -#define STAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).stqh_first } - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -#define STAILQ_CLASS_ENTRY(type) \ -struct { \ - class type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_CONCAT(head1, head2) do { \ - if (!STAILQ_EMPTY((head2))) { \ - *(head1)->stqh_last = (head2)->stqh_first; \ - (head1)->stqh_last = (head2)->stqh_last; \ - STAILQ_INIT((head2)); \ - } \ -} while (0) - -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) - -#define STAILQ_FIRST(head) ((head)->stqh_first) - -#define STAILQ_FOREACH(var, head, field) \ - for((var) = STAILQ_FIRST((head)); \ - (var); \ - (var) = STAILQ_NEXT((var), field)) - -#define STAILQ_FOREACH_FROM(var, head, field) \ - for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ - (var); \ - (var) = STAILQ_NEXT((var), field)) - -#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = STAILQ_FIRST((head)); \ - (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ - for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ - (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define STAILQ_INIT(head) do { \ - STAILQ_FIRST((head)) = NULL; \ - (head)->stqh_last = &STAILQ_FIRST((head)); \ -} while (0) - -#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ - if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ - (head)->stqh_last = &STAILQ_NEXT((elm), field); \ - STAILQ_NEXT((tqelm), field) = (elm); \ -} while (0) - -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ - if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ - (head)->stqh_last = &STAILQ_NEXT((elm), field); \ - STAILQ_FIRST((head)) = (elm); \ -} while (0) - -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ - STAILQ_NEXT((elm), field) = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &STAILQ_NEXT((elm), field); \ -} while (0) - -#define STAILQ_LAST(head, type, field) \ - (STAILQ_EMPTY((head)) ? NULL : \ - __containerof((head)->stqh_last, \ - QUEUE_TYPEOF(type), field.stqe_next)) - -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) - -#define STAILQ_REMOVE(head, elm, type, field) do { \ - QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \ - if (STAILQ_FIRST((head)) == (elm)) { \ - STAILQ_REMOVE_HEAD((head), field); \ - } \ - else { \ - QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \ - while (STAILQ_NEXT(curelm, field) != (elm)) \ - curelm = STAILQ_NEXT(curelm, field); \ - STAILQ_REMOVE_AFTER(head, curelm, field); \ - } \ - TRASHIT(*oldnext); \ -} while (0) - -#define STAILQ_REMOVE_AFTER(head, elm, field) do { \ - if ((STAILQ_NEXT(elm, field) = \ - STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ - (head)->stqh_last = &STAILQ_NEXT((elm), field); \ -} while (0) - -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if ((STAILQ_FIRST((head)) = \ - STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ - (head)->stqh_last = &STAILQ_FIRST((head)); \ -} while (0) - -#define STAILQ_SWAP(head1, head2, type) do { \ - QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \ - QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \ - STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ - (head1)->stqh_last = (head2)->stqh_last; \ - STAILQ_FIRST(head2) = swap_first; \ - (head2)->stqh_last = swap_last; \ - if (STAILQ_EMPTY(head1)) \ - (head1)->stqh_last = &STAILQ_FIRST(head1); \ - if (STAILQ_EMPTY(head2)) \ - (head2)->stqh_last = &STAILQ_FIRST(head2); \ -} while (0) - - -/* - * List declarations. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_CLASS_HEAD(name, type) \ -struct name { \ - class type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -#define LIST_CLASS_ENTRY(type) \ -struct { \ - class type *le_next; /* next element */ \ - class type **le_prev; /* address of previous next element */ \ -} - -/* - * List functions. - */ - -#if (defined(_KERNEL) && defined(INVARIANTS)) -/* - * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME) - * - * If the list is non-empty, validates that the first element of the list - * points back at 'head.' - */ -#define QMD_LIST_CHECK_HEAD(head, field) do { \ - if (LIST_FIRST((head)) != NULL && \ - LIST_FIRST((head))->field.le_prev != \ - &LIST_FIRST((head))) \ - panic("Bad list head %p first->prev != head", (head)); \ -} while (0) - -/* - * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME) - * - * If an element follows 'elm' in the list, validates that the next element - * points back at 'elm.' - */ -#define QMD_LIST_CHECK_NEXT(elm, field) do { \ - if (LIST_NEXT((elm), field) != NULL && \ - LIST_NEXT((elm), field)->field.le_prev != \ - &((elm)->field.le_next)) \ - panic("Bad link elm %p next->prev != elm", (elm)); \ -} while (0) - -/* - * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME) - * - * Validates that the previous element (or head of the list) points to 'elm.' - */ -#define QMD_LIST_CHECK_PREV(elm, field) do { \ - if (*(elm)->field.le_prev != (elm)) \ - panic("Bad link elm %p prev->next != elm", (elm)); \ -} while (0) -#else -#define QMD_LIST_CHECK_HEAD(head, field) -#define QMD_LIST_CHECK_NEXT(elm, field) -#define QMD_LIST_CHECK_PREV(elm, field) -#endif /* (_KERNEL && INVARIANTS) */ - -#define LIST_CONCAT(head1, head2, type, field) do { \ - QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \ - if (curelm == NULL) { \ - if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \ - LIST_FIRST(head2)->field.le_prev = \ - &LIST_FIRST((head1)); \ - LIST_INIT(head2); \ - } \ - } else if (LIST_FIRST(head2) != NULL) { \ - while (LIST_NEXT(curelm, field) != NULL) \ - curelm = LIST_NEXT(curelm, field); \ - LIST_NEXT(curelm, field) = LIST_FIRST(head2); \ - LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \ - LIST_INIT(head2); \ - } \ -} while (0) - -#define LIST_EMPTY(head) ((head)->lh_first == NULL) - -#define LIST_FIRST(head) ((head)->lh_first) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = LIST_FIRST((head)); \ - (var); \ - (var) = LIST_NEXT((var), field)) - -#define LIST_FOREACH_FROM(var, head, field) \ - for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ - (var); \ - (var) = LIST_NEXT((var), field)) - -#define LIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = LIST_FIRST((head)); \ - (var) && ((tvar) = LIST_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ - for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ - (var) && ((tvar) = LIST_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define LIST_INIT(head) do { \ - LIST_FIRST((head)) = NULL; \ -} while (0) - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - QMD_LIST_CHECK_NEXT(listelm, field); \ - if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ - LIST_NEXT((listelm), field)->field.le_prev = \ - &LIST_NEXT((elm), field); \ - LIST_NEXT((listelm), field) = (elm); \ - (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ -} while (0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - QMD_LIST_CHECK_PREV(listelm, field); \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - LIST_NEXT((elm), field) = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ -} while (0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - QMD_LIST_CHECK_HEAD((head), field); \ - if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ - LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ - LIST_FIRST((head)) = (elm); \ - (elm)->field.le_prev = &LIST_FIRST((head)); \ -} while (0) - -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - -#define LIST_PREV(elm, head, type, field) \ - ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \ - __containerof((elm)->field.le_prev, \ - QUEUE_TYPEOF(type), field.le_next)) - -#define LIST_REMOVE(elm, field) do { \ - QMD_SAVELINK(oldnext, (elm)->field.le_next); \ - QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ - QMD_LIST_CHECK_NEXT(elm, field); \ - QMD_LIST_CHECK_PREV(elm, field); \ - if (LIST_NEXT((elm), field) != NULL) \ - LIST_NEXT((elm), field)->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = LIST_NEXT((elm), field); \ - TRASHIT(*oldnext); \ - TRASHIT(*oldprev); \ -} while (0) - -#define LIST_SWAP(head1, head2, type, field) do { \ - QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \ - LIST_FIRST((head1)) = LIST_FIRST((head2)); \ - LIST_FIRST((head2)) = swap_tmp; \ - if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ - swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ - if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ - swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ -} while (0) - -/* - * Tail queue declarations. - */ -#define TAILQ_HEAD(name, type) \ -struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ - TRACEBUF \ -} - -#define TAILQ_CLASS_HEAD(name, type) \ -struct name { \ - class type *tqh_first; /* first element */ \ - class type **tqh_last; /* addr of last next element */ \ - TRACEBUF \ -} - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER } - -#define TAILQ_ENTRY(type) \ -struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ - TRACEBUF \ -} - -#define TAILQ_CLASS_ENTRY(type) \ -struct { \ - class type *tqe_next; /* next element */ \ - class type **tqe_prev; /* address of previous next element */ \ - TRACEBUF \ -} - -/* - * Tail queue functions. - */ -#if (defined(_KERNEL) && defined(INVARIANTS)) -/* - * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME) - * - * If the tailq is non-empty, validates that the first element of the tailq - * points back at 'head.' - */ -#define QMD_TAILQ_CHECK_HEAD(head, field) do { \ - if (!TAILQ_EMPTY(head) && \ - TAILQ_FIRST((head))->field.tqe_prev != \ - &TAILQ_FIRST((head))) \ - panic("Bad tailq head %p first->prev != head", (head)); \ -} while (0) - -/* - * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME) - * - * Validates that the tail of the tailq is a pointer to pointer to NULL. - */ -#define QMD_TAILQ_CHECK_TAIL(head, field) do { \ - if (*(head)->tqh_last != NULL) \ - panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ -} while (0) - -/* - * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME) - * - * If an element follows 'elm' in the tailq, validates that the next element - * points back at 'elm.' - */ -#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \ - if (TAILQ_NEXT((elm), field) != NULL && \ - TAILQ_NEXT((elm), field)->field.tqe_prev != \ - &((elm)->field.tqe_next)) \ - panic("Bad link elm %p next->prev != elm", (elm)); \ -} while (0) - -/* - * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME) - * - * Validates that the previous element (or head of the tailq) points to 'elm.' - */ -#define QMD_TAILQ_CHECK_PREV(elm, field) do { \ - if (*(elm)->field.tqe_prev != (elm)) \ - panic("Bad link elm %p prev->next != elm", (elm)); \ -} while (0) -#else -#define QMD_TAILQ_CHECK_HEAD(head, field) -#define QMD_TAILQ_CHECK_TAIL(head, headname) -#define QMD_TAILQ_CHECK_NEXT(elm, field) -#define QMD_TAILQ_CHECK_PREV(elm, field) -#endif /* (_KERNEL && INVARIANTS) */ - -#define TAILQ_CONCAT(head1, head2, field) do { \ - if (!TAILQ_EMPTY(head2)) { \ - *(head1)->tqh_last = (head2)->tqh_first; \ - (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ - (head1)->tqh_last = (head2)->tqh_last; \ - TAILQ_INIT((head2)); \ - QMD_TRACE_HEAD(head1); \ - QMD_TRACE_HEAD(head2); \ - } \ -} while (0) - -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) - -#define TAILQ_FIRST(head) ((head)->tqh_first) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = TAILQ_FIRST((head)); \ - (var); \ - (var) = TAILQ_NEXT((var), field)) - -#define TAILQ_FOREACH_FROM(var, head, field) \ - for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ - (var); \ - (var) = TAILQ_NEXT((var), field)) - -#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = TAILQ_FIRST((head)); \ - (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ - for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ - (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = TAILQ_LAST((head), headname); \ - (var); \ - (var) = TAILQ_PREV((var), headname, field)) - -#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ - for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ - (var); \ - (var) = TAILQ_PREV((var), headname, field)) - -#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ - for ((var) = TAILQ_LAST((head), headname); \ - (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ - (var) = (tvar)) - -#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ - for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ - (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ - (var) = (tvar)) - -#define TAILQ_INIT(head) do { \ - TAILQ_FIRST((head)) = NULL; \ - (head)->tqh_last = &TAILQ_FIRST((head)); \ - QMD_TRACE_HEAD(head); \ -} while (0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - QMD_TAILQ_CHECK_NEXT(listelm, field); \ - if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ - TAILQ_NEXT((elm), field)->field.tqe_prev = \ - &TAILQ_NEXT((elm), field); \ - else { \ - (head)->tqh_last = &TAILQ_NEXT((elm), field); \ - QMD_TRACE_HEAD(head); \ - } \ - TAILQ_NEXT((listelm), field) = (elm); \ - (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ - QMD_TRACE_ELEM(&(elm)->field); \ - QMD_TRACE_ELEM(&(listelm)->field); \ -} while (0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - QMD_TAILQ_CHECK_PREV(listelm, field); \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - TAILQ_NEXT((elm), field) = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ - QMD_TRACE_ELEM(&(elm)->field); \ - QMD_TRACE_ELEM(&(listelm)->field); \ -} while (0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - QMD_TAILQ_CHECK_HEAD(head, field); \ - if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ - TAILQ_FIRST((head))->field.tqe_prev = \ - &TAILQ_NEXT((elm), field); \ - else \ - (head)->tqh_last = &TAILQ_NEXT((elm), field); \ - TAILQ_FIRST((head)) = (elm); \ - (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ - QMD_TRACE_HEAD(head); \ - QMD_TRACE_ELEM(&(elm)->field); \ -} while (0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - QMD_TAILQ_CHECK_TAIL(head, field); \ - TAILQ_NEXT((elm), field) = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &TAILQ_NEXT((elm), field); \ - QMD_TRACE_HEAD(head); \ - QMD_TRACE_ELEM(&(elm)->field); \ -} while (0) - -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) - -/* - * The FAST function is fast in that it causes no data access other - * then the access to the head. The standard LAST function above - * will cause a data access of both the element you want and - * the previous element. FAST is very useful for instances when - * you may want to prefetch the last data element. - */ -#define TAILQ_LAST_FAST(head, type, field) \ - (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next)) - -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) - -#define TAILQ_REMOVE(head, elm, field) do { \ - QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ - QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ - QMD_TAILQ_CHECK_NEXT(elm, field); \ - QMD_TAILQ_CHECK_PREV(elm, field); \ - if ((TAILQ_NEXT((elm), field)) != NULL) \ - TAILQ_NEXT((elm), field)->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else { \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - QMD_TRACE_HEAD(head); \ - } \ - *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ - TRASHIT(*oldnext); \ - TRASHIT(*oldprev); \ - QMD_TRACE_ELEM(&(elm)->field); \ -} while (0) - -#define TAILQ_SWAP(head1, head2, type, field) do { \ - QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \ - QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \ - (head1)->tqh_first = (head2)->tqh_first; \ - (head1)->tqh_last = (head2)->tqh_last; \ - (head2)->tqh_first = swap_first; \ - (head2)->tqh_last = swap_last; \ - if ((swap_first = (head1)->tqh_first) != NULL) \ - swap_first->field.tqe_prev = &(head1)->tqh_first; \ - else \ - (head1)->tqh_last = &(head1)->tqh_first; \ - if ((swap_first = (head2)->tqh_first) != NULL) \ - swap_first->field.tqe_prev = &(head2)->tqh_first; \ - else \ - (head2)->tqh_last = &(head2)->tqh_first; \ -} while (0) - -#endif /* !_SYS_QUEUE_H_ */ diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_compiler.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_compiler.h index 505542078..22c8366ab 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_compiler.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_compiler.h @@ -102,6 +102,7 @@ #define TU_BSWAP32(u32) (__builtin_bswap32(u32)) #elif defined(__ICCARM__) + #include #define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) #define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name))) #define TU_ATTR_PACKED __attribute__ ((packed)) diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_error.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_error.h index f600c4ae3..d7ad8c318 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_error.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_error.h @@ -54,6 +54,7 @@ ENTRY(TUSB_ERROR_FAILED )\ /// \brief Error Code returned +/// TODO obsolete and to be remove typedef enum { ERROR_TABLE(ERROR_ENUM) diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_fifo.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_fifo.h index b87695743..b965386ab 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_fifo.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_fifo.h @@ -89,6 +89,7 @@ typedef struct .non_used_index_space = 0xFFFF - 2*_depth-1, \ } +bool tu_fifo_set_overwritable(tu_fifo_t *f, bool overwritable); bool tu_fifo_clear(tu_fifo_t *f); bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_size, bool overwritable); diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_types.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_types.h index d6b6ea627..5ab15aa3c 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_types.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/common/tusb_types.h @@ -250,6 +250,13 @@ typedef enum MS_OS_20_FEATURE_VENDOR_REVISION = 0x08 } microsoft_os_20_type_t; +enum +{ + CONTROL_STAGE_SETUP, + CONTROL_STAGE_DATA, + CONTROL_STAGE_ACK +}; + //--------------------------------------------------------------------+ // USB Descriptors //--------------------------------------------------------------------+ diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h index e88f64ba8..360567743 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h @@ -56,6 +56,9 @@ extern void dcd_int_handler(uint8_t rhport); // Get current bus speed tusb_speed_t tud_speed_get(void); +// Check if device is connected (may not mounted/configured yet) +bool tud_connected(void); + // Check if device is connected and configured bool tud_mounted(void); @@ -125,11 +128,7 @@ TU_ATTR_WEAK void tud_suspend_cb(bool remote_wakeup_en); TU_ATTR_WEAK void tud_resume_cb(void); // Invoked when received control request with VENDOR TYPE -TU_ATTR_WEAK bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const * request); - -// Invoked when vendor control request is complete -TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request); - +TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); //--------------------------------------------------------------------+ // Binary Device Object Store (BOS) Descriptor Templates diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd_pvt.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd_pvt.h index 09b285581..212c3a202 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd_pvt.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd_pvt.h @@ -46,8 +46,7 @@ typedef struct void (* init ) (void); void (* reset ) (uint8_t rhport); uint16_t (* open ) (uint8_t rhport, tusb_desc_interface_t const * desc_intf, uint16_t max_len); - bool (* control_request ) (uint8_t rhport, tusb_control_request_t const * request); - bool (* control_complete ) (uint8_t rhport, tusb_control_request_t const * request); + bool (* control_xfer_cb ) (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); bool (* xfer_cb ) (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); void (* sof ) (uint8_t rhport); /* optional */ } usbd_class_driver_t; @@ -57,6 +56,9 @@ typedef struct // Note: The drivers array must be accessible at all time when stack is active usbd_class_driver_t const* usbd_app_driver_get_cb(uint8_t* driver_count) TU_ATTR_WEAK; + +typedef bool (*usbd_control_xfer_cb_t)(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request); + //--------------------------------------------------------------------+ // USBD Endpoint API //--------------------------------------------------------------------+ diff --git a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb_option.h b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb_option.h index 2dd2b5841..65a06bfa7 100644 --- a/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb_option.h +++ b/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb_option.h @@ -97,6 +97,10 @@ // Dialog #define OPT_MCU_DA1469X 1000 ///< Dialog Semiconductor DA1469x +// NXP Kinetis +#define OPT_MCU_MKL25ZXX 1100 ///< NXP MKL25Zxx + + /** @} */ /** \defgroup group_supported_os Supported RTOS @@ -147,22 +151,22 @@ #define CFG_TUSB_RHPORT1_MODE OPT_MODE_NONE #endif -#if ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST ) && (CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST )) || \ - ((CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE) && (CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE)) +#if (((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST ) && ((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST )) || \ + (((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_DEVICE) && ((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_DEVICE)) #error "TinyUSB currently does not support same modes on more than 1 roothub port" #endif // Which roothub port is configured as host -#define TUH_OPT_RHPORT ( (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST) ? 0 : ((CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST) ? 1 : -1) ) +#define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) ) #define TUSB_OPT_HOST_ENABLED ( TUH_OPT_RHPORT >= 0 ) // Which roothub port is configured as device -#define TUD_OPT_RHPORT ( (CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE) ? 0 : ((CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE) ? 1 : -1) ) +#define TUD_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_DEVICE) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_DEVICE) ? 1 : -1) ) #if TUD_OPT_RHPORT == 0 -#define TUD_OPT_HIGH_SPEED ( CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED ) +#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HIGH_SPEED ) #else -#define TUD_OPT_HIGH_SPEED ( CFG_TUSB_RHPORT1_MODE & OPT_MODE_HIGH_SPEED ) +#define TUD_OPT_HIGH_SPEED ( (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HIGH_SPEED ) #endif #define TUSB_OPT_DEVICE_ENABLED ( TUD_OPT_RHPORT >= 0 ) diff --git a/tools/sdk/esp32s2/include/ulp/include/esp32/ulp.h b/tools/sdk/esp32s2/include/ulp/include/esp32/ulp.h index 309f09b8d..a3fc455f9 100644 --- a/tools/sdk/esp32s2/include/ulp/include/esp32/ulp.h +++ b/tools/sdk/esp32s2/include/ulp/include/esp32/ulp.h @@ -1009,8 +1009,8 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg) { /** * Perform an I2C transaction with a slave device. * I_I2C_READ and I_I2C_WRITE are provided for convenience, instead of using this directly. - * - * Slave address (in 7-bit format) has to be set in advance into SENS_I2C_SLAVE_ADDRx register field, where x == slave_sel. + * + * Slave address (in 7-bit format) has to be set in advance into SENS_I2C_SLAVE_ADDRx register field, where x == slave_sel. * For read operations, 8 bits of read result is stored into R0 register. * For write operations, val will be written to sub_addr at [high_bit:low_bit]. Bits outside of this range are masked. */ @@ -1026,14 +1026,14 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg) { /** * Read a byte from the sub address of an I2C slave, and store the result in R0. - * - * Slave address (in 7-bit format) has to be set in advance into SENS_I2C_SLAVE_ADDRx register field, where x == slave_sel. + * + * Slave address (in 7-bit format) has to be set in advance into SENS_I2C_SLAVE_ADDRx register field, where x == slave_sel. */ #define I_I2C_READ(slave_sel, sub_addr) I_I2C_RW(sub_addr, 0, 0, 0, slave_sel, SUB_OPCODE_I2C_RD) /** * Write a byte to the sub address of an I2C slave. - * + * * Slave address (in 7-bit format) has to be set in advance into SENS_I2C_SLAVE_ADDRx register field, where x == slave_sel. */ #define I_I2C_WRITE(slave_sel, sub_addr, val) I_I2C_RW(sub_addr, val, 0, 7, slave_sel, SUB_OPCODE_I2C_WR) diff --git a/tools/sdk/esp32s2/include/ulp/include/esp32s2/ulp_riscv.h b/tools/sdk/esp32s2/include/ulp/include/esp32s2/ulp_riscv.h index 6b1682d35..f98f2acda 100644 --- a/tools/sdk/esp32s2/include/ulp/include/esp32s2/ulp_riscv.h +++ b/tools/sdk/esp32s2/include/ulp/include/esp32s2/ulp_riscv.h @@ -28,7 +28,7 @@ esp_err_t ulp_riscv_run(void); /** * @brief Load ULP-RISC-V program binary into RTC memory - * + * * Different than ULP FSM, the binary program has no special format, it is the ELF * file generated by RISC-V toolchain converted to binary format using objcopy. * @@ -39,6 +39,6 @@ esp_err_t ulp_riscv_run(void); * @param program_size_bytes size of the program binary * @return * - ESP_OK on success - * - ESP_ERR_INVALID_SIZE if program_size_bytes is more than 8KiB + * - ESP_ERR_INVALID_SIZE if program_size_bytes is more than 8KiB */ esp_err_t ulp_riscv_load_binary(const uint8_t* program_binary, size_t program_size_bytes); diff --git a/tools/sdk/esp32s2/include/ulp/include/ulp_common.h b/tools/sdk/esp32s2/include/ulp/include/ulp_common.h index d149df610..7ca7b8594 100644 --- a/tools/sdk/esp32s2/include/ulp/include/ulp_common.h +++ b/tools/sdk/esp32s2/include/ulp/include/ulp_common.h @@ -86,7 +86,7 @@ esp_err_t ulp_run(uint32_t entry_point); * * ULP coprocessor starts running the program when the wakeup timer counts up * to a given value (called period). There are 5 period values which can be - * programmed into SENS_ULP_CP_SLEEP_CYCx_REG registers, x = 0..4 for ESP32, and + * programmed into SENS_ULP_CP_SLEEP_CYCx_REG registers, x = 0..4 for ESP32, and * one period value which can be programmed into RTC_CNTL_ULP_CP_TIMER_1_REG register for ESP32-S2. * By default, for ESP32, wakeup timer will use the period set into SENS_ULP_CP_SLEEP_CYC0_REG, * i.e. period number 0. ULP program code can use SLEEP instruction to select @@ -94,7 +94,7 @@ esp_err_t ulp_run(uint32_t entry_point); * * However, please note that SLEEP instruction issued (from ULP program) while the system * is in deep sleep mode does not have effect, and sleep cycle count 0 is used. - * + * * For ESP32-s2 the SLEEP instruction not exist. Instead a WAKE instruction will be used. * * @param period_index wakeup period setting number (0 - 4) diff --git a/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture.h b/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture.h deleted file mode 100644 index 2dcf473c7..000000000 --- a/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#ifndef UNITY_FIXTURE_H_ -#define UNITY_FIXTURE_H_ - -#include "unity.h" -#include "unity_internals.h" -#include "unity_fixture_malloc_overrides.h" -#include "unity_fixture_internals.h" - -int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); - - -#define TEST_GROUP(group)\ - static const char* TEST_GROUP_##group = #group - -#define TEST_SETUP(group) void TEST_##group##_SETUP(void);\ - void TEST_##group##_SETUP(void) - -#define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN(void);\ - void TEST_##group##_TEAR_DOWN(void) - - -#define TEST(group, name) \ - void TEST_##group##_##name##_(void);\ - void TEST_##group##_##name##_run(void);\ - void TEST_##group##_##name##_run(void)\ - {\ - UnityTestRunner(TEST_##group##_SETUP,\ - TEST_##group##_##name##_,\ - TEST_##group##_TEAR_DOWN,\ - "TEST(" #group ", " #name ")",\ - TEST_GROUP_##group, #name,\ - __FILE__, __LINE__);\ - }\ - void TEST_##group##_##name##_(void) - -#define IGNORE_TEST(group, name) \ - void TEST_##group##_##name##_(void);\ - void TEST_##group##_##name##_run(void);\ - void TEST_##group##_##name##_run(void)\ - {\ - UnityIgnoreTest("IGNORE_TEST(" #group ", " #name ")", TEST_GROUP_##group, #name);\ - }\ - void TEST_##group##_##name##_(void) - -/* Call this for each test, insider the group runner */ -#define RUN_TEST_CASE(group, name) \ - { void TEST_##group##_##name##_run(void);\ - TEST_##group##_##name##_run(); } - -/* This goes at the bottom of each test file or in a separate c file */ -#define TEST_GROUP_RUNNER(group)\ - void TEST_##group##_GROUP_RUNNER(void);\ - void TEST_##group##_GROUP_RUNNER(void) - -/* Call this from main */ -#define RUN_TEST_GROUP(group)\ - { void TEST_##group##_GROUP_RUNNER(void);\ - TEST_##group##_GROUP_RUNNER(); } - -/* CppUTest Compatibility Macros */ -#ifndef UNITY_EXCLUDE_CPPUTEST_ASSERTS -/* Sets a pointer and automatically restores it to its old value after teardown */ -#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&(ptr), (void*)(newPointerValue), __LINE__) -#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR((expected), (actual)) -#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) -#define FAIL(message) TEST_FAIL_MESSAGE((message)) -#define CHECK(condition) TEST_ASSERT_TRUE((condition)) -#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) -#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) -#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual)) -#endif - -/* You must compile with malloc replacement, as defined in unity_fixture_malloc_overrides.h */ -void UnityMalloc_MakeMallocFailAfterCount(int countdown); - -#endif /* UNITY_FIXTURE_H_ */ diff --git a/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture_internals.h b/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture_internals.h deleted file mode 100644 index 00cee8830..000000000 --- a/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture_internals.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#ifndef UNITY_FIXTURE_INTERNALS_H_ -#define UNITY_FIXTURE_INTERNALS_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -struct UNITY_FIXTURE_T -{ - int Verbose; - unsigned int RepeatCount; - const char* NameFilter; - const char* GroupFilter; -}; -extern struct UNITY_FIXTURE_T UnityFixture; - -typedef void unityfunction(void); -void UnityTestRunner(unityfunction* setup, - unityfunction* testBody, - unityfunction* teardown, - const char* printableName, - const char* group, - const char* name, - const char* file, unsigned int line); - -void UnityIgnoreTest(const char* printableName, const char* group, const char* name); -void UnityMalloc_StartTest(void); -void UnityMalloc_EndTest(void); -int UnityGetCommandLineOptions(int argc, const char* argv[]); -void UnityConcludeFixtureTest(void); - -void UnityPointer_Set(void** pointer, void* newValue, UNITY_LINE_TYPE line); -void UnityPointer_UndoAllSets(void); -void UnityPointer_Init(void); -#ifndef UNITY_MAX_POINTERS -#define UNITY_MAX_POINTERS 5 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* UNITY_FIXTURE_INTERNALS_H_ */ diff --git a/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture_malloc_overrides.h deleted file mode 100644 index 7daba50aa..000000000 --- a/tools/sdk/esp32s2/include/unity/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_ -#define UNITY_FIXTURE_MALLOC_OVERRIDES_H_ - -#include - -#ifdef UNITY_EXCLUDE_STDLIB_MALLOC -/* Define this macro to remove the use of stdlib.h, malloc, and free. - * Many embedded systems do not have a heap or malloc/free by default. - * This internal unity_malloc() provides allocated memory deterministically from - * the end of an array only, unity_free() only releases from end-of-array, - * blocks are not coalesced, and memory not freed in LIFO order is stranded. */ - #ifndef UNITY_INTERNAL_HEAP_SIZE_BYTES - #define UNITY_INTERNAL_HEAP_SIZE_BYTES 256 - #endif -#endif - -/* These functions are used by the Unity Fixture to allocate and release memory - * on the heap and can be overridden with platform-specific implementations. - * For example, when using FreeRTOS UNITY_FIXTURE_MALLOC becomes pvPortMalloc() - * and UNITY_FIXTURE_FREE becomes vPortFree(). */ -#if !defined(UNITY_FIXTURE_MALLOC) || !defined(UNITY_FIXTURE_FREE) - #include - #define UNITY_FIXTURE_MALLOC(size) malloc(size) - #define UNITY_FIXTURE_FREE(ptr) free(ptr) -#else - extern void* UNITY_FIXTURE_MALLOC(size_t size); - extern void UNITY_FIXTURE_FREE(void* ptr); -#endif - -#define malloc unity_malloc -#define calloc unity_calloc -#define realloc unity_realloc -#define free unity_free - -void* unity_malloc(size_t size); -void* unity_calloc(size_t num, size_t size); -void* unity_realloc(void * oldMem, size_t size); -void unity_free(void * mem); - -#endif /* UNITY_FIXTURE_MALLOC_OVERRIDES_H_ */ diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_rrm.h b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_rrm.h new file mode 100644 index 000000000..1ffcf1804 --- /dev/null +++ b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_rrm.h @@ -0,0 +1,52 @@ +/** + * 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. + */ + +#ifndef _ESP_RRM_H +#define _ESP_RRM_H + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Callback function type to get neighbor report + * + * @param ctx: neighbor report context + * @param report: neighbor report + * @param report_len: neighbor report length + * + * @return + * - void + */ +typedef void (*neighbor_rep_request_cb)(void *ctx, const uint8_t *report, size_t report_len); + +/** + * @brief Send Radio measurement neighbor report request to connected AP + * + * @param cb: callback function for neighbor report + * @param cb_ctx: callback context + * + * @return + * - 0: success else failure + */ +int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb, + void *cb_ctx); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wnm.h b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wnm.h new file mode 100644 index 000000000..a1dcfb655 --- /dev/null +++ b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wnm.h @@ -0,0 +1,56 @@ +/** + * 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. + */ + +#ifndef _ESP_WNM_H +#define _ESP_WNM_H + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * enum btm_query_reason: Reason code for sending btm query + */ +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, +}; + +/** + * @brief Send bss transition query to connected AP + * + * @param query_reason: reason for sending query + * @param btm_candidates: btm candidates list if available + * @param cand_list: whether candidate list to be included from scan results available in supplicant's cache. + * + * @return + * - 0: success else failure + */ +int esp_wnm_send_bss_transition_mgmt_query(enum btm_query_reason query_reason, + const char *btm_candidates, + int cand_list); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wpa.h b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wpa.h index 202c907d6..f448b737c 100644 --- a/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wpa.h +++ b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wpa.h @@ -49,7 +49,7 @@ const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs; /** * @brief Supplicant initialization * - * @return + * @return * - ESP_OK : succeed * - ESP_ERR_NO_MEM : out of memory */ @@ -58,7 +58,7 @@ esp_err_t esp_supplicant_init(void); /** * @brief Supplicant deinitialization * - * @return + * @return * - ESP_OK : succeed * - others: failed */ diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wps.h b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wps.h index 76c96730c..25c06782e 100644 --- a/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wps.h +++ b/tools/sdk/esp32s2/include/wpa_supplicant/include/esp_supplicant/esp_wps.h @@ -89,7 +89,7 @@ typedef struct { * * @param wps_type_t wps_type : WPS type, so far only WPS_TYPE_PBC and WPS_TYPE_PIN is supported * - * @return + * @return * - ESP_OK : succeed * - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid * - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on @@ -102,7 +102,7 @@ esp_err_t esp_wifi_wps_enable(const esp_wps_config_t *config); * * @param null * - * @return + * @return * - ESP_OK : succeed * - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on */ @@ -117,7 +117,7 @@ esp_err_t esp_wifi_wps_disable(void); * - 0 : non-blocking * - 1~120000 : blocking time (not supported in IDF v1.0) * - * @return + * @return * - ESP_OK : succeed * - ESP_ERR_WIFI_WPS_TYPE : wps type is invalid * - ESP_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/include/utils/wpa_debug.h b/tools/sdk/esp32s2/include/wpa_supplicant/include/utils/wpa_debug.h index e32c697fe..124786923 100644 --- a/tools/sdk/esp32s2/include/wpa_supplicant/include/utils/wpa_debug.h +++ b/tools/sdk/esp32s2/include/wpa_supplicant/include/utils/wpa_debug.h @@ -17,6 +17,7 @@ #include "wpabuf.h" #include "esp_log.h" +#include "supplicant_opt.h" #ifdef ESPRESSIF_USE @@ -28,7 +29,7 @@ #define MSG_DEBUG ESP_LOG_DEBUG #define MSG_MSGDUMP ESP_LOG_VERBOSE -#else +#else enum { MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR }; #endif @@ -60,6 +61,7 @@ void wpa_debug_print_timestamp(void); * Note: New line '\n' is added to the end of the text when printing to stdout. */ #define wpa_printf(level,fmt, args...) ESP_LOG_LEVEL_LOCAL(level, TAG, fmt, ##args) +#define wpa_dbg(ctx, level, fmt, args...) wpa_printf(level, fmt, ##args) void wpa_dump_mem(char* desc, uint8_t *addr, uint16_t len); static inline void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, size_t len) @@ -153,6 +155,7 @@ void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, #define wpa_hexdump_buf_key(...) do {} while(0) #define wpa_hexdump_ascii(...) do {} while(0) #define wpa_hexdump_ascii_key(...) do {} while(0) +#define wpa_dbg(...) do {} while(0) #endif #define wpa_auth_logger diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/port/include/endian.h b/tools/sdk/esp32s2/include/wpa_supplicant/port/include/endian.h index 392b40168..3527cea65 100644 --- a/tools/sdk/esp32s2/include/wpa_supplicant/port/include/endian.h +++ b/tools/sdk/esp32s2/include/wpa_supplicant/port/include/endian.h @@ -59,19 +59,19 @@ typedef __uint8_t uint8_t; typedef __uint16_t uint16_t; #define _UINT16_T_DECLARED #endif - + #define _UINT32_T_DECLARED #ifndef _UINT32_T_DECLARED typedef __uint32_t uint32_t; #define _UINT32_T_DECLARED #endif - + #define _UINT64_T_DECLARED #ifndef _UINT64_T_DECLARED typedef __uint64_t uint64_t; #define _UINT64_T_DECLARED #endif - + /* * General byte order swapping functions. */ diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/port/include/os.h b/tools/sdk/esp32s2/include/wpa_supplicant/port/include/os.h index f39fc5998..66eea39d8 100644 --- a/tools/sdk/esp32s2/include/wpa_supplicant/port/include/os.h +++ b/tools/sdk/esp32s2/include/wpa_supplicant/port/include/os.h @@ -34,6 +34,8 @@ struct os_time { suseconds_t usec; }; +#define os_reltime os_time + struct os_tm { int sec; /* 0..59 or 60 for leap seconds */ int min; /* 0..59 */ @@ -49,7 +51,7 @@ struct os_tm { * Returns: 0 on success, -1 on failure */ int os_get_time(struct os_time *t); - +#define os_get_reltime os_get_time /* Helper macros for handling struct os_time */ @@ -57,6 +59,7 @@ int os_get_time(struct os_time *t); ((a)->sec < (b)->sec || \ ((a)->sec == (b)->sec && (a)->usec < (b)->usec)) +#define os_reltime_before os_time_before #define os_time_sub(a, b, res) do { \ (res)->sec = (a)->sec - (b)->sec; \ (res)->usec = (a)->usec - (b)->usec; \ @@ -65,6 +68,7 @@ int os_get_time(struct os_time *t); (res)->usec += 1000000; \ } \ } while (0) +#define os_reltime_sub os_time_sub /** * os_mktime - Convert broken-down time into seconds since 1970-01-01 @@ -207,6 +211,10 @@ char * os_readfile(const char *name, size_t *len); #ifndef os_zalloc #define os_zalloc(s) calloc(1, (s)) #endif +#ifndef os_calloc +#define os_calloc(p, s) calloc((p), (s)) +#endif + #ifndef os_free #define os_free(p) free((p)) #endif @@ -293,4 +301,11 @@ static inline int os_snprintf_error(size_t size, int res) { return res < 0 || (unsigned int) res >= size; } + +static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size) +{ + if (size && nmemb > (~(size_t) 0) / size) + return NULL; + return os_realloc(ptr, nmemb * size); +} #endif /* OS_H */ diff --git a/tools/sdk/esp32s2/include/wpa_supplicant/port/include/supplicant_opt.h b/tools/sdk/esp32s2/include/wpa_supplicant/port/include/supplicant_opt.h index a3d4c6662..b70ffd4c6 100644 --- a/tools/sdk/esp32s2/include/wpa_supplicant/port/include/supplicant_opt.h +++ b/tools/sdk/esp32s2/include/wpa_supplicant/port/include/supplicant_opt.h @@ -28,4 +28,12 @@ #define DEBUG_PRINT #endif +#if CONFIG_WPA_11KV_SUPPORT +#define ROAMING_SUPPORT 1 +#endif + +#if CONFIG_WPA_SCAN_CACHE +#define SCAN_CACHE_SUPPORTED +#endif + #endif /* _SUPPLICANT_OPT_H */ diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-isa.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-isa.h index d07a1e7db..607e9fd0d 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-isa.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-isa.h @@ -709,4 +709,3 @@ #endif /* _XTENSA_CORE_CONFIGURATION_H */ - diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-matmap.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-matmap.h index 724e84f1d..965906765 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-matmap.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core-matmap.h @@ -319,4 +319,3 @@ #endif /*XTENSA_CONFIG_CORE_MATMAP_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core.h index 8460d1c92..155517b29 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/core.h @@ -1,4 +1,4 @@ -/* +/* * xtensa/config/core.h -- HAL definitions dependent on CORE configuration * * This header file is sometimes referred to as the "compile-time HAL" or CHAL. @@ -1412,4 +1412,3 @@ extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP7_IDENT); #endif #endif /*XTENSA_CONFIG_CORE_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/extreg.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/extreg.h index 95a6a69b6..c9ab2443b 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/extreg.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/extreg.h @@ -18,4 +18,4 @@ #pragma once -#define DSRSET 0x10200C \ No newline at end of file +#define DSRSET 0x10200C diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/specreg.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/specreg.h index b63d82b96..355283c9c 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/specreg.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/specreg.h @@ -102,4 +102,3 @@ #define INTCLEAR 227 #endif /* XTENSA_SPECREG_H */ - diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/system.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/system.h index b9bad9e38..76aaea6ac 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/system.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/system.h @@ -274,4 +274,3 @@ #endif /*XTENSA_CONFIG_SYSTEM_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie-asm.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie-asm.h index ac1f374da..fcaeb5132 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie-asm.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie-asm.h @@ -135,4 +135,3 @@ extern "C" { #endif #endif /*_XTENSA_CORE_TIE_ASM_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie.h b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie.h index f6765ba2d..d64e97218 100644 --- a/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie.h +++ b/tools/sdk/esp32s2/include/xtensa/esp32s2/include/xtensa/config/tie.h @@ -127,4 +127,3 @@ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3 #endif /*_XTENSA_CORE_TIE_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/eri.h b/tools/sdk/esp32s2/include/xtensa/include/eri.h index 33e4dd091..83ff77671 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/eri.h +++ b/tools/sdk/esp32s2/include/xtensa/include/eri.h @@ -28,4 +28,4 @@ uint32_t eri_read(int addr); void eri_write(int addr, uint32_t data); -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/xtensa/include/trax.h b/tools/sdk/esp32s2/include/xtensa/include/trax.h index 8147387c7..543deb2e3 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/trax.h +++ b/tools/sdk/esp32s2/include/xtensa/include/trax.h @@ -57,5 +57,3 @@ int trax_start_trace(trax_downcount_unit_t units_until_stop); * @return esp_err_t */ int trax_trigger_traceend_after_delay(int delay); - - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa-debug-module.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa-debug-module.h index 8ac47a9ca..d1aca40d5 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa-debug-module.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa-debug-module.h @@ -67,7 +67,7 @@ ERI registers / OCD offsets and field definitions #define TRAXADDR_TWSAT (1<<31) //1 if TWRAP has overflown, clear by disabling tren. #define PCMATCHCTRL_PCML_SHIFT 0 //Amount of lower bits to ignore in pc trigger register -#define PCMATCHCTRL_PCML_MASK 0x1F +#define PCMATCHCTRL_PCML_MASK 0x1F #define PCMATCHCTRL_PCMS (1<<31) //PC Match Sense, 0 - match when procs PC is in-range, 1 - match when //out-of-range @@ -112,4 +112,4 @@ ERI registers / OCD offsets and field definitions #define PGM_PMEN (1<<0) // Overall enable for all performance counting -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheasm.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheasm.h index b9961ae1f..e917b9f45 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheasm.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheasm.h @@ -959,4 +959,3 @@ .endm #endif /*XTENSA_CACHEASM_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheattrasm.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheattrasm.h index 9c1c9c939..c80caa7d2 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheattrasm.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/cacheattrasm.h @@ -433,4 +433,3 @@ #endif /*XTENSA_CACHEATTRASM_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/core-macros.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/core-macros.h index b9c99fad3..e042158dc 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/core-macros.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/core-macros.h @@ -503,4 +503,3 @@ static inline void xthal_mpu_set_entry_ (xthal_MPU_entry entry) #endif /* C code */ #endif /*XTENSA_CACHE_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/coreasm.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/coreasm.h index 8df8d6ecd..0dea3b094 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/coreasm.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/coreasm.h @@ -1056,4 +1056,3 @@ #endif #endif /*XTENSA_COREASM_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/corebits.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/corebits.h index 452aa69d6..5d14a8c67 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/corebits.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/corebits.h @@ -192,4 +192,3 @@ #endif /*XTENSA_COREBITS_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/hal.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/hal.h index 1bbb04e68..11120ec1c 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/hal.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/hal.h @@ -1505,4 +1505,3 @@ extern unsigned int xthal_get_npc(XTHAL_STATE *user_state); #endif /*!_ASMLANGUAGE && !_NOCLANGUAGE && !__ASSEMBLER__ */ #endif /*XTENSA_HAL_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/specreg.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/specreg.h index df1856347..8f8222c2a 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/specreg.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/specreg.h @@ -141,4 +141,3 @@ #endif #endif /* XTENSA_SPECREG_H */ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/traxreg.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/traxreg.h index 9f7202f3d..82f87b120 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/traxreg.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/traxreg.h @@ -193,4 +193,3 @@ extern const char * trax_regname(int regno); #endif #endif /* _TRAX_REGISTERS_H_ */ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-libdb-macros.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-libdb-macros.h index c9d275452..85b14ada9 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-libdb-macros.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-libdb-macros.h @@ -158,4 +158,3 @@ extern "C" { #endif #endif /* __H_LIBDB_MACROS */ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-versions.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-versions.h index 9a5819ff0..b60b251b2 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-versions.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-versions.h @@ -401,4 +401,3 @@ to avoid confusion. */ #endif /*XTENSA_VERSIONS_H*/ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-xer.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-xer.h index 900bda333..52741c996 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-xer.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa-xer.h @@ -1,8 +1,8 @@ -/* xer-constants.h -- various constants describing external registers accessed +/* xer-constants.h -- various constants describing external registers accessed via wer and rer. TODO: find a better prefix. Also conditionalize certain constants based - on number of cores and interrupts actually present. + on number of cores and interrupts actually present. */ /* @@ -33,7 +33,7 @@ #define NUM_INTERRUPTS 27 #define NUM_CORES 4 -/* Routing of NMI (BInterrupt2) and interrupts 0..n-1 (BInterrupt3+) +/* Routing of NMI (BInterrupt2) and interrupts 0..n-1 (BInterrupt3+) RER reads WER writes */ @@ -42,8 +42,8 @@ #define XER_MIROUT_LAST (XER_MIROUT + NUM_INTERRUPTS) -/* IPI to core M (all 16 causes). - +/* IPI to core M (all 16 causes). + RER reads WER clears */ @@ -58,7 +58,7 @@ #define XER_MIPICAUSE_FIELD_D_LAST 0xF -/* IPI from cause bit 0..15 +/* IPI from cause bit 0..15 RER invalid WER sets @@ -145,5 +145,3 @@ WER write */ #define XER_CCON 0x0220 - - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_api.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_api.h index 7f263b839..95501936c 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_api.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_api.h @@ -64,7 +64,7 @@ extern xt_exc_handler xt_set_exception_handler(int n, xt_exc_handler f); ------------------------------------------------------------------------------- Call this function to set a handler for the specified interrupt. The handler will be installed on the core that calls this function. - + n - Interrupt number. f - Handler function address, NULL to uninstall handler. arg - Argument to be passed to handler. @@ -120,7 +120,7 @@ static inline void xt_set_intclear(unsigned int arg) /* ------------------------------------------------------------------------------- Call this function to get handler's argument for the specified interrupt. - + n - Interrupt number. ------------------------------------------------------------------------------- */ @@ -129,7 +129,7 @@ extern void * xt_get_interrupt_handler_arg(int n); /* ------------------------------------------------------------------------------- Call this function to check if the specified interrupt is free to use. - + intr - Interrupt number. cpu - cpu number. ------------------------------------------------------------------------------- @@ -139,7 +139,7 @@ bool xt_int_has_handler(int intr, int cpu); /* ------------------------------------------------------------------------------- Call this function to disable non iram located interrupts. - + newmask - mask containing the interrupts to disable. ------------------------------------------------------------------------------- */ @@ -154,14 +154,14 @@ static inline uint32_t xt_int_disable_mask(uint32_t newmask) "wsr a3,INTENABLE\n" //write back "rsync\n" :"=&r"(oldint):"r"(newmask):"a3"); - - return oldint; + + return oldint; } /* ------------------------------------------------------------------------------- Call this function to enable non iram located interrupts. - + newmask - mask containing the interrupts to enable. ------------------------------------------------------------------------------- */ @@ -178,4 +178,3 @@ static inline void xt_int_enable_mask(uint32_t newmask) } #endif /* __XTENSA_API_H__ */ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_context.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_context.h index 120676dad..e65590442 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_context.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtensa_context.h @@ -86,16 +86,16 @@ NOTE: The Xtensa architecture requires stack pointer alignment to 16 bytes. INTERRUPT/EXCEPTION STACK FRAME FOR A THREAD OR NESTED INTERRUPT A stack frame of this structure is allocated for any interrupt or exception. - It goes on the current stack. If the RTOS has a system stack for handling - interrupts, every thread stack must allow space for just one interrupt stack + It goes on the current stack. If the RTOS has a system stack for handling + interrupts, every thread stack must allow space for just one interrupt stack frame, then nested interrupt stack frames go on the system stack. - The frame includes basic registers (explicit) and "extra" registers introduced + The frame includes basic registers (explicit) and "extra" registers introduced by user TIE or the use of the MAC16 option in the user's Xtensa config. The frame size is minimized by omitting regs not applicable to user's config. For Windowed ABI, this stack frame includes the interruptee's base save area, - another base save area to manage gcc nested functions, and a little temporary + another base save area to manage gcc nested functions, and a little temporary space to help manage the spilling of the register windows. ------------------------------------------------------------------------------- */ @@ -163,7 +163,7 @@ STRUCT_END(XtExcFrame) #else -#define XT_STK_NEXT2 XT_STK_NEXT1 +#define XT_STK_NEXT2 XT_STK_NEXT1 #endif @@ -180,12 +180,12 @@ STRUCT_END(XtExcFrame) ------------------------------------------------------------------------------- SOLICITED STACK FRAME FOR A THREAD - A stack frame of this structure is allocated whenever a thread enters the + A stack frame of this structure is allocated whenever a thread enters the RTOS kernel intentionally (and synchronously) to submit to thread scheduling. It goes on the current thread's stack. The solicited frame only includes registers that are required to be preserved - by the callee according to the compiler's ABI conventions, some space to save + by the callee according to the compiler's ABI conventions, some space to save the return address for returning to the caller, and the caller's PS register. For Windowed ABI, this stack frame includes the caller's base save area. @@ -193,7 +193,7 @@ STRUCT_END(XtExcFrame) Note on XT_SOL_EXIT field: It is necessary to distinguish a solicited from an interrupt stack frame. This field corresponds to XT_STK_EXIT in the interrupt stack frame and is - always at the same offset (0). It can be written with a code (usually 0) + always at the same offset (0). It can be written with a code (usually 0) to distinguish a solicted frame from an interrupt frame. An RTOS port may opt to ignore this field if it has another way of distinguishing frames. ------------------------------------------------------------------------------- @@ -238,7 +238,7 @@ STRUCT_END(XtSolFrame) and the context switch of that co-processor is then peformed by the handler. Ownership represents which thread's state is currently in the co-processor. - Co-processors may not be used by interrupt or exception handlers. If an + Co-processors may not be used by interrupt or exception handlers. If an co-processor instruction is executed by an interrupt or exception handler, the co-processor exception handler will trigger a kernel panic and freeze. This restriction is introduced to reduce the overhead of saving and restoring @@ -249,7 +249,7 @@ STRUCT_END(XtSolFrame) such as in the thread control block or above the thread stack area. It need not be in the interrupt stack frame since interrupts don't use co-processors. - Along with the save area for each co-processor, two bitmasks with flags per + Along with the save area for each co-processor, two bitmasks with flags per co-processor (laid out as in the CPENABLE reg) help manage context-switching co-processors as efficiently as possible: @@ -265,10 +265,10 @@ STRUCT_END(XtSolFrame) XT_CPSTORED A bitmask with the same layout as CPENABLE, a bit per co-processor. - Indicates whether the state of each co-processor is saved in the state + Indicates whether the state of each co-processor is saved in the state save area. When a thread enters the kernel, only the state of co-procs - still enabled in CPENABLE is saved. When the co-processor exception - handler assigns ownership of a co-processor to a thread, it restores + still enabled in CPENABLE is saved. When the co-processor exception + handler assigns ownership of a co-processor to a thread, it restores the saved state only if this bit is set, and clears this bit. XT_CP_CS_ST @@ -349,7 +349,7 @@ STRUCT_END(XtSolFrame) For framed functions the frame is created and the return address saved at base of frame (Call0 ABI) or as determined by hardware (Windowed ABI). For frameless functions, there is no frame and return address remains in a0. - Note: Because CPP macros expand to a single line, macros requiring multi-line + Note: Because CPP macros expand to a single line, macros requiring multi-line expansions are implemented as assembler macros. ------------------------------------------------------------------------------- */ @@ -362,7 +362,7 @@ STRUCT_END(XtSolFrame) addi sp, sp, -\size s32i a0, sp, 0 .endm - #define ENTRY0 + #define ENTRY0 #define RET(sz) ret1 sz .macro ret1 size=0x10 l32i a0, sp, 0 @@ -384,4 +384,3 @@ STRUCT_END(XtSolFrame) #endif /* XTENSA_CONTEXT_H */ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-core-state.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-core-state.h index 586e7dc39..f099517be 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-core-state.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-core-state.h @@ -237,4 +237,3 @@ STRUCT_END(XtosCoreState) // ... locked cache lines ... #endif /* _XTOS_CORE_STATE_H_ */ - diff --git a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-frames.h b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-frames.h index e7764267a..d0eb36873 100644 --- a/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-frames.h +++ b/tools/sdk/esp32s2/include/xtensa/include/xtensa/xtruntime-frames.h @@ -159,4 +159,3 @@ STRUCT_END(SetupInfo) #endif /* _XTRUNTIME_FRAMES_H_ */ - diff --git a/tools/sdk/esp32s2/ld/esp32s2.peripherals.ld b/tools/sdk/esp32s2/ld/esp32s2.peripherals.ld index 04e48f9b6..512d840f8 100644 --- a/tools/sdk/esp32s2/ld/esp32s2.peripherals.ld +++ b/tools/sdk/esp32s2/ld/esp32s2.peripherals.ld @@ -28,4 +28,5 @@ PROVIDE ( TWAI = 0x3f42B000 ); PROVIDE ( APB_SARADC = 0x3f440000 ); PROVIDE ( DEDIC_GPIO = 0x3f4cf000 ); PROVIDE ( USB0 = 0x60080000 ); +PROVIDE ( USBH = 0x60080000 ); PROVIDE ( USB_WRAP = 0x3f439000 ); diff --git a/tools/sdk/esp32s2/ld/esp32s2.project.ld b/tools/sdk/esp32s2/ld/esp32s2.project.ld index 7f0e5ce92..2d13057d6 100644 --- a/tools/sdk/esp32s2/ld/esp32s2.project.ld +++ b/tools/sdk/esp32s2/ld/esp32s2.project.ld @@ -17,16 +17,17 @@ SECTIONS _rtc_code_start = .; - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.literal EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.text EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.*) .rtc.text.*) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.literal EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.text EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port_common.* *libfreertos.a:port.*) .rtc.text.*) *libesp_system.a:startup.*( .rtc.text.*) *libesp_system.a:startup.*(.rtc.text.do_core_init) *libesp_system.a:startup.*(.rtc.text.do_secondary_init) *libesp_system.a:startup.*(.rtc.text.start_cpu0_default) *libfreertos.a:port.*( .rtc.text.*) + *libfreertos.a:port_common.*( .rtc.text.*) *libfreertos.a:queue.*( .rtc.text.*) *libfreertos.a:port.*(.rtc.text.esp_startup_start_app) *libfreertos.a:port.*(.rtc.text.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.rtc.text.main_task) + *libfreertos.a:port_common.*(.rtc.text.main_task) *libfreertos.a:queue.*(.rtc.text.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .rtc.literal .rtc.text .rtc.text.*) *libhal.a:uart_hal_iram.*( .rtc.literal .rtc.text .rtc.text.*) @@ -60,18 +61,19 @@ SECTIONS { . = ALIGN(4); _rtc_force_fast_start = ABSOLUTE(.); - + _coredump_rtc_fast_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.fast.coredump EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.*) .rtc.fast.coredump.*) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.fast.coredump EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port_common.* *libfreertos.a:port.* *libfreertos.a:queue.*) .rtc.fast.coredump.*) *libesp_system.a:startup.*( .rtc.fast.coredump.*) *libesp_system.a:startup.*(.rtc.fast.coredump.do_core_init) *libesp_system.a:startup.*(.rtc.fast.coredump.do_secondary_init) *libesp_system.a:startup.*(.rtc.fast.coredump.start_cpu0_default) *libfreertos.a:port.*( .rtc.fast.coredump.*) + *libfreertos.a:port_common.*( .rtc.fast.coredump.*) *libfreertos.a:queue.*( .rtc.fast.coredump.*) *libfreertos.a:port.*(.rtc.fast.coredump.esp_startup_start_app) *libfreertos.a:port.*(.rtc.fast.coredump.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.rtc.fast.coredump.main_task) + *libfreertos.a:port_common.*(.rtc.fast.coredump.main_task) *libfreertos.a:queue.*(.rtc.fast.coredump.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .rtc.fast.coredump .rtc.fast.coredump.*) *libhal.a:uart_hal_iram.*( .rtc.fast.coredump .rtc.fast.coredump.*) @@ -95,32 +97,34 @@ SECTIONS /* coredump mapping */ _coredump_rtc_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.coredump EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:queue.*) .rtc.coredump.*) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.coredump EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port_common.* *libfreertos.a:queue.* *libfreertos.a:port.*) .rtc.coredump.*) *libesp_system.a:startup.*( .rtc.coredump.*) *libesp_system.a:startup.*(.rtc.coredump.do_core_init) *libesp_system.a:startup.*(.rtc.coredump.do_secondary_init) *libesp_system.a:startup.*(.rtc.coredump.start_cpu0_default) *libfreertos.a:port.*( .rtc.coredump.*) + *libfreertos.a:port_common.*( .rtc.coredump.*) *libfreertos.a:queue.*( .rtc.coredump.*) *libfreertos.a:port.*(.rtc.coredump.esp_startup_start_app) *libfreertos.a:port.*(.rtc.coredump.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.rtc.coredump.main_task) + *libfreertos.a:port_common.*(.rtc.coredump.main_task) *libfreertos.a:queue.*(.rtc.coredump.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .rtc.coredump .rtc.coredump.*) *libhal.a:uart_hal_iram.*( .rtc.coredump .rtc.coredump.*) _coredump_rtc_end = ABSOLUTE(.); - + /* should be placed after coredump mapping */ - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.data EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.*) .rtc.data.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.rodata EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.*) .rtc.rodata.*) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.data EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.* *libfreertos.a:port_common.*) .rtc.data.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .rtc.rodata EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.* *libfreertos.a:port_common.*) .rtc.rodata.*) *libesp_system.a:startup.*( .rtc.data.* .rtc.rodata.*) *libesp_system.a:startup.*(.rtc.data.do_core_init .rtc.rodata.do_core_init) *libesp_system.a:startup.*(.rtc.data.do_secondary_init .rtc.rodata.do_secondary_init) *libesp_system.a:startup.*(.rtc.data.start_cpu0_default .rtc.rodata.start_cpu0_default) *libfreertos.a:port.*( .rtc.data.* .rtc.rodata.*) + *libfreertos.a:port_common.*( .rtc.data.* .rtc.rodata.*) *libfreertos.a:queue.*( .rtc.data.* .rtc.rodata.*) *libfreertos.a:port.*(.rtc.data.esp_startup_start_app .rtc.rodata.esp_startup_start_app) *libfreertos.a:port.*(.rtc.data.esp_startup_start_app_other_cores .rtc.rodata.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.rtc.data.main_task .rtc.rodata.main_task) + *libfreertos.a:port_common.*(.rtc.data.main_task .rtc.rodata.main_task) *libfreertos.a:queue.*(.rtc.data.xQueueGenericCreateStatic .rtc.rodata.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .rtc.data .rtc.data.* .rtc.rodata .rtc.rodata.*) *libhal.a:uart_hal_iram.*( .rtc.data .rtc.data.* .rtc.rodata .rtc.rodata.*) @@ -192,7 +196,7 @@ SECTIONS { _iram_start = ABSOLUTE(.); /* Vectors go to IRAM */ - _init_start = ABSOLUTE(.); + _vector_table = ABSOLUTE(.); /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */ . = 0x0; KEEP(*(.WindowVectors.text)); @@ -232,7 +236,7 @@ SECTIONS /* Code marked as runnning out of IRAM */ _iram_text_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .iram1 EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:queue.*) .iram1.*) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .iram1 EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port_common.* *libfreertos.a:port.* *libfreertos.a:queue.*) .iram1.*) *libapp_trace.a:SEGGER_RTT_esp32.*( .literal .literal.* .text .text.*) *libapp_trace.a:SEGGER_SYSVIEW.*( .literal .literal.* .text .text.*) *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.*( .literal .literal.* .text .text.*) @@ -243,6 +247,7 @@ SECTIONS *libesp_event.a:default_event_loop.*(.literal.esp_event_isr_post .text.esp_event_isr_post) *libesp_event.a:esp_event.*(.literal.esp_event_isr_post_to .text.esp_event_isr_post_to) *libesp_hw_support.a:cpu_util.*( .literal .literal.* .text .text.*) + *libesp_hw_support.a:regi2c_ctrl.*( .literal .literal.* .text .text.*) *libesp_hw_support.a:rtc_clk.*( .literal .literal.* .text .text.*) *libesp_hw_support.a:rtc_periph.*( .literal .literal.* .text .text.*) *libesp_hw_support.a:rtc_pm.*( .literal .literal.* .text .text.*) @@ -252,6 +257,7 @@ SECTIONS *libesp_hw_support.a:rtc_init.*(.literal.rtc_vddsdio_set_config .text.rtc_vddsdio_set_config) *libesp_ringbuf.a:( .literal .literal.* .text .text.*) *libesp_system.a:panic.*( .literal .literal.* .text .text.*) + *libesp_system.a:panic_arch.*( .literal .literal.* .text .text.*) *libesp_system.a:panic_handler.*( .literal .literal.* .text .text.*) *libesp_system.a:reset_reason.*( .literal .literal.* .text .text.*) *libesp_system.a:startup.*(.iram1.26.literal .iram1.25 .iram1.26) @@ -259,12 +265,13 @@ SECTIONS *libesp_system.a:startup.*(.iram1.do_secondary_init) *libesp_system.a:startup.*(.iram1.start_cpu0_default) *libesp_system.a:system_api.*(.literal.esp_system_abort .text.esp_system_abort) - *libfreertos.a:( .literal EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:queue.*) .literal.* .text EXCLUDE_FILE(*libfreertos.a:port.* *libfreertos.a:queue.*) .text.*) + *libfreertos.a:( .literal EXCLUDE_FILE(*libfreertos.a:port_common.* *libfreertos.a:port.* *libfreertos.a:queue.*) .literal.* .text EXCLUDE_FILE(*libfreertos.a:port_common.* *libfreertos.a:port.* *libfreertos.a:queue.*) .text.*) *libfreertos.a:port.*(.iram1.24.literal .iram1.25.literal .iram1.24 .iram1.25 .literal.pxPortInitialiseStack .literal.unlikely.vPortEndScheduler .literal.xPortStartScheduler .literal.vPortYieldOtherCore .literal.xPortInIsrContext .literal.xPortSysTickHandler .literal.vPortAssertIfInISR .literal.vPortSetStackWatchpoint .literal.vPortEnterCritical .literal.vPortExitCritical .literal.vApplicationStackOverflowHook .text.pxPortInitialiseStack .text.unlikely.vPortEndScheduler .text.xPortStartScheduler .text.vPortYieldOtherCore .text.xPortInIsrContext .text.xPortSysTickHandler .text.vPortAssertIfInISR .text.vPortSetStackWatchpoint .text.xPortGetTickRateHz .text.vPortEnterCritical .text.vPortExitCritical .text.vApplicationStackOverflowHook) + *libfreertos.a:port_common.*( .iram1.* .literal.esp_startup_start_app_common .text.esp_startup_start_app_common) *libfreertos.a:queue.*( .iram1.* .literal.prvCopyDataToQueue .literal.prvNotifyQueueSetContainer .literal.prvCopyDataFromQueue .literal.prvUnlockQueue .literal.xQueueGenericReset .literal.xQueueGenericCreate .literal.xQueueGetMutexHolder .literal.xQueueGetMutexHolderFromISR .literal.xQueueCreateCountingSemaphoreStatic .literal.xQueueCreateCountingSemaphore .literal.xQueueGenericSend .literal.xQueueCreateMutexStatic .literal.xQueueGiveMutexRecursive .literal.xQueueCreateMutex .literal.xQueueGenericSendFromISR .literal.xQueueGiveFromISR .literal.xQueueReceive .literal.xQueueSemaphoreTake .literal.xQueueTakeMutexRecursive .literal.xQueuePeek .literal.xQueueReceiveFromISR .literal.xQueuePeekFromISR .literal.uxQueueMessagesWaiting .literal.uxQueueSpacesAvailable .literal.uxQueueMessagesWaitingFromISR .literal.vQueueDelete .literal.xQueueIsQueueEmptyFromISR .literal.xQueueIsQueueFullFromISR .literal.vQueueWaitForMessageRestricted .literal.xQueueCreateSet .literal.xQueueAddToSet .literal.xQueueRemoveFromSet .literal.xQueueSelectFromSet .literal.xQueueSelectFromSetFromISR .text.prvCopyDataToQueue .text.prvNotifyQueueSetContainer .text.prvCopyDataFromQueue .text.prvUnlockQueue .text.xQueueGenericReset .text.xQueueGenericCreate .text.xQueueGetMutexHolder .text.xQueueGetMutexHolderFromISR .text.xQueueCreateCountingSemaphoreStatic .text.xQueueCreateCountingSemaphore .text.xQueueGenericSend .text.xQueueCreateMutexStatic .text.xQueueGiveMutexRecursive .text.xQueueCreateMutex .text.xQueueGenericSendFromISR .text.xQueueGiveFromISR .text.xQueueReceive .text.xQueueSemaphoreTake .text.xQueueTakeMutexRecursive .text.xQueuePeek .text.xQueueReceiveFromISR .text.xQueuePeekFromISR .text.uxQueueMessagesWaiting .text.uxQueueSpacesAvailable .text.uxQueueMessagesWaitingFromISR .text.vQueueDelete .text.xQueueIsQueueEmptyFromISR .text.xQueueIsQueueFullFromISR .text.vQueueWaitForMessageRestricted .text.xQueueCreateSet .text.xQueueAddToSet .text.xQueueRemoveFromSet .text.xQueueSelectFromSet .text.xQueueSelectFromSetFromISR) *libfreertos.a:port.*(.iram1.esp_startup_start_app) *libfreertos.a:port.*(.iram1.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.iram1.main_task) + *libfreertos.a:port_common.*(.iram1.main_task) *libfreertos.a:queue.*(.iram1.xQueueGenericCreateStatic) *libgcc.a:lib2funcs.*( .literal .literal.* .text .text.*) *libgcov.a:( .literal .literal.* .text .text.*) @@ -334,27 +341,28 @@ SECTIONS /* coredump mapping */ _coredump_dram_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .dram1.coredump EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:queue.*) .dram1.coredump.*) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .dram1.coredump EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:port_common.* *libfreertos.a:queue.*) .dram1.coredump.*) *libesp_system.a:startup.*( .dram1.coredump.*) *libesp_system.a:startup.*(.dram1.coredump.do_core_init) *libesp_system.a:startup.*(.dram1.coredump.do_secondary_init) *libesp_system.a:startup.*(.dram1.coredump.start_cpu0_default) *libfreertos.a:port.*( .dram1.coredump.*) + *libfreertos.a:port_common.*( .dram1.coredump.*) *libfreertos.a:queue.*( .dram1.coredump.*) *libfreertos.a:port.*(.dram1.coredump.esp_startup_start_app) *libfreertos.a:port.*(.dram1.coredump.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.dram1.coredump.main_task) + *libfreertos.a:port_common.*(.dram1.coredump.main_task) *libfreertos.a:queue.*(.dram1.coredump.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .dram1.coredump .dram1.coredump.*) *libhal.a:uart_hal_iram.*( .dram1.coredump .dram1.coredump.*) _coredump_dram_end = ABSOLUTE(.); - + /* should be placed after coredump mapping */ _esp_system_init_fn_array_start = ABSOLUTE(.); KEEP (*(SORT(.esp_system_init_fn) SORT(.esp_system_init_fn.*))) _esp_system_init_fn_array_end = ABSOLUTE(.); - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .data EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.*) .data.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .dram1 EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.*) .dram1.*) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .data EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port_common.* *libfreertos.a:port.*) .data.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .dram1 EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port_common.* *libfreertos.a:port.*) .dram1.*) *libapp_trace.a:SEGGER_RTT_esp32.*( .rodata .rodata.*) *libapp_trace.a:SEGGER_SYSVIEW.*( .rodata .rodata.*) *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.*( .rodata .rodata.*) @@ -364,9 +372,11 @@ SECTIONS *libesp_common.a:esp_err.*( .rodata .rodata.*) *libesp_event.a:default_event_loop.*(.rodata.esp_event_isr_post) *libesp_event.a:esp_event.*(.rodata.esp_event_isr_post_to) + *libesp_hw_support.a:regi2c_ctrl.*( .rodata .rodata.*) *libesp_hw_support.a:rtc_clk.*( .rodata .rodata.*) *libesp_hw_support.a:rtc_init.*(.rodata.rtc_vddsdio_set_config) *libesp_system.a:panic.*( .rodata .rodata.*) + *libesp_system.a:panic_arch.*( .rodata .rodata.*) *libesp_system.a:panic_handler.*( .rodata .rodata.*) *libesp_system.a:reset_reason.*( .rodata .rodata.*) *libesp_system.a:startup.*(.data.g_startup_fn .dram1.*) @@ -375,10 +385,11 @@ SECTIONS *libesp_system.a:startup.*(.data.start_cpu0_default .dram1.start_cpu0_default) *libesp_system.a:system_api.*(.rodata.esp_system_abort) *libfreertos.a:port.*( .data.* .dram1.*) + *libfreertos.a:port_common.*( .data.* .dram1.*) *libfreertos.a:queue.*( .data.* .dram1.*) *libfreertos.a:port.*(.data.esp_startup_start_app .dram1.esp_startup_start_app) *libfreertos.a:port.*(.data.esp_startup_start_app_other_cores .dram1.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.data.main_task .dram1.main_task) + *libfreertos.a:port_common.*(.data.main_task .dram1.main_task) *libfreertos.a:queue.*(.data.xQueueGenericCreateStatic .dram1.xQueueGenericCreateStatic) *libgcov.a:( .rodata .rodata.*) *libhal.a:cpu_hal.*( .rodata .rodata.*) @@ -440,16 +451,17 @@ SECTIONS _bss_start = ABSOLUTE(.); *(.ext_ram.bss*) - *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .bss EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.*) .bss.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) COMMON) - *libesp_system.a:startup.*(.bss.ob$12209 .bss.g_startup_time) + *(EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .bss EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:queue.* *libfreertos.a:port_common.*) .bss.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) COMMON) + *libesp_system.a:startup.*(.bss.ob$12335 .bss.g_startup_time) *libesp_system.a:startup.*(.bss.do_core_init) *libesp_system.a:startup.*(.bss.do_secondary_init) *libesp_system.a:startup.*(.bss.start_cpu0_default) - *libfreertos.a:port.*(.bss.port_uxOldInterruptState .bss.port_uxCriticalNesting .bss.port_interruptNesting .bss.port_xSchedulerRunning) + *libfreertos.a:port.*(.bss.port_uxOldInterruptState .bss.port_uxCriticalNesting .bss.port_interruptNesting) + *libfreertos.a:port_common.*(.bss.port_xSchedulerRunning) *libfreertos.a:queue.*( .bss.*) *libfreertos.a:port.*(.bss.esp_startup_start_app) *libfreertos.a:port.*(.bss.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.bss.main_task) + *libfreertos.a:port_common.*(.bss.main_task) *libfreertos.a:queue.*(.bss.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .bss .bss.* COMMON) *libhal.a:uart_hal_iram.*( .bss .bss.* COMMON) @@ -479,24 +491,25 @@ SECTIONS *(.rodata_desc .rodata_desc.*) /* Should be the first. App version info. DO NOT PUT ANYTHING BEFORE IT! */ *(.rodata_custom_desc .rodata_custom_desc.*) /* Should be the second. Custom app version info. DO NOT PUT ANYTHING BEFORE IT! */ - *(EXCLUDE_FILE(*libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libesp_hw_support.a:rtc_clk.* *libphy.a) .rodata EXCLUDE_FILE(*libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *liblog.a:log_freertos.* *liblog.a:log.* *libesp_event.a:esp_event.* *libesp_event.a:default_event_loop.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libesp_system.a:startup.* *libesp_system.a:system_api.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_clk.* *libphy.a) .rodata.*) + *(EXCLUDE_FILE(*libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic_arch.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:regi2c_ctrl.* *libphy.a) .rodata EXCLUDE_FILE(*libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *liblog.a:log_freertos.* *liblog.a:log.* *libesp_event.a:esp_event.* *libesp_event.a:default_event_loop.* *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libesp_system.a:startup.* *libesp_system.a:system_api.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic_arch.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a:queue.* *libfreertos.a:port.* *libfreertos.a:port_common.* *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:regi2c_ctrl.* *libphy.a) .rodata.*) *libesp_event.a:default_event_loop.*(.rodata.esp_event_loop_create_default.str1.4 .rodata.esp_event_send_to_default_loop) - *libesp_event.a:esp_event.*(.rodata.base_node_add_handler.str1.4 .rodata.loop_node_add_handler.str1.4 .rodata.esp_event_loop_create.str1.4 .rodata.esp_event_loop_run.str1.4 .rodata.esp_event_loop_run_task.str1.4 .rodata.esp_event_handler_register_with_internal.str1.4 .rodata.esp_event_handler_unregister_with_internal.str1.4 .rodata.__func__$10027 .rodata.__func__$10014 .rodata.__func__$9981 .rodata.__func__$9949 .rodata.__func__$9924 .rodata.__func__$9883 .rodata.__func__$9874) + *libesp_event.a:esp_event.*(.rodata.base_node_add_handler.str1.4 .rodata.loop_node_add_handler.str1.4 .rodata.esp_event_loop_create.str1.4 .rodata.esp_event_loop_run.str1.4 .rodata.esp_event_loop_run_task.str1.4 .rodata.esp_event_handler_register_with_internal.str1.4 .rodata.esp_event_handler_unregister_with_internal.str1.4 .rodata.__func__$8200 .rodata.__func__$8187 .rodata.__func__$8154 .rodata.__func__$8122 .rodata.__func__$8097 .rodata.__func__$8056 .rodata.__func__$8047) *libesp_hw_support.a:rtc_init.*( .rodata.*) - *libesp_system.a:startup.*(.rodata.start_cpu0_default.str1.4 .rodata.__func__$12235) + *libesp_system.a:startup.*(.rodata.start_cpu0_default.str1.4 .rodata.__func__$12361) *libesp_system.a:system_api.*(.rodata.esp_get_idf_version.str1.4) *libesp_system.a:startup.*(.rodata.do_core_init) *libesp_system.a:startup.*(.rodata.do_secondary_init) *libesp_system.a:startup.*(.rodata.start_cpu0_default) - *libfreertos.a:port.*(.rodata.main_task.str1.4 .rodata.vPortAssertIfInISR.str1.4 .rodata.vApplicationStackOverflowHook.str1.4 .rodata.esp_startup_start_app.str1.4 .rodata.__func__$5507 .rodata.__func__$5512 .rodata.__FUNCTION__$5472) - *libfreertos.a:queue.*(.rodata.prvNotifyQueueSetContainer.str1.4 .rodata.__FUNCTION__$5514 .rodata.__FUNCTION__$5504 .rodata.__FUNCTION__$5467 .rodata.__FUNCTION__$5462 .rodata.__FUNCTION__$5456 .rodata.__FUNCTION__$5450 .rodata.__FUNCTION__$5444 .rodata.__FUNCTION__$5433 .rodata.__FUNCTION__$5422 .rodata.__FUNCTION__$5409 .rodata.__FUNCTION__$5398 .rodata.__FUNCTION__$5387 .rodata.__FUNCTION__$5378 .rodata.__FUNCTION__$5551 .rodata.__FUNCTION__$5366 .rodata.__FUNCTION__$5355 .rodata.__FUNCTION__$5349 .rodata.__FUNCTION__$5342 .rodata.__FUNCTION__$5335 .rodata.__FUNCTION__$5329 .rodata.__FUNCTION__$5296 .rodata.__FUNCTION__$5286 .rodata.__FUNCTION__$5277) + *libfreertos.a:port.*(.rodata.vPortAssertIfInISR.str1.4 .rodata.vApplicationStackOverflowHook.str1.4 .rodata.__FUNCTION__$5481) + *libfreertos.a:port_common.*(.rodata.main_task.str1.4 .rodata.esp_startup_start_app_common.str1.4 .rodata.__func__$5228 .rodata.__func__$5222) + *libfreertos.a:queue.*(.rodata.prvNotifyQueueSetContainer.str1.4 .rodata.__FUNCTION__$5525 .rodata.__FUNCTION__$5515 .rodata.__FUNCTION__$5478 .rodata.__FUNCTION__$5473 .rodata.__FUNCTION__$5467 .rodata.__FUNCTION__$5461 .rodata.__FUNCTION__$5455 .rodata.__FUNCTION__$5444 .rodata.__FUNCTION__$5433 .rodata.__FUNCTION__$5420 .rodata.__FUNCTION__$5409 .rodata.__FUNCTION__$5398 .rodata.__FUNCTION__$5389 .rodata.__FUNCTION__$5562 .rodata.__FUNCTION__$5377 .rodata.__FUNCTION__$5366 .rodata.__FUNCTION__$5360 .rodata.__FUNCTION__$5353 .rodata.__FUNCTION__$5346 .rodata.__FUNCTION__$5340 .rodata.__FUNCTION__$5307 .rodata.__FUNCTION__$5297 .rodata.__FUNCTION__$5288) *libfreertos.a:port.*(.rodata.esp_startup_start_app) *libfreertos.a:port.*(.rodata.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.rodata.main_task) + *libfreertos.a:port_common.*(.rodata.main_task) *libfreertos.a:queue.*(.rodata.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .rodata .rodata.*) *libhal.a:uart_hal_iram.*( .rodata .rodata.*) - *liblog.a:log.*(.rodata.esp_log_level_set.str1.4 .rodata.__func__$3542 .rodata.__func__$3513) + *liblog.a:log.*(.rodata.esp_log_level_set.str1.4 .rodata.__func__$3546 .rodata.__func__$3517) *liblog.a:log_freertos.*(.rodata.esp_log_system_timestamp.str1.4) *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ @@ -559,7 +572,7 @@ SECTIONS _instruction_reserved_start = ABSOLUTE(.); _text_start = ABSOLUTE(.); - *(EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libgcc.a:lib2funcs.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .literal EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *liblog.a:log.* *liblog.a:log_freertos.* *libgcc.a:lib2funcs.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:startup.* *libesp_system.a:system_api.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .literal.* EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libgcc.a:lib2funcs.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .text EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *liblog.a:log.* *liblog.a:log_freertos.* *libgcc.a:lib2funcs.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:startup.* *libesp_system.a:system_api.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .text.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .wifi0iram EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:queue.*) .wifi0iram.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .wifirxiram EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:queue.*) .wifirxiram.*) + *(EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libgcc.a:lib2funcs.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic_arch.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .literal EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *liblog.a:log.* *liblog.a:log_freertos.* *libgcc.a:lib2funcs.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:startup.* *libesp_system.a:system_api.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic_arch.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .literal.* EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *libgcc.a:lib2funcs.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic_arch.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .text EXCLUDE_FILE(*libesp_ringbuf.a *libgcov.a *libapp_trace.a:SEGGER_RTT_esp32.* *libapp_trace.a:SEGGER_SYSVIEW_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW_Config_FreeRTOS.* *libapp_trace.a:SEGGER_SYSVIEW.* *libapp_trace.a:app_trace.* *libapp_trace.a:app_trace_util.* *liblog.a:log.* *liblog.a:log_freertos.* *libgcc.a:lib2funcs.* *libesp_event.a:default_event_loop.* *libesp_event.a:esp_event.* *librtc.a *libheap.a:multi_heap.* *libheap.a:multi_heap_poisoning.* *libheap.a:heap_tlsf.* *libxt_hal.a *libesp_system.a:startup.* *libesp_system.a:system_api.* *libesp_system.a:reset_reason.* *libesp_system.a:panic_handler.* *libesp_system.a:panic_arch.* *libesp_system.a:panic.* *libesp_common.a:esp_err.* *libspi_flash.a:spi_flash_chip_mxic.* *libspi_flash.a:spi_flash_chip_winbond.* *libspi_flash.a:spi_flash_chip_issi.* *libspi_flash.a:spi_flash_rom_patch.* *libspi_flash.a:spi_flash_chip_gd.* *libspi_flash.a:memspi_host_driver.* *libspi_flash.a:spi_flash_chip_generic.* *libsoc.a:lldesc.* *libxtensa.a:stdatomic.* *libxtensa.a:eri.* *libnewlib.a:heap.* *libnewlib.a:abort.* *libhal.a:spi_flash_hal_iram.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libhal.a:i2c_hal_iram.* *libhal.a:soc_hal.* *libhal.a:spi_flash_hal_gpspi.* *libhal.a:cpu_hal.* *libhal.a:ledc_hal_iram.* *libhal.a:spi_slave_hal_iram.* *libhal.a:systimer_hal.* *libhal.a:wdt_hal_iram.* *libhal.a:spi_hal_iram.* *libfreertos.a *libesp_hw_support.a:rtc_init.* *libesp_hw_support.a:cpu_util.* *libesp_hw_support.a:rtc_sleep.* *libesp_hw_support.a:rtc_pm.* *libesp_hw_support.a:rtc_clk.* *libesp_hw_support.a:regi2c_ctrl.* *libesp_hw_support.a:rtc_wdt.* *libesp_hw_support.a:rtc_time.* *libesp_hw_support.a:rtc_periph.*) .text.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .wifi0iram EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:port_common.* *libfreertos.a:queue.*) .wifi0iram.* EXCLUDE_FILE(*libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.*) .wifirxiram EXCLUDE_FILE(*libesp_system.a:startup.* *libhal.a:uart_hal_iram.* *libhal.a:twai_hal_iram.* *libfreertos.a:port.* *libfreertos.a:port_common.* *libfreertos.a:queue.*) .wifirxiram.*) *libesp_event.a:default_event_loop.*(.literal.esp_event_handler_register .literal.esp_event_handler_instance_register .literal.esp_event_handler_unregister .literal.esp_event_handler_instance_unregister .literal.esp_event_post .literal.esp_event_loop_create_default .literal.esp_event_loop_delete_default .literal.esp_event_send_to_default_loop .text.esp_event_handler_register .text.esp_event_handler_instance_register .text.esp_event_handler_unregister .text.esp_event_handler_instance_unregister .text.esp_event_post .text.esp_event_loop_create_default .text.esp_event_loop_delete_default .text.esp_event_send_to_default_loop) *libesp_event.a:esp_event.*(.literal.handler_instances_add .literal.base_node_add_handler .literal.loop_node_add_handler .literal.handler_instances_remove .literal.handler_instances_remove_all$isra$1 .literal.esp_event_loop_create .literal.esp_event_loop_run .literal.esp_event_loop_run_task .literal.esp_event_loop_delete .literal.esp_event_handler_register_with_internal .literal.esp_event_handler_register_with .literal.esp_event_handler_instance_register_with .literal.esp_event_handler_unregister_with_internal .literal.esp_event_handler_unregister_with .literal.esp_event_handler_instance_unregister_with .literal.esp_event_post_to .text.handler_instances_add .text.base_node_add_handler .text.loop_node_add_handler .text.handler_instances_remove .text.handler_instances_remove_all$isra$1 .text.esp_event_loop_create .text.esp_event_loop_run .text.esp_event_loop_run_task .text.esp_event_loop_delete .text.esp_event_handler_register_with_internal .text.esp_event_handler_register_with .text.esp_event_handler_instance_register_with .text.esp_event_handler_unregister_with_internal .text.esp_event_handler_unregister_with .text.esp_event_handler_instance_unregister_with .text.esp_event_post_to .text.esp_event_dump) *libesp_hw_support.a:rtc_init.*(.literal.rtc_init .literal.rtc_vddsdio_get_config .text.rtc_init .text.rtc_vddsdio_get_config) @@ -569,10 +582,11 @@ SECTIONS *libesp_system.a:startup.*(.literal.do_secondary_init .text.do_secondary_init .wifi0iram.do_secondary_init .wifirxiram.do_secondary_init) *libesp_system.a:startup.*(.literal.start_cpu0_default .text.start_cpu0_default .wifi0iram.start_cpu0_default .wifirxiram.start_cpu0_default) *libfreertos.a:port.*( .wifi0iram.* .wifirxiram.*) + *libfreertos.a:port_common.*( .wifi0iram.* .wifirxiram.*) *libfreertos.a:queue.*( .wifi0iram.* .wifirxiram.*) *libfreertos.a:port.*(.literal.esp_startup_start_app .text.esp_startup_start_app .wifi0iram.esp_startup_start_app .wifirxiram.esp_startup_start_app) *libfreertos.a:port.*(.literal.esp_startup_start_app_other_cores .text.esp_startup_start_app_other_cores .wifi0iram.esp_startup_start_app_other_cores .wifirxiram.esp_startup_start_app_other_cores) - *libfreertos.a:port.*(.literal.main_task .text.main_task .wifi0iram.main_task .wifirxiram.main_task) + *libfreertos.a:port_common.*(.literal.main_task .text.main_task .wifi0iram.main_task .wifirxiram.main_task) *libfreertos.a:queue.*(.literal.xQueueGenericCreateStatic .text.xQueueGenericCreateStatic .wifi0iram.xQueueGenericCreateStatic .wifirxiram.xQueueGenericCreateStatic) *libhal.a:twai_hal_iram.*( .literal .literal.* .text .text.* .wifi0iram .wifi0iram.* .wifirxiram .wifirxiram.*) *libhal.a:uart_hal_iram.*( .literal .literal.* .text .text.* .wifi0iram .wifi0iram.* .wifirxiram .wifirxiram.*) diff --git a/tools/sdk/esp32s2/ld/esp32s2.rom.api.ld b/tools/sdk/esp32s2/ld/esp32s2.rom.api.ld index c96a54fef..63ad6e6d6 100644 --- a/tools/sdk/esp32s2/ld/esp32s2.rom.api.ld +++ b/tools/sdk/esp32s2/ld/esp32s2.rom.api.ld @@ -35,3 +35,4 @@ PROVIDE ( esp_rom_md5_final = 0x4000530c ); PROVIDE ( esp_rom_printf = ets_printf ); PROVIDE ( esp_rom_delay_us = ets_delay_us ); +PROVIDE ( esp_rom_install_uart_printf = ets_install_uart_printf ); diff --git a/tools/sdk/esp32s2/ld/esp32s2.rom.ld b/tools/sdk/esp32s2/ld/esp32s2.rom.ld index 445d033bf..8781a9c8c 100644 --- a/tools/sdk/esp32s2/ld/esp32s2.rom.ld +++ b/tools/sdk/esp32s2/ld/esp32s2.rom.ld @@ -1,7 +1,7 @@ /** * ESP32-S2 ROM address table (except symbols from libgcc and libc) * Generated for ROM with MD5sum: 0a2c7ec5109c17884606d23b47045796 - * + * * These are all weak symbols that could be overwritten in ESP-IDF. */ diff --git a/tools/sdk/esp32s2/ld/esp32s2.rom.newlib-data.ld b/tools/sdk/esp32s2/ld/esp32s2.rom.newlib-data.ld index 33eda7e05..681c34b56 100644 --- a/tools/sdk/esp32s2/ld/esp32s2.rom.newlib-data.ld +++ b/tools/sdk/esp32s2/ld/esp32s2.rom.newlib-data.ld @@ -13,3 +13,5 @@ _PathLocale = 0x3ffffd80; __sf_fake_stderr = 0x3ffaf08c; __sf_fake_stdin = 0x3ffaf0cc; __sf_fake_stdout = 0x3ffaf0ac; +__sfp_recursive_mutex = 0x3ffffd88; +__sinit_recursive_mutex = 0x3ffffd84; diff --git a/tools/sdk/esp32s2/ld/libesp32s2.a b/tools/sdk/esp32s2/ld/libesp32s2.a index 4f9891641..d40889a0b 100644 Binary files a/tools/sdk/esp32s2/ld/libesp32s2.a and b/tools/sdk/esp32s2/ld/libesp32s2.a differ diff --git a/tools/sdk/esp32s2/lib/libapp_trace.a b/tools/sdk/esp32s2/lib/libapp_trace.a index ff8a04f7a..ea5aa1997 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 f1b275d60..01a5199f9 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/libasio.a b/tools/sdk/esp32s2/lib/libasio.a index 9a76cd54f..179524ba7 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 406f7c2a8..91008a9ca 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/libcbor.a b/tools/sdk/esp32s2/lib/libcbor.a index 91ecbbf1d..589d9848f 100644 Binary files a/tools/sdk/esp32s2/lib/libcbor.a and b/tools/sdk/esp32s2/lib/libcbor.a differ diff --git a/tools/sdk/esp32s2/lib/libcmock.a b/tools/sdk/esp32s2/lib/libcmock.a index 203f0d64a..fd15bb144 100644 Binary files a/tools/sdk/esp32s2/lib/libcmock.a and b/tools/sdk/esp32s2/lib/libcmock.a differ diff --git a/tools/sdk/esp32s2/lib/libcoap.a b/tools/sdk/esp32s2/lib/libcoap.a index b6f9eef6a..c95c193ab 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 acb72b789..816228fed 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 468243480..ff2ed5ede 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 d4b84f076..6017f19b1 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 962c1db8d..4f571de30 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 753c8a610..7f62fdcaa 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 d0933b2b5..631fdd3b9 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-dsp.a b/tools/sdk/esp32s2/lib/libesp-dsp.a new file mode 100644 index 000000000..555b59241 Binary files /dev/null and b/tools/sdk/esp32s2/lib/libesp-dsp.a differ diff --git a/tools/sdk/esp32s2/lib/libesp-face.a b/tools/sdk/esp32s2/lib/libesp-face.a index 1fbfd40cd..0ce47b9a0 100644 Binary files a/tools/sdk/esp32s2/lib/libesp-face.a and b/tools/sdk/esp32s2/lib/libesp-face.a differ diff --git a/tools/sdk/esp32s2/lib/libesp-tls.a b/tools/sdk/esp32s2/lib/libesp-tls.a index 461710440..24e06550c 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/libesp32s2.a b/tools/sdk/esp32s2/lib/libesp32s2.a index 4f9891641..d40889a0b 100644 Binary files a/tools/sdk/esp32s2/lib/libesp32s2.a and b/tools/sdk/esp32s2/lib/libesp32s2.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_adc_cal.a b/tools/sdk/esp32s2/lib/libesp_adc_cal.a index 10e138386..4dae2b6a6 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_adc_cal.a and b/tools/sdk/esp32s2/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/esp32s2/lib/libesp_common.a b/tools/sdk/esp32s2/lib/libesp_common.a index 0536672a7..72e4b8479 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 4d2a1bef9..416a4681b 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 f00bb640e..03993cffd 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 c77098c20..5d0fc63bb 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 c1feabbfc..40d18f0e7 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 f3f5c419b..7f9cb6e44 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 a08f41b46..c169a555a 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 79f10e0cf..54e8644cd 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 92be1aedd..a7d4c3b9d 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 ff10c7c6c..33ef00475 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 7223719d0..284b77d77 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_littlefs.a b/tools/sdk/esp32s2/lib/libesp_littlefs.a index 2c1d3764e..bfa7ea74d 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 cc02897b9..f9a0ebab1 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 7d4e7980f..39bf3756b 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_pm.a b/tools/sdk/esp32s2/lib/libesp_pm.a index 4c55056ae..02139cf4a 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 34794ffc4..ff69f0f3b 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_rom.a b/tools/sdk/esp32s2/lib/libesp_rom.a index 3a3c3a706..a42ad4f59 100644 Binary files a/tools/sdk/esp32s2/lib/libesp_rom.a and b/tools/sdk/esp32s2/lib/libesp_rom.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 b0ef73cc7..1a98a6196 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 234d5aef4..dd1d9d1b8 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 2b5ec6272..d57febfa7 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 c8d73b575..46dfcb8bd 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 56b72a155..21259f82d 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 c19999789..029b5efb1 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 2e8e176a2..06066d440 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/libexpat.a b/tools/sdk/esp32s2/lib/libexpat.a index 9f5a01887..93542694b 100644 Binary files a/tools/sdk/esp32s2/lib/libexpat.a and b/tools/sdk/esp32s2/lib/libexpat.a differ diff --git a/tools/sdk/esp32s2/lib/libfatfs.a b/tools/sdk/esp32s2/lib/libfatfs.a index dabd0a90d..a901253bd 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/libfb_gfx.a b/tools/sdk/esp32s2/lib/libfb_gfx.a index 8b8d7e7d9..514477f62 100644 Binary files a/tools/sdk/esp32s2/lib/libfb_gfx.a and b/tools/sdk/esp32s2/lib/libfb_gfx.a differ diff --git a/tools/sdk/esp32s2/lib/libfreemodbus.a b/tools/sdk/esp32s2/lib/libfreemodbus.a index 3fda137dc..228ccb5c9 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 dd39badb0..a65c8fecb 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 cd8a0b62c..a7e99bbb1 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 540cc3c78..50420d93a 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/libjsmn.a b/tools/sdk/esp32s2/lib/libjsmn.a index c2dddc2a9..26a761419 100644 Binary files a/tools/sdk/esp32s2/lib/libjsmn.a and b/tools/sdk/esp32s2/lib/libjsmn.a differ diff --git a/tools/sdk/esp32s2/lib/libjson.a b/tools/sdk/esp32s2/lib/libjson.a index 47a964ca2..800642e15 100644 Binary files a/tools/sdk/esp32s2/lib/libjson.a and b/tools/sdk/esp32s2/lib/libjson.a differ diff --git a/tools/sdk/esp32s2/lib/liblibsodium.a b/tools/sdk/esp32s2/lib/liblibsodium.a index 73ee6f4ca..01da67ae2 100644 Binary files a/tools/sdk/esp32s2/lib/liblibsodium.a and b/tools/sdk/esp32s2/lib/liblibsodium.a differ diff --git a/tools/sdk/esp32s2/lib/liblog.a b/tools/sdk/esp32s2/lib/liblog.a index f70d352fd..b64993718 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 042e1010c..16d065bd3 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 eaf05d526..cd588be3b 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 4a719d4db..78b18854d 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/libmbedx509.a b/tools/sdk/esp32s2/lib/libmbedx509.a index 546846f01..1c1be15b5 100644 Binary files a/tools/sdk/esp32s2/lib/libmbedx509.a and b/tools/sdk/esp32s2/lib/libmbedx509.a differ diff --git a/tools/sdk/esp32s2/lib/libmdns.a b/tools/sdk/esp32s2/lib/libmdns.a index 8caf44d5c..95cfbbb73 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 d0c1a118f..a5c2924da 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 82e8694ae..33078dda4 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 2f9b6cf20..14da421c0 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 fb26a1987..3e23d01cf 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/libnghttp.a b/tools/sdk/esp32s2/lib/libnghttp.a index 06227be88..bbee1179d 100644 Binary files a/tools/sdk/esp32s2/lib/libnghttp.a and b/tools/sdk/esp32s2/lib/libnghttp.a differ diff --git a/tools/sdk/esp32s2/lib/libnvs_flash.a b/tools/sdk/esp32s2/lib/libnvs_flash.a index e261c7249..5586410f8 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 523756b71..42b3340ba 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/libperfmon.a b/tools/sdk/esp32s2/lib/libperfmon.a index f694738d8..5fa562b50 100644 Binary files a/tools/sdk/esp32s2/lib/libperfmon.a and b/tools/sdk/esp32s2/lib/libperfmon.a differ diff --git a/tools/sdk/esp32s2/lib/libphy.a b/tools/sdk/esp32s2/lib/libphy.a index 2a1d92d4a..7c96169e4 100644 Binary files a/tools/sdk/esp32s2/lib/libphy.a and b/tools/sdk/esp32s2/lib/libphy.a differ diff --git a/tools/sdk/esp32s2/lib/libpp.a b/tools/sdk/esp32s2/lib/libpp.a index 22403b356..faff39101 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/libprotobuf-c.a b/tools/sdk/esp32s2/lib/libprotobuf-c.a index a8e6fc033..e18148868 100644 Binary files a/tools/sdk/esp32s2/lib/libprotobuf-c.a and b/tools/sdk/esp32s2/lib/libprotobuf-c.a differ diff --git a/tools/sdk/esp32s2/lib/libprotocomm.a b/tools/sdk/esp32s2/lib/libprotocomm.a index e50bcfe87..3b98747a8 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 a33d6d3b7..5453c1b89 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 7c5ff356f..355b8aff4 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 a23ec17aa..6a82894ec 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 3ce57ac41..345643649 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 cd6d3de9d..62e210fff 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 ab9f8e380..d9c043617 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 3f5e8a809..12766b9b6 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 9dfd81417..dcc248dd0 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/libtinyusb.a b/tools/sdk/esp32s2/lib/libtinyusb.a index e2b4201c7..ab4c61e30 100644 Binary files a/tools/sdk/esp32s2/lib/libtinyusb.a and b/tools/sdk/esp32s2/lib/libtinyusb.a differ diff --git a/tools/sdk/esp32s2/lib/libulp.a b/tools/sdk/esp32s2/lib/libulp.a index b39ded4b8..9bbdca47f 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/libunity.a b/tools/sdk/esp32s2/lib/libunity.a index 417d0002b..2a254e431 100644 Binary files a/tools/sdk/esp32s2/lib/libunity.a and b/tools/sdk/esp32s2/lib/libunity.a differ diff --git a/tools/sdk/esp32s2/lib/libvfs.a b/tools/sdk/esp32s2/lib/libvfs.a index 508c8653a..95683db4e 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/libwear_levelling.a b/tools/sdk/esp32s2/lib/libwear_levelling.a index 6d679aca8..5d4903aa6 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 02ea3e1bd..5cf546c4e 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 b55c7bf54..78d116bc1 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 3a2883a7c..ee2784189 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 6f18191e8..4b44aa715 100644 --- a/tools/sdk/esp32s2/sdkconfig +++ b/tools/sdk/esp32s2/sdkconfig @@ -3,6 +3,7 @@ # Espressif IoT Development Framework (ESP-IDF) Project Configuration # CONFIG_IDF_CMAKE=y +CONFIG_IDF_TARGET_ARCH_XTENSA=y CONFIG_IDF_TARGET="esp32s2" CONFIG_IDF_TARGET_ESP32S2=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x0002 @@ -375,7 +376,6 @@ CONFIG_ESP32S2_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S2_KEEP_USB_ALIVE=y # CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM is not set # CONFIG_ESP32S2_USE_FIXED_STATIC_RAM_SIZE is not set -CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y # end of ESP32S2-specific # @@ -396,6 +396,7 @@ CONFIG_ESP_CONSOLE_UART_DEFAULT=y # CONFIG_ESP_CONSOLE_UART_CUSTOM is not set # CONFIG_ESP_CONSOLE_NONE is not set CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y CONFIG_ESP_CONSOLE_UART_NUM=0 CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 CONFIG_ESP_INT_WDT=y @@ -416,6 +417,7 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_BT_OFFSET=1 CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_SPI_ETHERNET=y CONFIG_ETH_SPI_ETHERNET_DM9051=y +CONFIG_ETH_SPI_ETHERNET_W5500=y # CONFIG_ETH_USE_OPENETH is not set # end of Ethernet @@ -485,6 +487,8 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y +CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y +CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y # end of ESP System Settings # @@ -573,6 +577,7 @@ CONFIG_FATFS_FS_LOCK=0 CONFIG_FATFS_TIMEOUT_MS=10000 CONFIG_FATFS_PER_FILE_CACHE=y CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y +# CONFIG_FATFS_USE_FASTSEEK is not set # end of FAT Filesystem support # @@ -724,7 +729,6 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_TCP_ISN_HOOK=y CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=16 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y @@ -753,6 +757,14 @@ CONFIG_LWIP_MAX_UDP_PCBS=16 CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP +# +# Checksums +# +# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set +# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set +CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y +# end of Checksums + CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 # CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY is not set CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y @@ -791,6 +803,20 @@ CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 CONFIG_LWIP_ESP_LWIP_ASSERT=y +# +# Hooks +# +# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set +CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y +# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y +# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +# end of Hooks + # # Debug # @@ -801,8 +827,10 @@ CONFIG_LWIP_ESP_LWIP_ASSERT=y # CONFIG_LWIP_SOCKETS_DEBUG is not set # CONFIG_LWIP_IP_DEBUG is not set # CONFIG_LWIP_ICMP_DEBUG is not set +# CONFIG_LWIP_DHCP_DEBUG is not set # CONFIG_LWIP_IP6_DEBUG is not set # CONFIG_LWIP_ICMP6_DEBUG is not set +# CONFIG_LWIP_TCP_DEBUG is not set # end of Debug # end of LWIP @@ -998,9 +1026,9 @@ CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set # CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y -CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 -CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 +CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 +CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set @@ -1173,10 +1201,27 @@ CONFIG_WPA_MBEDTLS_CRYPTO=y # CONFIG_WPA_DEBUG_PRINT is not set # CONFIG_WPA_TESTING_OPTIONS is not set # CONFIG_WPA_WPS_WARS is not set +# CONFIG_WPA_11KV_SUPPORT is not set # end of Supplicant -# CONFIG_C_IMPL is not set -CONFIG_XTENSA_IMPL=y +# +# DSP Library +# +CONFIG_DSP_ANSI=y +# CONFIG_DSP_OPTIMIZED is not set +CONFIG_DSP_OPTIMIZATION=0 +# CONFIG_DSP_MAX_FFT_SIZE_512 is not set +# CONFIG_DSP_MAX_FFT_SIZE_1024 is not set +# CONFIG_DSP_MAX_FFT_SIZE_2048 is not set +CONFIG_DSP_MAX_FFT_SIZE_4096=y +# CONFIG_DSP_MAX_FFT_SIZE_8192 is not set +# CONFIG_DSP_MAX_FFT_SIZE_16384 is not set +# CONFIG_DSP_MAX_FFT_SIZE_32768 is not set +CONFIG_DSP_MAX_FFT_SIZE=4096 +# end of DSP Library + +CONFIG_C_IMPL=y +# CONFIG_XTENSA_IMPL is not set # # ESP-FACE Configuration @@ -1222,6 +1267,7 @@ CONFIG_LITTLEFS_USE_MTIME=y # CONFIG_LITTLEFS_HUMAN_READABLE is not set CONFIG_LITTLEFS_MTIME_USE_SECONDS=y # CONFIG_LITTLEFS_MTIME_USE_NONCE is not set +# CONFIG_LITTLEFS_SPIFFS_COMPAT is not set # end of LittleFS # end of Component config @@ -1300,6 +1346,7 @@ CONFIG_POST_EVENTS_FROM_IRAM_ISR=y CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set # CONFIG_ESP32S2_PANIC_GDBSTUB is not set +CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y CONFIG_TIMER_TASK_STACK_SIZE=4096 # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set @@ -1318,7 +1365,6 @@ CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 CONFIG_MB_TIMER_PORT_ENABLED=y CONFIG_MB_TIMER_GROUP=0 CONFIG_MB_TIMER_INDEX=0 -CONFIG_SUPPORT_STATIC_ALLOCATION=y # CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set CONFIG_TIMER_TASK_PRIORITY=1 CONFIG_TIMER_TASK_STACK_DEPTH=2048