]> granicus.if.org Git - esp-idf/commitdiff
separate rom from esp32 component to esp_rom
authormorris <maoshengrong@espressif.com>
Thu, 14 Mar 2019 09:29:32 +0000 (17:29 +0800)
committermorris <maoshengrong@espressif.com>
Thu, 21 Mar 2019 10:51:45 +0000 (18:51 +0800)
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt

215 files changed:
components/app_trace/sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c
components/app_trace/sys_view/esp32/SEGGER_RTT_esp32.c
components/app_update/esp_ota_ops.c
components/app_update/test/test_switch_ota.c
components/bootloader/subproject/CMakeLists.txt
components/bootloader/subproject/Makefile
components/bootloader/subproject/main/bootloader_start.c
components/bootloader/subproject/main/component.mk
components/bootloader_support/src/bootloader_clock.c
components/bootloader_support/src/bootloader_common.c
components/bootloader_support/src/bootloader_flash.c
components/bootloader_support/src/bootloader_init.c
components/bootloader_support/src/bootloader_sha.c
components/bootloader_support/src/bootloader_utility.c
components/bootloader_support/src/esp_image_format.c
components/bootloader_support/src/flash_encrypt.c
components/bootloader_support/src/flash_partitions.c
components/bootloader_support/src/flash_qio_mode.c
components/bootloader_support/src/secure_boot.c
components/bootloader_support/src/secure_boot_signatures.c
components/bootloader_support/test/test_verify_image.c
components/console/commands.c
components/driver/i2s.c
components/driver/include/driver/gpio.h
components/driver/include/driver/i2s.h
components/driver/include/driver/sdio_slave.h
components/driver/include/driver/spi_common.h
components/driver/rtc_module.c
components/driver/sdio_slave.c
components/driver/sdmmc_host.c
components/driver/sdspi_crc.c
components/driver/spi_common.c
components/driver/spi_master.c
components/driver/spi_slave.c
components/driver/test/test_gpio.c
components/driver/test/test_ledc.c
components/driver/test/test_pcnt.c
components/driver/test/test_pwm.c
components/driver/test/test_spi_master.c
components/driver/test/test_spi_sio.c
components/efuse/src/esp_efuse_fields.c
components/efuse/test/test_efuse.c
components/esp32/CMakeLists.txt
components/esp32/brownout.c
components/esp32/clk.c
components/esp32/component.mk
components/esp32/cpu_start.c
components/esp32/crosscore_int.c
components/esp32/dport_access.c
components/esp32/esp_himem.c
components/esp32/esp_timer.c
components/esp32/ets_timer_legacy.c
components/esp32/gdbstub.c
components/esp32/hwcrypto/sha.c
components/esp32/include/esp_intr.h
components/esp32/include/esp_wifi.h
components/esp32/include/esp_wifi_internal.h
components/esp32/include/esp_wifi_types.h
components/esp32/include/hwcrypto/aes.h
components/esp32/include/hwcrypto/sha.h
components/esp32/include/rom/aes.h
components/esp32/include/rom/bigint.h
components/esp32/include/rom/cache.h
components/esp32/include/rom/crc.h
components/esp32/include/rom/efuse.h
components/esp32/include/rom/ets_sys.h
components/esp32/include/rom/gpio.h
components/esp32/include/rom/libc_stubs.h
components/esp32/include/rom/lldesc.h
components/esp32/include/rom/md5_hash.h
components/esp32/include/rom/miniz.h
components/esp32/include/rom/queue.h
components/esp32/include/rom/rtc.h
components/esp32/include/rom/secure_boot.h
components/esp32/include/rom/sha.h
components/esp32/include/rom/spi_flash.h
components/esp32/include/rom/tbconsole.h
components/esp32/include/rom/tjpgd.h
components/esp32/include/rom/uart.h
components/esp32/panic.c
components/esp32/phy_init.c
components/esp32/pm_locks.c
components/esp32/reset_reason.c
components/esp32/sleep_modes.c
components/esp32/spiram.c
components/esp32/spiram_psram.c
components/esp32/system_api.c
components/esp32/test/test_aes_sha_rsa.c
components/esp32/test/test_ahb_arb.c
components/esp32/test/test_delay.c
components/esp32/test/test_dport.c
components/esp32/test/test_ets_timer.c
components/esp32/test/test_fastbus.c
components/esp32/test/test_himem.c
components/esp32/test/test_intr_alloc.c
components/esp32/test/test_miniz.c
components/esp32/test/test_reset_reason.c
components/esp32/test/test_sleep.c
components/esp32/test/test_spiram_cache_flush.c
components/esp32/test/test_tjpgd.c
components/esp32/test/test_tsens.c
components/esp32/test/test_unal_dma.c
components/esp_event/event_default_handlers.c
components/esp_http_client/lib/http_auth.c
components/esp_http_client/lib/include/http_header.h
components/esp_rom/CMakeLists.txt [new file with mode: 0644]
components/esp_rom/component.mk [new file with mode: 0644]
components/esp_rom/esp32/ld/esp32.rom.ld [moved from components/esp32/ld/esp32.rom.ld with 100% similarity]
components/esp_rom/esp32/ld/esp32.rom.libgcc.ld [moved from components/esp32/ld/esp32.rom.libgcc.ld with 100% similarity]
components/esp_rom/esp32/ld/esp32.rom.nanofmt.ld [moved from components/esp32/ld/esp32.rom.nanofmt.ld with 100% similarity]
components/esp_rom/esp32/ld/esp32.rom.redefined.ld [moved from components/esp32/ld/esp32.rom.redefined.ld with 100% similarity]
components/esp_rom/esp32/ld/esp32.rom.spiflash.ld [moved from components/esp32/ld/esp32.rom.spiflash.ld with 100% similarity]
components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld [moved from components/esp32/ld/esp32.rom.spiram_incompatible_fns.ld with 100% similarity]
components/esp_rom/esp_rom.c [new file with mode: 0644]
components/esp_rom/include/esp32/rom/aes.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/bigint.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/cache.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/crc.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/efuse.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/ets_sys.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/gpio.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/libc_stubs.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/lldesc.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/md5_hash.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/miniz.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/rtc.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/secure_boot.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/sha.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/spi_flash.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/tbconsole.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/tjpgd.h [new file with mode: 0644]
components/esp_rom/include/esp32/rom/uart.h [new file with mode: 0644]
components/espcoredump/src/core_dump_common.c
components/espcoredump/src/core_dump_flash.c
components/ethernet/emac_dev.c
components/ethernet/emac_main.c
components/ethernet/test/test_emac_deinit.c
components/fatfs/test_fatfs_host/Makefile.files
components/freertos/include/freertos/FreeRTOSConfig.h
components/freertos/port.c
components/freertos/queue.c
components/freertos/tasks.c
components/freertos/test/test_freertos.c
components/freertos/test/test_freertos_isinisrcontext.c
components/freertos/test/test_freertos_task_delete.c
components/freertos/test/test_newlib_reent.c
components/freertos/test/test_panic.c
components/freertos/test/test_preemption.c
components/freertos/test/test_spinlocks.c
components/freertos/xtensa_intr.c
components/heap/heap_private.h
components/heap/multi_heap_platform.h
components/heap/test/test_malloc.c
components/log/include/esp_log.h
components/log/log.c
components/mbedtls/port/esp_bignum.c
components/mqtt/esp-mqtt
components/newlib/syscall_table.c
components/newlib/time.c
components/nvs_flash/src/nvs_api.cpp
components/nvs_flash/src/nvs_page.cpp
components/nvs_flash/src/nvs_types.cpp
components/nvs_flash/test_nvs_host/Makefile
components/protocomm/src/common/protocomm.c
components/protocomm/src/common/protocomm_priv.h
components/pthread/pthread.c
components/pthread/pthread_cond_var.c
components/pthread/pthread_local_storage.c
components/soc/CMakeLists.txt
components/soc/esp32/rtc_clk.c
components/soc/esp32/rtc_clk_init.c
components/soc/esp32/rtc_sleep.c
components/soc/esp32/rtc_time.c
components/soc/esp32/soc_log.h
components/soc/esp32/test/test_rtc_clk.c
components/spi_flash/cache_utils.c
components/spi_flash/flash_mmap.c
components/spi_flash/flash_ops.c
components/spi_flash/partition.c
components/spi_flash/sim/Makefile.files
components/spi_flash/sim/SpiFlash.h
components/spi_flash/sim/flash_mock.cpp
components/spi_flash/sim/flash_mock_util.c
components/spi_flash/spi_flash_rom_patch.c
components/spi_flash/test/test_large_flash_writes.c
components/spi_flash/test/test_read_write.c
components/spiffs/esp_spiffs.c
components/spiffs/test_spiffs_host/Makefile.files
components/tcp_transport/transport.c
components/tcpip_adapter/include/tcpip_adapter.h
components/tcpip_adapter/include/tcpip_adapter_internal.h
components/unity/unity_port_esp32.c
components/vfs/test/test_vfs_uart.c
components/vfs/vfs_uart.c
components/wear_levelling/crc32.cpp
components/wear_levelling/test_wl_host/Makefile.files
components/wpa_supplicant/include/crypto/includes.h
components/wpa_supplicant/include/wpa/wpa.h
components/wpa_supplicant/include/wps/wps.h
components/wpa_supplicant/port/include/os.h
components/wpa_supplicant/src/wps/wps_enrollee.c
examples/bluetooth/blufi/main/blufi_security.c
examples/ethernet/ethernet/main/ethernet_example_main.c
examples/peripherals/sdio/slave/main/app_main.c
examples/peripherals/spi_master/main/decode_image.c
examples/peripherals/spi_slave/receiver/main/app_main.c
examples/peripherals/spi_slave/sender/main/app_main.c
examples/system/console/components/cmd_system/cmd_system.c
examples/system/himem/main/himem_test_main.c
examples/system/light_sleep/main/light_sleep_example_main.c
examples/wifi/espnow/main/espnow_example_main.c
tools/ci/test_build_system.sh
tools/ci/test_build_system_cmake.sh
tools/unit-test-app/components/test_utils/ref_clock.c
tools/unit-test-app/components/test_utils/test_utils.c

index 6c4a53eb9b8fc4672d8bb99831e41e254dfef53c..90db930d55ba1285d432e51312c76d1b12ff6786 100644 (file)
@@ -63,7 +63,7 @@ Revision: $Rev: 3734 $
 */
 #include "freertos/FreeRTOS.h"
 #include "SEGGER_SYSVIEW.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_app_trace.h"
 #include "esp_app_trace_util.h"
 #include "esp_intr_alloc.h"
index 0cb92be55c23bd78da092f4ca2a877745c0b0195..410f303a3f5614cda23a49066a065c72ddd4da91 100644 (file)
@@ -17,7 +17,7 @@
 #include "SEGGER_RTT.h"
 #include "SEGGER_SYSVIEW.h"
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_app_trace.h"
 
 #include "esp_log.h"
index d5c87b42714bddb416e6865262284d2a1d00790c..f7d2282e03584f0f6c50c4a05f8ae04aae6e449a 100644 (file)
@@ -32,8 +32,8 @@
 #include "sdkconfig.h"
 
 #include "esp_ota_ops.h"
-#include "rom/queue.h"
-#include "rom/crc.h"
+#include "sys/queue.h"
+#include "esp32/rom/crc.h"
 #include "soc/dport_reg.h"
 #include "esp_log.h"
 #include "esp_flash_partitions.h"
index f2adb2f799b9521a2081d77b6438cd4c7f01eca7..f8112ae7f814d561fc48f61c245182b49dade9e5 100644 (file)
@@ -6,9 +6,9 @@
 #include <stdio.h>
 #include "string.h"
 
-#include "rom/spi_flash.h"
-#include "rom/rtc.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/spi_flash.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index aad0ff99ebe2306ccc9bd796d7c6fbd2848bc980..c7a605c6cdad3d9dfac60b2ace6e71375979e7f4 100644 (file)
@@ -14,7 +14,7 @@ set(COMPONENTS bootloader esptool_py esp32 partition_table soc bootloader_suppor
 set(BOOTLOADER_BUILD 1)
 add_definitions(-DBOOTLOADER_BUILD=1)
 
-set(COMPONENT_REQUIRES_COMMON log esp32 soc)
+set(COMPONENT_REQUIRES_COMMON esp_rom log esp32 soc)
 
 include("${IDF_PATH}/tools/cmake/project.cmake")
 project(bootloader)
@@ -27,8 +27,8 @@ target_linker_script(bootloader.elf
 # as cmake won't attach linker args to a header-only library, attach
 # linker args directly to the bootloader.elf
 set(ESP32_BOOTLOADER_LINKER_SCRIPTS
-    "../../esp32/ld/esp32.rom.ld"
-    "../../esp32/ld/esp32.rom.spiram_incompatible_fns.ld"
+    "../../esp_rom/esp32/ld/esp32.rom.ld"
+    "../../esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld"
     "../../esp32/ld/esp32.peripherals.ld")
 
 target_linker_script(bootloader.elf ${ESP32_BOOTLOADER_LINKER_SCRIPTS})
index 7093ef4f0924fb35ffec8922fa1dd5ac90e5b916..727c8f05d862ac094e43dece1388dacd4445a2eb 100644 (file)
@@ -14,8 +14,9 @@ COMPONENTS := esptool_py bootloader_support log spi_flash micro-ecc soc main efu
 CFLAGS =
 CXXFLAGS =
 
-#We cannot include the esp32 component directly but we need its includes.
+#We cannot include the esp32 and esp_rom component directly but we need their includes.
 CFLAGS += -I $(IDF_PATH)/components/esp32/include
+CFLAGS += -I $(IDF_PATH)/components/esp_rom/include
 
 # The bootloader pseudo-component is also included in this build, for its Kconfig.projbuild to be included.
 #
index 6f7edc42eefc2021be4cbc60c4d2e4ab31e37a08..780c1326ec208a75e9cfdb024768b24e51083639 100644 (file)
@@ -16,8 +16,8 @@
 #include <stdbool.h>
 
 #include "esp_log.h"
-#include "rom/gpio.h"
-#include "rom/spi_flash.h"
+#include "esp32/rom/gpio.h"
+#include "esp32/rom/spi_flash.h"
 #include "bootloader_config.h"
 #include "bootloader_init.h"
 #include "bootloader_utility.h"
index a54fe30a9046d9249fc9d44fcb8ee723e37bf0ec..3c4ee81a38267e6e1a6f15a10fa5846ec639056e 100644 (file)
@@ -7,13 +7,13 @@
 
 LINKER_SCRIPTS := \
        esp32.bootloader.ld \
-       $(IDF_PATH)/components/esp32/ld/esp32.rom.ld \
-       $(IDF_PATH)/components/esp32/ld/esp32.rom.spiram_incompatible_fns.ld \
+       $(IDF_PATH)/components/esp_rom/esp32/ld/esp32.rom.ld \
+       $(IDF_PATH)/components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld \
        $(IDF_PATH)/components/esp32/ld/esp32.peripherals.ld \
        esp32.bootloader.rom.ld
 
 ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
-LINKER_SCRIPTS += $(IDF_PATH)/components/esp32/ld/esp32.rom.spiflash.ld
+LINKER_SCRIPTS += $(IDF_PATH)/components/esp_rom/esp32/ld/esp32.rom.spiflash.ld
 endif
 
 COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH) $(addprefix -T ,$(LINKER_SCRIPTS))
index 24267cc32a5f893ea896b465bdeb0401b44c710d..5bf283c519febb699a1dc03287dcd8b11734e1d1 100644 (file)
@@ -11,8 +11,8 @@
 // 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 "rom/uart.h"
-#include "rom/rtc.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/rtc.h"
 #include "soc/soc.h"
 #include "soc/rtc.h"
 #include "soc/dport_reg.h"
index 92b824669080cdf67188952c26b65bf11a97d111..da1935f7bb9972a2803a5409239f3c53560159e0 100644 (file)
 #include "sdkconfig.h"
 #include "esp_err.h"
 #include "esp_log.h"
-#include "rom/spi_flash.h"
-#include "rom/crc.h"
-#include "rom/ets_sys.h"
-#include "rom/gpio.h"
+#include "esp32/rom/spi_flash.h"
+#include "esp32/rom/crc.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/gpio.h"
 #include "esp_secure_boot.h"
 #include "esp_flash_partitions.h"
 #include "bootloader_flash.h"
index dbdf84ee2bab999198826cefe013de4577c6f42b..5b4a555e1c27e5ee7f402e3d84af27294ee07d7a 100644 (file)
@@ -81,8 +81,8 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
 #else
 /* Bootloader version, uses ROM functions only */
 #include <soc/dport_reg.h>
-#include <rom/spi_flash.h>
-#include <rom/cache.h>
+#include <esp32/rom/spi_flash.h>
+#include <esp32/rom/cache.h>
 
 static const char *TAG = "bootloader_flash";
 
index 7263c651665f1582f7f1c45e8f44f2ac85282825..9f7c16a4f2b8fcbd5df72fb95988ceb1fa00178d 100644 (file)
 #include "esp_attr.h"
 #include "esp_log.h"
 
-#include "rom/cache.h"
-#include "rom/efuse.h"
-#include "rom/ets_sys.h"
-#include "rom/spi_flash.h"
-#include "rom/crc.h"
-#include "rom/rtc.h"
-#include "rom/uart.h"
-#include "rom/gpio.h"
-#include "rom/secure_boot.h"
+#include "esp32/rom/cache.h"
+#include "esp32/rom/efuse.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/spi_flash.h"
+#include "esp32/rom/crc.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/gpio.h"
+#include "esp32/rom/secure_boot.h"
 
 #include "soc/soc.h"
 #include "soc/cpu.h"
index 1f7c1b4934bddd9e189c0be5af25555c2884b976..0ae1fd4a832f505147d0e1060a26d6c4be254dda 100644 (file)
@@ -57,11 +57,11 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest
 
 #else // Bootloader version
 
-#include "rom/sha.h"
+#include "esp32/rom/sha.h"
 #include "soc/dport_reg.h"
 #include "soc/hwcrypto_reg.h"
 
-#include "rom/ets_sys.h" // TO REMOVE
+#include "esp32/rom/ets_sys.h" // TO REMOVE
 
 static uint32_t words_hashed;
 
index 720294fa48a259ce66e853f61c6d1933a28c8f27..a9dbd553d305e87210b1ecbacb895dcf0e17e0c7 100644 (file)
 #include "esp_attr.h"
 #include "esp_log.h"
 
-#include "rom/cache.h"
-#include "rom/efuse.h"
-#include "rom/ets_sys.h"
-#include "rom/spi_flash.h"
-#include "rom/crc.h"
-#include "rom/rtc.h"
-#include "rom/uart.h"
-#include "rom/gpio.h"
-#include "rom/secure_boot.h"
+#include "esp32/rom/cache.h"
+#include "esp32/rom/efuse.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/spi_flash.h"
+#include "esp32/rom/crc.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/gpio.h"
+#include "esp32/rom/secure_boot.h"
 
 #include "soc/soc.h"
 #include "soc/cpu.h"
index 958f3a6a99f2e31233c0a15954ae755f8ca37f57..b6245a22e9a7e2a81e1637801739bfc591a18c17 100644 (file)
@@ -14,7 +14,7 @@
 #include <string.h>
 #include <sys/param.h>
 
-#include <rom/rtc.h>
+#include <esp32/rom/rtc.h>
 #include <soc/cpu.h>
 #include <esp_image_format.h>
 #include <esp_secure_boot.h>
index c79531f13a5f9158733cdac2bab68a454ddd6574..faadd07e3b7c763b070e51925a42fd31714a82fa 100644 (file)
 #include "esp_secure_boot.h"
 #include "esp_efuse.h"
 #include "esp_log.h"
-#include "rom/secure_boot.h"
+#include "esp32/rom/secure_boot.h"
 #include "soc/rtc_wdt.h"
 
-#include "rom/cache.h"
-#include "rom/spi_flash.h"   /* TODO: Remove this */
+#include "esp32/rom/cache.h"
+#include "esp32/rom/spi_flash.h"   /* TODO: Remove this */
 
 static const char *TAG = "flash_encrypt";
 
index bf499fcade9b2ef7448b3d01a74331b2cd9c6c2f..56219c898146b60e0356bc0cb2622119cc31c9b3 100644 (file)
@@ -14,8 +14,8 @@
 #include <string.h>
 #include "esp_flash_partitions.h"
 #include "esp_log.h"
-#include "rom/spi_flash.h"
-#include "rom/md5_hash.h"
+#include "esp32/rom/spi_flash.h"
+#include "esp32/rom/md5_hash.h"
 
 static const char *TAG = "flash_parts";
 
index f7a0b414d70b7ce7903634b01ff0ce21009e6c90..bdd0ac508e6c28d33665cf41c49de88a58709b11 100644 (file)
@@ -16,8 +16,8 @@
 #include "flash_qio_mode.h"
 #include "esp_log.h"
 #include "esp_err.h"
-#include "rom/spi_flash.h"
-#include "rom/efuse.h"
+#include "esp32/rom/spi_flash.h"
+#include "esp32/rom/efuse.h"
 #include "soc/spi_struct.h"
 #include "soc/efuse_reg.h"
 #include "sdkconfig.h"
index 64bf07180368ef086361199f9a8eae978f6de0d9..1972ebc32af0dda29f93aa136225c964d4c95c89 100644 (file)
@@ -18,9 +18,9 @@
 #include "esp_types.h"
 #include "esp_log.h"
 
-#include "rom/cache.h"
-#include "rom/ets_sys.h"
-#include "rom/secure_boot.h"
+#include "esp32/rom/cache.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/secure_boot.h"
 
 #include "soc/dport_reg.h"
 #include "soc/io_mux_reg.h"
index b6681bc79d3828215751237a13996304f34d8b61..eb2d6a702fa6254fce3a24a43240dfec0c1f2bf4 100644 (file)
@@ -22,7 +22,7 @@
 #include "uECC.h"
 
 #ifdef BOOTLOADER_BUILD
-#include "rom/sha.h"
+#include "esp32/rom/sha.h"
 typedef SHA_CTX sha_context;
 #else
 #include "mbedtls/sha256.h"
index 81f97f3f964053f162fcf87798c01f869d0cd13f..d5a7c84ae2fc16b28f01c819d3aca208ef610578 100644 (file)
@@ -5,7 +5,7 @@
 #include <esp_types.h>
 #include <stdio.h>
 #include "string.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 7d7232869bf08b0b81306e81ada89dde247e255b..52d1675a179f7a86e9c87a8a5f745342a344000e 100644 (file)
@@ -20,7 +20,7 @@
 #include "esp_console.h"
 #include "linenoise/linenoise.h"
 #include "argtable3/argtable3.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 #define ANSI_COLOR_DEFAULT      39      /** Default foreground color */
 
index 9ea8b25d4b1cc66b418dc459427f5e50e3714b5b..a813934b5306c4e5e35b06b6a489c0f49bded792 100644 (file)
@@ -25,7 +25,7 @@
 #include "soc/sens_reg.h"
 #include "soc/rtc.h"
 #include "soc/efuse_reg.h"
-#include "rom/lldesc.h"
+#include "esp32/rom/lldesc.h"
 
 #include "driver/gpio.h"
 #include "driver/i2s.h"
index ffa88a45cc5d30451c2cefbb1d10246e84cf4b24..86196fd344d32feba53c1fceb0860f0b2a8eb54e 100644 (file)
@@ -21,7 +21,7 @@
 #include "soc/rtc_io_reg.h"
 #include "soc/io_mux_reg.h"
 #include "soc/gpio_sig_map.h"
-#include "rom/gpio.h"
+#include "esp32/rom/gpio.h"
 #include "esp_attr.h"
 #include "esp_intr_alloc.h"
 #include "soc/gpio_periph.h"
index 0957e10cc8972c2a8f4a2f7f104f6a22b1846df4..2160bcfcdd7262abebe5ec6fac15daeda85471c0 100644 (file)
@@ -22,7 +22,7 @@
 #include "soc/i2s_reg.h"
 #include "soc/rtc_io_reg.h"
 #include "soc/io_mux_reg.h"
-#include "rom/gpio.h"
+#include "esp32/rom/gpio.h"
 #include "esp_attr.h"
 #include "esp_intr_alloc.h"
 #include "driver/periph_ctrl.h"
index fba650d1dcaabd7b4b68b4e43870c4de0f052301..93f08d94ae3d80421eed5bf9db6529eaf5ca8514 100644 (file)
@@ -18,7 +18,7 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/portmacro.h"
 #include "esp_err.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 #include "soc/sdio_slave_periph.h"
 
index 02a757bda41e5e0b7e89fd21ce9bd4c83e6a2c8b..546735caa04914aab49361c97cb82d9e0cf4daa8 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include "esp_err.h"
-#include "rom/lldesc.h"
+#include "esp32/rom/lldesc.h"
 #include "soc/spi_periph.h"
 #include "sdkconfig.h"
 
index 2c505f9cc4aac817568de2431b0e68f5ae6b4ef0..9c35d040a44d31f8d515707b37f387bb3298b5c9 100644 (file)
@@ -15,7 +15,7 @@
 #include <esp_types.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_log.h"
 #include "soc/rtc_io_reg.h"
 #include "soc/rtc_io_struct.h"
@@ -44,7 +44,7 @@
 // Enable built-in checks in queue.h in debug builds
 #define INVARIANTS
 #endif
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 
 #define ADC_FSM_RSTB_WAIT_DEFAULT     (8)
index 9036131c2d2f15dbc7b249e0e3dce1201770a8d1..03188d7a670b52a882900a44ec8e539c27cf1df1 100644 (file)
@@ -87,7 +87,7 @@ The driver of FIFOs works as below:
 #include <string.h>
 #include "driver/sdio_slave.h"
 #include "soc/sdio_slave_periph.h"
-#include "rom/lldesc.h"
+#include "esp32/rom/lldesc.h"
 #include "esp_log.h"
 #include "esp_intr_alloc.h"
 #include "freertos/FreeRTOS.h"
index 2d276b40922be2d52c7ce560399659185a2d6590..1ca44cf4b8e722b94dab9ac1d8397804583bd058 100644 (file)
@@ -18,7 +18,7 @@
 #include "esp_log.h"
 #include "esp_intr_alloc.h"
 #include "soc/io_mux_reg.h"
-#include "rom/gpio.h"
+#include "esp32/rom/gpio.h"
 #include "driver/gpio.h"
 #include "driver/sdmmc_host.h"
 #include "driver/periph_ctrl.h"
index 177f1b05b65b4b0e1ad77ccacd8e8265e76a0857..fa723787cc5646a49b2ac2d50234e4f4337f4ff6 100644 (file)
@@ -13,7 +13,7 @@
 // limitations under the License.
 
 #include <stdint.h>
-#include "rom/crc.h"
+#include "esp32/rom/crc.h"
 #include "sdspi_crc.h"
 
 static const uint8_t crc7_table[256] =
index 451bae0fa3589f363261896baa9c5b66b76e05bd..f27a28101248d96ea81c415db1b0db733d604ce2 100644 (file)
@@ -17,7 +17,7 @@
 #include "driver/spi_master.h"
 #include "soc/dport_reg.h"
 #include "soc/spi_periph.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_types.h"
 #include "esp_attr.h"
 #include "esp_intr.h"
@@ -26,7 +26,7 @@
 #include "esp_err.h"
 #include "soc/soc.h"
 #include "soc/dport_reg.h"
-#include "rom/lldesc.h"
+#include "esp32/rom/lldesc.h"
 #include "driver/gpio.h"
 #include "driver/periph_ctrl.h"
 #include "esp_heap_caps.h"
index 872a22fb7a869e0e2a4b64c293b8dbcbb91a1d36..7e7effa84cacb7af8dc27424ad5180dd484eeb6c 100644 (file)
@@ -123,7 +123,7 @@ We have two bits to control the interrupt:
 #include "driver/spi_master.h"
 #include "soc/dport_reg.h"
 #include "soc/spi_periph.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_types.h"
 #include "esp_attr.h"
 #include "esp_intr.h"
@@ -138,7 +138,7 @@ We have two bits to control the interrupt:
 #include "soc/soc.h"
 #include "soc/soc_memory_layout.h"
 #include "soc/dport_reg.h"
-#include "rom/lldesc.h"
+#include "esp32/rom/lldesc.h"
 #include "driver/gpio.h"
 #include "driver/periph_ctrl.h"
 #include "esp_heap_caps.h"
index 02dd587df96fffbdfdbc8272e5fcbf1aa3de0934..edfa95e62890e3aae554806afc9f6d562354e114 100644 (file)
@@ -17,7 +17,7 @@
 #include "driver/spi_slave.h"
 #include "soc/dport_reg.h"
 #include "soc/spi_periph.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_types.h"
 #include "esp_attr.h"
 #include "esp_intr.h"
@@ -32,7 +32,7 @@
 #include "soc/soc.h"
 #include "soc/soc_memory_layout.h"
 #include "soc/dport_reg.h"
-#include "rom/lldesc.h"
+#include "esp32/rom/lldesc.h"
 #include "driver/gpio.h"
 #include "driver/periph_ctrl.h"
 #include "esp_heap_caps.h"
index e2550c7ee4c089122c2f2f52165d60ee506dd3cb..ee07484bea6b5f0e0628ee5f5fbb4f10560a48d5 100644 (file)
@@ -4,7 +4,7 @@
  */
 #include <stdio.h>
 #include <string.h>
-#include "rom/uart.h"
+#include "esp32/rom/uart.h"
 #include "esp_system.h"
 #include "esp_sleep.h"
 #include "unity.h"
index 4d21cd2b83e64829f7089846f8585b55b05c35f8..93632d8e57c0b7828101f91d4bbbb83a2da8d2c0 100644 (file)
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <malloc.h>
 #include <string.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
index 3bca9e6027de84d9e31b999b5ba421d18931fbcd..35917363ea9440b65023d2d22fee0b29bb935b53 100644 (file)
@@ -22,7 +22,7 @@
 #include "esp_log.h"
 #include "soc/gpio_sig_map.h"
 #include "unity.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #define PULSE_IO 18
 #define PCNT_INPUT_IO 4
index c202af68c9eac601387269312498a2192e9daa18..d6458488054b5834ce6106507d106b191cbbd233 100644 (file)
@@ -26,7 +26,7 @@
 #include "esp_attr.h"
 #include "esp_log.h"
 #include "soc/rtc.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #define GPIO_PWMA_OUT  4
 #define GPIO_PWMB_OUT  13
index 4d7f8f50e4a78ec8a44279de363b962dc127e5be..d529cfc74182f386aa407a64b98987638cb06126 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #include <malloc.h>
 #include <string.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
index a286bedde16ca9847b6e2c86288a8b4b455d1511..df9cff1105458fea1faf7353de3f410729d3f24b 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #include <malloc.h>
 #include <string.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
index ad4843937df171178ac4b4c9bc898360df66b33c..097fe8445e08bba4de519ea914e52ec6d976b8dd 100644 (file)
@@ -17,7 +17,7 @@
 #include "esp_efuse_table.h"
 #include "stdlib.h"
 #include "esp_types.h"
-#include "rom/efuse.h"
+#include "esp32/rom/efuse.h"
 #include "assert.h"
 #include "esp_err.h"
 #include "esp_log.h"
index 91fe35c85c035723ed1b30b5798af3d08cc8e1ca..7ea2830774c10ef2ddfb405941fd73a0ff8ebfa4 100644 (file)
@@ -10,7 +10,7 @@
 #include "esp_efuse_table.h"
 #include "../src/esp_efuse_utility.h"
 #include "esp_efuse_test_table.h"
-#include "rom/efuse.h"
+#include "esp32/rom/efuse.h"
 #include "bootloader_random.h"
 #include "sdkconfig.h"
 
index eb73b5302d9e4e621e5ea00f50ffaa5e56de2b3e..87107125dfd856928bca5b1335228fd8cae25d07 100644 (file)
@@ -86,28 +86,7 @@ else()
         set_property(TARGET ${IDF_PROJECT_EXECUTABLE} APPEND PROPERTY LINK_DEPENDS ${esp32_project_script})
     endif()
 
-    target_linker_script(${COMPONENT_TARGET}
-        "ld/esp32.rom.ld"
-        "ld/esp32.peripherals.ld"
-        "ld/esp32.rom.libgcc.ld"
-        )
-
-    if(CONFIG_SPIRAM_CACHE_WORKAROUND)
-        # Note: Adding as a PUBLIC compile option here causes this option to propagate to all components that depend on esp32.
-        #
-        # To handle some corner cases, the same flag is set in project_include.cmake
-        target_compile_options(${COMPONENT_TARGET} PUBLIC -mfix-esp32-psram-cache-issue)
-    else()
-        target_linker_script(${COMPONENT_TARGET} "ld/esp32.rom.spiram_incompatible_fns.ld")
-    endif()
-
-    if(CONFIG_NEWLIB_NANO_FORMAT)
-        target_linker_script(${COMPONENT_TARGET} "ld/esp32.rom.nanofmt.ld")
-    endif()
-
-    if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
-        target_linker_script(${COMPONENT_TARGET} "ld/esp32.rom.spiflash.ld")
-    endif()
+    target_linker_script(${COMPONENT_TARGET} "ld/esp32.peripherals.ld")
 
     target_link_libraries(${COMPONENT_TARGET} "${CMAKE_CURRENT_SOURCE_DIR}/libhal.a")
     target_link_libraries(${COMPONENT_TARGET} gcc)
index 1d78006140c3b820a288df12532729bcceb63daf..fe94cdbf454c3a361c1d9aa2f69e690a2adcbefb 100644 (file)
@@ -20,7 +20,7 @@
 #include "soc/soc.h"
 #include "soc/cpu.h"
 #include "soc/rtc_cntl_reg.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_system_internal.h"
 #include "driver/rtc_cntl.h"
 #include "freertos/FreeRTOS.h"
index d8120ebad2b63d150ff14d054f747ad2cb278a18..12764e0b623c7ae3b87b19ee5808ce63da8ff63a 100644 (file)
@@ -21,9 +21,9 @@
 #include "esp_log.h"
 #include "esp32/clk.h"
 #include "esp_clk_internal.h"
-#include "rom/ets_sys.h"
-#include "rom/uart.h"
-#include "rom/rtc.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/rtc.h"
 #include "soc/soc.h"
 #include "soc/rtc.h"
 #include "soc/rtc_wdt.h"
index 21d8ce6bc307e35b3cc5bd43da9b0dcdbcaadec2..a90c5e5b4deecb3a57d4bd3eedaf8ad5b88c60b9 100644 (file)
@@ -8,7 +8,7 @@ ifndef CONFIG_NO_BLOBS
 LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy mesh
 endif
 
-ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY  
+ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
    # This linker script must come before esp32.project.ld
    LINKER_SCRIPTS += esp32.extram.bss.ld
 endif
@@ -16,24 +16,7 @@ endif
 #Linker scripts used to link the final application.
 #Warning: These linker scripts are only used when the normal app is compiled; the bootloader
 #specifies its own scripts.
-LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.rom.ld esp32.peripherals.ld
-
-#Force pure functions from libgcc.a to be linked from ROM
-LINKER_SCRIPTS += esp32.rom.libgcc.ld
-
-#SPI-RAM incompatible functions can be used in when the SPI RAM 
-#workaround is not enabled.
-ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
-LINKER_SCRIPTS += esp32.rom.spiram_incompatible_fns.ld
-endif
-
-ifdef CONFIG_NEWLIB_NANO_FORMAT
-LINKER_SCRIPTS += esp32.rom.nanofmt.ld
-endif
-
-ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
-LINKER_SCRIPTS += esp32.rom.spiflash.ld
-endif
+LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.peripherals.ld
 
 #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
 #linker will ignore panic_highint_hdl.S as it has no other files depending on any
index b4d067c461d7060c2ab90177b663cea0c8d206bc..adb44f576e3c5dda05503dc021d221c089df9c65 100644 (file)
 #include "esp_attr.h"
 #include "esp_err.h"
 
-#include "rom/ets_sys.h"
-#include "rom/uart.h"
-#include "rom/rtc.h"
-#include "rom/cache.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/cache.h"
 
 #include "soc/cpu.h"
 #include "soc/rtc.h"
index 18a5237b5ae460a7f4a1930d89cf339ae926a39a..2b8f1df4867bd3db30861ef05c4d4cedd6859efd 100644 (file)
@@ -19,8 +19,8 @@
 #include "esp_intr.h"
 #include "esp_intr_alloc.h"
 
-#include "rom/ets_sys.h"
-#include "rom/uart.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/uart.h"
 
 #include "soc/cpu.h"
 #include "soc/dport_reg.h"
index 731bdb7ec5461bb67f77589ffb121c55c81fb6e9..02bb8ee18317a642c15b3e35593f5ccb171994bc 100644 (file)
@@ -26,8 +26,8 @@
 #include "esp_attr.h"
 #include "esp_err.h"
 #include "esp_intr.h"
-#include "rom/ets_sys.h"
-#include "rom/uart.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/uart.h"
 
 #include "soc/cpu.h"
 #include "soc/dport_reg.h"
index b2a55d385e3c7f7804e6072bf205bc5a13b88b07..7053af341bd866159993162afce3e693feea4002 100644 (file)
@@ -15,7 +15,7 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "esp32/spiram.h"
-#include "rom/cache.h"
+#include "esp32/rom/cache.h"
 #include "sdkconfig.h"
 #include "esp32/himem.h"
 #include "soc/soc.h"
index 78f004acf0264cc7b972ade572d2f12ba5cd67ec..edfa6b480f0e607c88a374ec0256a806fbb61f13 100644 (file)
@@ -36,7 +36,7 @@
 // Enable built-in checks in queue.h in debug builds
 #define INVARIANTS
 #endif
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 #define TIMER_EVENT_QUEUE_SIZE      16
 
index 23e1add12486f4782a958f87e91395768db2f91b..44d789589b05dd6a26da39d47c3d264756c00180 100644 (file)
@@ -24,7 +24,7 @@
 #include "esp_log.h"
 #include "esp_attr.h"
 #include "esp_intr_alloc.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "soc/frc_timer_reg.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index a93b459927cf4bad9903e926d20a94924123fd22..e514222098acb0932f646663f64bbe6ec760088f 100644 (file)
@@ -19,7 +19,7 @@
  *******************************************************************************/
 
 #include <string.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "soc/uart_reg.h"
 #include "soc/io_mux_reg.h"
 #include "esp_gdbstub.h"
index 422065f9ca040d6bde7d824cffeaffa144a4fbf4..b60c7280ddd4da715b68eb197dcc2dcc795d8040 100644 (file)
@@ -34,7 +34,7 @@
 #include "freertos/semphr.h"
 
 #include "hwcrypto/sha.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "soc/dport_reg.h"
 #include "soc/hwcrypto_reg.h"
 #include "driver/periph_ctrl.h"
index 579eb6353d87ed6a497f6d8a8b035b7aeac1ce5f..10039ccd82d3a8ec4a52389e1324ea05ecebcde5 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef __ESP_INTR_H__
 #define __ESP_INTR_H__
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "freertos/xtensa_api.h"
 
 #ifdef __cplusplus
index 3348f8f4ef43e5d3fd5988fadfc342b9a956655b..bc8d0a844bc644acee3106096f3d5dc23b1b5f90 100644 (file)
@@ -61,7 +61,7 @@
 #include <stdbool.h>
 #include "freertos/FreeRTOS.h"
 #include "freertos/queue.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "sdkconfig.h"
 #include "esp_err.h"
 #include "esp_wifi_types.h"
index 979d0134edd2485868089e875872a4646beb7840..b6dea52a952aed89540d5300db85271a15f8c3fb 100644 (file)
@@ -31,7 +31,7 @@
 #include <stdbool.h>
 #include "freertos/FreeRTOS.h"
 #include "freertos/queue.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "esp_err.h"
 #include "esp_wifi_types.h"
 #include "esp_event.h"
index 8689e5fd448c3ef00eef5860b8d97882a2ef32b3..02a59e017c0cd591e951d2ce551c9b5f355fb60b 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "esp_err.h"
 #include "esp_interface.h"
 
index 1dd5291f07c06f37cd21ccc7f23b8520bff23997..424713f98ce4c35697e9b00f9b07f60be00a362c 100644 (file)
@@ -25,7 +25,7 @@
 #define ESP_AES_H
 
 #include "esp_types.h"
-#include "rom/aes.h"
+#include "esp32/rom/aes.h"
 
 #ifdef __cplusplus
 extern "C" {
index 516de6c12724288807f69a800d353f797cd7ec0a..2009d198180e116abc4a3ccdbc25919f91aee977 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef _ESP_SHA_H_
 #define _ESP_SHA_H_
 
-#include "rom/sha.h"
+#include "esp32/rom/sha.h"
 #include "esp_types.h"
 
 /** @brief Low-level support functions for the hardware SHA engine
@@ -43,7 +43,7 @@
 extern "C" {
 #endif
 
-/* Defined in rom/sha.h */
+/* Defined in esp32/rom/sha.h */
 typedef enum SHA_TYPE esp_sha_type;
 
 /** @brief Calculate SHA1 or SHA2 sum of some data, using hardware SHA engine
index 80eca973fc9d71838a1b231bb4c7b0ca12fdbf11..5cb2e94b82b09cddc2f11a1521f14be21da49cef 100644 (file)
@@ -1,57 +1,2 @@
-/*
-  ROM functions for hardware AES support.
-
-  It is not recommended to use these functions directly,
-  use the wrapper functions in hwcrypto/aes.h instead.
-
- */
-// 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.
-
-#ifndef _ROM_AES_H_
-#define _ROM_AES_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//TODO, add comment for aes apis
-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);
-
-bool ets_aes_setkey_enc(const uint8_t *key, enum AES_BITS bits);
-
-bool ets_aes_setkey_dec(const uint8_t *key, enum AES_BITS bits);
-
-void ets_aes_crypt(const uint8_t input[16], uint8_t output[16]);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_AES_H_ */
+#warning rom/aes.h is deprecated, please use esp32/rom/aes.h instead
+#include "esp32/rom/aes.h"
index 97ad72202a334f42f42bd9d2c0c8fb01be9aa55a..d6390d003b9fc22e8ec53c35f479a924854cd740 100644 (file)
@@ -1,62 +1,2 @@
-/*
-  ROM functions for hardware bigint support.
-
-  It is not recommended to use these functions directly,
-  use the wrapper functions in hwcrypto/mpi.h instead.
-
- */
-// 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.
-
-#ifndef _ROM_BIGINT_H_
-#define _ROM_BIGINT_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//TODO: add comment here
-void ets_bigint_enable(void);
-
-void ets_bigint_disable(void);
-
-void ets_bigint_wait_finish(void);
-
-bool ets_bigint_mod_power_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
-                                  uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
-
-bool ets_bigint_mod_power_getz(uint32_t *z, uint32_t len);
-
-bool ets_bigint_mult_prepare(uint32_t *x, uint32_t *y, uint32_t len);
-
-bool ets_bigint_mult_getz(uint32_t *z, uint32_t len);
-
-bool ets_bigint_montgomery_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
-                                        uint32_t m_dash, uint32_t len, bool again);
-
-bool ets_bigint_montgomery_mult_getz(uint32_t *z, uint32_t len);
-
-bool ets_bigint_mod_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
-                                 uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
-
-bool ets_bigint_mod_mult_getz(uint32_t *m, uint32_t *z, uint32_t len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_BIGINT_H_ */
+#warning rom/bigint.h is deprecated, please use esp32/rom/bigint.h instead
+#include "esp32/rom/bigint.h"
index 4b923e669d77cfc4e0194685a635e2aaf52d9177..4b3e44ad5e8782aa421ebb44584cd9b659af5538 100644 (file)
@@ -1,186 +1,2 @@
-// 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.
-
-#ifndef _ROM_CACHE_H_
-#define _ROM_CACHE_H_
-
-#include "soc/dport_access.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \defgroup uart_apis, uart configuration and communication related apis
-  * @brief uart apis
-  */
-
-/** @addtogroup uart_apis
-  * @{
-  */
-
-/**
-  * @brief Initialise cache mmu, mark all entries as invalid.
-  *        Please do not call this function in your SDK application.
-  *
-  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
-  *
-  * @return None
-  */
-void mmu_init(int cpu_no);
-
-/**
-  * @brief Set Flash-Cache mmu mapping.
-  *        Please do not call this function in your SDK application.
-  *
-  * @param  int cpu_no : CPU number, 0 for PRO cpu, 1 for APP cpu.
-  *
-  * @param  int pod : process identifier. Range 0~7.
-  *
-  * @param  unsigned int vaddr : virtual address in CPU address space.
-  *                              Can be IRam0, IRam1, IRom0 and DRom0 memory address.
-  *                              Should be aligned by psize.
-  *
-  * @param  unsigned int paddr : physical address in Flash.
-  *                              Should be aligned by psize.
-  *
-  * @param  int psize : page size of flash, in kilobytes. Should be 64 here.
-  *
-  * @param  int num : pages to be set.
-  *
-  * @return unsigned int: error status
-  *                   0 : mmu set success
-  *                   1 : vaddr or paddr is not aligned
-  *                   2 : pid error
-  *                   3 : psize error
-  *                   4 : mmu table to be written is out of range
-  *                   5 : vaddr is out of range
-  */
-static inline unsigned int IRAM_ATTR cache_flash_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr,  int psize, int num)
-{
-    extern unsigned int cache_flash_mmu_set_rom(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr,  int psize, int num);
-
-    unsigned int ret;
-
-    DPORT_STALL_OTHER_CPU_START();
-    ret = cache_flash_mmu_set_rom(cpu_no, pid, vaddr, paddr, psize, num);
-    DPORT_STALL_OTHER_CPU_END();
-
-    return ret;
-}
-
-/**
-  * @brief Set Ext-SRAM-Cache mmu mapping.
-  *        Please do not call this function in your SDK application.
-  *
-  * Note that this code lives in IRAM and has a bugfix in respect to the ROM version
-  * of this function (which erroneously refused a vaddr > 2MiB
-  *
-  * @param  int cpu_no : CPU number, 0 for PRO cpu, 1 for APP cpu.
-  *
-  * @param  int pod : process identifier. Range 0~7.
-  *
-  * @param  unsigned int vaddr : virtual address in CPU address space.
-  *                              Can be IRam0, IRam1, IRom0 and DRom0 memory address.
-  *                              Should be aligned by psize.
-  *
-  * @param  unsigned int paddr : physical address in Ext-SRAM.
-  *                              Should be aligned by psize.
-  *
-  * @param  int psize : page size of flash, in kilobytes. Should be 32 here.
-  *
-  * @param  int num : pages to be set.
-  *
-  * @return unsigned int: error status
-  *                   0 : mmu set success
-  *                   1 : vaddr or paddr is not aligned
-  *                   2 : pid error
-  *                   3 : psize error
-  *                   4 : mmu table to be written is out of range
-  *                   5 : vaddr is out of range
-  */
-unsigned int IRAM_ATTR cache_sram_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr, int psize, int num);
-
-/**
-  * @brief Initialise cache access for the cpu.
-  *        Please do not call this function in your SDK application.
-  *
-  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
-  *
-  * @return None
-  */
-static inline void IRAM_ATTR Cache_Read_Init(int cpu_no)
-{
-    extern void Cache_Read_Init_rom(int cpu_no);
-    DPORT_STALL_OTHER_CPU_START();
-    Cache_Read_Init_rom(cpu_no);
-    DPORT_STALL_OTHER_CPU_END();
-}
-
-/**
-  * @brief Flush the cache value for the cpu.
-  *        Please do not call this function in your SDK application.
-  *
-  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
-  *
-  * @return None
-  */
-static inline void IRAM_ATTR Cache_Flush(int cpu_no)
-{
-    extern void Cache_Flush_rom(int cpu_no);
-    DPORT_STALL_OTHER_CPU_START();
-    Cache_Flush_rom(cpu_no);
-    DPORT_STALL_OTHER_CPU_END();
-}
-
-/**
-  * @brief Disable Cache access for the cpu.
-  *        Please do not call this function in your SDK application.
-  *
-  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
-  *
-  * @return None
-  */
-static inline void IRAM_ATTR Cache_Read_Disable(int cpu_no)
-{
-    extern void Cache_Read_Disable_rom(int cpu_no);
-    DPORT_STALL_OTHER_CPU_START();
-    Cache_Read_Disable_rom(cpu_no);
-    DPORT_STALL_OTHER_CPU_END();
-}
-
-/**
-  * @brief Enable Cache access for the cpu.
-  *        Please do not call this function in your SDK application.
-  *
-  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
-  *
-  * @return None
-  */
-static inline void IRAM_ATTR Cache_Read_Enable(int cpu_no)
-{
-    extern void Cache_Read_Enable_rom(int cpu_no);
-    DPORT_STALL_OTHER_CPU_START();
-    Cache_Read_Enable_rom(cpu_no);
-    DPORT_STALL_OTHER_CPU_END();
-}
-
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_CACHE_H_ */
+#warning rom/cache.h is deprecated, please use esp32/rom/cache.h instead
+#include "esp32/rom/cache.h"
index faa1e8c351b31ffb478e77bddc5b36ed41c60199..85ea280be657671d70da33ac55d5469f59d62ab6 100644 (file)
@@ -1,160 +1,2 @@
-// 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.
-
-#ifndef ROM_CRC_H
-#define ROM_CRC_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \defgroup uart_apis, uart configuration and communication related apis
-  * @brief uart apis
-  */
-
-/** @addtogroup uart_apis
-  * @{
-  */
-
-
-/*           Notes about CRC APIs usage
- * The ESP32 ROM include some CRC tables and CRC APIs to speed up CRC calculation.
- * The CRC APIs include CRC8, CRC16, CRC32 algorithms for both little endian and big endian modes.
- * Here are the polynomials for the algorithms:
- * CRC-8        x8+x2+x1+1                                              0x07
- * CRC16-CCITT  x16+x12+x5+1                                            0x1021
- * CRC32        x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x1+1     0x04c11db7
- * 
- * These group of CRC APIs are designed to calculate the data in buffers either continuous or not.
- * To make it easy, we had added a `~` at the beginning and the end of the functions.
- * To calculate non-continuous buffers, we can write the code like this:
- *     init = ~init;
- *     crc = crc32_le(init, buf0, length0);
- *     crc = crc32_le(crc, buf1, length1);
- *     crc = ~crc;
- *
- * However, it is not easy to select which API to use and give the correct parameters.
- * A specific CRC algorithm will include this parameters: width, polynomials, init, refin, refout, xorout
- *     refin and refout show the endian of the algorithm:
- *         if both of them are true, please use the little endian API.
- *         if both of them are false, please use the big endian API.
- *     xorout is the value which you need to be xored to the raw result.
- * However, these group of APIs need one '~' before and after the APIs.
- *
- * Here are some examples for CRC16:
- * CRC-16/CCITT, poly = 0x1021, init = 0x0000, refin = true, refout = true, xorout = 0x0000
- *     crc = ~crc16_le((uint16_t)~0x0000, buf, length);
- * 
- * CRC-16/CCITT-FALSE, poly = 0x1021, init = 0xffff, refin = false, refout = false, xorout = 0x0000
- *     crc = ~crc16_be((uint16_t)~0xffff, buf, length);
- *
- * CRC-16/X25, poly = 0x1021, init = 0xffff, refin = true, refout = true, xorout = 0xffff
- *     crc = (~crc16_le((uint16_t)~(0xffff), buf, length))^0xffff;
- *
- * CRC-16/XMODEM, poly= 0x1021, init = 0x0000, refin = false, refout = false, xorout = 0x0000
- *     crc = ~crc16_be((uint16_t)~0x0000, buf, length);
- *
- *     
- */
-
-/**
-  * @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
+#warning rom/crc.h is deprecated, please use esp32/rom/crc.h instead
+#include "esp32/rom/crc.h"
index 337227ab0d47ccdcdc0887361bf2d160de014d65..511b34c5f84e22257001163310b9c98af8d28b9d 100644 (file)
@@ -1,117 +1,2 @@
-// 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.
-
-#ifndef _ROM_EFUSE_H_
-#define _ROM_EFUSE_H_
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \defgroup efuse_APIs efuse APIs
-  * @brief     ESP32 efuse read/write APIs
-  * @attention
-  *
-  */
-
-/** @addtogroup efuse_APIs
-  * @{
-  */
-
-/**
-  * @brief  Do a efuse read operation, to update the efuse value to efuse read registers.
-  *
-  * @param  null
-  *
-  * @return null
-  */
-void ets_efuse_read_op(void);
-
-/**
-  * @brief  Do a efuse write operation, to update efuse write registers to efuse, then you need call ets_efuse_read_op again.
-  *
-  * @param  null
-  *
-  * @return null
-  */
-void ets_efuse_program_op(void);
-
-/**
-  * @brief  Read 8M Analog Clock value(8 bit) in efuse, the analog clock will not change with temperature.
-  *         It can be used to test the external xtal frequency, do not touch this efuse field.
-  *
-  * @param  null
-  *
-  * @return u32: 1 for 100KHZ, range is 0 to 255.
-  */
-uint32_t ets_efuse_get_8M_clock(void);
-
-/**
-  * @brief  Read spi flash pin 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);
-
-#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  A crc8 algorithm used in efuse check.
-  *
-  * @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_ */
+#warning rom/efuse.h is deprecated, please use esp32/rom/efuse.h instead
+#include "esp32/rom/efuse.h"
index 3c34bbe779c2438786479dec302fdfb164069e8f..b1f2aa8a533914d1f00b8cec4c33662317a125ce 100644 (file)
@@ -1,645 +1,2 @@
-// Copyright 2010-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.
-
-#ifndef _ROM_ETS_SYS_H_
-#define _ROM_ETS_SYS_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "soc/soc.h"
-
-#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 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);
-
-/**
-  * @brief  unpack the image in flash to iram and dram, no using cache.
-  *
-  * @param  uint32_t pos : Flash physical address.
-  *
-  * @param  uint32_t *entry_addr: the pointer of an variable that can store Entry code address.
-  *
-  * @param  bool jump : Jump into the code in the function or not.
-  *
-  * @param  bool config : Config the flash when unpacking the image, config should be done only once.
-  *
-  * @return ETS_OK     : unpack successful
-  * @return ETS_FAILED : unpack failed
-  */
-ETS_STATUS ets_unpack_flash_code_legacy(uint32_t pos, uint32_t *entry_addr, bool jump, bool config);
-
-/**
-  * @brief  unpack the image in flash to iram and dram, using cache, maybe decrypting.
-  *
-  * @param  uint32_t pos : Flash physical address.
-  *
-  * @param  uint32_t *entry_addr: the pointer of an variable that can store Entry code address.
-  *
-  * @param  bool jump : Jump into the code in the function or not.
-  *
-  * @param  bool sb_need_check : Do security boot check or not.
-  *
-  * @param  bool config : Config the flash when unpacking the image, config should be done only once.
-  *
-  * @return ETS_OK     : unpack successful
-  * @return ETS_FAILED : unpack failed
-  */
-ETS_STATUS ets_unpack_flash_code(uint32_t pos, uint32_t *entry_addr, bool jump, bool sb_need_check, bool config);
-
-/**
-  * @}
-  */
-
-/** \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  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/analog_8M*256 value calibrated in rtc module.
-  *
-  * @param  None
-  *
-  * @return uint32_t : xtal_freq/analog_8M*256.
-  */
-uint32_t ets_get_xtal_scale(void);
-
-/**
-  * @brief  Get xtal_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 if analog_8M in efuse
-  *                         clock = ets_get_xtal_scale() * 15625 * ets_efuse_get_8M_clock() / 40;
-  *                    else clock = 26M.
-  */
-uint32_t ets_get_detected_xtal_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);
-
-#define _ETSTR(v) # v
-#define _ETS_SET_INTLEVEL(intlevel)        ({ unsigned __tmp; \
-            __asm__ __volatile__(   "rsil   %0, " _ETSTR(intlevel) "\n" \
-                        : "=a" (__tmp) : : "memory" ); \
-            })
-
-#ifdef CONFIG_NONE_OS
-#define ETS_INTR_LOCK() \
-        ets_intr_lock()
-
-#define ETS_INTR_UNLOCK() \
-        ets_intr_unlock()
-
-#define ETS_ISR_ATTACH \
-        ets_isr_attach
-
-#define ETS_INTR_ENABLE(inum) \
-        ets_isr_unmask((1<<inum))
-
-#define ETS_INTR_DISABLE(inum) \
-        ets_isr_mask((1<<inum))
-
-#define ETS_WMAC_INTR_ATTACH(func, arg) \
-        ETS_ISR_ATTACH(ETS_WMAC_INUM, (func), (void *)(arg))
-
-#define ETS_TG0_T0_INTR_ATTACH(func, arg) \
-        ETS_ISR_ATTACH(ETS_TG0_T0_INUM, (func), (void *)(arg))
-
-#define ETS_GPIO_INTR_ATTACH(func, arg) \
-        ETS_ISR_ATTACH(ETS_GPIO_INUM, (func), (void *)(arg))
-
-#define ETS_UART0_INTR_ATTACH(func, arg) \
-        ETS_ISR_ATTACH(ETS_UART0_INUM, (func), (void *)(arg))
-
-#define ETS_WDT_INTR_ATTACH(func, arg) \
-        ETS_ISR_ATTACH(ETS_WDT_INUM, (func), (void *)(arg))
-
-#define ETS_SLC_INTR_ATTACH(func, arg) \
-        ETS_ISR_ATTACH(ETS_SLC_INUM, (func), (void *)(arg))
-
-#define ETS_BB_INTR_ENABLE() \
-        ETS_INTR_ENABLE(ETS_BB_INUM)
-
-#define ETS_BB_INTR_DISABLE() \
-        ETS_INTR_DISABLE(ETS_BB_INUM)
-
-#define ETS_UART0_INTR_ENABLE() \
-        ETS_INTR_ENABLE(ETS_UART0_INUM)
-
-#define ETS_UART0_INTR_DISABLE() \
-        ETS_INTR_DISABLE(ETS_UART0_INUM)
-
-#define ETS_GPIO_INTR_ENABLE() \
-        ETS_INTR_ENABLE(ETS_GPIO_INUM)
-
-#define ETS_GPIO_INTR_DISABLE() \
-        ETS_INTR_DISABLE(ETS_GPIO_INUM)
-
-#define ETS_WDT_INTR_ENABLE() \
-        ETS_INTR_ENABLE(ETS_WDT_INUM)
-
-#define ETS_WDT_INTR_DISABLE() \
-        ETS_INTR_DISABLE(ETS_WDT_INUM)
-
-#define ETS_TG0_T0_INTR_ENABLE() \
-        ETS_INTR_ENABLE(ETS_TG0_T0_INUM)
-
-#define ETS_TG0_T0_INTR_DISABLE() \
-        ETS_INTR_DISABLE(ETS_TG0_T0_INUM)
-
-#define ETS_SLC_INTR_ENABLE() \
-        ETS_INTR_ENABLE(ETS_SLC_INUM)
-
-#define ETS_SLC_INTR_DISABLE() \
-        ETS_INTR_DISABLE(ETS_SLC_INUM)
-#endif
-
-/**
-  * @}
-  */
-
-#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_ */
+#warning rom/ets_sys.h is deprecated, please use esp32/rom/ets_sys.h instead
+#include "esp32/rom/ets_sys.h"
index f98d6cf2dd0db133cb284563985de068cbfe2c14..445586728eb881d070eb646ccc842b903f4aad6c 100644 (file)
@@ -1,303 +1,2 @@
-// Copyright 2010-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.
-
-#ifndef _ROM_GPIO_H_
-#define _ROM_GPIO_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "esp_attr.h"
-#include "soc/gpio_reg.h"
-#include "soc/gpio_pins.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                0x30
-
-#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, (bit_value ? 0 : 1)<<gpio_no, 1<<gpio_no,0) : \
-                         gpio_output_set_high(bit_value<<(gpio_no - 32), (bit_value ? 0 : 1)<<(gpio_no - 32), 1<<(gpio_no -32),0))
-#define GPIO_DIS_OUTPUT(gpio_no)    ((gpio_no < 32) ? gpio_output_set(0,0,0, 1<<gpio_no) : gpio_output_set_high(0,0,0, 1<<(gpio_no - 32)))
-#define GPIO_INPUT_GET(gpio_no)     ((gpio_no < 32) ? ((gpio_input_get()>>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~0x27
-  *                        gpio == 0x30, input 0 to signal
-  *                        gpio == 0x34, ???
-  *                        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~0x27
-  *
-  * @param uint32_t signal_idx : signal index.
-  *                        signal_idx == 0x100, cancel output put to the gpio
-  *
-  * @param bool out_inv : the signal output is inv or not
-  *
-  * @param bool oen_inv : the signal output enable is inv 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~0x27
-  *
-  * @return None
-  */
-void gpio_pad_select_gpio(uint8_t gpio_num);
-
-/**
-  * @brief Set pad driver capability.
-  *
-  * @param uint32_t gpio_num : gpio number, 0~0x27
-  *
-  * @param uint8_t drv : 0-3
-  *
-  * @return None
-  */
-void gpio_pad_set_drv(uint8_t gpio_num, uint8_t drv);
-
-/**
-  * @brief Pull up the pad from gpio number.
-  *
-  * @param uint32_t gpio_num : gpio number, 0~0x27
-  *
-  * @return None
-  */
-void gpio_pad_pullup(uint8_t gpio_num);
-
-/**
-  * @brief Pull down the pad from gpio number.
-  *
-  * @param uint32_t gpio_num : gpio number, 0~0x27
-  *
-  * @return None
-  */
-void gpio_pad_pulldown(uint8_t gpio_num);
-
-/**
-  * @brief Unhold the pad from gpio number.
-  *
-  * @param uint32_t gpio_num : gpio number, 0~0x27
-  *
-  * @return None
-  */
-void gpio_pad_unhold(uint8_t gpio_num);
-
-/**
-  * @brief Hold the pad from gpio number.
-  *
-  * @param uint32_t gpio_num : gpio number, 0~0x27
-  *
-  * @return None
-  */
-void gpio_pad_hold(uint8_t gpio_num);
-
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_GPIO_H_ */
+#warning rom/gpio.h is deprecated, please use esp32/rom/gpio.h instead
+#include "esp32/rom/gpio.h"
index 6c6366c30651e9d710362fc5d6654742b0141692..f6a50125aedffb0bf94dfa31ee5f4bac5c7b3ec8 100644 (file)
@@ -1,89 +1,2 @@
-// 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.
-#ifndef _ROM_LIBC_STUBS_H_
-#define _ROM_LIBC_STUBS_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <reent.h>
-#include <errno.h>
-
-#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. There are two pointers, `syscall_table_ptr_pro` and
-`syscall_table_ptr_app`, which can be set to point to the locations of syscall tables of CPU 0 (aka PRO CPU)
-and CPU 1 (aka APP CPU). Location of these pointers in .bss segment of ROM code is defined in linker script.
-
-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); /* function signature is incorrect in ROM */
-    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);
-    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);
-    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);
-};
-
-extern struct syscall_stub_table* syscall_table_ptr_pro;
-extern struct syscall_stub_table* syscall_table_ptr_app;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* _ROM_LIBC_STUBS_H_ */
+#warning rom/libc_stubs.h is deprecated, please use esp32/rom/libc_stubs.h instead
+#include "esp32/rom/libc_stubs.h"
index d027362a51f774667264b1eeac30090d72efcdf8..5d5443bfbc9c233ff19fb10a977dd052a126e7f7 100644 (file)
@@ -1,176 +1,2 @@
-// Copyright 2010-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.
-
-#ifndef _ROM_LLDESC_H_
-#define _ROM_LLDESC_H_
-
-#include <stdint.h>
-
-#include "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 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_ */
+#warning rom/lldesc.h is deprecated, please use esp32/rom/lldesc.h instead
+#include "esp32/rom/lldesc.h"
index f116f1e670f42c02254525abb0046d77df4d3b10..4b1cd15aef4da5a664f0f09548c4e55e27f25262 100644 (file)
@@ -1,38 +1,2 @@
-/*
- * MD5 internal definitions
- * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
- *
- * 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 <stdint.h>
-
-#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_ */
+#warning rom/md5_hash.h is deprecated, please use esp32/rom/md5_hash.h instead
+#include "esp32/rom/md5_hash.h"
index ed79beb2cbd662e1e6b6b6a5fa0758c07d188a5a..3837fbd7d0b9154feb1333de62aed5298ad503f9 100644 (file)
@@ -1,777 +1,2 @@
-#ifndef MINIZ_HEADER_INCLUDED
-#define MINIZ_HEADER_INCLUDED
-
-#include <stdlib.h>
-
-// 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 <time.h>
-#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
-
+#warning rom/miniz.h is deprecated, please use esp32/rom/miniz.h instead
+#include "esp32/rom/miniz.h"
index 29ee6706009588b33aef0484c501aa70f1cca675..5e0c2109544a73521fc455d19c321caf229210ae 100644 (file)
@@ -1,645 +1,2 @@
-/*-
- * 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.
- * 4. 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 <sys/cdefs.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * 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 only be traversed in the forward 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.
- *
- *
- *                             SLIST   LIST    STAILQ  TAILQ
- * _HEAD                       +       +       +       +
- * _HEAD_INITIALIZER           +       +       +       +
- * _ENTRY                      +       +       +       +
- * _INIT                       +       +       +       +
- * _EMPTY                      +       +       +       +
- * _FIRST                      +       +       +       +
- * _NEXT                       +       +       +       +
- * _PREV                       -       -       -       +
- * _LAST                       -       -       +       +
- * _FOREACH                    +       +       +       +
- * _FOREACH_SAFE               +       +       +       +
- * _FOREACH_REVERSE            -       -       -       +
- * _FOREACH_REVERSE_SAFE       -       -       -       +
- * _INSERT_HEAD                        +       +       +       +
- * _INSERT_BEFORE              -       +       -       +
- * _INSERT_AFTER               +       +       +       +
- * _INSERT_TAIL                        -       -       +       +
- * _CONCAT                     -       -       +       +
- * _REMOVE_AFTER               +       -       +       -
- * _REMOVE_HEAD                        +       -       +       -
- * _REMOVE                     +       +       +       +
- *
- */
-#ifdef QUEUE_MACRO_DEBUG
-/* Store the last 2 places the queue element or head was altered */
-struct qm_trace {
-       char * lastfile;
-       int lastline;
-       char * prevfile;
-       int prevline;
-};
-
-#define        TRACEBUF        struct qm_trace trace;
-#define        TRASHIT(x)      do {(x) = (void *)-1;} while (0)
-#define        QMD_SAVELINK(name, link)        void **name = (void *)&(link)
-
-#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
-#define        QMD_TRACE_ELEM(elem)
-#define        QMD_TRACE_HEAD(head)
-#define        QMD_SAVELINK(name, link)
-#define        TRACEBUF
-#define        TRASHIT(x)
-#endif /* QUEUE_MACRO_DEBUG */
-
-/*
- * Singly-linked List declarations.
- */
-#define        SLIST_HEAD(name, type)                                          \
-struct name {                                                          \
-       struct type *slh_first; /* first element */                     \
-}
-
-#define        SLIST_HEAD_INITIALIZER(head)                                    \
-       { NULL }
-
-#define        SLIST_ENTRY(type)                                               \
-struct {                                                               \
-       struct type *sle_next;  /* next element */                      \
-}
-
-/*
- * Singly-linked List functions.
- */
-#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_SAFE(var, head, field, tvar)                      \
-       for ((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 {                                                          \
-               struct 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)
-
-/*
- * 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_HEAD_INITIALIZER(head)                                   \
-       { NULL, &(head).stqh_first }
-
-#define        STAILQ_ENTRY(type)                                              \
-struct {                                                               \
-       struct 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_SAFE(var, head, field, tvar)                     \
-       for ((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 :                                                  \
-               ((struct type *)(void *)                                \
-               ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
-
-#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 {                                                          \
-               struct 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_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_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_SWAP(head1, head2, type) do {                           \
-       struct type *swap_first = STAILQ_FIRST(head1);                  \
-       struct 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)
-
-#define STAILQ_INSERT_CHAIN_HEAD(head, elm_chead, elm_ctail, field) do {   \
-    if ((STAILQ_NEXT(elm_ctail, field) = STAILQ_FIRST(head)) == NULL ) { \
-        (head)->stqh_last = &STAILQ_NEXT(elm_ctail, field);            \
-    }                                                                      \
-    STAILQ_FIRST(head) = (elm_chead);                                    \
-} while (0)
-
-
-/*
- * List declarations.
- */
-#define        LIST_HEAD(name, type)                                           \
-struct name {                                                          \
-       struct 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 */  \
-}
-
-/*
- * List functions.
- */
-
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#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)
-
-#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)
-
-#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_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_SAFE(var, head, field, tvar)                       \
-       for ((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_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 {                      \
-       struct 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_HEAD_INITIALIZER(head)                                    \
-       { NULL, &(head).tqh_first }
-
-#define        TAILQ_ENTRY(type)                                               \
-struct {                                                               \
-       struct type *tqe_next;  /* next element */                      \
-       struct type **tqe_prev; /* address of previous next element */  \
-       TRACEBUF                                                        \
-}
-
-/*
- * Tail queue functions.
- */
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#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)
-
-#define        QMD_TAILQ_CHECK_TAIL(head, field) do {                          \
-       if (*(head)->tqh_last != NULL)                                  \
-               panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head));  \
-} while (0)
-
-#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)
-
-#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_SAFE(var, head, field, tvar)                      \
-       for ((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_SAFE(var, head, headname, field, tvar)    \
-       for ((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))
-
-#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 {                     \
-       struct type *swap_first = (head1)->tqh_first;                   \
-       struct 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)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_SYS_QUEUE_H_ */
+#warning rom/queue.h is deprecated, please use sys/queue.h instead
+#include "sys/queue.h"
index 6d9d297746abe6408a848b507b57500fbf26ca8a..95ea54a7a572b2494a35cf4b4e197cae4b6c04dd 100644 (file)
@@ -1,220 +1,2 @@
-// Copyright 2010-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.
-
-#ifndef _ROM_RTC_H_
-#define _ROM_RTC_H_
-
-#include "ets_sys.h"
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "soc/soc.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
-  *     0x3ff61000(0x50000000)  Slow    SIZE_CP         Co-Processor code/Reset Entry
-  *     0x3ff61000+SIZE_CP      Slow    4096-SIZE_CP
-  *     0x3ff62800              Slow    4096            Reserved
-  *
-  *     0x3ff80000(0x400c0000)  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. The frequency must necessarily be even, otherwise there will be a conflict with the low bit, which is used to disable logs in the ROM code.
-  *     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
-
-#define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code.
-
-typedef enum {
-    AWAKE = 0,             //<CPU ON
-    LIGHT_SLEEP = BIT0,    //CPU waiti, PLL ON.  We don't need explicitly set this mode.
-    DEEP_SLEEP  = BIT1     //CPU OFF, PLL OFF, only specific timer could wake up
-} SLEEP_MODE;
-
-typedef enum {
-    NO_MEAN                =  0,
-    POWERON_RESET          =  1,    /**<1, Vbat power on reset*/
-    SW_RESET               =  3,    /**<3, Software reset digital core*/
-    OWDT_RESET             =  4,    /**<4, Legacy watch dog reset digital core*/
-    DEEPSLEEP_RESET        =  5,    /**<3, Deep Sleep reset digital core*/
-    SDIO_RESET             =  6,    /**<6, Reset by SLC module, reset digital core*/
-    TG0WDT_SYS_RESET       =  7,    /**<7, Timer Group0 Watch dog reset digital core*/
-    TG1WDT_SYS_RESET       =  8,    /**<8, Timer Group1 Watch dog reset digital core*/
-    RTCWDT_SYS_RESET       =  9,    /**<9, RTC Watch dog Reset digital core*/
-    INTRUSION_RESET        = 10,    /**<10, Instrusion tested to reset CPU*/
-    TGWDT_CPU_RESET        = 11,    /**<11, Time Group reset CPU*/
-    SW_CPU_RESET           = 12,    /**<12, Software reset CPU*/
-    RTCWDT_CPU_RESET       = 13,    /**<13, RTC Watch dog Reset CPU*/
-    EXT_CPU_RESET          = 14,    /**<14, for APP CPU, reseted by PRO CPU*/
-    RTCWDT_BROWN_OUT_RESET = 15,    /**<15, Reset when the vdd voltage is not stable*/
-    RTCWDT_RTC_RESET       = 16     /**<16, RTC Watch dog reset digital core and rtc module*/
-} RESET_REASON;
-
-typedef enum {
-    NO_SLEEP        = 0,
-    EXT_EVENT0_TRIG = BIT0,
-    EXT_EVENT1_TRIG = BIT1,
-    GPIO_TRIG       = BIT2,
-    TIMER_EXPIRE    = BIT3,
-    SDIO_TRIG       = BIT4,
-    MAC_TRIG        = BIT5,
-    UART0_TRIG      = BIT6,
-    UART1_TRIG      = BIT7,
-    TOUCH_TRIG      = BIT8,
-    SAR_TRIG        = BIT9,
-    BT_TRIG         = BIT10
-} WAKEUP_REASON;
-
-typedef enum {
-    DISEN_WAKEUP       = NO_SLEEP,
-    EXT_EVENT0_TRIG_EN = EXT_EVENT0_TRIG,
-    EXT_EVENT1_TRIG_EN = EXT_EVENT1_TRIG,
-    GPIO_TRIG_EN       = GPIO_TRIG,
-    TIMER_EXPIRE_EN    = TIMER_EXPIRE,
-    SDIO_TRIG_EN       = SDIO_TRIG,
-    MAC_TRIG_EN        = MAC_TRIG,
-    UART0_TRIG_EN      = UART0_TRIG,
-    UART1_TRIG_EN      = UART1_TRIG,
-    TOUCH_TRIG_EN      = TOUCH_TRIG,
-    SAR_TRIG_EN        = SAR_TRIG,
-    BT_TRIG_EN         = BT_TRIG
-} WAKEUP_ENABLE;
-
-typedef enum {
-    NO_INT             = 0,
-    WAKEUP_INT         = BIT0,
-    REJECT_INT         = BIT1,
-    SDIO_IDLE_INT      = BIT2,
-    RTC_WDT_INT        = BIT3,
-    RTC_TIME_VALID_INT = BIT4
-} RTC_INT_REASON;
-
-typedef enum {
-    DISEN_INT             = 0,
-    WAKEUP_INT_EN         = WAKEUP_INT,
-    REJECT_INT_EN         = REJECT_INT,
-    SDIO_IDLE_INT_EN      = SDIO_IDLE_INT,
-    RTC_WDT_INT_EN        = RTC_WDT_INT,
-    RTC_TIME_VALID_INT_EN = RTC_TIME_VALID_INT
-} RTC_INT_EN;
-
-/**
-  * @brief  Get the reset reason for CPU.
-  *
-  * @param  int cpu_no : CPU no.
-  *
-  * @return RESET_REASON
-  */
-RESET_REASON rtc_get_reset_reason(int cpu_no);
-
-/**
-  * @brief  Get the wakeup cause for CPU.
-  *
-  * @param  int cpu_no : CPU no.
-  *
-  * @return WAKEUP_REASON
-  */
-WAKEUP_REASON rtc_get_wakeup_cause(void);
-
-/**
-  * @brief Get CRC for Fast RTC Memory.
-  *
-  * @param  uint32_t start_addr : 0 - 0x7ff for Fast RTC Memory.
-  *
-  * @param  uint32_t crc_len : 0 - 0x7ff, 0 for 4 byte, 0x7ff for 0x2000 byte.
-  *
-  * @return uint32_t : CRC32 result
-  */
-uint32_t calc_rtc_memory_crc(uint32_t start_addr, uint32_t crc_len);
-
-/**
-  * @brief Set CRC of Fast RTC memory 0-0x7ff into RTC STORE7.
-  *
-  * @param  None
-  *
-  * @return None
-  */
-void set_rtc_memory_crc(void);
-
-/**
-  * @brief Software Reset digital core.
-  *
-  * It is not recommended to use this function in esp-idf, use
-  * esp_restart() instead.
-  *
-  * @param  None
-  *
-  * @return None
-  */
-void __attribute__((noreturn)) software_reset(void);
-
-/**
-  * @brief Software Reset digital core.
-  *
-  * It is not recommended to use this function in esp-idf, use
-  * esp_restart() instead.
-  *
-  * @param  int cpu_no : The CPU to reset, 0 for PRO CPU, 1 for APP CPU.
-  *
-  * @return None
-  */
-void software_reset_cpu(int cpu_no);
-
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_RTC_H_ */
-
+#warning rom/rtc.h is deprecated, please use esp32/rom/rtc.h instead
+#include "esp32/rom/rtc.h"
index bd4f32ed95e42639dc2199c94b77fbae5d4edccf..103958d95902cd5c0b19eba490a43aa2278d3e1d 100644 (file)
@@ -1,46 +1,2 @@
-// 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.
-
-#ifndef _ROM_SECURE_BOOT_H_
-#define _ROM_SECURE_BOOT_H_
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void ets_secure_boot_start(void);
-
-void ets_secure_boot_finish(void);
-
-void ets_secure_boot_hash(const uint32_t *buf);
-
-void ets_secure_boot_obtain(void);
-
-int ets_secure_boot_check(uint32_t *buf);
-
-void ets_secure_boot_rd_iv(uint32_t *buf);
-
-void ets_secure_boot_rd_abstract(uint32_t *buf);
-
-bool ets_secure_boot_check_start(uint8_t abs_index, uint32_t iv_addr);
-
-int ets_secure_boot_check_finish(uint32_t *abstract);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_SECURE_BOOT_H_ */
+#warning rom/secure_boot.h is deprecated, please use esp32/rom/secure_boot.h instead
+#include "esp32/rom/secure_boot.h"
index 5dd9c9981fb7cc23fbb7d31655442227549b2ee9..bd7b152d761e6255b8fc55db145ad045938df47b 100644 (file)
@@ -1,61 +1,2 @@
-/*
-  ROM functions for hardware SHA support.
-
-  It is not recommended to use these functions directly.  If using
-  them from esp-idf then use the esp_sha_lock_engine() and
-  esp_sha_lock_memory_block() functions in hwcrypto/sha.h to ensure
-  exclusive access.
- */
-// 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.
-#ifndef _ROM_SHA_H_
-#define _ROM_SHA_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct SHAContext {
-    bool start;
-    uint32_t total_input_bits[4];
-} SHA_CTX;
-
-enum SHA_TYPE {
-    SHA1 = 0,
-    SHA2_256,
-    SHA2_384,
-    SHA2_512,
-
-
-    SHA_INVALID = -1,
-};
-
-void ets_sha_init(SHA_CTX *ctx);
-
-void ets_sha_enable(void);
-
-void ets_sha_disable(void);
-
-void ets_sha_update(SHA_CTX *ctx, enum SHA_TYPE type, const uint8_t *input, size_t input_bits);
-
-void ets_sha_finish(SHA_CTX *ctx, enum SHA_TYPE type, uint8_t *output);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_SHA_H_ */
+#warning rom/sha.h is deprecated, please use esp32/rom/sha.h instead
+#include "esp32/rom/sha.h"
index cc9856f45550196346357b81815069f68d276c4d..f89834e002a86f09288c6df8474185a8a935ae89 100644 (file)
@@ -1,548 +1,2 @@
-// Copyright 2010-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.
-
-#ifndef _ROM_SPI_FLASH_H_
-#define _ROM_SPI_FLASH_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "esp_attr.h"
-
-#include "soc/spi_reg.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \defgroup spi_flash_apis, spi flash operation related apis
-  * @brief spi_flash apis
-  */
-
-/** @addtogroup spi_flash_apis
-  * @{
-  */
-
-/*************************************************************
- *                            Note
- *************************************************************
- * 1. ESP32 chip have 4 SPI slave/master, however, SPI0 is
- *    used as an SPI master to access Flash and ext-SRAM by
- *    Cache module. It will support Decryto read for Flash,
- *    read/write for ext-SRAM. And SPI1 is also used as an
- *    SPI master for Flash read/write and ext-SRAM read/write.
- *    It will support Encrypto write for Flash.
- * 2. As an SPI master, SPI support Highest clock to 80M,
- *    however, Flash with 80M Clock should be configured
- *    for different Flash chips. If you want to use 80M
- *    clock We should use the SPI that is certified by
- *    Espressif. However, the certification is not started
- *    at the time, so please use 40M clock at the moment.
- * 3. SPI Flash can use 2 lines or 4 lines mode. If you
- *    use 2 lines mode, you can save two pad SPIHD and
- *    SPIWP for gpio. ESP32 support configured SPI pad for
- *    Flash, the configuration is stored in efuse and flash.
- *    However, the configurations of pads should be certified
- *    by Espressif. If you use this function, please use 40M
- *    clock at the moment.
- * 4. ESP32 support to use Common SPI command to configure
- *    Flash to QIO mode, if you failed to configure with fix
- *    command. With Common SPI Command, ESP32 can also provide
- *    a way to use same Common SPI command groups on different
- *    Flash chips.
- * 5. This functions are not protected by packeting, Please use the
- *************************************************************
- */
-
-#define PERIPHS_SPI_FLASH_CMD                 SPI_CMD_REG(1)
-#define PERIPHS_SPI_FLASH_ADDR                SPI_ADDR_REG(1)
-#define PERIPHS_SPI_FLASH_CTRL                SPI_CTRL_REG(1)
-#define PERIPHS_SPI_FLASH_CTRL1               SPI_CTRL1_REG(1)
-#define PERIPHS_SPI_FLASH_STATUS              SPI_RD_STATUS_REG(1)
-#define PERIPHS_SPI_FLASH_USRREG              SPI_USER_REG(1)
-#define PERIPHS_SPI_FLASH_USRREG1             SPI_USER1_REG(1)
-#define PERIPHS_SPI_FLASH_USRREG2             SPI_USER2_REG(1)
-#define PERIPHS_SPI_FLASH_C0                  SPI_W0_REG(1)
-#define PERIPHS_SPI_FLASH_C1                  SPI_W1_REG(1)
-#define PERIPHS_SPI_FLASH_C2                  SPI_W2_REG(1)
-#define PERIPHS_SPI_FLASH_C3                  SPI_W3_REG(1)
-#define PERIPHS_SPI_FLASH_C4                  SPI_W4_REG(1)
-#define PERIPHS_SPI_FLASH_C5                  SPI_W5_REG(1)
-#define PERIPHS_SPI_FLASH_C6                  SPI_W6_REG(1)
-#define PERIPHS_SPI_FLASH_C7                  SPI_W7_REG(1)
-#define PERIPHS_SPI_FLASH_TX_CRC              SPI_TX_CRC_REG(1)
-
-#define SPI0_R_QIO_DUMMY_CYCLELEN             3
-#define SPI0_R_QIO_ADDR_BITSLEN               31
-#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             3
-#define SPI1_R_QIO_ADDR_BITSLEN               31
-#define SPI1_R_FAST_DUMMY_CYCLELEN            7
-#define SPI1_R_DIO_DUMMY_CYCLELEN             3
-#define SPI1_R_DIO_ADDR_BITSLEN               31
-#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_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   64
-#define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_BITS  0x3f
-
-//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);
-
-
-/** @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);
-
-/** @brief Global esp_rom_spiflash_chip_t structure used by ROM functions
- *
- */
-extern esp_rom_spiflash_chip_t g_rom_flashchip;
-
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_SPI_FLASH_H_ */
+#warning rom/spi_flash.h is deprecated, please use esp32/rom/spi_flash.h instead
+#include "esp32/rom/spi_flash.h"
index 891c2732a53db52768726e195c992d1159ef9365..e077fc458ef4dfa5a21d49be4ce4517336cce9a9 100644 (file)
@@ -1,27 +1,2 @@
-// 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.
-#ifndef _ROM_TBCONSOLE_H_
-#define _ROM_TBCONSOLE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void start_tb_console();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_TBCONSOLE_H_ */
+#warning rom/tbconsole.h is deprecated, please use esp32/rom/tbconsole.h instead
+#include "esp32/rom/tbconsole.h"
index 31fbc97cce995b32a2f9300d06eb6180fbdb2468..11baa03fb7a3353131c5ce2b57f64c473349006c 100644 (file)
@@ -1,99 +1,2 @@
-/*----------------------------------------------------------------------------/
-/ 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 */
+#warning rom/tjpgd.h is deprecated, please use esp32/rom/tjpgd.h instead
+#include "esp32/rom/tjpgd.h"
index a010bfbca471c2b640d50d5dcbc05ebd2d838ba7..97b2f1a2a5295ccde171cc9f97ada366ae42715d 100644 (file)
@@ -1,420 +1,2 @@
-// Copyright 2010-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.
-
-#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                     0x100
-#define TX_BUFF_SIZE                     100
-
-//uart int enable 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
-    uint8_t          tx_uart_no;
-    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  None
-  *
-  * @return None
-  */
-void uartAttach(void);
-
-/**
-  * @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.
-  */
-static inline void IRAM_ATTR uart_tx_wait_idle(uint8_t uart_no) {
-    uint32_t status;
-    do {
-        status = READ_PERI_REG(UART_STATUS_REG(uart_no));
-        /* either tx count or state is non-zero */
-    } while ((status & (UART_ST_UTX_OUT_M | UART_TXFIFO_CNT_M)) != 0);
-}
-
-/**
-  * @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, include '\0'.
-  *
-  * @return OK.
-  */
-STATUS UartRxString(uint8_t *pString, uint8_t MaxStrlen);
-
-/**
-  * @brief Process uart received 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);
-
-extern UartDevice UartDev;
-
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ROM_UART_H_ */
+#warning rom/uart.h is deprecated, please use esp32/rom/uart.h instead
+#include "esp32/rom/uart.h"
index 880d219a10c1b1eec5a2bd56046e8739595d77da..ff7288df967399a325c1ba4cf43f4bb7719a6a6c 100644 (file)
@@ -15,8 +15,8 @@
 
 #include <xtensa/config/core.h>
 
-#include "rom/rtc.h"
-#include "rom/uart.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/uart.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index cf122ae26567762f1e5cbe01820e10bd24b2517a..6dfe83795ce1e62daacc95acaa5685b5e40e68ad 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <sys/lock.h>
 
-#include "rom/ets_sys.h"
-#include "rom/rtc.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/rtc.h"
 #include "soc/rtc.h"
 #include "soc/dport_reg.h"
 
index bbd8f04d6d5b2c4afb0de218905acc8382d46da9..e45a352b62b884ebe4ce34c9c65a96af74926650 100644 (file)
@@ -17,7 +17,7 @@
 #include <sys/lock.h>
 #include "esp_pm.h"
 #include "esp_system.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "freertos/FreeRTOS.h"
 #include "pm_impl.h"
 #include "esp_timer.h"
index b43bc8bc70ac6c66584d4f079d3105f1e74877a3..8870fc2a7fbf7bc0093e08b2f49014ba21cc4087 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "esp_system.h"
 #include "esp_system_internal.h"
-#include "rom/rtc.h"
+#include "esp32/rom/rtc.h"
 #include "soc/rtc_cntl_reg.h"
 
 static void esp_reset_reason_clear_hint();
index 9bd754e8be8beb0294877766c89c81c3513fac73..8ee6f67fecb294ac757a53dbb54bb2a6102b9497 100644 (file)
@@ -22,9 +22,9 @@
 #include "esp32/clk.h"
 #include "esp_newlib.h"
 #include "esp_spi_flash.h"
-#include "rom/cache.h"
-#include "rom/rtc.h"
-#include "rom/uart.h"
+#include "esp32/rom/cache.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/uart.h"
 #include "soc/cpu.h"
 #include "soc/rtc.h"
 #include "soc/rtc_cntl_reg.h"
index ee60ab08ad8e8b7d1bff1763e1112847739b4060..d090c4e7ccd5c46e685c430b06331f8dde52a52b 100644 (file)
@@ -33,8 +33,8 @@ we add more types of external RAM memory, this can be made into a more intellige
 #include "esp_heap_caps_init.h"
 #include "soc/soc_memory_layout.h"
 #include "soc/dport_reg.h"
-#include "rom/cache.h"
 #include "esp32/himem.h"
+#include "esp32/rom/cache.h"
 
 #if CONFIG_FREERTOS_UNICORE
 #define PSRAM_MODE PSRAM_VADDR_MODE_NORMAL
index 0c07e4cb752e2462cda854ff518e409203a5fdc8..4e42ff0b8985e1636fdd407ea4a80ed3056ba41d 100644 (file)
 #include "esp_types.h"
 #include "esp_log.h"
 #include "spiram_psram.h"
-#include "rom/ets_sys.h"
-#include "rom/spi_flash.h"
-#include "rom/gpio.h"
-#include "rom/cache.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/spi_flash.h"
+#include "esp32/rom/gpio.h"
+#include "esp32/rom/cache.h"
 #include "soc/io_mux_reg.h"
 #include "soc/dport_reg.h"
 #include "soc/gpio_sig_map.h"
index f9f5239b1f1f440324b068e05005f75900546a3a..aaafb3edf411ef2ed00da080c7ac9a66ab90d6fa 100644 (file)
@@ -20,9 +20,9 @@
 #include "esp_wifi_internal.h"
 #include "esp_log.h"
 #include "sdkconfig.h"
-#include "rom/efuse.h"
-#include "rom/cache.h"
-#include "rom/uart.h"
+#include "esp32/rom/efuse.h"
+#include "esp32/rom/cache.h"
+#include "esp32/rom/uart.h"
 #include "soc/dport_reg.h"
 #include "soc/gpio_reg.h"
 #include "soc/efuse_reg.h"
index 003d58419e9d0ab01f523f0faeaa3659edc3cbc8..70383dd8390ab7014a4c72bc9cb696c0679f90c6 100644 (file)
@@ -11,8 +11,8 @@
 #include "soc/cpu.h"
 #include "unity.h"
 #include "test_utils.h"
-#include "rom/uart.h"
-#include "rom/sha.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/sha.h"
 #include "soc/uart_reg.h"
 #include "soc/dport_reg.h"
 #include "soc/rtc.h"
index d36d498b08bcecb2cdc052495266af3b792feb6a..c6bf622fba00dcdda4adc788bf74ee0b09657a88 100644 (file)
@@ -2,9 +2,9 @@
 #include <esp_types.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "rom/ets_sys.h"
-#include "rom/lldesc.h"
-#include "rom/gpio.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/lldesc.h"
+#include "esp32/rom/gpio.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index b32299ec857fddd2c7b0c50564b8fdee2c9b4f82..30d22302431731812f3574ae851b49a773732eaf 100644 (file)
@@ -3,7 +3,7 @@
 #include <time.h>
 #include <sys/time.h>
 #include "unity.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
index ab81d7230a0cdb166a02539d6a0f3c20a57fa49c..7fd30e4f52be8d8d4033a68c1b5a1137a3d94267 100644 (file)
@@ -10,7 +10,7 @@
 #include "soc/cpu.h"
 #include "unity.h"
 #include "test_utils.h"
-#include "rom/uart.h"
+#include "esp32/rom/uart.h"
 #include "soc/uart_reg.h"
 #include "soc/dport_reg.h"
 #include "soc/rtc.h"
index 33f633ff69ba7344b7c4996b37ab155e2217d904..7316966c84ce6b1912273907e27f629c45335f4a 100644 (file)
@@ -3,7 +3,7 @@
 #include <time.h>
 #include <sys/time.h>
 #include "unity.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
index dc5e5b312d2963d399903305da269cf55b5082c5..eb59a3a267ee91b4d2ad282da3b3ce45cb86054c 100644 (file)
@@ -1,7 +1,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 496d09588ffa7457414082e6a1bad807e497f9e4..5200a3b526351a8964f1b5d180ec7ce7d5689249 100644 (file)
@@ -5,7 +5,7 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "esp_system.h"
-#include "rom/cache.h"
+#include "esp32/rom/cache.h"
 #include "sdkconfig.h"
 #include "esp32/himem.h"
 
index f1313cff4c2b2a03110cddc407d9c7ead286c4b6..4439f9bcae8f01735e1fc9fb1cfcef88d246c4d3 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index d7d9dc33b63208738b5b16b596d05a1c27c71371..e4a6c9944580e0fc8a80197a5b646656e1c9ca68 100644 (file)
@@ -1,7 +1,7 @@
 
 
 #include <stdio.h>
-#include "rom/miniz.h"
+#include "esp32/rom/miniz.h"
 #include "unity.h"
 
 
index fa9715e722f9354dd161abe44676c50f43d6e062..a885c98bb91d8371227a84da029124689fa76a08 100644 (file)
@@ -4,7 +4,7 @@
 #include "esp_attr.h"
 #include "soc/rtc_cntl_reg.h"
 #include "driver/timer.h"
-#include "rom/rtc.h"
+#include "esp32/rom/rtc.h"
 
 #define RTC_BSS_ATTR __attribute__((section(".rtc.bss")))
 
index 57aad6ab626da091478b2a34a8b90ded730d6341..eebec796396222e16d4daba1931ef7dace46839f 100644 (file)
@@ -7,14 +7,14 @@
 #include "soc/gpio_reg.h"
 #include "soc/rtc.h"
 #include "soc/uart_reg.h"
-#include "rom/uart.h"
+#include "esp32/rom/uart.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
 #include "soc/rtc.h"            // for wakeup trigger defines
 #include "soc/rtc_cntl_reg.h"   // for read rtc registers directly (cause)
 #include "soc/soc.h"            // for direct register read macros
-#include "rom/rtc.h"
+#include "esp32/rom/rtc.h"
 #include "esp_newlib.h"
 #include "test_utils.h"
 #include "sdkconfig.h"
index 964ccde33d50eed2b1d672a25c1037b34ee48b27..a01d9bddd600130229bb5ae8a89af06740807282 100644 (file)
@@ -4,8 +4,7 @@ This code tests the interaction between PSRAM and SPI flash routines.
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
-
+#include "esp32/rom/ets_sys.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
@@ -18,7 +17,7 @@ This code tests the interaction between PSRAM and SPI flash routines.
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_heap_caps.h"
 #include "esp_spi_flash.h"
 #include "esp_partition.h"
@@ -162,7 +161,7 @@ IRAM_ATTR TEST_CASE("Spiram memcmp weirdness at 80MHz", "[spiram]") {
     assert(mem1);
     assert(mem2);
     for (int i=0; i<0x10000; i++) mem1[i]=i^0xAAAAAAAA;
-    
+
     for (int cycle=1; cycle<100; cycle++) {
         memcpy(mem2, mem1, 0x10000);
         if (memcmp(mem1, mem2, 0x10000)!=0) {
index 60c687f0799324bdf456faf9ec7ddf95ea634d63..82c147b11ee5560522fb3d8399a0a0bf28329863 100644 (file)
@@ -1,7 +1,7 @@
 
 
 #include <stdio.h>
-#include "rom/tjpgd.h"
+#include "esp32/rom/tjpgd.h"
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
index ff2660d1b2895ef6fff7ef9e6ba31d259bed198e..bff507848bfd19ecff054fd72b36baace9207b4d 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include "unity.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "soc/rtc_cntl_reg.h"
 #include "soc/sens_reg.h"
 
index f5788bff36dda7d3750c0f8cddea097e6f27190c..7e67a89f5d14a02484bbe0b736a8c1145f997f47 100644 (file)
@@ -3,9 +3,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "rom/ets_sys.h"
-#include "rom/lldesc.h"
-#include "rom/gpio.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/lldesc.h"
+#include "esp32/rom/gpio.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index bb5676bca75b9efe3d2c51dce3b2bcef113f6dba..1a08e7e48ff046a9c9cda654bfda9a43f2d9c6ff 100644 (file)
@@ -25,7 +25,7 @@
 #include "esp_eth.h"
 #include "esp_system.h"
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index c406937c965c399629563fe1108e6d2648cb5012..7463a92f59aeb30e3ad6f220ecb1f031ecdf8be3 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "tcpip_adapter.h"
 #include "lwip/sockets.h"
-#include "rom/md5_hash.h"
+#include "esp32/rom/md5_hash.h"
 #include "mbedtls/base64.h"
 
 #include "esp_system.h"
index 7c680daf7f3ebe32bb60a5d3c34558c58a8d404f..0a15372225b1692c2a79983f6c8cd6422d5941ca 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef _HTTP_HEADER_H_
 #define _HTTP_HEADER_H_
 
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "esp_err.h"
 
 #ifdef __cplusplus
diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt
new file mode 100644 (file)
index 0000000..47a3b3c
--- /dev/null
@@ -0,0 +1,31 @@
+if(BOOTLOADER_BUILD)
+    # For bootloader, all we need is headers
+    set(COMPONENT_ADD_INCLUDEDIRS "include")
+    set(COMPONENT_REQUIRES ${IDF_COMPONENTS})
+    set(COMPONENT_SRCS)
+    register_component()
+else()
+    # Regular app build
+    set(COMPONENT_SRCS "esp_rom.c")
+    set(COMPONENT_ADD_INCLUDEDIRS "include")
+
+    register_component()
+
+    target_linker_script(${COMPONENT_TARGET}
+                        "esp32/ld/esp32.rom.ld"
+                        "esp32/ld/esp32.rom.libgcc.ld")
+
+    if(CONFIG_SPIRAM_CACHE_WORKAROUND)
+        target_compile_options(${COMPONENT_TARGET} PUBLIC -mfix-esp32-psram-cache-issue)
+    else()
+        target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.spiram_incompatible_fns.ld")
+    endif()
+
+    if(CONFIG_NEWLIB_NANO_FORMAT)
+        target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.nanofmt.ld")
+    endif()
+
+    if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
+        target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.spiflash.ld")
+    endif()
+endif()
diff --git a/components/esp_rom/component.mk b/components/esp_rom/component.mk
new file mode 100644 (file)
index 0000000..9badd56
--- /dev/null
@@ -0,0 +1,23 @@
+#Linker scripts used to link the final application.
+#Warning: These linker scripts are only used when the normal app is compiled; the bootloader
+#specifies its own scripts.
+LINKER_SCRIPTS += esp32.rom.ld esp32.rom.libgcc.ld
+
+#SPI-RAM incompatible functions can be used in when the SPI RAM
+#workaround is not enabled.
+ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
+LINKER_SCRIPTS += esp32.rom.spiram_incompatible_fns.ld
+endif
+
+ifdef CONFIG_NEWLIB_NANO_FORMAT
+LINKER_SCRIPTS += esp32.rom.nanofmt.ld
+endif
+
+ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
+LINKER_SCRIPTS += esp32.rom.spiflash.ld
+endif
+
+COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH)/esp32/ld \
+                         $(addprefix -T ,$(LINKER_SCRIPTS)) \
+
+COMPONENT_ADD_LINKER_DEPS += $(addprefix esp32/ld/, $(LINKER_SCRIPTS))
diff --git a/components/esp_rom/esp_rom.c b/components/esp_rom/esp_rom.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/components/esp_rom/include/esp32/rom/aes.h b/components/esp_rom/include/esp32/rom/aes.h
new file mode 100644 (file)
index 0000000..80eca97
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+  ROM functions for hardware AES support.
+
+  It is not recommended to use these functions directly,
+  use the wrapper functions in hwcrypto/aes.h instead.
+
+ */
+// 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.
+
+#ifndef _ROM_AES_H_
+#define _ROM_AES_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//TODO, add comment for aes apis
+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);
+
+bool ets_aes_setkey_enc(const uint8_t *key, enum AES_BITS bits);
+
+bool ets_aes_setkey_dec(const uint8_t *key, enum AES_BITS bits);
+
+void ets_aes_crypt(const uint8_t input[16], uint8_t output[16]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_AES_H_ */
diff --git a/components/esp_rom/include/esp32/rom/bigint.h b/components/esp_rom/include/esp32/rom/bigint.h
new file mode 100644 (file)
index 0000000..97ad722
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+  ROM functions for hardware bigint support.
+
+  It is not recommended to use these functions directly,
+  use the wrapper functions in hwcrypto/mpi.h instead.
+
+ */
+// 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.
+
+#ifndef _ROM_BIGINT_H_
+#define _ROM_BIGINT_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//TODO: add comment here
+void ets_bigint_enable(void);
+
+void ets_bigint_disable(void);
+
+void ets_bigint_wait_finish(void);
+
+bool ets_bigint_mod_power_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
+                                  uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
+
+bool ets_bigint_mod_power_getz(uint32_t *z, uint32_t len);
+
+bool ets_bigint_mult_prepare(uint32_t *x, uint32_t *y, uint32_t len);
+
+bool ets_bigint_mult_getz(uint32_t *z, uint32_t len);
+
+bool ets_bigint_montgomery_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
+                                        uint32_t m_dash, uint32_t len, bool again);
+
+bool ets_bigint_montgomery_mult_getz(uint32_t *z, uint32_t len);
+
+bool ets_bigint_mod_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
+                                 uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
+
+bool ets_bigint_mod_mult_getz(uint32_t *m, uint32_t *z, uint32_t len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_BIGINT_H_ */
diff --git a/components/esp_rom/include/esp32/rom/cache.h b/components/esp_rom/include/esp32/rom/cache.h
new file mode 100644 (file)
index 0000000..4b923e6
--- /dev/null
@@ -0,0 +1,186 @@
+// 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.
+
+#ifndef _ROM_CACHE_H_
+#define _ROM_CACHE_H_
+
+#include "soc/dport_access.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \defgroup uart_apis, uart configuration and communication related apis
+  * @brief uart apis
+  */
+
+/** @addtogroup uart_apis
+  * @{
+  */
+
+/**
+  * @brief Initialise cache mmu, mark all entries as invalid.
+  *        Please do not call this function in your SDK application.
+  *
+  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
+  *
+  * @return None
+  */
+void mmu_init(int cpu_no);
+
+/**
+  * @brief Set Flash-Cache mmu mapping.
+  *        Please do not call this function in your SDK application.
+  *
+  * @param  int cpu_no : CPU number, 0 for PRO cpu, 1 for APP cpu.
+  *
+  * @param  int pod : process identifier. Range 0~7.
+  *
+  * @param  unsigned int vaddr : virtual address in CPU address space.
+  *                              Can be IRam0, IRam1, IRom0 and DRom0 memory address.
+  *                              Should be aligned by psize.
+  *
+  * @param  unsigned int paddr : physical address in Flash.
+  *                              Should be aligned by psize.
+  *
+  * @param  int psize : page size of flash, in kilobytes. Should be 64 here.
+  *
+  * @param  int num : pages to be set.
+  *
+  * @return unsigned int: error status
+  *                   0 : mmu set success
+  *                   1 : vaddr or paddr is not aligned
+  *                   2 : pid error
+  *                   3 : psize error
+  *                   4 : mmu table to be written is out of range
+  *                   5 : vaddr is out of range
+  */
+static inline unsigned int IRAM_ATTR cache_flash_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr,  int psize, int num)
+{
+    extern unsigned int cache_flash_mmu_set_rom(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr,  int psize, int num);
+
+    unsigned int ret;
+
+    DPORT_STALL_OTHER_CPU_START();
+    ret = cache_flash_mmu_set_rom(cpu_no, pid, vaddr, paddr, psize, num);
+    DPORT_STALL_OTHER_CPU_END();
+
+    return ret;
+}
+
+/**
+  * @brief Set Ext-SRAM-Cache mmu mapping.
+  *        Please do not call this function in your SDK application.
+  *
+  * Note that this code lives in IRAM and has a bugfix in respect to the ROM version
+  * of this function (which erroneously refused a vaddr > 2MiB
+  *
+  * @param  int cpu_no : CPU number, 0 for PRO cpu, 1 for APP cpu.
+  *
+  * @param  int pod : process identifier. Range 0~7.
+  *
+  * @param  unsigned int vaddr : virtual address in CPU address space.
+  *                              Can be IRam0, IRam1, IRom0 and DRom0 memory address.
+  *                              Should be aligned by psize.
+  *
+  * @param  unsigned int paddr : physical address in Ext-SRAM.
+  *                              Should be aligned by psize.
+  *
+  * @param  int psize : page size of flash, in kilobytes. Should be 32 here.
+  *
+  * @param  int num : pages to be set.
+  *
+  * @return unsigned int: error status
+  *                   0 : mmu set success
+  *                   1 : vaddr or paddr is not aligned
+  *                   2 : pid error
+  *                   3 : psize error
+  *                   4 : mmu table to be written is out of range
+  *                   5 : vaddr is out of range
+  */
+unsigned int IRAM_ATTR cache_sram_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr, int psize, int num);
+
+/**
+  * @brief Initialise cache access for the cpu.
+  *        Please do not call this function in your SDK application.
+  *
+  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
+  *
+  * @return None
+  */
+static inline void IRAM_ATTR Cache_Read_Init(int cpu_no)
+{
+    extern void Cache_Read_Init_rom(int cpu_no);
+    DPORT_STALL_OTHER_CPU_START();
+    Cache_Read_Init_rom(cpu_no);
+    DPORT_STALL_OTHER_CPU_END();
+}
+
+/**
+  * @brief Flush the cache value for the cpu.
+  *        Please do not call this function in your SDK application.
+  *
+  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
+  *
+  * @return None
+  */
+static inline void IRAM_ATTR Cache_Flush(int cpu_no)
+{
+    extern void Cache_Flush_rom(int cpu_no);
+    DPORT_STALL_OTHER_CPU_START();
+    Cache_Flush_rom(cpu_no);
+    DPORT_STALL_OTHER_CPU_END();
+}
+
+/**
+  * @brief Disable Cache access for the cpu.
+  *        Please do not call this function in your SDK application.
+  *
+  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
+  *
+  * @return None
+  */
+static inline void IRAM_ATTR Cache_Read_Disable(int cpu_no)
+{
+    extern void Cache_Read_Disable_rom(int cpu_no);
+    DPORT_STALL_OTHER_CPU_START();
+    Cache_Read_Disable_rom(cpu_no);
+    DPORT_STALL_OTHER_CPU_END();
+}
+
+/**
+  * @brief Enable Cache access for the cpu.
+  *        Please do not call this function in your SDK application.
+  *
+  * @param  int cpu_no : 0 for PRO cpu, 1 for APP cpu.
+  *
+  * @return None
+  */
+static inline void IRAM_ATTR Cache_Read_Enable(int cpu_no)
+{
+    extern void Cache_Read_Enable_rom(int cpu_no);
+    DPORT_STALL_OTHER_CPU_START();
+    Cache_Read_Enable_rom(cpu_no);
+    DPORT_STALL_OTHER_CPU_END();
+}
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_CACHE_H_ */
diff --git a/components/esp_rom/include/esp32/rom/crc.h b/components/esp_rom/include/esp32/rom/crc.h
new file mode 100644 (file)
index 0000000..faa1e8c
--- /dev/null
@@ -0,0 +1,160 @@
+// 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.
+
+#ifndef ROM_CRC_H
+#define ROM_CRC_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \defgroup uart_apis, uart configuration and communication related apis
+  * @brief uart apis
+  */
+
+/** @addtogroup uart_apis
+  * @{
+  */
+
+
+/*           Notes about CRC APIs usage
+ * The ESP32 ROM include some CRC tables and CRC APIs to speed up CRC calculation.
+ * The CRC APIs include CRC8, CRC16, CRC32 algorithms for both little endian and big endian modes.
+ * Here are the polynomials for the algorithms:
+ * CRC-8        x8+x2+x1+1                                              0x07
+ * CRC16-CCITT  x16+x12+x5+1                                            0x1021
+ * CRC32        x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x1+1     0x04c11db7
+ * 
+ * These group of CRC APIs are designed to calculate the data in buffers either continuous or not.
+ * To make it easy, we had added a `~` at the beginning and the end of the functions.
+ * To calculate non-continuous buffers, we can write the code like this:
+ *     init = ~init;
+ *     crc = crc32_le(init, buf0, length0);
+ *     crc = crc32_le(crc, buf1, length1);
+ *     crc = ~crc;
+ *
+ * However, it is not easy to select which API to use and give the correct parameters.
+ * A specific CRC algorithm will include this parameters: width, polynomials, init, refin, refout, xorout
+ *     refin and refout show the endian of the algorithm:
+ *         if both of them are true, please use the little endian API.
+ *         if both of them are false, please use the big endian API.
+ *     xorout is the value which you need to be xored to the raw result.
+ * However, these group of APIs need one '~' before and after the APIs.
+ *
+ * Here are some examples for CRC16:
+ * CRC-16/CCITT, poly = 0x1021, init = 0x0000, refin = true, refout = true, xorout = 0x0000
+ *     crc = ~crc16_le((uint16_t)~0x0000, buf, length);
+ * 
+ * CRC-16/CCITT-FALSE, poly = 0x1021, init = 0xffff, refin = false, refout = false, xorout = 0x0000
+ *     crc = ~crc16_be((uint16_t)~0xffff, buf, length);
+ *
+ * CRC-16/X25, poly = 0x1021, init = 0xffff, refin = true, refout = true, xorout = 0xffff
+ *     crc = (~crc16_le((uint16_t)~(0xffff), buf, length))^0xffff;
+ *
+ * CRC-16/XMODEM, poly= 0x1021, init = 0x0000, refin = false, refout = false, xorout = 0x0000
+ *     crc = ~crc16_be((uint16_t)~0x0000, buf, length);
+ *
+ *     
+ */
+
+/**
+  * @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/components/esp_rom/include/esp32/rom/efuse.h b/components/esp_rom/include/esp32/rom/efuse.h
new file mode 100644 (file)
index 0000000..337227a
--- /dev/null
@@ -0,0 +1,117 @@
+// 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.
+
+#ifndef _ROM_EFUSE_H_
+#define _ROM_EFUSE_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \defgroup efuse_APIs efuse APIs
+  * @brief     ESP32 efuse read/write APIs
+  * @attention
+  *
+  */
+
+/** @addtogroup efuse_APIs
+  * @{
+  */
+
+/**
+  * @brief  Do a efuse read operation, to update the efuse value to efuse read registers.
+  *
+  * @param  null
+  *
+  * @return null
+  */
+void ets_efuse_read_op(void);
+
+/**
+  * @brief  Do a efuse write operation, to update efuse write registers to efuse, then you need call ets_efuse_read_op again.
+  *
+  * @param  null
+  *
+  * @return null
+  */
+void ets_efuse_program_op(void);
+
+/**
+  * @brief  Read 8M Analog Clock value(8 bit) in efuse, the analog clock will not change with temperature.
+  *         It can be used to test the external xtal frequency, do not touch this efuse field.
+  *
+  * @param  null
+  *
+  * @return u32: 1 for 100KHZ, range is 0 to 255.
+  */
+uint32_t ets_efuse_get_8M_clock(void);
+
+/**
+  * @brief  Read spi flash pin 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);
+
+#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  A crc8 algorithm used in efuse check.
+  *
+  * @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/components/esp_rom/include/esp32/rom/ets_sys.h b/components/esp_rom/include/esp32/rom/ets_sys.h
new file mode 100644 (file)
index 0000000..3c34bbe
--- /dev/null
@@ -0,0 +1,645 @@
+// Copyright 2010-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.
+
+#ifndef _ROM_ETS_SYS_H_
+#define _ROM_ETS_SYS_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "soc/soc.h"
+
+#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 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);
+
+/**
+  * @brief  unpack the image in flash to iram and dram, no using cache.
+  *
+  * @param  uint32_t pos : Flash physical address.
+  *
+  * @param  uint32_t *entry_addr: the pointer of an variable that can store Entry code address.
+  *
+  * @param  bool jump : Jump into the code in the function or not.
+  *
+  * @param  bool config : Config the flash when unpacking the image, config should be done only once.
+  *
+  * @return ETS_OK     : unpack successful
+  * @return ETS_FAILED : unpack failed
+  */
+ETS_STATUS ets_unpack_flash_code_legacy(uint32_t pos, uint32_t *entry_addr, bool jump, bool config);
+
+/**
+  * @brief  unpack the image in flash to iram and dram, using cache, maybe decrypting.
+  *
+  * @param  uint32_t pos : Flash physical address.
+  *
+  * @param  uint32_t *entry_addr: the pointer of an variable that can store Entry code address.
+  *
+  * @param  bool jump : Jump into the code in the function or not.
+  *
+  * @param  bool sb_need_check : Do security boot check or not.
+  *
+  * @param  bool config : Config the flash when unpacking the image, config should be done only once.
+  *
+  * @return ETS_OK     : unpack successful
+  * @return ETS_FAILED : unpack failed
+  */
+ETS_STATUS ets_unpack_flash_code(uint32_t pos, uint32_t *entry_addr, bool jump, bool sb_need_check, bool config);
+
+/**
+  * @}
+  */
+
+/** \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  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/analog_8M*256 value calibrated in rtc module.
+  *
+  * @param  None
+  *
+  * @return uint32_t : xtal_freq/analog_8M*256.
+  */
+uint32_t ets_get_xtal_scale(void);
+
+/**
+  * @brief  Get xtal_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 if analog_8M in efuse
+  *                         clock = ets_get_xtal_scale() * 15625 * ets_efuse_get_8M_clock() / 40;
+  *                    else clock = 26M.
+  */
+uint32_t ets_get_detected_xtal_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);
+
+#define _ETSTR(v) # v
+#define _ETS_SET_INTLEVEL(intlevel)        ({ unsigned __tmp; \
+            __asm__ __volatile__(   "rsil   %0, " _ETSTR(intlevel) "\n" \
+                        : "=a" (__tmp) : : "memory" ); \
+            })
+
+#ifdef CONFIG_NONE_OS
+#define ETS_INTR_LOCK() \
+        ets_intr_lock()
+
+#define ETS_INTR_UNLOCK() \
+        ets_intr_unlock()
+
+#define ETS_ISR_ATTACH \
+        ets_isr_attach
+
+#define ETS_INTR_ENABLE(inum) \
+        ets_isr_unmask((1<<inum))
+
+#define ETS_INTR_DISABLE(inum) \
+        ets_isr_mask((1<<inum))
+
+#define ETS_WMAC_INTR_ATTACH(func, arg) \
+        ETS_ISR_ATTACH(ETS_WMAC_INUM, (func), (void *)(arg))
+
+#define ETS_TG0_T0_INTR_ATTACH(func, arg) \
+        ETS_ISR_ATTACH(ETS_TG0_T0_INUM, (func), (void *)(arg))
+
+#define ETS_GPIO_INTR_ATTACH(func, arg) \
+        ETS_ISR_ATTACH(ETS_GPIO_INUM, (func), (void *)(arg))
+
+#define ETS_UART0_INTR_ATTACH(func, arg) \
+        ETS_ISR_ATTACH(ETS_UART0_INUM, (func), (void *)(arg))
+
+#define ETS_WDT_INTR_ATTACH(func, arg) \
+        ETS_ISR_ATTACH(ETS_WDT_INUM, (func), (void *)(arg))
+
+#define ETS_SLC_INTR_ATTACH(func, arg) \
+        ETS_ISR_ATTACH(ETS_SLC_INUM, (func), (void *)(arg))
+
+#define ETS_BB_INTR_ENABLE() \
+        ETS_INTR_ENABLE(ETS_BB_INUM)
+
+#define ETS_BB_INTR_DISABLE() \
+        ETS_INTR_DISABLE(ETS_BB_INUM)
+
+#define ETS_UART0_INTR_ENABLE() \
+        ETS_INTR_ENABLE(ETS_UART0_INUM)
+
+#define ETS_UART0_INTR_DISABLE() \
+        ETS_INTR_DISABLE(ETS_UART0_INUM)
+
+#define ETS_GPIO_INTR_ENABLE() \
+        ETS_INTR_ENABLE(ETS_GPIO_INUM)
+
+#define ETS_GPIO_INTR_DISABLE() \
+        ETS_INTR_DISABLE(ETS_GPIO_INUM)
+
+#define ETS_WDT_INTR_ENABLE() \
+        ETS_INTR_ENABLE(ETS_WDT_INUM)
+
+#define ETS_WDT_INTR_DISABLE() \
+        ETS_INTR_DISABLE(ETS_WDT_INUM)
+
+#define ETS_TG0_T0_INTR_ENABLE() \
+        ETS_INTR_ENABLE(ETS_TG0_T0_INUM)
+
+#define ETS_TG0_T0_INTR_DISABLE() \
+        ETS_INTR_DISABLE(ETS_TG0_T0_INUM)
+
+#define ETS_SLC_INTR_ENABLE() \
+        ETS_INTR_ENABLE(ETS_SLC_INUM)
+
+#define ETS_SLC_INTR_DISABLE() \
+        ETS_INTR_DISABLE(ETS_SLC_INUM)
+#endif
+
+/**
+  * @}
+  */
+
+#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/components/esp_rom/include/esp32/rom/gpio.h b/components/esp_rom/include/esp32/rom/gpio.h
new file mode 100644 (file)
index 0000000..f98d6cf
--- /dev/null
@@ -0,0 +1,303 @@
+// Copyright 2010-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.
+
+#ifndef _ROM_GPIO_H_
+#define _ROM_GPIO_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "esp_attr.h"
+#include "soc/gpio_reg.h"
+#include "soc/gpio_pins.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                0x30
+
+#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, (bit_value ? 0 : 1)<<gpio_no, 1<<gpio_no,0) : \
+                         gpio_output_set_high(bit_value<<(gpio_no - 32), (bit_value ? 0 : 1)<<(gpio_no - 32), 1<<(gpio_no -32),0))
+#define GPIO_DIS_OUTPUT(gpio_no)    ((gpio_no < 32) ? gpio_output_set(0,0,0, 1<<gpio_no) : gpio_output_set_high(0,0,0, 1<<(gpio_no - 32)))
+#define GPIO_INPUT_GET(gpio_no)     ((gpio_no < 32) ? ((gpio_input_get()>>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~0x27
+  *                        gpio == 0x30, input 0 to signal
+  *                        gpio == 0x34, ???
+  *                        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~0x27
+  *
+  * @param uint32_t signal_idx : signal index.
+  *                        signal_idx == 0x100, cancel output put to the gpio
+  *
+  * @param bool out_inv : the signal output is inv or not
+  *
+  * @param bool oen_inv : the signal output enable is inv 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~0x27
+  *
+  * @return None
+  */
+void gpio_pad_select_gpio(uint8_t gpio_num);
+
+/**
+  * @brief Set pad driver capability.
+  *
+  * @param uint32_t gpio_num : gpio number, 0~0x27
+  *
+  * @param uint8_t drv : 0-3
+  *
+  * @return None
+  */
+void gpio_pad_set_drv(uint8_t gpio_num, uint8_t drv);
+
+/**
+  * @brief Pull up the pad from gpio number.
+  *
+  * @param uint32_t gpio_num : gpio number, 0~0x27
+  *
+  * @return None
+  */
+void gpio_pad_pullup(uint8_t gpio_num);
+
+/**
+  * @brief Pull down the pad from gpio number.
+  *
+  * @param uint32_t gpio_num : gpio number, 0~0x27
+  *
+  * @return None
+  */
+void gpio_pad_pulldown(uint8_t gpio_num);
+
+/**
+  * @brief Unhold the pad from gpio number.
+  *
+  * @param uint32_t gpio_num : gpio number, 0~0x27
+  *
+  * @return None
+  */
+void gpio_pad_unhold(uint8_t gpio_num);
+
+/**
+  * @brief Hold the pad from gpio number.
+  *
+  * @param uint32_t gpio_num : gpio number, 0~0x27
+  *
+  * @return None
+  */
+void gpio_pad_hold(uint8_t gpio_num);
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_GPIO_H_ */
diff --git a/components/esp_rom/include/esp32/rom/libc_stubs.h b/components/esp_rom/include/esp32/rom/libc_stubs.h
new file mode 100644 (file)
index 0000000..47e75bc
--- /dev/null
@@ -0,0 +1,89 @@
+// 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.
+#ifndef _ROM_LIBC_STUBS_H_
+#define _ROM_LIBC_STUBS_H_
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <reent.h>
+#include <errno.h>
+
+#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. There are two pointers, `syscall_table_ptr_pro` and
+`syscall_table_ptr_app`, which can be set to point to the locations of syscall tables of CPU 0 (aka PRO CPU)
+and CPU 1 (aka APP CPU). Location of these pointers in .bss segment of ROM code is defined in linker script.
+
+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); /* function signature is incorrect in ROM */
+    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);
+    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);
+    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);
+};
+
+extern struct syscall_stub_table* syscall_table_ptr_pro;
+extern struct syscall_stub_table* syscall_table_ptr_app;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* _ROM_LIBC_STUBS_H_ */
diff --git a/components/esp_rom/include/esp32/rom/lldesc.h b/components/esp_rom/include/esp32/rom/lldesc.h
new file mode 100644 (file)
index 0000000..ae5b416
--- /dev/null
@@ -0,0 +1,176 @@
+// Copyright 2010-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.
+
+#ifndef _ROM_LLDESC_H_
+#define _ROM_LLDESC_H_
+
+#include <stdint.h>
+
+#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 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/components/esp_rom/include/esp32/rom/md5_hash.h b/components/esp_rom/include/esp32/rom/md5_hash.h
new file mode 100644 (file)
index 0000000..f116f1e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * MD5 internal definitions
+ * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
+ *
+ * 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 <stdint.h>
+
+#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/components/esp_rom/include/esp32/rom/miniz.h b/components/esp_rom/include/esp32/rom/miniz.h
new file mode 100644 (file)
index 0000000..ed79beb
--- /dev/null
@@ -0,0 +1,777 @@
+#ifndef MINIZ_HEADER_INCLUDED
+#define MINIZ_HEADER_INCLUDED
+
+#include <stdlib.h>
+
+// 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 <time.h>
+#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/components/esp_rom/include/esp32/rom/rtc.h b/components/esp_rom/include/esp32/rom/rtc.h
new file mode 100644 (file)
index 0000000..6d9d297
--- /dev/null
@@ -0,0 +1,220 @@
+// Copyright 2010-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.
+
+#ifndef _ROM_RTC_H_
+#define _ROM_RTC_H_
+
+#include "ets_sys.h"
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "soc/soc.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
+  *     0x3ff61000(0x50000000)  Slow    SIZE_CP         Co-Processor code/Reset Entry
+  *     0x3ff61000+SIZE_CP      Slow    4096-SIZE_CP
+  *     0x3ff62800              Slow    4096            Reserved
+  *
+  *     0x3ff80000(0x400c0000)  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. The frequency must necessarily be even, otherwise there will be a conflict with the low bit, which is used to disable logs in the ROM code.
+  *     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
+
+#define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code.
+
+typedef enum {
+    AWAKE = 0,             //<CPU ON
+    LIGHT_SLEEP = BIT0,    //CPU waiti, PLL ON.  We don't need explicitly set this mode.
+    DEEP_SLEEP  = BIT1     //CPU OFF, PLL OFF, only specific timer could wake up
+} SLEEP_MODE;
+
+typedef enum {
+    NO_MEAN                =  0,
+    POWERON_RESET          =  1,    /**<1, Vbat power on reset*/
+    SW_RESET               =  3,    /**<3, Software reset digital core*/
+    OWDT_RESET             =  4,    /**<4, Legacy watch dog reset digital core*/
+    DEEPSLEEP_RESET        =  5,    /**<3, Deep Sleep reset digital core*/
+    SDIO_RESET             =  6,    /**<6, Reset by SLC module, reset digital core*/
+    TG0WDT_SYS_RESET       =  7,    /**<7, Timer Group0 Watch dog reset digital core*/
+    TG1WDT_SYS_RESET       =  8,    /**<8, Timer Group1 Watch dog reset digital core*/
+    RTCWDT_SYS_RESET       =  9,    /**<9, RTC Watch dog Reset digital core*/
+    INTRUSION_RESET        = 10,    /**<10, Instrusion tested to reset CPU*/
+    TGWDT_CPU_RESET        = 11,    /**<11, Time Group reset CPU*/
+    SW_CPU_RESET           = 12,    /**<12, Software reset CPU*/
+    RTCWDT_CPU_RESET       = 13,    /**<13, RTC Watch dog Reset CPU*/
+    EXT_CPU_RESET          = 14,    /**<14, for APP CPU, reseted by PRO CPU*/
+    RTCWDT_BROWN_OUT_RESET = 15,    /**<15, Reset when the vdd voltage is not stable*/
+    RTCWDT_RTC_RESET       = 16     /**<16, RTC Watch dog reset digital core and rtc module*/
+} RESET_REASON;
+
+typedef enum {
+    NO_SLEEP        = 0,
+    EXT_EVENT0_TRIG = BIT0,
+    EXT_EVENT1_TRIG = BIT1,
+    GPIO_TRIG       = BIT2,
+    TIMER_EXPIRE    = BIT3,
+    SDIO_TRIG       = BIT4,
+    MAC_TRIG        = BIT5,
+    UART0_TRIG      = BIT6,
+    UART1_TRIG      = BIT7,
+    TOUCH_TRIG      = BIT8,
+    SAR_TRIG        = BIT9,
+    BT_TRIG         = BIT10
+} WAKEUP_REASON;
+
+typedef enum {
+    DISEN_WAKEUP       = NO_SLEEP,
+    EXT_EVENT0_TRIG_EN = EXT_EVENT0_TRIG,
+    EXT_EVENT1_TRIG_EN = EXT_EVENT1_TRIG,
+    GPIO_TRIG_EN       = GPIO_TRIG,
+    TIMER_EXPIRE_EN    = TIMER_EXPIRE,
+    SDIO_TRIG_EN       = SDIO_TRIG,
+    MAC_TRIG_EN        = MAC_TRIG,
+    UART0_TRIG_EN      = UART0_TRIG,
+    UART1_TRIG_EN      = UART1_TRIG,
+    TOUCH_TRIG_EN      = TOUCH_TRIG,
+    SAR_TRIG_EN        = SAR_TRIG,
+    BT_TRIG_EN         = BT_TRIG
+} WAKEUP_ENABLE;
+
+typedef enum {
+    NO_INT             = 0,
+    WAKEUP_INT         = BIT0,
+    REJECT_INT         = BIT1,
+    SDIO_IDLE_INT      = BIT2,
+    RTC_WDT_INT        = BIT3,
+    RTC_TIME_VALID_INT = BIT4
+} RTC_INT_REASON;
+
+typedef enum {
+    DISEN_INT             = 0,
+    WAKEUP_INT_EN         = WAKEUP_INT,
+    REJECT_INT_EN         = REJECT_INT,
+    SDIO_IDLE_INT_EN      = SDIO_IDLE_INT,
+    RTC_WDT_INT_EN        = RTC_WDT_INT,
+    RTC_TIME_VALID_INT_EN = RTC_TIME_VALID_INT
+} RTC_INT_EN;
+
+/**
+  * @brief  Get the reset reason for CPU.
+  *
+  * @param  int cpu_no : CPU no.
+  *
+  * @return RESET_REASON
+  */
+RESET_REASON rtc_get_reset_reason(int cpu_no);
+
+/**
+  * @brief  Get the wakeup cause for CPU.
+  *
+  * @param  int cpu_no : CPU no.
+  *
+  * @return WAKEUP_REASON
+  */
+WAKEUP_REASON rtc_get_wakeup_cause(void);
+
+/**
+  * @brief Get CRC for Fast RTC Memory.
+  *
+  * @param  uint32_t start_addr : 0 - 0x7ff for Fast RTC Memory.
+  *
+  * @param  uint32_t crc_len : 0 - 0x7ff, 0 for 4 byte, 0x7ff for 0x2000 byte.
+  *
+  * @return uint32_t : CRC32 result
+  */
+uint32_t calc_rtc_memory_crc(uint32_t start_addr, uint32_t crc_len);
+
+/**
+  * @brief Set CRC of Fast RTC memory 0-0x7ff into RTC STORE7.
+  *
+  * @param  None
+  *
+  * @return None
+  */
+void set_rtc_memory_crc(void);
+
+/**
+  * @brief Software Reset digital core.
+  *
+  * It is not recommended to use this function in esp-idf, use
+  * esp_restart() instead.
+  *
+  * @param  None
+  *
+  * @return None
+  */
+void __attribute__((noreturn)) software_reset(void);
+
+/**
+  * @brief Software Reset digital core.
+  *
+  * It is not recommended to use this function in esp-idf, use
+  * esp_restart() instead.
+  *
+  * @param  int cpu_no : The CPU to reset, 0 for PRO CPU, 1 for APP CPU.
+  *
+  * @return None
+  */
+void software_reset_cpu(int cpu_no);
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_RTC_H_ */
+
diff --git a/components/esp_rom/include/esp32/rom/secure_boot.h b/components/esp_rom/include/esp32/rom/secure_boot.h
new file mode 100644 (file)
index 0000000..bd4f32e
--- /dev/null
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef _ROM_SECURE_BOOT_H_
+#define _ROM_SECURE_BOOT_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ets_secure_boot_start(void);
+
+void ets_secure_boot_finish(void);
+
+void ets_secure_boot_hash(const uint32_t *buf);
+
+void ets_secure_boot_obtain(void);
+
+int ets_secure_boot_check(uint32_t *buf);
+
+void ets_secure_boot_rd_iv(uint32_t *buf);
+
+void ets_secure_boot_rd_abstract(uint32_t *buf);
+
+bool ets_secure_boot_check_start(uint8_t abs_index, uint32_t iv_addr);
+
+int ets_secure_boot_check_finish(uint32_t *abstract);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_SECURE_BOOT_H_ */
diff --git a/components/esp_rom/include/esp32/rom/sha.h b/components/esp_rom/include/esp32/rom/sha.h
new file mode 100644 (file)
index 0000000..5dd9c99
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+  ROM functions for hardware SHA support.
+
+  It is not recommended to use these functions directly.  If using
+  them from esp-idf then use the esp_sha_lock_engine() and
+  esp_sha_lock_memory_block() functions in hwcrypto/sha.h to ensure
+  exclusive access.
+ */
+// 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.
+#ifndef _ROM_SHA_H_
+#define _ROM_SHA_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct SHAContext {
+    bool start;
+    uint32_t total_input_bits[4];
+} SHA_CTX;
+
+enum SHA_TYPE {
+    SHA1 = 0,
+    SHA2_256,
+    SHA2_384,
+    SHA2_512,
+
+
+    SHA_INVALID = -1,
+};
+
+void ets_sha_init(SHA_CTX *ctx);
+
+void ets_sha_enable(void);
+
+void ets_sha_disable(void);
+
+void ets_sha_update(SHA_CTX *ctx, enum SHA_TYPE type, const uint8_t *input, size_t input_bits);
+
+void ets_sha_finish(SHA_CTX *ctx, enum SHA_TYPE type, uint8_t *output);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_SHA_H_ */
diff --git a/components/esp_rom/include/esp32/rom/spi_flash.h b/components/esp_rom/include/esp32/rom/spi_flash.h
new file mode 100644 (file)
index 0000000..cc9856f
--- /dev/null
@@ -0,0 +1,548 @@
+// Copyright 2010-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.
+
+#ifndef _ROM_SPI_FLASH_H_
+#define _ROM_SPI_FLASH_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "esp_attr.h"
+
+#include "soc/spi_reg.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \defgroup spi_flash_apis, spi flash operation related apis
+  * @brief spi_flash apis
+  */
+
+/** @addtogroup spi_flash_apis
+  * @{
+  */
+
+/*************************************************************
+ *                            Note
+ *************************************************************
+ * 1. ESP32 chip have 4 SPI slave/master, however, SPI0 is
+ *    used as an SPI master to access Flash and ext-SRAM by
+ *    Cache module. It will support Decryto read for Flash,
+ *    read/write for ext-SRAM. And SPI1 is also used as an
+ *    SPI master for Flash read/write and ext-SRAM read/write.
+ *    It will support Encrypto write for Flash.
+ * 2. As an SPI master, SPI support Highest clock to 80M,
+ *    however, Flash with 80M Clock should be configured
+ *    for different Flash chips. If you want to use 80M
+ *    clock We should use the SPI that is certified by
+ *    Espressif. However, the certification is not started
+ *    at the time, so please use 40M clock at the moment.
+ * 3. SPI Flash can use 2 lines or 4 lines mode. If you
+ *    use 2 lines mode, you can save two pad SPIHD and
+ *    SPIWP for gpio. ESP32 support configured SPI pad for
+ *    Flash, the configuration is stored in efuse and flash.
+ *    However, the configurations of pads should be certified
+ *    by Espressif. If you use this function, please use 40M
+ *    clock at the moment.
+ * 4. ESP32 support to use Common SPI command to configure
+ *    Flash to QIO mode, if you failed to configure with fix
+ *    command. With Common SPI Command, ESP32 can also provide
+ *    a way to use same Common SPI command groups on different
+ *    Flash chips.
+ * 5. This functions are not protected by packeting, Please use the
+ *************************************************************
+ */
+
+#define PERIPHS_SPI_FLASH_CMD                 SPI_CMD_REG(1)
+#define PERIPHS_SPI_FLASH_ADDR                SPI_ADDR_REG(1)
+#define PERIPHS_SPI_FLASH_CTRL                SPI_CTRL_REG(1)
+#define PERIPHS_SPI_FLASH_CTRL1               SPI_CTRL1_REG(1)
+#define PERIPHS_SPI_FLASH_STATUS              SPI_RD_STATUS_REG(1)
+#define PERIPHS_SPI_FLASH_USRREG              SPI_USER_REG(1)
+#define PERIPHS_SPI_FLASH_USRREG1             SPI_USER1_REG(1)
+#define PERIPHS_SPI_FLASH_USRREG2             SPI_USER2_REG(1)
+#define PERIPHS_SPI_FLASH_C0                  SPI_W0_REG(1)
+#define PERIPHS_SPI_FLASH_C1                  SPI_W1_REG(1)
+#define PERIPHS_SPI_FLASH_C2                  SPI_W2_REG(1)
+#define PERIPHS_SPI_FLASH_C3                  SPI_W3_REG(1)
+#define PERIPHS_SPI_FLASH_C4                  SPI_W4_REG(1)
+#define PERIPHS_SPI_FLASH_C5                  SPI_W5_REG(1)
+#define PERIPHS_SPI_FLASH_C6                  SPI_W6_REG(1)
+#define PERIPHS_SPI_FLASH_C7                  SPI_W7_REG(1)
+#define PERIPHS_SPI_FLASH_TX_CRC              SPI_TX_CRC_REG(1)
+
+#define SPI0_R_QIO_DUMMY_CYCLELEN             3
+#define SPI0_R_QIO_ADDR_BITSLEN               31
+#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             3
+#define SPI1_R_QIO_ADDR_BITSLEN               31
+#define SPI1_R_FAST_DUMMY_CYCLELEN            7
+#define SPI1_R_DIO_DUMMY_CYCLELEN             3
+#define SPI1_R_DIO_ADDR_BITSLEN               31
+#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_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   64
+#define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_BITS  0x3f
+
+//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);
+
+
+/** @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);
+
+/** @brief Global esp_rom_spiflash_chip_t structure used by ROM functions
+ *
+ */
+extern esp_rom_spiflash_chip_t g_rom_flashchip;
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_SPI_FLASH_H_ */
diff --git a/components/esp_rom/include/esp32/rom/tbconsole.h b/components/esp_rom/include/esp32/rom/tbconsole.h
new file mode 100644 (file)
index 0000000..891c273
--- /dev/null
@@ -0,0 +1,27 @@
+// 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.
+#ifndef _ROM_TBCONSOLE_H_
+#define _ROM_TBCONSOLE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void start_tb_console();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_TBCONSOLE_H_ */
diff --git a/components/esp_rom/include/esp32/rom/tjpgd.h b/components/esp_rom/include/esp32/rom/tjpgd.h
new file mode 100644 (file)
index 0000000..31fbc97
--- /dev/null
@@ -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/components/esp_rom/include/esp32/rom/uart.h b/components/esp_rom/include/esp32/rom/uart.h
new file mode 100644 (file)
index 0000000..a010bfb
--- /dev/null
@@ -0,0 +1,420 @@
+// Copyright 2010-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.
+
+#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                     0x100
+#define TX_BUFF_SIZE                     100
+
+//uart int enable 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
+    uint8_t          tx_uart_no;
+    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  None
+  *
+  * @return None
+  */
+void uartAttach(void);
+
+/**
+  * @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.
+  */
+static inline void IRAM_ATTR uart_tx_wait_idle(uint8_t uart_no) {
+    uint32_t status;
+    do {
+        status = READ_PERI_REG(UART_STATUS_REG(uart_no));
+        /* either tx count or state is non-zero */
+    } while ((status & (UART_ST_UTX_OUT_M | UART_TXFIFO_CNT_M)) != 0);
+}
+
+/**
+  * @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, include '\0'.
+  *
+  * @return OK.
+  */
+STATUS UartRxString(uint8_t *pString, uint8_t MaxStrlen);
+
+/**
+  * @brief Process uart received 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);
+
+extern UartDevice UartDev;
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ROM_UART_H_ */
index 7e00c1b40b5694098af5aa99b0115c59dd996344..762db19939cf4376e0423b3b48a5537d03d7af8b 100644 (file)
@@ -13,7 +13,7 @@
 // limitations under the License.
 #include <string.h>
 #include <stdbool.h>
-#include "rom/crc.h"
+#include "esp32/rom/crc.h"
 #include "esp_panic.h"
 #include "esp_partition.h"
 #include "esp_core_dump_priv.h"
index 0aa23e96632cae507b862af7eeed27e5e9809cfa..dd48d5ba8eee7e3408a1b7f0baaee7f3ff478016 100644 (file)
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 #include <string.h>
-#include "rom/crc.h"
+#include "esp32/rom/crc.h"
 #include "esp_partition.h"
 #include "esp_core_dump_priv.h"
 
index e0269a48957da48ed0afe9010e58cf86c85e13c9..162f7eb73131d898fc052c3f7cadc2d5faec0fce 100644 (file)
@@ -15,8 +15,8 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "rom/ets_sys.h"
-#include "rom/gpio.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/gpio.h"
 
 #include "soc/dport_reg.h"
 #include "soc/io_mux_reg.h"
index dc9a42b887d59be7715732992c7c706767a93602..2b78663f943c8c9ffd3b05b42682bef49d696c53 100644 (file)
@@ -16,8 +16,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "rom/ets_sys.h"
-#include "rom/gpio.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/gpio.h"
 #include "soc/dport_reg.h"
 #include "soc/io_mux_reg.h"
 #include "soc/rtc.h"
index 3b540728a64433b75d6c6a3afe8292afbfc92a44..0468a474be7189fd320bbb4355897050ff429ecf 100644 (file)
@@ -21,7 +21,7 @@
 #include "esp_eth.h"
 #include "unity.h"
 
-#include "rom/gpio.h"
+#include "esp32/rom/gpio.h"
 
 #include "tcpip_adapter.h"
 #include "driver/gpio.h"
index 26714857717899c3fe5c4cbeb9443956b0b9c5c5..7356568d80f36293532e3d96c0a30aa53d7d96fd 100644 (file)
@@ -5,7 +5,7 @@ SOURCE_FILES := \
        ffsystem.c \
        ffunicode.c \
        diskio_wl.c \
-       ) 
+       )
 
 INCLUDE_DIRS := \
        . \
@@ -21,6 +21,7 @@ INCLUDE_DIRS := \
        vfs/include \
        ) \
        $(addprefix ../../../components/, \
+       esp_rom/include \
        soc/esp32/include \
        esp32/include \
        bootloader_support/include \
index cc6cdad90b9f789b43bc8899f0e299717d09060e..931264bf6c730ceab6be2f59a8560ee77886d046 100644 (file)
@@ -117,7 +117,7 @@ int xt_clock_freq(void) __attribute__((deprecated));
 /* configASSERT behaviour */
 #ifndef __ASSEMBLER__
 #include <stdlib.h> /* for abort() */
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
 #define configASSERT(a) /* assertions disabled */
index 58b12338d76cb7eb9077e2bfe8b7341c3bc98ddf..4b6b7c09367f38f1005ccc3c9b2d12300660658b 100644 (file)
@@ -97,7 +97,7 @@
 
 #include "xtensa_rtos.h"
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "soc/cpu.h"
 
 #include "FreeRTOS.h"
index eccd1a016a407c6c48a2b26277aa872e8ef1bdf3..0107bbc10aa1296ba3dabfd45cf4c033cd361583 100644 (file)
@@ -79,7 +79,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
 all the API functions to use the MPU wrappers.  That should only be done when
index 06ec1db684836b33eb3d82edc7d92ee522e3efd3..0fd71afacbddb007ac5b7af2bb7d1d5295429a1d 100644 (file)
@@ -76,7 +76,7 @@ all the API functions to use the MPU wrappers.  That should only be done when
 task.h is included from an application file. */
 #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "esp_newlib.h"
 #include "esp_panic.h"
 
index 1f9b159d068c3d9b414e1ce97c3f8ecf890a9495..b56bd9d109ce5a613ebf9f6cbca44f26d8fe4756 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 085e60ddb0cfdf6e68b25d0635cc06f048b77ea2..ff8bf27d5ee9af7ed218322e85ed95b50d1b9df4 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index f97efeb495c8b2259d683d1de77804c641b9950b..fa40f417a54a7a1af8b0a19ed614ca97b9446212 100644 (file)
@@ -17,7 +17,7 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "esp_heap_caps.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "unity.h"
 #include "test_utils.h"
index 17346a6979fe9b9849f077f53a294209ee84f665..4719d40bdc4384de3330107d8617ccb750cc1a12 100644 (file)
@@ -5,7 +5,7 @@
 #include <esp_types.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 6297d80c0ef9149d372d0f7e4249687bbca1d6f5..336bfea37dcbd574b4cd823e659e89de66809e6e 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 796827730a4db5ec10f1541a7986d915d1aea684..80713b2d6b8afdd190cb108118abc728c7f500eb 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 7703b11753645764b30dc1657bfb46856481f47c..f64ca26047996906dcfa8e234ebc3009664c972d 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 856096d55e8d7ec7a53d71cc98c37c27063dc10c..03979f48a50bc61e5c9fb4e72445482f34a6d339 100644 (file)
@@ -34,7 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "freertos/xtensa_api.h"
 #include "freertos/portable.h"
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #if XCHAL_HAVE_EXCEPTIONS
 
index f5a61f3276597c407939030e8799d24920e40955..0826badc3f04fe50dfff3f1d93e9a52943cffe59 100644 (file)
@@ -18,7 +18,7 @@
 #include <freertos/FreeRTOS.h>
 #include <soc/soc_memory_layout.h>
 #include "multi_heap.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 #ifdef __cplusplus
 extern "C" {
index 6c220cd5d2c87cf3b94dd89e5deee4515291866f..7ff1f00ae030bc9c391eb1e168e3ac9792f88249 100644 (file)
@@ -16,7 +16,7 @@
 #ifdef ESP_PLATFORM
 
 #include <freertos/FreeRTOS.h>
-#include <rom/ets_sys.h>
+#include <esp32/rom/ets_sys.h>
 #include <assert.h>
 
 /* Because malloc/free can happen inside an ISR context,
index 703270c9a3ee1bdbbfd72b7d53c695e70e89f694..46516dac3c05bc2509d833046cf913327563859a 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <esp_types.h>
 #include <stdio.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index e57aabbdd53f6875b8c98ca6d5e3ca3702c7d71f..82acd6e1fc1fd894f7b6fb1073bf39b61b10d88b 100644 (file)
@@ -18,7 +18,7 @@
 #include <stdint.h>
 #include <stdarg.h>
 #include "sdkconfig.h"
-#include <rom/ets_sys.h>
+#include <esp32/rom/ets_sys.h>
 
 #ifdef __cplusplus
 extern "C" {
index 28bd89d80ccfe09fde5b4b2dca21429d0d37882f..72c232c68bf65d115c751758ef6b823d893fb242 100644 (file)
@@ -56,7 +56,7 @@
 
 #include "esp_log.h"
 
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "soc/soc_memory_layout.h"
 
 //print number of bytes per line for esp_log_buffer_char and esp_log_buffer_hex
index ebcd208cc2605054cdd009e0f9fcb1726c299b98..189d9ff065eeffca8454ddd1aaf669911c1b8fd5 100644 (file)
@@ -27,7 +27,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <sys/param.h>
-#include "rom/bigint.h"
+#include "esp32/rom/bigint.h"
 #include "soc/hwcrypto_reg.h"
 #include "esp_system.h"
 #include "esp_log.h"
index f08f3b678717865234637164a29ed3a63e756ca7..39118d5182f804edc01ed030c8ba137a9c7f388e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f08f3b678717865234637164a29ed3a63e756ca7
+Subproject commit 39118d5182f804edc01ed030c8ba137a9c7f388e
index 697d050fad69bf1d72a59f478a8afb5eef9e3965..d9ddc0074cbc1d8ada6a35c23ab380b6d59786cd 100644 (file)
@@ -22,7 +22,7 @@
 #include <sys/signal.h>
 #include <sys/unistd.h>
 #include <sys/reent.h>
-#include "rom/libc_stubs.h"
+#include "esp32/rom/libc_stubs.h"
 #include "esp_vfs.h"
 #include "esp_newlib.h"
 #include "sdkconfig.h"
index a8364367a3ad99bf987979f1abcf7d6779d39a26..f9cf83539d0bf74e70cc2a5c4b66f597b5941101 100644 (file)
@@ -22,7 +22,7 @@
 #include <sys/time.h>
 #include <sys/times.h>
 #include <sys/lock.h>
-#include <rom/rtc.h>
+#include <esp32/rom/rtc.h>
 #include "esp_attr.h"
 #include "esp_intr_alloc.h"
 #include "esp32/clk.h"
@@ -31,7 +31,7 @@
 #include "soc/rtc.h"
 #include "soc/rtc_cntl_reg.h"
 #include "soc/frc_timer_reg.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/xtensa_api.h"
 #include "freertos/task.h"
index e993c9637a38719e944ba9f0bfd33a772cef9fba..da905922d56487c598224263bf542c36ea078a4d 100644 (file)
@@ -23,7 +23,7 @@
 #endif
 
 #ifdef ESP_PLATFORM
-#include <rom/crc.h>
+#include <esp32/rom/crc.h>
 
 // Uncomment this line to force output from this module
 // #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
index e0bda34c555951d01c0c83dee68c8574a4fb4ad2..cfe6987f8e53bfa7fe4b7db354c31600826d8dce 100644 (file)
@@ -13,7 +13,7 @@
 // limitations under the License.
 #include "nvs_page.hpp"
 #if defined(ESP_PLATFORM)
-#include <rom/crc.h>
+#include <esp32/rom/crc.h>
 #else
 #include "crc.h"
 #endif
index 1f60fc350bd57f35849f4b2f66b309c6b213746a..f6b4f31e7fb0558e50e0597bbce9ee5f6ace75c5 100644 (file)
@@ -14,7 +14,7 @@
 #include "nvs_types.hpp"
 
 #if defined(ESP_PLATFORM)
-#include <rom/crc.h>
+#include <esp32/rom/crc.h>
 #else
 #include "crc.h"
 #endif
index b125aaffe1444c1c3c9dce160ea23fbfe3c8cf45..8421f6cf722085c3454f2c9400ba7c5feb231c81 100644 (file)
@@ -21,7 +21,7 @@ SOURCE_FILES = \
        crc.cpp \
        main.cpp
 
-CPPFLAGS += -I../include -I../src -I./ -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage -DCONFIG_NVS_ENCRYPTION
+CPPFLAGS += -I../include -I../src -I./ -I../../esp_common/include -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage -DCONFIG_NVS_ENCRYPTION
 CFLAGS += -fprofile-arcs -ftest-coverage
 CXXFLAGS += -std=c++11 -Wall -Werror
 LDFLAGS += -lstdc++ -Wall -fprofile-arcs -ftest-coverage
index 687efdbab3cbb63e48a44d16332f7524f21bc5fc..fe0102856bea778b36fcdce81a134878827c166f 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <esp_err.h>
 #include <esp_log.h>
-#include <rom/queue.h>
+#include <sys/queue.h>
 
 #include <protocomm.h>
 #include <protocomm_security.h>
index 895d1101510cd13f4edcfaa650bae51e164eeaa1..16e478337da4595e40319176e92c0a5317810fa8 100644 (file)
@@ -14,7 +14,7 @@
 
 #pragma once
 
-#include <rom/queue.h>
+#include <sys/queue.h>
 #include <protocomm_security.h>
 #include <esp_err.h>
 
index 2250c4075c12a2d32ddcf6ec2701fb3e1a0f7467..99e5d209e2bcd3ac41685924920a9707c81ced05 100644 (file)
@@ -22,7 +22,7 @@
 #include <string.h>
 #include "esp_err.h"
 #include "esp_attr.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/semphr.h"
index 39e23821f15dfbd22dc3e39f61471b8480943986..fe3144512dfe54f31cabc73b0fcf80d2909b64a6 100644 (file)
@@ -27,7 +27,7 @@
 #include "freertos/semphr.h"
 #include "freertos/list.h"
 
-#include <rom/queue.h>
+#include <sys/queue.h>
 #include <sys/time.h>
 
 #define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
index f87f698d8bcd89507ca237f68f743ed974ccc028..06445542dddaf5f637a551884086e096e68268a6 100644 (file)
@@ -19,7 +19,7 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "sys/lock.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 #include "pthread_internal.h"
 
index ec532ad8723141ddd4ea04286c44483f07c04845..89191cb66f0533028f6b57ed116585ed0e5097fb 100644 (file)
@@ -13,6 +13,6 @@ list(APPEND COMPONENT_SRCS "src/memory_layout_utils.c")
 
 set(COMPONENT_ADD_LDFRAGMENTS linker.lf)
 
-set(COMPONENT_REQUIRES)
+set(COMPONENT_REQUIRES esp_rom)
 
 register_component()
index 43964448c93e38af80f6ab9a43191ff50f9bb0a4..184752aac5496552f114f72a71580eb12a147354 100644 (file)
 #include <stdint.h>
 #include <stddef.h>
 #include <stdlib.h>
-#include "rom/ets_sys.h"
-#include "rom/rtc.h"
-#include "rom/uart.h"
-#include "rom/gpio.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/gpio.h"
 #include "soc/rtc.h"
 #include "soc/rtc_cntl_reg.h"
 #include "soc/rtc_io_reg.h"
index 0c3bba915e934540d56373f7360ff3684b7b1a9f..ef1485311e0938b68a791cb92a478a2c7d46909d 100644 (file)
 #include <stdint.h>
 #include <stddef.h>
 #include <stdlib.h>
-#include "rom/ets_sys.h"
-#include "rom/rtc.h"
-#include "rom/uart.h"
-#include "rom/gpio.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/rtc.h"
+#include "esp32/rom/uart.h"
+#include "esp32/rom/gpio.h"
 #include "soc/rtc.h"
 #include "soc/rtc_cntl_reg.h"
 #include "soc/rtc_io_reg.h"
index 6b16aa2889a4830f4c877df6e7411c163618202a..6b8897ae25678af48a2aaafa6ae68a520cd184a2 100644 (file)
@@ -24,7 +24,7 @@
 #include "soc/nrx_reg.h"
 #include "soc/fe_reg.h"
 #include "soc/rtc.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #define MHZ (1000000)
 
index 5cbdbeb7377d26628d2afd25ce3d7077d6cb77d5..5160f8602dd18cfdb55fbcfafa6ec135f8be225a 100644 (file)
@@ -13,7 +13,7 @@
 // limitations under the License.
 
 #include <stdint.h>
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "soc/rtc.h"
 #include "soc/rtc_cntl_reg.h"
 #include "soc/timer_group_reg.h"
index 4fdffd7b50233fa29f03a8af298c4b7fced9d116..1710d0c863d8dd24bf93d18b7bebd66f07efc41b 100644 (file)
@@ -31,7 +31,7 @@
 #define SOC_LOGV(tag, fmt, ...) ESP_EARLY_LOGV(tag, fmt, ##__VA_ARGS__)
 
 #else
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #define SOC_LOGE(tag, fmt, ...) ets_printf("%s(err): " fmt, tag, ##__VA_ARGS__)
 #define SOC_LOGW(tag, fmt, ...) ets_printf("%s(warn): " fmt, tag, ##__VA_ARGS__)
 #define SOC_LOGI(tag, fmt, ...) ets_printf("%s(info): " fmt, tag, ##__VA_ARGS__)
index eb5c1b1ddba38b670d71a6e11a6c66f36faa4d33..9c1fe689820465e8b2d48008bc0ca23fbe7d38af 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include "unity.h"
-#include "rom/ets_sys.h"
-#include "rom/uart.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/uart.h"
 #include "soc/rtc.h"
 #include "soc/rtc_cntl_reg.h"
 #include "soc/rtc_io_reg.h"
index 56038de37901baaac1ff5668e21050dfbabe9af5..b27b968ad65270aaba46bfb7cd2d451ed1ee933f 100644 (file)
@@ -20,8 +20,8 @@
 #include <freertos/FreeRTOS.h>
 #include <freertos/task.h>
 #include <freertos/semphr.h>
-#include <rom/spi_flash.h>
-#include <rom/cache.h>
+#include <esp32/rom/spi_flash.h>
+#include <esp32/rom/cache.h>
 #include <soc/soc.h>
 #include <soc/dport_reg.h>
 #include "sdkconfig.h"
index c1e68cbedb90b124c85d652a4f9291c63fc77114..9818319a5f6873618ee4f23398c14c6cd95e5d20 100644 (file)
@@ -20,8 +20,8 @@
 #include <freertos/FreeRTOS.h>
 #include <freertos/task.h>
 #include <freertos/semphr.h>
-#include <rom/spi_flash.h>
-#include <rom/cache.h>
+#include <esp32/rom/spi_flash.h>
+#include <esp32/rom/cache.h>
 #include <soc/soc.h>
 #include <soc/dport_reg.h>
 #include "sdkconfig.h"
@@ -37,7 +37,7 @@
 // Enable built-in checks in queue.h in debug builds
 #define INVARIANTS
 #endif
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 #define REGIONS_COUNT 4
 #define PAGES_PER_REGION 64
index 6529a750d9a02a38b637e10e14cb37d8c6e6d9e0..3bc4ba5ccecff36cb5ea62b75bc9fc0fb38d4541 100644 (file)
@@ -21,8 +21,8 @@
 #include <freertos/FreeRTOS.h>
 #include <freertos/task.h>
 #include <freertos/semphr.h>
-#include <rom/spi_flash.h>
-#include <rom/cache.h>
+#include <esp32/rom/spi_flash.h>
+#include <esp32/rom/cache.h>
 #include <soc/soc.h>
 #include <soc/dport_reg.h>
 #include "sdkconfig.h"
index 77c13bd57b85363ece5396f4370a1846dff9bad4..d4c8fbd49ec35bd5d429461e62b3a6a879200924 100644 (file)
@@ -31,7 +31,7 @@
 // Enable built-in checks in queue.h in debug builds
 #define INVARIANTS
 #endif
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 
 typedef struct partition_list_item_ {
index 9e5cb0463044781b541c360257127b4f5a0683b6..35326074556f2f51f6da3e2f7cac537fa88384c3 100644 (file)
@@ -22,6 +22,7 @@ INCLUDE_DIRS := \
        vfs/include \
        ) \
        $(addprefix ../../../components/, \
+       esp_rom/include \
        soc/esp32/include \
        esp32/include \
        bootloader_support/include \
index db5d86380ac8d97473cf2c0516503cc673439044..ba870a5a205082813dccf4b6a118b34457e74146 100644 (file)
@@ -18,7 +18,7 @@
 #include <stdbool.h>
 
 #include "esp_err.h"
-#include "rom/spi_flash.h"
+#include "esp32/rom/spi_flash.h"
 
 /**
 * @brief This class is used to emulate flash devices.
index 502f6df994fc74bab1f691d11a40507a724ce8b1..9535bf29b16df6a8092904dd2e2479057b2ec3bb 100644 (file)
@@ -7,7 +7,7 @@
 #include "esp_partition.h"
 
 #include "esp_err.h"
-#include "rom/spi_flash.h"
+#include "esp32/rom/spi_flash.h"
 
 SpiFlash spiflash = SpiFlash();
 
index dd3190c39c1d1b28a704c992523ab4063bf47c32..a22b2854cc5fbf637a3573bf6f39c65e55ddfc61 100644 (file)
@@ -2,7 +2,7 @@
 #include "esp_partition.h"
 
 #include "esp_err.h"
-#include "rom/spi_flash.h"
+#include "esp32/rom/spi_flash.h"
 
 extern void _spi_flash_init(const char* chip_size, size_t block_size, size_t sector_size, size_t page_size, const char* partition_bin);
 
index ec59a1ff195c0469e6883474683bde5e76ab34d6..1f28f2d676a1ddbc0c0e32b627d3b8c2833ebe6a 100644 (file)
@@ -12,9 +12,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "rom/ets_sys.h"
-#include "rom/gpio.h"
-#include "rom/spi_flash.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/gpio.h"
+#include "esp32/rom/spi_flash.h"
 #include "sdkconfig.h"
 
 #define SPI_IDX   1
index 8d9e04bac263382d45f10bf8cc2cd8c987cfb9e7..3a96ac458b6c5ece8e38f70367ea2957000eae31 100644 (file)
@@ -25,7 +25,7 @@
 #include <test_utils.h>
 #include <esp_spi_flash.h>
 #include <esp_log.h>
-#include <rom/spi_flash.h>
+#include <esp32/rom/spi_flash.h>
 #include "../cache_utils.h"
 #include "soc/timer_group_struct.h"
 #include "soc/timer_group_reg.h"
index 8b1061b96d1f5519b8f4275ecb17020008ff0299..66e2d3152de1ab42948bc7cadc0eca61847b7778 100644 (file)
@@ -23,7 +23,7 @@
 #include <unity.h>
 #include <test_utils.h>
 #include <esp_spi_flash.h>
-#include <rom/spi_flash.h>
+#include <esp32/rom/spi_flash.h>
 #include "../cache_utils.h"
 #include "soc/timer_group_struct.h"
 #include "soc/timer_group_reg.h"
index 06cfe44c4ce9f87145f3359b3c001edd7263d8c5..0019c1da52ed97f5db2aa23dab12a28d4109540e 100644 (file)
@@ -29,7 +29,7 @@
 #include <sys/lock.h>
 #include "esp_vfs.h"
 #include "esp_err.h"
-#include "rom/spi_flash.h"
+#include "esp32/rom/spi_flash.h"
 #include "spiffs_api.h"
 
 static const char* TAG = "SPIFFS";
index 06858bc1a091098ca4f299c3d1e4a2db827fb71f..ba612fca59d203751a7b0c47528cb24270edba6b 100644 (file)
@@ -6,7 +6,7 @@ SOURCE_FILES := \
        spiffs_gc.c \
        spiffs_hydrogen.c \
        spiffs_nucleus.c \
-       ) 
+       )
 
 INCLUDE_DIRS := \
        . \
@@ -24,6 +24,7 @@ INCLUDE_DIRS := \
        vfs/include \
        ) \
        $(addprefix ../../../components/, \
+       esp_rom/include \
        soc/esp32/include \
        esp32/include \
        bootloader_support/include \
index f6fa311ae7ecbb24936a8deb1c982d7b036d1134..44756e1d4b1b65cf44b4ac34a3fdac3a5cebca5e 100644 (file)
@@ -16,7 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "esp_log.h"
 
 #include "esp_transport.h"
index 6850f23a4ad3c8419ddbb07e62c81f84be3c8253..43e6e24213ad157d2163e0b9ad7567774556cfc1 100644 (file)
@@ -16,7 +16,7 @@
 #define _TCPIP_ADAPTER_H_
 
 #include <stdint.h>
-#include "rom/queue.h"
+#include "sys/queue.h"
 #include "esp_wifi_types.h"
 #include "sdkconfig.h"
 
index 93dfdeedcea2b10af0fe3608fefe4fcc9340d369..2b9879b4a7ade1900dd1f49b5880e83c4025334e 100644 (file)
@@ -15,7 +15,7 @@
 #pragma once
 
 #include "tcpip_adapter.h"
-#include "rom/queue.h"
+#include "sys/queue.h"
 
 struct tcpip_adapter_api_msg_s;
 
index 535d63bccd2bd51df13d22ddff6a8e23506cb526..7770bd5051ca26b5005316b3e7c24fbb8841aa8f 100644 (file)
@@ -14,8 +14,8 @@
 #include <string.h>
 #include "unity.h"
 #include "sdkconfig.h"
-#include "rom/uart.h"
 #include "esp32/clk.h"
+#include "esp32/rom/uart.h"
 #include "soc/cpu.h"
 
 static uint32_t s_test_start, s_test_stop;
index 2e45d76bf495b01cdf8027b3edb8127c6078dec5..89fb3bdcf9dd9784cb3467dc2dbed6a747008440 100644 (file)
@@ -19,7 +19,7 @@
 #include <sys/termios.h>
 #include <sys/errno.h>
 #include "unity.h"
-#include "rom/uart.h"
+#include "esp32/rom/uart.h"
 #include "soc/uart_struct.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
index 62308e424a5d5c9802c75764476badfa2fe4b624..895940a8a00d9ee2bd54ca3cb64f3d195a5cbad7 100644 (file)
@@ -26,7 +26,7 @@
 #include "driver/uart.h"
 #include "sdkconfig.h"
 #include "driver/uart_select.h"
-#include "rom/uart.h"
+#include "esp32/rom/uart.h"
 
 // TODO: make the number of UARTs chip dependent
 #define UART_NUM 3
index 52147f4e35ac00bdcc6d30e4a73bf8da80c00816..982c5b1c21686211eda7ecf8096e6d106ec16cad 100644 (file)
@@ -12,7 +12,7 @@
 // limitations under the License.
 
 #include "crc32.h"
-#include "rom/crc.h"
+#include "esp32/rom/crc.h"
 
 unsigned int crc32::crc32_le(unsigned int crc, unsigned char const *buf, unsigned int len)
 {
index f96d2cc807b6d9fe36364c2440499cbf4f296191..009e1be7a9e76929cedddf56d4ac22042fec0192 100644 (file)
@@ -4,7 +4,7 @@ SOURCE_FILES := \
        crc32.cpp \
        WL_Flash.cpp \
        Partition.cpp \
-       ) 
+       )
 
 INCLUDE_DIRS := \
        . \
@@ -23,6 +23,7 @@ INCLUDE_DIRS := \
        vfs/include \
        ) \
        $(addprefix ../../../components/, \
+       esp_rom/include \
        soc/esp32/include \
        esp32/include \
        bootloader_support/include \
index dbc65759b0df66baee055fecd25bb6afc08ad5e4..26307898188a3b5e0c531b37aa20ca6d575663b7 100644 (file)
@@ -58,7 +58,7 @@
 
 #else
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 #endif /* !__ets__ */
 
index 9d50bb1ba573ea19406ecd170ab6c5f558296a17..14ed2175af624e2839eb8f2345ab3f4358f5f3f3 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef WPA_H
 #define WPA_H
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "common.h"
 #include "wpa/defs.h"
 #include "wpa/wpa_common.h"
index b731b9b95f2cc4ccc365fcad8206b8f6e9900bef..42544957412e8501eb014a69d163676a6bf4dfd5 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef WPS_H
 #define WPS_H
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "wps_defs.h"
 #include "esp_wifi_types.h"
 
index 0028c21e9cb747a5c7886e3941223099fda8a205..ff1ba9bce1b065627135b520804f6b3c492f5b9f 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "esp_err.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 
 typedef long os_time_t;
 
index 6a4f9bdfb94053706c6743377878146d7cd8a6dd..3c2a7471c1d66b6b10cc6d06bebe7ab25a81c951 100644 (file)
@@ -6,7 +6,7 @@
  * See README for more details.
  */
 
-#include "rom/ets_sys.h"
+#include "esp32/rom/ets_sys.h"
 #include "wpa/includes.h"
 
 #include "wpa/common.h"
index 49ba6c1c695a64c28ef2d4bf7775537941abb853..64b989e7413a2c643531738483ca0e70d42d72d5 100644 (file)
@@ -28,7 +28,7 @@
 #include "mbedtls/aes.h"
 #include "mbedtls/dhm.h"
 #include "mbedtls/md5.h"
-#include "rom/crc.h"
+#include "esp32/rom/crc.h"
 
 /*
    The SEC_TYPE_xxx is for self-defined packet data type in the procedure of "BLUFI negotiate key"
index 7059bb174e6f341fed71435c5276e5946b9929a7..54a608d99a66efd7079a11140557414e5a469acc 100644 (file)
@@ -15,7 +15,7 @@
 #include "esp_event.h"
 #include "esp_log.h"
 #include "esp_eth.h"
-#include "rom/gpio.h"
+#include "esp32/rom/gpio.h"
 #include "tcpip_adapter.h"
 #include "driver/gpio.h"
 #include "driver/periph_ctrl.h"
index ced905d90cc51c9ea10d224f9dab4a3124ea6b39..0c1d59fed279870a3bf3067b3bf6bfc0f1f7175f 100644 (file)
@@ -8,8 +8,8 @@
    */
 #include "driver/sdio_slave.h"
 #include "esp_log.h"
-#include "rom/lldesc.h"
-#include "rom/queue.h"
+#include "esp32/rom/lldesc.h"
+#include "sys/queue.h"
 #include "soc/soc.h"
 #include "soc/sdio_slave_periph.h"
 #include "freertos/task.h"
index 1e3c18c8c90072dd521bd00c9f34f8bc83bde83f..4a4b4daed93c25651f9b363cdced15dcece048cf 100644 (file)
@@ -20,7 +20,7 @@ format if you want to use a different image file.
 
 
 #include "decode_image.h"
-#include "rom/tjpgd.h"
+#include "esp32/rom/tjpgd.h"
 #include "esp_log.h"
 #include <string.h>
 
index fe47cce15f759cf2d68a124a4d96c19d701d814a..a7815b296bb6a5f5e7c1122a70217ee2d7e45eba 100644 (file)
@@ -27,7 +27,7 @@
 #include "esp_event_loop.h"
 #include "nvs_flash.h"
 #include "soc/rtc_cntl_reg.h"
-#include "rom/cache.h"
+#include "esp32/rom/cache.h"
 #include "driver/spi_slave.h"
 #include "esp_log.h"
 #include "esp_spi_flash.h"
index b033fcf2a9345e9d270443b6e37cbacc9c09385c..dc16bd556607df36d63545c7908b09903ab5256f 100644 (file)
@@ -27,7 +27,7 @@
 #include "esp_event_loop.h"
 #include "nvs_flash.h"
 #include "soc/rtc_cntl_reg.h"
-#include "rom/cache.h"
+#include "esp32/rom/cache.h"
 #include "driver/spi_master.h"
 #include "esp_log.h"
 #include "esp_spi_flash.h"
index 80fecee0158b5c474fb5b3d4648e94b4a1d72b94..97dee42aa10d6530866bbe9e9b33a6113de965cb 100644 (file)
@@ -21,7 +21,7 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "soc/rtc_cntl_reg.h"
-#include "rom/uart.h"
+#include "esp32/rom/uart.h"
 #include "cmd_system.h"
 #include "sdkconfig.h"
 
index 98955725a62be61af3224e1458aad3a26ec05e9f..5a83482cc5b9aca9e313987c6a609381bb163bfa 100644 (file)
@@ -16,7 +16,7 @@
 #include "nvs_flash.h"
 #include "esp_heap_caps.h"
 #include "esp32/spiram.h"
-#include "rom/cache.h"
+#include "esp32/rom/cache.h"
 #include "sdkconfig.h"
 #include "esp32/himem.h"
 
index 79436ba3d8452d36c351844fcab312a52726b7b4..4c8e12029a390a0e68a9151c189f4f1312028c95 100644 (file)
@@ -16,7 +16,7 @@
 #include "freertos/task.h"
 #include "esp_sleep.h"
 #include "esp_log.h"
-#include "rom/uart.h"
+#include "esp32/rom/uart.h"
 #include "driver/rtc_io.h"
 
 /* Most development boards have "boot" button attached to GPIO0.
index 49e04c83661f6ace202f78fbe4bb6f7ed4c27312..da54bff87bf2c564afb2d0c7f97aeebcdc474c07 100644 (file)
@@ -26,8 +26,8 @@
 #include "esp_log.h"
 #include "esp_system.h"
 #include "esp_now.h"
-#include "rom/ets_sys.h"
-#include "rom/crc.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/crc.h"
 #include "espnow_example.h"
 
 static const char *TAG = "espnow_example";
index ee8e70bd58e50f7ae43a5f1e3d4dcbd4f6c7805f..8153e7e5b2900a063246fa8c2d1ec6978bad3714 100755 (executable)
@@ -153,7 +153,7 @@ function run_tests()
     print_status "Touching rom ld file should re-link app and bootloader"
     make
     take_build_snapshot
-    touch ${IDF_PATH}/components/esp32/ld/esp32.rom.ld
+    touch ${IDF_PATH}/components/esp_rom/esp32/ld/esp32.rom.ld
     make
     assert_rebuilt ${APP_BINS} ${BOOTLOADER_BINS}
 
@@ -251,7 +251,7 @@ function run_tests()
        make
     assert_rebuilt ${APP_BINS}
     assert_not_rebuilt ${BOOTLOADER_BINS} esp32/libesp32.a
-    
+
     print_status "Re-building does not change app.bin"
     take_build_snapshot
     make
@@ -263,7 +263,7 @@ function run_tests()
     version="App \"app-template\" version: "
     version+=$(git describe --always --tags --dirty)
     grep "${version}" log.log || failure "Project version should have a hash commit"
-    
+
     print_status "Build fails if partitions don't fit in flash"
     sed -i.bak "s/CONFIG_ESPTOOLPY_FLASHSIZE.\+//" sdkconfig  # remove all flashsize config
     echo "CONFIG_ESPTOOLPY_FLASHSIZE_1MB=y" >> sdkconfig     # introduce undersize flash
index 75fb523c4a1080a61b375fb8910bbf275242d736..7913da33a51ff21f2b9563f9724c3e12ce163aeb 100755 (executable)
@@ -169,12 +169,12 @@ function run_tests()
     idf.py build
     take_build_snapshot
     sleep 1  # ninja may ignore if the timestamp delta is too low
-    cp ${IDF_PATH}/components/esp32/ld/esp32.rom.ld .
-    echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp32/ld/esp32.rom.ld
-    tail ${IDF_PATH}/components/esp32/ld/esp32.rom.ld
+    cp ${IDF_PATH}/components/esp_rom/esp32/ld/esp32.rom.ld .
+    echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp_rom/esp32/ld/esp32.rom.ld
+    tail ${IDF_PATH}/components/esp_rom/esp32/ld/esp32.rom.ld
     idf.py build || failure "Failed to rebuild with modified linker script"
     assert_rebuilt ${APP_BINS} ${BOOTLOADER_BINS}
-    mv esp32.rom.ld ${IDF_PATH}/components/esp32/ld/
+    mv esp32.rom.ld ${IDF_PATH}/components/esp_rom/esp32/ld/
 
     print_status "Updating app-only ld file should only re-link app"
     take_build_snapshot
index 52d4f1ca3e9a15927a245e9e86f643da8eb3ffc1..668a79e3da1eced26bac896b6603dff62be6b0ef 100644 (file)
@@ -36,8 +36,8 @@
 #include "soc/pcnt_reg.h"
 #include "soc/gpio_sig_map.h"
 #include "soc/dport_reg.h"
-#include "rom/gpio.h"
-#include "rom/ets_sys.h"
+#include "esp32/rom/gpio.h"
+#include "esp32/rom/ets_sys.h"
 #include "driver/gpio.h"
 #include "esp_intr_alloc.h"
 #include "freertos/FreeRTOS.h"
index e42843f76c0411360bc9d3cd99a99fed4da242ad..deed8783021e032805c1ab7056d5f979a2bb62e3 100644 (file)
@@ -15,8 +15,8 @@
 #include <string.h>
 #include "unity.h"
 #include "test_utils.h"
-#include "rom/ets_sys.h"
-#include "rom/uart.h"
+#include "esp32/rom/ets_sys.h"
+#include "esp32/rom/uart.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "tcpip_adapter.h"