Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
20a3b4c0cd
101 changed files with 8203 additions and 1133 deletions
7
.gitmodules
vendored
7
.gitmodules
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
[submodule "lwip/lwip"]
|
[submodule "lwip/lwip"]
|
||||||
path = lwip/lwip
|
path = lwip/lwip
|
||||||
url = https://github.com/SuperHouse/esp-lwip.git
|
url = https://github.com/SuperHouse/esp-lwip.git
|
||||||
[submodule "axtls/axtls"]
|
[submodule "extras/mbedtls/mbedtls"]
|
||||||
path = axtls/axtls
|
path = extras/mbedtls/mbedtls
|
||||||
url = https://github.com/SuperHouse/axtls.git
|
url = https://github.com/ARMmbed/mbedtls.git
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,9 @@ void xPortSysTickHandle (void)
|
||||||
//OpenNMI();
|
//OpenNMI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool sdk_compat_initialised;
|
||||||
|
void sdk_compat_initialise(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See header file for description.
|
* See header file for description.
|
||||||
*/
|
*/
|
||||||
|
|
@ -186,6 +189,14 @@ portBASE_TYPE xPortStartScheduler( void )
|
||||||
_xt_isr_attach(INUM_SOFT, SV_ISR);
|
_xt_isr_attach(INUM_SOFT, SV_ISR);
|
||||||
_xt_isr_unmask(BIT(INUM_SOFT));
|
_xt_isr_unmask(BIT(INUM_SOFT));
|
||||||
|
|
||||||
|
/* ENORMOUS HACK: Call the sdk_compat_initialise() function.
|
||||||
|
This can be removed happily once we have open source startup code.
|
||||||
|
*/
|
||||||
|
if(!sdk_compat_initialised) {
|
||||||
|
sdk_compat_initialised = true;
|
||||||
|
sdk_compat_initialise();
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize system tick timer interrupt and schedule the first tick. */
|
/* Initialize system tick timer interrupt and schedule the first tick. */
|
||||||
sdk__xt_tick_timer_init();
|
sdk__xt_tick_timer_init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,9 +182,6 @@ not necessary for to use this port. They are defined so the common demo files
|
||||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* ESPTODO: These parts of the FreeRTOS support are still in binary libraries */
|
|
||||||
#define vApplicationStackOverflowHook sdk_vApplicationStackOverflowHook
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
INC_DIRS += $(freertos_MAIN)/include $(freertos_MAIN)/portable/esp8266
|
INC_DIRS += $(freertos_MAIN)include $(freertos_MAIN)portable/esp8266
|
||||||
|
|
||||||
# args for passing into compile rule generation
|
# args for passing into compile rule generation
|
||||||
freertos_ROOT = $(ROOT)FreeRTOS/
|
|
||||||
freertos_MAIN = $(freertos_ROOT)Source/
|
freertos_MAIN = $(freertos_ROOT)Source/
|
||||||
freertos_INC_DIR = $(freertos_MAIN)include $(freertos_MAIN)portable/esp8266
|
freertos_INC_DIR = $(freertos_MAIN)include $(freertos_MAIN)portable/esp8266
|
||||||
freertos_SRC_DIR = $(freertos_MAIN) $(freertos_MAIN)portable/esp8266
|
freertos_SRC_DIR = $(freertos_MAIN) $(freertos_MAIN)portable/esp8266
|
||||||
|
|
|
||||||
50
README.md
50
README.md
|
|
@ -4,8 +4,18 @@ A community developed open source [FreeRTOS](http://www.freertos.org/)-based fra
|
||||||
|
|
||||||
Originally based on, but substantially different from, the [Espressif IOT RTOS SDK](https://github.com/espressif/esp_iot_rtos_sdk).
|
Originally based on, but substantially different from, the [Espressif IOT RTOS SDK](https://github.com/espressif/esp_iot_rtos_sdk).
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
[](https://travis-ci.org/SuperHouse/esp-open-rtos)
|
[](https://travis-ci.org/SuperHouse/esp-open-rtos)
|
||||||
|
|
||||||
|
Email discussion list: https://groups.google.com/d/forum/esp-open-rtos
|
||||||
|
|
||||||
|
IRC channel: #esp-open-rtos on Freenode ([Web Chat Link](http://webchat.freenode.net/?channels=%23esp-open-rtos&uio=d4)).
|
||||||
|
|
||||||
|
Github issues list/bugtracker: http://github.com/superhouse/esp-open-rtos/issues
|
||||||
|
|
||||||
|
Please note that this project is released with a [Contributor Code of Conduct](https://github.com/SuperHouse/esp-open-rtos/blob/master/code_of_conduct.md). By participating in this project you agree to abide by its terms.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
* Install [esp-open-sdk](https://github.com/pfalcon/esp-open-sdk/), build it with `make STANDALONE=n`, then edit your PATH and add the generated toolchain `bin` directory. (Despite the similar name esp-open-sdk has different maintainers - but we think it's fantastic!)
|
* Install [esp-open-sdk](https://github.com/pfalcon/esp-open-sdk/), build it with `make STANDALONE=n`, then edit your PATH and add the generated toolchain `bin` directory. (Despite the similar name esp-open-sdk has different maintainers - but we think it's fantastic!)
|
||||||
|
|
@ -14,7 +24,7 @@ Originally based on, but substantially different from, the [Espressif IOT RTOS S
|
||||||
|
|
||||||
* Install [esptool.py](https://github.com/themadinventor/esptool) and make it available on your PATH. If you used esp-open-sdk then this is done already.
|
* Install [esptool.py](https://github.com/themadinventor/esptool) and make it available on your PATH. If you used esp-open-sdk then this is done already.
|
||||||
|
|
||||||
* The esp-open-rtos build process uses `GNU Make`, and the utilities `sed` and `grep`. If you built esp-open-sdk then you probably have these already.
|
* The esp-open-rtos build process uses `GNU Make`, and the utilities `sed` and `grep`. If you built esp-open-sdk then you have these already.
|
||||||
|
|
||||||
* Use git to clone the esp-open-rtos project (note the `--recursive`):
|
* Use git to clone the esp-open-rtos project (note the `--recursive`):
|
||||||
|
|
||||||
|
|
@ -30,7 +40,7 @@ cd esp-open-rtos
|
||||||
#define WIFI_PASS "my secret password"
|
#define WIFI_PASS "my secret password"
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove the `#warning` and follow the git ignore instructions to keep your credentials from being pushed to Github.
|
Remove the `#warning` line and follow the git ignore instructions written in the header file to keep your credentials from being pushed to Github.
|
||||||
|
|
||||||
* Build an example project (found in the 'examples' directory) and flash it to a serial port:
|
* Build an example project (found in the 'examples' directory) and flash it to a serial port:
|
||||||
|
|
||||||
|
|
@ -40,6 +50,8 @@ make flash -j4 -C examples/http_get ESPPORT=/dev/ttyUSB0
|
||||||
|
|
||||||
Run `make help -C examples/http_get` for a summary of other Make targets.
|
Run `make help -C examples/http_get` for a summary of other Make targets.
|
||||||
|
|
||||||
|
(Note: the `-C` option to make is the same as changing to that directory, then running make.)
|
||||||
|
|
||||||
The [Build Process wiki page](https://github.com/SuperHouse/esp-open-rtos/wiki/Build-Process) has in-depth details of the build process.
|
The [Build Process wiki page](https://github.com/SuperHouse/esp-open-rtos/wiki/Build-Process) has in-depth details of the build process.
|
||||||
|
|
||||||
## Goals
|
## Goals
|
||||||
|
|
@ -49,13 +61,26 @@ The [Build Process wiki page](https://github.com/SuperHouse/esp-open-rtos/wiki/B
|
||||||
* Leave upstream source clean, for easy interaction with upstream projects.
|
* Leave upstream source clean, for easy interaction with upstream projects.
|
||||||
* Flexible build and compilation settings.
|
* Flexible build and compilation settings.
|
||||||
|
|
||||||
Current status is alpha quality, under development. AP STATION mode (ie wifi client mode) and UDP/TCP client modes are tested. Other functionality should work. Contributors and testers are welcome!
|
Current status is alpha quality, actively developed. AP STATION mode (ie wifi client mode) and UDP/TCP client modes are tested. Other functionality should work. Contributors and testers are welcome!
|
||||||
|
|
||||||
|
## Code Structure
|
||||||
|
|
||||||
|
* `examples` contains a range of example projects (one per subdirectory). Check them out!
|
||||||
|
* `include` contains header files from Espressif RTOS SDK, relating to the binary libraries & Xtensa core.
|
||||||
|
* `core` contains source & headers for low-level ESP8266 functions & peripherals. `core/include/esp` contains useful headers for peripheral access, etc. Minimal to no FreeRTOS dependencies.
|
||||||
|
* `extras` is a directory that contains optional components that can be added to your project. Most 'extras' components will have a corresponding example in the `examples` directory. Extras include:
|
||||||
|
- mbedtls - [mbedTLS](https://tls.mbed.org/) is a TLS/SSL library providing up to date secure connectivity and encryption support.
|
||||||
|
- i2c - software i2c driver ([upstream project](https://github.com/kanflo/esp-open-rtos-driver-i2c))
|
||||||
|
- rboot-ota - OTA support (over-the-air updates) including a TFTP server for receiving updates ([for rboot by @raburton](http://richard.burtons.org/2015/05/18/rboot-a-new-boot-loader-for-esp8266/))
|
||||||
|
- bmp180 driver for digital pressure sensor ([upstream project](https://github.com/Angus71/esp-open-rtos-driver-bmp180))
|
||||||
|
* `FreeRTOS` contains FreeRTOS implementation, subdirectory structure is the standard FreeRTOS structure. `FreeRTOS/source/portable/esp8266/` contains the ESP8266 port.
|
||||||
|
* `lwip` contains the lwIP TCP/IP library. See [Third Party Libraries](https://github.com/SuperHouse/esp-open-rtos/wiki/Third-Party-Libraries) wiki page for details.
|
||||||
|
* `libc` contains the newlib libc. [Libc details here](https://github.com/SuperHouse/esp-open-rtos/wiki/libc-configuration).
|
||||||
|
|
||||||
## Open Source Components
|
## Open Source Components
|
||||||
|
|
||||||
* [FreeRTOS](http://freertos.org) V7.5.2
|
* [FreeRTOS](http://freertos.org) V7.5.2
|
||||||
* [lwIP](http://lwip.wikia.com/wiki/LwIP_Wiki) v1.4.1, modified via the [esp-lwip project](https://github.com/kadamski/esp-lwip) by @kadamski.
|
* [lwIP](http://lwip.wikia.com/wiki/LwIP_Wiki) v1.4.1, modified via the [esp-lwip project](https://github.com/kadamski/esp-lwip) by @kadamski.
|
||||||
* [axTLS](http://axtls.sourceforge.net/) compiled from development version v1.5.3, plus modifications for low memory devices.
|
|
||||||
* [newlib](https://github.com/projectgus/newlib-xtensa) v2.2.0, with patches for xtensa support and locking stubs for thread-safe operation on FreeRTOS.
|
* [newlib](https://github.com/projectgus/newlib-xtensa) v2.2.0, with patches for xtensa support and locking stubs for thread-safe operation on FreeRTOS.
|
||||||
|
|
||||||
For details of how third party libraries are integrated, [see the wiki page](https://github.com/SuperHouse/esp-open-rtos/wiki/Third-Party-Libraries).
|
For details of how third party libraries are integrated, [see the wiki page](https://github.com/SuperHouse/esp-open-rtos/wiki/Third-Party-Libraries).
|
||||||
|
|
@ -66,23 +91,16 @@ Binary libraries (inside the `lib` dir) are all supplied by Espressif as part of
|
||||||
|
|
||||||
As part of the esp-open-rtos build process, all binary SDK symbols are prefixed with `sdk_`. This makes it easier to differentiate binary & open source code, and also prevents namespace conflicts.
|
As part of the esp-open-rtos build process, all binary SDK symbols are prefixed with `sdk_`. This makes it easier to differentiate binary & open source code, and also prevents namespace conflicts.
|
||||||
|
|
||||||
|
Espressif's RTOS SDK provided a "libssl" based on axTLS. This has been replaced with the more up to date mbedTLS library (see below).
|
||||||
|
|
||||||
Some binary libraries appear to contain unattributed open source code:
|
Some binary libraries appear to contain unattributed open source code:
|
||||||
|
|
||||||
* libnet80211.a & libwpa.a appear to be based on FreeBSD net80211/wpa, or forks of them. ([See this issue](https://github.com/SuperHouse/esp-open-rtos/issues/4)).
|
* libnet80211.a & libwpa.a appear to be based on FreeBSD net80211/wpa, or forks of them. ([See this issue](https://github.com/SuperHouse/esp-open-rtos/issues/4)).
|
||||||
* libudhcp has been removed from esp-open-rtos. It was released with the Espressif RTOS SDK but udhcp is GPL licensed.
|
* libudhcp has been removed from esp-open-rtos. It was released with the Espressif RTOS SDK but udhcp is GPL licensed.
|
||||||
|
|
||||||
## Code Structure
|
|
||||||
|
|
||||||
* `examples` contains a range of example projects (one per subdirectory). Check them out!
|
|
||||||
* `include` contains header files from Espressif RTOS SDK, relating to the binary libraries & Xtensa core.
|
|
||||||
* `core` contains source & headers for low-level ESP8266 functions & peripherals. `core/include/esp` contains useful headers for peripheral access, etc. Still being fleshed out. Minimal to no FreeRTOS dependencies.
|
|
||||||
* `FreeRTOS` contains FreeRTOS implementation, subdirectory structure is the standard FreeRTOS structure. `FreeRTOS/source/portable/esp8266/` contains the ESP8266 port.
|
|
||||||
* `lwip` and `axtls` contain the lwIP TCP/IP library and the axTLS TLS library ('libssl' in the esp8266 SDKs), respectively. See [Third Party Libraries](https://github.com/SuperHouse/esp-open-rtos/wiki/Third-Party-Libraries) wiki page for details.
|
|
||||||
|
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
* BSD license (as described in LICENSE) applies to original source files, [lwIP](http://lwip.wikia.com/wiki/LwIP_Wiki), and [axTLS](http://axtls.sourceforge.net/). lwIP is Copyright (C) Swedish Institute of Computer Science. axTLS is Copyright (C) Cameron Rich.
|
* BSD license (as described in LICENSE) applies to original source files, [lwIP](http://lwip.wikia.com/wiki/LwIP_Wiki). lwIP is Copyright (C) Swedish Institute of Computer Science.
|
||||||
|
|
||||||
* FreeRTOS is provided under the GPL with the FreeRTOS linking exception, allowing non-GPL firmwares to be produced using FreeRTOS as the RTOS core. License details in files under FreeRTOS dir. FreeRTOS is Copyright (C) Real Time Engineers Ltd.
|
* FreeRTOS is provided under the GPL with the FreeRTOS linking exception, allowing non-GPL firmwares to be produced using FreeRTOS as the RTOS core. License details in files under FreeRTOS dir. FreeRTOS is Copyright (C) Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
|
@ -90,6 +108,10 @@ Some binary libraries appear to contain unattributed open source code:
|
||||||
|
|
||||||
* Newlib is covered by several copyrights and licenses, as per the files in the `libc` directory.
|
* Newlib is covered by several copyrights and licenses, as per the files in the `libc` directory.
|
||||||
|
|
||||||
|
* [mbedTLS](https://tls.mbed.org/) is provided under the Apache 2.0 license as described in the file extras/mbedtls/mbedtls/apache-2.0.txt. mbedTLS is Copyright (C) ARM Limited.
|
||||||
|
|
||||||
|
Components under `extras/` may contain different licenses, please see those directories for details.
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
|
||||||
Contributions are very welcome!
|
Contributions are very welcome!
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit a4860ef68d7f5d98a8731f99787d51cc44c433c9
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* Stub time-related functions for TLS time-related operations
|
|
||||||
*
|
|
||||||
* ESPTODO: Revisit these ASAP as gettimeofday() is used for entropy
|
|
||||||
*
|
|
||||||
* Part of esp-open-rtos
|
|
||||||
* Copyright (C) 2015 Superhouse Automation Pty Ltd
|
|
||||||
* BSD Licensed as described in the file LICENSE
|
|
||||||
*/
|
|
||||||
#include <time.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
time_t time(time_t *t)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
time_t mktime(struct tm *tm)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gettimeofday(struct timeval *tv, void *tz)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void abort(void)
|
|
||||||
{
|
|
||||||
printf("abort() was called.\r\n");
|
|
||||||
while(1) {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
# Component makefile for axTLS
|
|
||||||
|
|
||||||
# axTLS has its own configure and build system, but it's not particularly
|
|
||||||
# designed for embedded systems. For now we're just imposing the ESP Open RTOS
|
|
||||||
# build system over the top.
|
|
||||||
|
|
||||||
# We supply our own hand tweaked config.h in the external 'include' dir.
|
|
||||||
|
|
||||||
AXTLS_DIR = $(ROOT)axtls/axtls/
|
|
||||||
INC_DIRS += $(ROOT)axtls/include $(AXTLS_DIR)ssl $(AXTLS_DIR)crypto
|
|
||||||
|
|
||||||
# args for passing into compile rule generation
|
|
||||||
axtls_ROOT = $(ROOT)axtls
|
|
||||||
axtls_INC_DIR = $(AXTLS_DIR)include $(AXTLS_DIR)
|
|
||||||
axtls_SRC_DIR = $(AXTLS_DIR)crypto $(AXTLS_DIR)ssl $(ROOT)axtls
|
|
||||||
|
|
||||||
#axtls_CFLAGS = $(CFLAGS) -Wno-address
|
|
||||||
|
|
||||||
$(eval $(call component_compile_rules,axtls))
|
|
||||||
|
|
||||||
# Helpful error if git submodule not initialised
|
|
||||||
$(axtls_SRC_DIR):
|
|
||||||
$(error "axtls git submodule not installed. Please run 'git submodule init' then 'git submodule update'")
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
/*
|
|
||||||
* Automatically generated header file: don't edit
|
|
||||||
*/
|
|
||||||
#define HAVE_DOT_CONFIG 0
|
|
||||||
#undef CONFIG_PLATFORM_LINUX
|
|
||||||
#undef CONFIG_PLATFORM_CYGWIN
|
|
||||||
#undef CONFIG_PLATFORM_WIN32
|
|
||||||
|
|
||||||
/*
|
|
||||||
* General Configuration
|
|
||||||
*/
|
|
||||||
#define PREFIX "/usr/local"
|
|
||||||
#define CROSS "xtensa-lx106-elf-"
|
|
||||||
#undef CONFIG_DEBUG
|
|
||||||
#define CONFIG_STRIP_UNWANTED_SECTIONS 1
|
|
||||||
#undef CONFIG_VISUAL_STUDIO_7_0
|
|
||||||
#undef CONFIG_VISUAL_STUDIO_8_0
|
|
||||||
#undef CONFIG_VISUAL_STUDIO_10_0
|
|
||||||
#define CONFIG_VISUAL_STUDIO_7_0_BASE ""
|
|
||||||
#define CONFIG_VISUAL_STUDIO_8_0_BASE ""
|
|
||||||
#define CONFIG_VISUAL_STUDIO_10_0_BASE ""
|
|
||||||
#define CONFIG_EXTRA_CFLAGS_OPTIONS ""
|
|
||||||
#define CONFIG_EXTRA_LDFLAGS_OPTIONS ""
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Embedded System Options (added for ESP RTOS SDK, don't have config entries yetr)
|
|
||||||
*/
|
|
||||||
#define CONFIG_NO_FILESYSTEM 1
|
|
||||||
#define CONFIG_USE_RAND 1
|
|
||||||
#define CONFIG_MAX_PLAIN_LENGTH 1024
|
|
||||||
#define CONFIG_MAX_KEY_BYTE_SIZE 256 /* for max 2048 bit keys (untested with >1024 bit keys) */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SSL Library
|
|
||||||
*/
|
|
||||||
#undef CONFIG_SSL_SERVER_ONLY
|
|
||||||
#undef CONFIG_SSL_CERT_VERIFICATION
|
|
||||||
#define CONFIG_SSL_ENABLE_CLIENT 1
|
|
||||||
#undef CONFIG_SSL_FULL_MODE
|
|
||||||
#undef CONFIG_SSL_SKELETON_MODE
|
|
||||||
#undef CONFIG_SSL_PROT_LOW
|
|
||||||
#define CONFIG_SSL_PROT_MEDIUM 1
|
|
||||||
#undef CONFIG_SSL_PROT_HIGH
|
|
||||||
#undef CONFIG_SSL_USE_DEFAULT_KEY
|
|
||||||
#define CONFIG_SSL_PRIVATE_KEY_LOCATION ""
|
|
||||||
#define CONFIG_SSL_PRIVATE_KEY_PASSWORD ""
|
|
||||||
#define CONFIG_SSL_X509_CERT_LOCATION ""
|
|
||||||
#undef CONFIG_SSL_GENERATE_X509_CERT
|
|
||||||
#define CONFIG_SSL_X509_COMMON_NAME ""
|
|
||||||
#define CONFIG_SSL_X509_ORGANIZATION_NAME ""
|
|
||||||
#define CONFIG_SSL_X509_ORGANIZATION_UNIT_NAME ""
|
|
||||||
#undef CONFIG_SSL_ENABLE_V23_HANDSHAKE
|
|
||||||
#undef CONFIG_SSL_HAS_PEM
|
|
||||||
#undef CONFIG_SSL_USE_PKCS12
|
|
||||||
#define CONFIG_SSL_EXPIRY_TIME 24
|
|
||||||
#define CONFIG_X509_MAX_CA_CERTS 1
|
|
||||||
#define CONFIG_SSL_MAX_CERTS 3
|
|
||||||
#undef CONFIG_SSL_CTX_MUTEXING
|
|
||||||
#undef CONFIG_USE_DEV_URANDOM
|
|
||||||
#undef CONFIG_WIN32_USE_CRYPTO_LIB
|
|
||||||
#undef CONFIG_OPENSSL_COMPATIBLE
|
|
||||||
#undef CONFIG_PERFORMANCE_TESTING
|
|
||||||
#undef CONFIG_SSL_TEST
|
|
||||||
#undef CONFIG_AXTLSWRAP
|
|
||||||
#undef CONFIG_AXHTTPD
|
|
||||||
#undef CONFIG_HTTP_STATIC_BUILD
|
|
||||||
#define CONFIG_HTTP_PORT
|
|
||||||
#define CONFIG_HTTP_HTTPS_PORT
|
|
||||||
#define CONFIG_HTTP_SESSION_CACHE_SIZE
|
|
||||||
#define CONFIG_HTTP_WEBROOT ""
|
|
||||||
#define CONFIG_HTTP_TIMEOUT
|
|
||||||
#undef CONFIG_HTTP_HAS_CGI
|
|
||||||
#define CONFIG_HTTP_CGI_EXTENSIONS ""
|
|
||||||
#undef CONFIG_HTTP_ENABLE_LUA
|
|
||||||
#define CONFIG_HTTP_LUA_PREFIX ""
|
|
||||||
#undef CONFIG_HTTP_BUILD_LUA
|
|
||||||
#define CONFIG_HTTP_CGI_LAUNCHER ""
|
|
||||||
#undef CONFIG_HTTP_DIRECTORIES
|
|
||||||
#undef CONFIG_HTTP_HAS_AUTHORIZATION
|
|
||||||
#undef CONFIG_HTTP_HAS_IPV6
|
|
||||||
#undef CONFIG_HTTP_ENABLE_DIFFERENT_USER
|
|
||||||
#define CONFIG_HTTP_USER ""
|
|
||||||
#undef CONFIG_HTTP_VERBOSE
|
|
||||||
#undef CONFIG_HTTP_IS_DAEMON
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Language Bindings
|
|
||||||
*/
|
|
||||||
#undef CONFIG_BINDINGS
|
|
||||||
#undef CONFIG_CSHARP_BINDINGS
|
|
||||||
#undef CONFIG_VBNET_BINDINGS
|
|
||||||
#define CONFIG_DOT_NET_FRAMEWORK_BASE ""
|
|
||||||
#undef CONFIG_JAVA_BINDINGS
|
|
||||||
#define CONFIG_JAVA_HOME ""
|
|
||||||
#undef CONFIG_PERL_BINDINGS
|
|
||||||
#define CONFIG_PERL_CORE ""
|
|
||||||
#define CONFIG_PERL_LIB ""
|
|
||||||
#undef CONFIG_LUA_BINDINGS
|
|
||||||
#define CONFIG_LUA_CORE ""
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Samples
|
|
||||||
*/
|
|
||||||
#undef CONFIG_SAMPLES
|
|
||||||
#undef CONFIG_C_SAMPLES
|
|
||||||
#undef CONFIG_CSHARP_SAMPLES
|
|
||||||
#undef CONFIG_VBNET_SAMPLES
|
|
||||||
#undef CONFIG_JAVA_SAMPLES
|
|
||||||
#undef CONFIG_PERL_SAMPLES
|
|
||||||
#undef CONFIG_LUA_SAMPLES
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BigInt Options
|
|
||||||
*/
|
|
||||||
#undef CONFIG_BIGINT_CLASSICAL
|
|
||||||
#undef CONFIG_BIGINT_MONTGOMERY
|
|
||||||
#define CONFIG_BIGINT_BARRETT 1
|
|
||||||
#define CONFIG_BIGINT_CRT 1
|
|
||||||
#undef CONFIG_BIGINT_KARATSUBA
|
|
||||||
#define MUL_KARATSUBA_THRESH
|
|
||||||
#define SQU_KARATSUBA_THRESH
|
|
||||||
#define CONFIG_BIGINT_SLIDING_WINDOW 1
|
|
||||||
#define CONFIG_BIGINT_SQUARE 1
|
|
||||||
#define CONFIG_BIGINT_CHECK_ON 1
|
|
||||||
#define CONFIG_INTEGER_32BIT 1
|
|
||||||
#undef CONFIG_INTEGER_16BIT
|
|
||||||
#undef CONFIG_INTEGER_8BIT
|
|
||||||
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
#ifndef _OS_INT_H
|
|
||||||
#define _OS_INT_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2007-2015, Cameron Rich
|
|
||||||
* Modifications Copyright (c) 2015 Superhouse Automation Pty Ltd
|
|
||||||
*
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* * 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.
|
|
||||||
* * Neither the name of the axTLS project 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file os_port.h
|
|
||||||
*
|
|
||||||
* Some stuff to minimise the differences between windows and linux/unix
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _HEADER_OS_PORT_H
|
|
||||||
#define _HEADER_OS_PORT_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
#include "os_int.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
//#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <posix/sys/socket.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <ipv4/lwip/inet.h>
|
|
||||||
#if defined(CONFIG_SSL_CTX_MUTEXING)
|
|
||||||
#include "semphr.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SOCKET_READ(A,B,C) read(A,B,C)
|
|
||||||
#define SOCKET_WRITE(A,B,C) write(A,B,C)
|
|
||||||
#define SOCKET_CLOSE(A) if (A >= 0) close(A)
|
|
||||||
#define TTY_FLUSH()
|
|
||||||
|
|
||||||
static inline uint64_t be64toh(uint64_t x) {
|
|
||||||
return ntohl(x>>32) | ((uint64_t)(ntohl(x)) << 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
void exit_now(const char *format, ...) __attribute((noreturn));
|
|
||||||
|
|
||||||
#define EXP_FUNC
|
|
||||||
#define STDCALL
|
|
||||||
|
|
||||||
/* Mutex definitions */
|
|
||||||
#if defined(CONFIG_SSL_CTX_MUTEXING)
|
|
||||||
#define SSL_CTX_MUTEX_TYPE xSemaphoreHandle
|
|
||||||
#define SSL_CTX_MUTEX_INIT(A) vSemaphoreCreateBinaryCreateMutex(A)
|
|
||||||
#define SSL_CTX_MUTEX_DESTROY(A) vSemaphoreDelete(A)
|
|
||||||
#define SSL_CTX_LOCK(A) xSemaphoreTakeRecursive(A, portMAX_DELAY)
|
|
||||||
#define SSL_CTX_UNLOCK(A) xSemaphoreGiveRecursive(A)
|
|
||||||
#else
|
|
||||||
#define SSL_CTX_MUTEX_TYPE
|
|
||||||
#define SSL_CTX_MUTEX_INIT(A)
|
|
||||||
#define SSL_CTX_MUTEX_DESTROY(A)
|
|
||||||
#define SSL_CTX_LOCK(A)
|
|
||||||
#define SSL_CTX_UNLOCK(A)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
/* axTLS version header
|
|
||||||
|
|
||||||
We need this because we're using axTLS from source repo, not from a release.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _VERSION_H
|
|
||||||
|
|
||||||
#define AXTLS_VERSION "esp-open-rtos axTLS "GITSHORTREV
|
|
||||||
|
|
||||||
#endif
|
|
||||||
22
code_of_conduct.md
Normal file
22
code_of_conduct.md
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Contributor Code of Conduct
|
||||||
|
|
||||||
|
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
||||||
|
|
||||||
|
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery
|
||||||
|
* Personal attacks
|
||||||
|
* Trolling or insulting/derogatory comments
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
|
||||||
|
* Other unethical or unprofessional conduct.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
|
||||||
|
|
||||||
|
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
|
||||||
96
common.mk
96
common.mk
|
|
@ -80,7 +80,7 @@ OBJDUMP = $(CROSS)objdump
|
||||||
|
|
||||||
# Source components to compile and link. Each of these are subdirectories
|
# Source components to compile and link. Each of these are subdirectories
|
||||||
# of the root, with a 'component.mk' file.
|
# of the root, with a 'component.mk' file.
|
||||||
COMPONENTS ?= core FreeRTOS lwip axtls $(EXTRA_COMPONENTS)
|
COMPONENTS ?= $(EXTRA_COMPONENTS) FreeRTOS lwip core
|
||||||
|
|
||||||
# binary esp-iot-rtos SDK libraries to link. These are pre-processed prior to linking.
|
# binary esp-iot-rtos SDK libraries to link. These are pre-processed prior to linking.
|
||||||
SDK_LIBS ?= main net80211 phy pp wpa
|
SDK_LIBS ?= main net80211 phy pp wpa
|
||||||
|
|
@ -94,14 +94,37 @@ OWN_LIBC ?= 1
|
||||||
# Note: you will need a recent esp
|
# Note: you will need a recent esp
|
||||||
ENTRY_SYMBOL ?= call_user_start
|
ENTRY_SYMBOL ?= call_user_start
|
||||||
|
|
||||||
CFLAGS = -Wall -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -std=gnu99 $(CPPFLAGS)
|
# Set this to zero if you don't want individual function & data sections
|
||||||
|
# (some code may be slightly slower, linking will be slighty slower,
|
||||||
|
# but compiled code size will come down a small amount.)
|
||||||
|
SPLIT_SECTIONS ?= 1
|
||||||
|
|
||||||
|
# Common flags for both C & C++_
|
||||||
|
C_CXX_FLAGS = -Wall -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals $(CPPFLAGS)
|
||||||
|
# Flags for C only
|
||||||
|
CFLAGS = $(C_CXX_FLAGS) -std=gnu99
|
||||||
|
# Flags for C++ only
|
||||||
|
CXXFLAGS = $(C_CXX_FLAGS) -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
LDFLAGS = -nostdlib -Wl,--no-check-sections -Wl,-L$(BUILD_DIR)sdklib -Wl,-L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=build/${PROGRAM}.map $(EXTRA_LDFLAGS)
|
LDFLAGS = -nostdlib -Wl,--no-check-sections -Wl,-L$(BUILD_DIR)sdklib -Wl,-L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=build/${PROGRAM}.map $(EXTRA_LDFLAGS)
|
||||||
|
|
||||||
|
ifeq ($(SPLIT_SECTIONS),1)
|
||||||
|
C_CXX_FLAGS += -ffunction-sections -fdata-sections
|
||||||
|
LDFLAGS += -Wl,-gc-sections
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(FLAVOR),debug)
|
ifeq ($(FLAVOR),debug)
|
||||||
CFLAGS += -g -O0
|
C_CXX_FLAGS += -g -O0
|
||||||
LDFLAGS += -g -O0
|
LDFLAGS += -g -O0
|
||||||
|
else ifeq ($(FLAVOR),sdklike)
|
||||||
|
# These are flags intended to produce object code as similar as possible to
|
||||||
|
# the output of the compiler used to build the SDK libs (for comparison of
|
||||||
|
# disassemblies when coding replacement routines). It is not normally
|
||||||
|
# intended to be used otherwise.
|
||||||
|
CFLAGS += -O2 -Os -fno-inline -fno-ipa-cp -fno-toplevel-reorder
|
||||||
|
LDFLAGS += -O2
|
||||||
else
|
else
|
||||||
CFLAGS += -g -O2
|
C_CXX_FLAGS += -g -O2
|
||||||
LDFLAGS += -g -O2
|
LDFLAGS += -g -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -147,7 +170,7 @@ ifeq ($(OTA),0)
|
||||||
# for non-OTA, we create two different files for uploading into the flash
|
# for non-OTA, we create two different files for uploading into the flash
|
||||||
# these are the names and options to generate them
|
# these are the names and options to generate them
|
||||||
FW_ADDR_1 = 0x00000
|
FW_ADDR_1 = 0x00000
|
||||||
FW_ADDR_2 = 0x40000
|
FW_ADDR_2 = 0x20000
|
||||||
FW_FILE_1 = $(addprefix $(FW_BASE),$(FW_ADDR_1).bin)
|
FW_FILE_1 = $(addprefix $(FW_BASE),$(FW_ADDR_1).bin)
|
||||||
FW_FILE_2 = $(addprefix $(FW_BASE),$(FW_ADDR_2).bin)
|
FW_FILE_2 = $(addprefix $(FW_BASE),$(FW_ADDR_2).bin)
|
||||||
else
|
else
|
||||||
|
|
@ -194,42 +217,45 @@ all: $(PROGRAM_OUT) $(FW_FILE_1) $(FW_FILE_2) $(FW_FILE)
|
||||||
# component_compile_rules: Produces compilation rules for a given
|
# component_compile_rules: Produces compilation rules for a given
|
||||||
# component
|
# component
|
||||||
#
|
#
|
||||||
|
# For user-facing documentation, see:
|
||||||
|
# https://github.com/SuperHouse/esp-open-rtos/wiki/Build-Process#adding-a-new-component
|
||||||
|
#
|
||||||
# Call arguments are:
|
# Call arguments are:
|
||||||
# $(1) - component name
|
# $(1) - component name
|
||||||
#
|
#
|
||||||
# Expects that the following component-specific variables are defined:
|
# Expects that the following component-specific variables are defined:
|
||||||
#
|
#
|
||||||
# $(1)_ROOT = Top-level dir containing component. Can be in-tree or out-of-tree.
|
# $(1)_ROOT = Top-level dir containing component. Can be in-tree or out-of-tree.
|
||||||
|
# (if this variable isn't defined, directory containing component.mk is used)
|
||||||
# $(1)_SRC_DIR = List of source directories for the component. All must be under $(1)_ROOT
|
# $(1)_SRC_DIR = List of source directories for the component. All must be under $(1)_ROOT
|
||||||
# $(1)_INC_DIR = List of include directories specific for the component
|
# $(1)_INC_DIR = List of include directories specific for the component
|
||||||
#
|
#
|
||||||
# As an alternative to $(1)_SRC_DIR, you can specify source filenames
|
|
||||||
# as $(1)_SRC_FILES. If you want to specify both directories and
|
|
||||||
# some additional files, specify directories in $(1)_SRC_DIR and
|
|
||||||
# additional files in $(1)_EXTRA_SRC_FILES.
|
|
||||||
#
|
|
||||||
# Optional variables:
|
|
||||||
# $(1)_CFLAGS = CFLAGS to override the default CFLAGS for this component only.
|
|
||||||
#
|
#
|
||||||
# Each call appends to COMPONENT_ARS which is a list of archive files for compiled components
|
# Each call appends to COMPONENT_ARS which is a list of archive files for compiled components
|
||||||
COMPONENT_ARS =
|
COMPONENT_ARS =
|
||||||
define component_compile_rules
|
define component_compile_rules
|
||||||
|
$(1)_DEFAULT_ROOT := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
|
$(1)_ROOT ?= $$($(1)_DEFAULT_ROOT)
|
||||||
$(1)_OBJ_DIR = $(call lc,$(BUILD_DIR)$(1)/)
|
$(1)_OBJ_DIR = $(call lc,$(BUILD_DIR)$(1)/)
|
||||||
### determine source files and object files ###
|
### determine source files and object files ###
|
||||||
$(1)_SRC_FILES ?= $$(foreach sdir,$$($(1)_SRC_DIR), \
|
$(1)_SRC_FILES ?= $$(foreach sdir,$$($(1)_SRC_DIR), \
|
||||||
$$(wildcard $$(sdir)/*.c) $$(wildcard $$(sdir)/*.S)) \
|
$$(wildcard $$(sdir)/*.c) $$(wildcard $$(sdir)/*.S) \
|
||||||
|
$$(wildcard $$(sdir)/*.cpp)) \
|
||||||
$$($(1)_EXTRA_SRC_FILES)
|
$$($(1)_EXTRA_SRC_FILES)
|
||||||
$(1)_REAL_SRC_FILES = $$(foreach sfile,$$($(1)_SRC_FILES),$$(realpath $$(sfile)))
|
$(1)_REAL_SRC_FILES = $$(foreach sfile,$$($(1)_SRC_FILES),$$(realpath $$(sfile)))
|
||||||
$(1)_REAL_ROOT = $$(realpath $$($(1)_ROOT))
|
$(1)_REAL_ROOT = $$(realpath $$($(1)_ROOT))
|
||||||
# patsubst here substitutes real component root path for the relative OBJ_DIR path, making things short again
|
# patsubst here substitutes real component root path for the relative OBJ_DIR path, making things short again
|
||||||
$(1)_OBJ_FILES_C = $$(patsubst $$($(1)_REAL_ROOT)%.c,$$($(1)_OBJ_DIR)%.o,$$($(1)_REAL_SRC_FILES))
|
$(1)_OBJ_FILES_CXX = $$(patsubst $$($(1)_REAL_ROOT)%.cpp,$$($(1)_OBJ_DIR)%.o,$$($(1)_REAL_SRC_FILES))
|
||||||
|
$(1)_OBJ_FILES_C = $$(patsubst $$($(1)_REAL_ROOT)%.c,$$($(1)_OBJ_DIR)%.o,$$($(1)_OBJ_FILES_CXX))
|
||||||
$(1)_OBJ_FILES = $$(patsubst $$($(1)_REAL_ROOT)%.S,$$($(1)_OBJ_DIR)%.o,$$($(1)_OBJ_FILES_C))
|
$(1)_OBJ_FILES = $$(patsubst $$($(1)_REAL_ROOT)%.S,$$($(1)_OBJ_DIR)%.o,$$($(1)_OBJ_FILES_C))
|
||||||
# the last included makefile is our component's component.mk makefile (rebuild the component if it changes)
|
# the last included makefile is our component's component.mk makefile (rebuild the component if it changes)
|
||||||
$(1)_MAKEFILE ?= $(lastword $(MAKEFILE_LIST))
|
$(1)_MAKEFILE ?= $(lastword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
### determine compiler arguments ###
|
### determine compiler arguments ###
|
||||||
$(1)_CFLAGS ?= $(CFLAGS)
|
$(1)_CFLAGS ?= $(CFLAGS)
|
||||||
|
$(1)_CXXFLAGS ?= $(CXXFLAGS)
|
||||||
$(1)_CC_ARGS = $(Q) $(CC) $$(addprefix -I,$$(INC_DIRS)) $$(addprefix -I,$$($(1)_INC_DIR)) $$($(1)_CFLAGS)
|
$(1)_CC_ARGS = $(Q) $(CC) $$(addprefix -I,$$(INC_DIRS)) $$(addprefix -I,$$($(1)_INC_DIR)) $$($(1)_CFLAGS)
|
||||||
|
$(1)_CXX_ARGS = $(Q) $(C++) $$(addprefix -I,$$(INC_DIRS)) $$(addprefix -I,$$($(1)_INC_DIR)) $$($(1)_CXXFLAGS)
|
||||||
$(1)_AR = $(call lc,$(BUILD_DIR)$(1).a)
|
$(1)_AR = $(call lc,$(BUILD_DIR)$(1).a)
|
||||||
|
|
||||||
$$($(1)_OBJ_DIR)%.o: $$($(1)_REAL_ROOT)%.c $$($(1)_MAKEFILE) $(wildcard $(ROOT)*.mk) | $$($(1)_SRC_DIR)
|
$$($(1)_OBJ_DIR)%.o: $$($(1)_REAL_ROOT)%.c $$($(1)_MAKEFILE) $(wildcard $(ROOT)*.mk) | $$($(1)_SRC_DIR)
|
||||||
|
|
@ -238,10 +264,17 @@ $$($(1)_OBJ_DIR)%.o: $$($(1)_REAL_ROOT)%.c $$($(1)_MAKEFILE) $(wildcard $(ROOT)*
|
||||||
$$($(1)_CC_ARGS) -c $$< -o $$@
|
$$($(1)_CC_ARGS) -c $$< -o $$@
|
||||||
$$($(1)_CC_ARGS) -MM -MT $$@ -MF $$(@:.o=.d) $$<
|
$$($(1)_CC_ARGS) -MM -MT $$@ -MF $$(@:.o=.d) $$<
|
||||||
|
|
||||||
|
$$($(1)_OBJ_DIR)%.o: $$($(1)_REAL_ROOT)%.cpp $$($(1)_MAKEFILE) $(wildcard $(ROOT)*.mk) | $$($(1)_SRC_DIR)
|
||||||
|
$(vecho) "C++ $$<"
|
||||||
|
$(Q) mkdir -p $$(dir $$@)
|
||||||
|
$$($(1)_CXX_ARGS) -c $$< -o $$@
|
||||||
|
$$($(1)_CXX_ARGS) -MM -MT $$@ -MF $$(@:.o=.d) $$<
|
||||||
|
|
||||||
$$($(1)_OBJ_DIR)%.o: $$($(1)_REAL_ROOT)%.S $$($(1)_MAKEFILE) $(wildcard $(ROOT)*.mk) | $$($(1)_SRC_DIR)
|
$$($(1)_OBJ_DIR)%.o: $$($(1)_REAL_ROOT)%.S $$($(1)_MAKEFILE) $(wildcard $(ROOT)*.mk) | $$($(1)_SRC_DIR)
|
||||||
$(vecho) "AS $$<"
|
$(vecho) "AS $$<"
|
||||||
$(Q) mkdir -p $$(dir $$@)
|
$(Q) mkdir -p $$(dir $$@)
|
||||||
$$($(1)_CC_ARGS) -c $$< -o $$@
|
$$($(1)_CC_ARGS) -c $$< -o $$@
|
||||||
|
$$($(1)_CC_ARGS) -MM -MT $$@ -MF $$(@:.o=.d) $$<
|
||||||
|
|
||||||
# the component is shown to depend on both obj and source files so we get a meaningful error message
|
# the component is shown to depend on both obj and source files so we get a meaningful error message
|
||||||
# for missing explicitly named source files
|
# for missing explicitly named source files
|
||||||
|
|
@ -280,25 +313,9 @@ $(BUILD_DIR)sdklib/%_stage1.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/%.remove | $(BU
|
||||||
$(Q) cat $< > $@
|
$(Q) cat $< > $@
|
||||||
$(Q) $(AR) d $@ @$(word 2,$^)
|
$(Q) $(AR) d $@ @$(word 2,$^)
|
||||||
|
|
||||||
# Generate a regex to match symbols we don't want to rename, listed in
|
# Stage 2: Redefine all SDK symbols as sdk_, weaken all symbols.
|
||||||
# symbols_norename.txt
|
$(BUILD_DIR)sdklib/%.a: $(BUILD_DIR)sdklib/%_stage1.a $(ROOT)lib/allsymbols.rename
|
||||||
$(BUILD_DIR)sdklib/norename.match: $(ROOT)lib/symbols_norename.txt | $(BUILD_DIR)sdklib
|
@echo "SDK processing stage 2: Renaming symbols in SDK library $< -> $@"
|
||||||
cat $< | grep -v "^#" | sed ':begin;$!N;s/\n/\\|/;tbegin' > $@
|
|
||||||
|
|
||||||
# Stage 2: Build a list of defined symbols per library, renamed with sdk_ prefix
|
|
||||||
$(BUILD_DIR)sdklib/%.rename: $(BUILD_DIR)sdklib/%_stage1.a $(BUILD_DIR)sdklib/norename.match
|
|
||||||
@echo "SDK processing stage 2: Building symbol list for $< -> $@"
|
|
||||||
$(Q) $(OBJDUMP) -t $< | grep ' g ' \
|
|
||||||
| sed -r 's/^.+ ([^ ]+)$$/\1 sdk_\1/' \
|
|
||||||
| grep -v `cat $(BUILD_DIR)sdklib/norename.match` > $@
|
|
||||||
|
|
||||||
# Build a master list of all SDK-defined symbols to rename across all libraries
|
|
||||||
$(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LIBS))
|
|
||||||
cat $^ > $@
|
|
||||||
|
|
||||||
# Stage 3: Redefine all SDK symbols as sdk_, weaken all symbols.
|
|
||||||
$(BUILD_DIR)sdklib/%.a: $(BUILD_DIR)sdklib/%_stage1.a $(BUILD_DIR)sdklib/allsymbols.rename
|
|
||||||
@echo "SDK processing stage 3: Renaming symbols in SDK library $< -> $@"
|
|
||||||
$(Q) $(OBJCOPY) --redefine-syms $(word 2,$^) --weaken $< $@
|
$(Q) $(OBJCOPY) --redefine-syms $(word 2,$^) --weaken $< $@
|
||||||
|
|
||||||
# include "dummy component" for the 'program' object files, defined in the Makefile
|
# include "dummy component" for the 'program' object files, defined in the Makefile
|
||||||
|
|
@ -308,8 +325,15 @@ PROGRAM_MAKEFILE = $(firstword $(MAKEFILE_LIST))
|
||||||
$(eval $(call component_compile_rules,PROGRAM))
|
$(eval $(call component_compile_rules,PROGRAM))
|
||||||
|
|
||||||
## Include other components (this is where the actual compiler sections are generated)
|
## Include other components (this is where the actual compiler sections are generated)
|
||||||
$(foreach component,$(COMPONENTS), $(eval include $(ROOT)$(component)/component.mk))
|
##
|
||||||
|
## if component directory exists relative to $(ROOT), use that.
|
||||||
|
## otherwise try to resolve it as an absolute path
|
||||||
|
$(foreach component,$(COMPONENTS), \
|
||||||
|
$(if $(wildcard $(ROOT)$(component)), \
|
||||||
|
$(eval include $(ROOT)$(component)/component.mk), \
|
||||||
|
$(eval include $(component)/component.mk) \
|
||||||
|
) \
|
||||||
|
)
|
||||||
|
|
||||||
## Run linker scripts via C preprocessor to evaluate macros
|
## Run linker scripts via C preprocessor to evaluate macros
|
||||||
$(LD_DIR)%.ld: $(ROOT)ld/%.ld | $(LD_DIR)
|
$(LD_DIR)%.ld: $(ROOT)ld/%.ld | $(LD_DIR)
|
||||||
|
|
@ -318,7 +342,7 @@ $(LD_DIR)%.ld: $(ROOT)ld/%.ld | $(LD_DIR)
|
||||||
# final linking step to produce .elf
|
# final linking step to produce .elf
|
||||||
$(PROGRAM_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS_PROCESSED)
|
$(PROGRAM_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS_PROCESSED)
|
||||||
$(vecho) "LD $@"
|
$(vecho) "LD $@"
|
||||||
$(Q) $(LD) $(LDFLAGS) -Wl,--start-group $(LIB_ARGS) $(SDK_LIB_ARGS) $(COMPONENT_ARS) -Wl,--end-group -o $@
|
$(Q) $(LD) $(LDFLAGS) -Wl,--start-group $(COMPONENT_ARS) $(LIB_ARGS) $(SDK_LIB_ARGS) -Wl,--end-group -o $@
|
||||||
|
|
||||||
$(BUILD_DIR) $(FW_BASE) $(BUILD_DIR)sdklib $(LD_DIR):
|
$(BUILD_DIR) $(FW_BASE) $(BUILD_DIR)sdklib $(LD_DIR):
|
||||||
$(Q) mkdir -p $@
|
$(Q) mkdir -p $@
|
||||||
|
|
|
||||||
510
core/app_main.c
Normal file
510
core/app_main.c
Normal file
|
|
@ -0,0 +1,510 @@
|
||||||
|
/* Implementation of libmain/app_main.o from the Espressif SDK.
|
||||||
|
*
|
||||||
|
* This contains most of the startup code for the SDK/OS, some event handlers,
|
||||||
|
* etc.
|
||||||
|
*
|
||||||
|
* Part of esp-open-rtos
|
||||||
|
* Copyright (C) 2015 Superhouse Automation Pty Ltd
|
||||||
|
* BSD Licensed as described in the file LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include <task.h>
|
||||||
|
#include <lwip/tcpip.h>
|
||||||
|
|
||||||
|
#include "common_macros.h"
|
||||||
|
#include "xtensa_ops.h"
|
||||||
|
#include "esp/rom.h"
|
||||||
|
#include "esp/iomux_regs.h"
|
||||||
|
#include "esp/uart_regs.h"
|
||||||
|
#include "esp/spi_regs.h"
|
||||||
|
#include "esp/dport_regs.h"
|
||||||
|
#include "esp/wdev_regs.h"
|
||||||
|
#include "os_version.h"
|
||||||
|
|
||||||
|
#include "espressif/esp_common.h"
|
||||||
|
#include "sdk_internal.h"
|
||||||
|
|
||||||
|
/* This is not declared in any header file (but arguably should be) */
|
||||||
|
|
||||||
|
void user_init(void);
|
||||||
|
|
||||||
|
#define UART_DIVISOR 1068 // 74906 bps (yeah, I don't understand it either)
|
||||||
|
#define BOOT_INFO_SIZE 28
|
||||||
|
//TODO: phy_info should probably be a struct (no idea about its organization, though)
|
||||||
|
#define PHY_INFO_SIZE 128
|
||||||
|
|
||||||
|
// These are the offsets of these values within the RTCMEM regions. It appears
|
||||||
|
// that the ROM saves them to RTCMEM before calling us, and we pull them out of
|
||||||
|
// there to display them in startup messages (not sure why it works that way).
|
||||||
|
#define RTCMEM_BACKUP_PHY_VER 31
|
||||||
|
#define RTCMEM_SYSTEM_PP_VER 62
|
||||||
|
|
||||||
|
#define halt() while (1) {}
|
||||||
|
|
||||||
|
extern uint32_t _bss_start;
|
||||||
|
extern uint32_t _bss_end;
|
||||||
|
|
||||||
|
// .Ldata003 -- .irom.text+0x0
|
||||||
|
static const uint8_t IROM default_phy_info[PHY_INFO_SIZE] = {
|
||||||
|
0x05, 0x00, 0x04, 0x02, 0x05, 0x05, 0x05, 0x02,
|
||||||
|
0x05, 0x00, 0x04, 0x05, 0x05, 0x04, 0x05, 0x05,
|
||||||
|
0x04, 0xfe, 0xfd, 0xff, 0xf0, 0xf0, 0xf0, 0xe0,
|
||||||
|
0xe0, 0xe0, 0xe1, 0x0a, 0xff, 0xff, 0xf8, 0x00,
|
||||||
|
0xf8, 0xf8, 0x52, 0x4e, 0x4a, 0x44, 0x40, 0x38,
|
||||||
|
0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe1, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x01, 0x93, 0x43, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
// user_init_flag -- .bss+0x0
|
||||||
|
uint8_t sdk_user_init_flag;
|
||||||
|
|
||||||
|
// info -- .bss+0x4
|
||||||
|
struct sdk_info_st sdk_info;
|
||||||
|
|
||||||
|
// xUserTaskHandle -- .bss+0x28
|
||||||
|
xTaskHandle sdk_xUserTaskHandle;
|
||||||
|
|
||||||
|
// xWatchDogTaskHandle -- .bss+0x2c
|
||||||
|
xTaskHandle sdk_xWatchDogTaskHandle;
|
||||||
|
|
||||||
|
/* Static function prototypes */
|
||||||
|
|
||||||
|
static void IRAM get_otp_mac_address(uint8_t *buf);
|
||||||
|
static void IRAM set_spi0_divisor(uint32_t divisor);
|
||||||
|
static int IRAM default_putc(char c);
|
||||||
|
static void IRAM default_putc1(char c);
|
||||||
|
static void zero_bss(void);
|
||||||
|
static void init_networking(uint8_t *phy_info, uint8_t *mac_addr);
|
||||||
|
static void init_g_ic(void);
|
||||||
|
static void dump_excinfo(void);
|
||||||
|
static void user_start_phase2(void);
|
||||||
|
static void dump_flash_sector(uint32_t start_sector, uint32_t length);
|
||||||
|
static void dump_flash_config_sectors(uint32_t start_sector);
|
||||||
|
|
||||||
|
// .Lfunc001 -- .text+0x14
|
||||||
|
static void IRAM get_otp_mac_address(uint8_t *buf) {
|
||||||
|
uint32_t otp_flags;
|
||||||
|
uint32_t otp_id0, otp_id1;
|
||||||
|
uint32_t otp_vendor_id;
|
||||||
|
|
||||||
|
otp_flags = DPORT.OTP_CHIPID;
|
||||||
|
otp_id1 = DPORT.OTP_MAC1;
|
||||||
|
otp_id0 = DPORT.OTP_MAC0;
|
||||||
|
if (!(otp_flags & 0x8000)) {
|
||||||
|
//FIXME: do we really need this check?
|
||||||
|
printf("Firmware ONLY supports ESP8266!!!\n");
|
||||||
|
halt();
|
||||||
|
}
|
||||||
|
if (otp_id0 == 0 && otp_id1 == 0) {
|
||||||
|
printf("empty otp\n");
|
||||||
|
halt();
|
||||||
|
}
|
||||||
|
if (otp_flags & 0x1000) {
|
||||||
|
// If bit 12 is set, it indicates that the vendor portion of the MAC
|
||||||
|
// address is stored in DPORT.OTP_MAC2.
|
||||||
|
otp_vendor_id = DPORT.OTP_MAC2;
|
||||||
|
buf[0] = otp_vendor_id >> 16;
|
||||||
|
buf[1] = otp_vendor_id >> 8;
|
||||||
|
buf[2] = otp_vendor_id;
|
||||||
|
} else {
|
||||||
|
// If bit 12 is clear, there's no MAC vendor in DPORT.OTP_MAC2, so
|
||||||
|
// default to the Espressif MAC vendor prefix instead.
|
||||||
|
buf[1] = 0xfe;
|
||||||
|
buf[0] = 0x18;
|
||||||
|
buf[2] = 0x34;
|
||||||
|
}
|
||||||
|
buf[3] = otp_id1 >> 8;
|
||||||
|
buf[4] = otp_id1;
|
||||||
|
buf[5] = otp_id0 >> 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc002 -- .text+0xa0
|
||||||
|
static void IRAM set_spi0_divisor(uint32_t divisor) {
|
||||||
|
int cycle_len, half_cycle_len, clkdiv;
|
||||||
|
|
||||||
|
if (divisor < 2) {
|
||||||
|
clkdiv = 0;
|
||||||
|
SPI(0).CTRL0 |= SPI_CTRL0_CLOCK_EQU_SYS_CLOCK;
|
||||||
|
IOMUX.CONF |= IOMUX_CONF_SPI0_CLOCK_EQU_SYS_CLOCK;
|
||||||
|
} else {
|
||||||
|
cycle_len = divisor - 1;
|
||||||
|
half_cycle_len = (divisor / 2) - 1;
|
||||||
|
clkdiv = VAL2FIELD(SPI_CTRL0_CLOCK_NUM, cycle_len)
|
||||||
|
| VAL2FIELD(SPI_CTRL0_CLOCK_HIGH, half_cycle_len)
|
||||||
|
| VAL2FIELD(SPI_CTRL0_CLOCK_LOW, cycle_len);
|
||||||
|
SPI(0).CTRL0 &= ~SPI_CTRL0_CLOCK_EQU_SYS_CLOCK;
|
||||||
|
IOMUX.CONF &= ~IOMUX_CONF_SPI0_CLOCK_EQU_SYS_CLOCK;
|
||||||
|
}
|
||||||
|
SPI(0).CTRL0 = SET_FIELD(SPI(0).CTRL0, SPI_CTRL0_CLOCK, clkdiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .text+0x148
|
||||||
|
void IRAM sdk_user_fatal_exception_handler(void) {
|
||||||
|
if (!sdk_NMIIrqIsOn) {
|
||||||
|
vPortEnterCritical();
|
||||||
|
do {
|
||||||
|
DPORT.DPORT0 &= 0xffffffe0;
|
||||||
|
} while (DPORT.DPORT0 & 0x00000001);
|
||||||
|
}
|
||||||
|
Cache_Read_Disable();
|
||||||
|
Cache_Read_Enable(0, 0, 1);
|
||||||
|
dump_excinfo();
|
||||||
|
while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS)) {}
|
||||||
|
while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(1).STATUS)) {}
|
||||||
|
sdk_system_restart_in_nmi();
|
||||||
|
halt();
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc003 -- .text+0x1d0
|
||||||
|
static int IRAM default_putc(char c) {
|
||||||
|
while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS) > 125) {}
|
||||||
|
UART(0).FIFO = c;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc004 -- .text+0x1f4
|
||||||
|
static void IRAM default_putc1(char c) {
|
||||||
|
if (c == '\n') {
|
||||||
|
default_putc('\r');
|
||||||
|
} else if (c == '\r') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default_putc(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .text+0x258
|
||||||
|
void IRAM sdk_user_start(void) {
|
||||||
|
uint32_t buf32[sizeof(struct sdk_g_ic_saved_st) / 4];
|
||||||
|
uint8_t *buf8 = (uint8_t *)buf32;
|
||||||
|
uint32_t flash_speed_divisor;
|
||||||
|
uint32_t flash_sectors;
|
||||||
|
uint32_t flash_size;
|
||||||
|
int boot_slot;
|
||||||
|
uint32_t cksum_magic;
|
||||||
|
uint32_t cksum_len;
|
||||||
|
uint32_t cksum_value;
|
||||||
|
uint32_t ic_flash_addr;
|
||||||
|
|
||||||
|
SPI(0).USER0 |= SPI_USER0_CS_SETUP;
|
||||||
|
sdk_SPIRead(0, buf32, 4);
|
||||||
|
|
||||||
|
switch (buf8[3] & 0x0f) {
|
||||||
|
case 0xf: // 80 MHz
|
||||||
|
flash_speed_divisor = 1;
|
||||||
|
break;
|
||||||
|
case 0x0: // 40 MHz
|
||||||
|
flash_speed_divisor = 2;
|
||||||
|
break;
|
||||||
|
case 0x1: // 26 MHz
|
||||||
|
flash_speed_divisor = 3;
|
||||||
|
break;
|
||||||
|
case 0x2: // 20 MHz
|
||||||
|
flash_speed_divisor = 4;
|
||||||
|
break;
|
||||||
|
default: // Invalid -- Assume 40 MHz
|
||||||
|
flash_speed_divisor = 2;
|
||||||
|
}
|
||||||
|
switch (buf8[3] >> 4) {
|
||||||
|
case 0x0: // 4 Mbit (512 KByte)
|
||||||
|
flash_sectors = 128;
|
||||||
|
break;
|
||||||
|
case 0x1: // 2 Mbit (256 Kbyte)
|
||||||
|
flash_sectors = 64;
|
||||||
|
break;
|
||||||
|
case 0x2: // 8 Mbit (1 Mbyte)
|
||||||
|
flash_sectors = 256;
|
||||||
|
break;
|
||||||
|
case 0x3: // 16 Mbit (2 Mbyte)
|
||||||
|
flash_sectors = 512;
|
||||||
|
break;
|
||||||
|
case 0x4: // 32 Mbit (4 Mbyte)
|
||||||
|
flash_sectors = 1024;
|
||||||
|
break;
|
||||||
|
default: // Invalid -- Assume 4 Mbit (512 KByte)
|
||||||
|
flash_sectors = 128;
|
||||||
|
}
|
||||||
|
//FIXME: we should probably calculate flash_sectors by starting with flash_size and dividing by sdk_flashchip.sector_size instead of vice-versa.
|
||||||
|
flash_size = flash_sectors * 4096;
|
||||||
|
sdk_flashchip.chip_size = flash_size;
|
||||||
|
set_spi0_divisor(flash_speed_divisor);
|
||||||
|
sdk_SPIRead(flash_size - 4096, buf32, BOOT_INFO_SIZE);
|
||||||
|
boot_slot = buf8[0] ? 1 : 0;
|
||||||
|
cksum_magic = buf32[1];
|
||||||
|
cksum_len = buf32[3 + boot_slot];
|
||||||
|
cksum_value = buf32[5 + boot_slot];
|
||||||
|
ic_flash_addr = (flash_sectors - 3 + boot_slot) * sdk_flashchip.sector_size;
|
||||||
|
sdk_SPIRead(ic_flash_addr, buf32, sizeof(struct sdk_g_ic_saved_st));
|
||||||
|
Cache_Read_Enable(0, 0, 1);
|
||||||
|
zero_bss();
|
||||||
|
sdk_os_install_putc1(default_putc1);
|
||||||
|
if (cksum_magic == 0xffffffff) {
|
||||||
|
// No checksum required
|
||||||
|
} else if ((cksum_magic == 0x55aa55aa) &&
|
||||||
|
(sdk_system_get_checksum(buf8, cksum_len) == cksum_value)) {
|
||||||
|
// Checksum OK
|
||||||
|
} else {
|
||||||
|
// Bad checksum or bad cksum_magic value
|
||||||
|
dump_flash_config_sectors(flash_sectors - 4);
|
||||||
|
//FIXME: should we halt here? (original SDK code doesn't)
|
||||||
|
}
|
||||||
|
memcpy(&sdk_g_ic.s, buf32, sizeof(struct sdk_g_ic_saved_st));
|
||||||
|
|
||||||
|
user_start_phase2();
|
||||||
|
}
|
||||||
|
|
||||||
|
// .text+0x3a8
|
||||||
|
void IRAM vApplicationStackOverflowHook(xTaskHandle task, char *task_name) {
|
||||||
|
printf("\"%s\"(stack_size = %lu) overflow the heap_size.\n", task_name, uxTaskGetStackHighWaterMark(task));
|
||||||
|
}
|
||||||
|
|
||||||
|
// .text+0x3d8
|
||||||
|
void IRAM vApplicationIdleHook(void) {
|
||||||
|
printf("idle %u\n", WDEV.SYS_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .text+0x404
|
||||||
|
void IRAM vApplicationTickHook(void) {
|
||||||
|
printf("tick %u\n", WDEV.SYS_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc005 -- .irom0.text+0x8
|
||||||
|
static void zero_bss(void) {
|
||||||
|
uint32_t *addr;
|
||||||
|
|
||||||
|
for (addr = &_bss_start; addr < &_bss_end; addr++) {
|
||||||
|
*addr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc006 -- .irom0.text+0x70
|
||||||
|
static void init_networking(uint8_t *phy_info, uint8_t *mac_addr) {
|
||||||
|
if (sdk_register_chipv6_phy(phy_info)) {
|
||||||
|
printf("FATAL: sdk_register_chipv6_phy failed");
|
||||||
|
halt();
|
||||||
|
}
|
||||||
|
sdk_uart_div_modify(0, UART_DIVISOR);
|
||||||
|
sdk_uart_div_modify(1, UART_DIVISOR);
|
||||||
|
sdk_phy_disable_agc();
|
||||||
|
sdk_ieee80211_phy_init(sdk_g_ic.s.phy_mode);
|
||||||
|
sdk_lmacInit();
|
||||||
|
sdk_wDev_Initialize();
|
||||||
|
sdk_pp_attach();
|
||||||
|
sdk_ieee80211_ifattach(&sdk_g_ic, mac_addr);
|
||||||
|
_xt_isr_mask(1);
|
||||||
|
DPORT.DPORT0 = SET_FIELD(DPORT.DPORT0, DPORT_DPORT0_FIELD0, 1);
|
||||||
|
sdk_pm_attach();
|
||||||
|
sdk_phy_enable_agc();
|
||||||
|
sdk_cnx_attach(&sdk_g_ic);
|
||||||
|
sdk_wDevEnableRx();
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc007 -- .irom0.text+0x148
|
||||||
|
static void init_g_ic(void) {
|
||||||
|
if (sdk_g_ic.s.wifi_mode == 0xff) {
|
||||||
|
sdk_g_ic.s.wifi_mode = 2;
|
||||||
|
}
|
||||||
|
sdk_wifi_softap_set_default_ssid();
|
||||||
|
if (sdk_g_ic.s._unknown30d < 1 || sdk_g_ic.s._unknown30d > 14) {
|
||||||
|
sdk_g_ic.s._unknown30d = 1;
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s._unknown544 < 100 || sdk_g_ic.s._unknown544 > 60000) {
|
||||||
|
sdk_g_ic.s._unknown544 = 100;
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s._unknown30e == 1 || sdk_g_ic.s._unknown30e > 4) {
|
||||||
|
sdk_g_ic.s._unknown30e = 0;
|
||||||
|
}
|
||||||
|
bzero(sdk_g_ic.s._unknown2ac, sizeof(sdk_g_ic.s._unknown2ac));
|
||||||
|
if (sdk_g_ic.s._unknown30f > 1) {
|
||||||
|
sdk_g_ic.s._unknown30f = 0;
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s._unknown310 > 4) {
|
||||||
|
sdk_g_ic.s._unknown310 = 4;
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s._unknown1e4._unknown1e4 == 0xffffffff) {
|
||||||
|
bzero(&sdk_g_ic.s._unknown1e4, sizeof(sdk_g_ic.s._unknown1e4));
|
||||||
|
bzero(&sdk_g_ic.s._unknown20f, sizeof(sdk_g_ic.s._unknown20f));
|
||||||
|
}
|
||||||
|
sdk_g_ic.s.wifi_led_enable = 0;
|
||||||
|
if (sdk_g_ic.s._unknown281 > 1) {
|
||||||
|
sdk_g_ic.s._unknown281 = 0;
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s.ap_number > 5) {
|
||||||
|
sdk_g_ic.s.ap_number = 1;
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s.phy_mode < 1 || sdk_g_ic.s.phy_mode > 3) {
|
||||||
|
sdk_g_ic.s.phy_mode = PHY_MODE_11N;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc008 -- .irom0.text+0x2a0
|
||||||
|
static void dump_excinfo(void) {
|
||||||
|
uint32_t exccause, epc1, epc2, epc3, excvaddr, depc, excsave1;
|
||||||
|
uint32_t excinfo[8];
|
||||||
|
|
||||||
|
RSR(exccause, exccause);
|
||||||
|
printf("Fatal exception (%d): \n", (int)exccause);
|
||||||
|
RSR(epc1, epc1);
|
||||||
|
RSR(epc2, epc2);
|
||||||
|
RSR(epc3, epc3);
|
||||||
|
RSR(excvaddr, excvaddr);
|
||||||
|
RSR(depc, depc);
|
||||||
|
RSR(excsave1, excsave1);
|
||||||
|
printf("%s=0x%08x\n", "epc1", epc1);
|
||||||
|
printf("%s=0x%08x\n", "epc2", epc2);
|
||||||
|
printf("%s=0x%08x\n", "epc3", epc3);
|
||||||
|
printf("%s=0x%08x\n", "excvaddr", excvaddr);
|
||||||
|
printf("%s=0x%08x\n", "depc", depc);
|
||||||
|
printf("%s=0x%08x\n", "excsave1", excsave1);
|
||||||
|
sdk_system_rtc_mem_read(0, excinfo, 32); // Why?
|
||||||
|
excinfo[0] = 2;
|
||||||
|
excinfo[1] = exccause;
|
||||||
|
excinfo[2] = epc1;
|
||||||
|
excinfo[3] = epc2;
|
||||||
|
excinfo[4] = epc3;
|
||||||
|
excinfo[5] = excvaddr;
|
||||||
|
excinfo[6] = depc;
|
||||||
|
excinfo[7] = excsave1;
|
||||||
|
sdk_system_rtc_mem_write(0, excinfo, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .irom0.text+0x368
|
||||||
|
int sdk_uart_rx_one_char(char *buf) {
|
||||||
|
if (FIELD2VAL(UART_STATUS_RXFIFO_COUNT, UART(0).STATUS)) {
|
||||||
|
*buf = UART(0).FIFO;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .irom0.text+0x398
|
||||||
|
void sdk_wdt_init(void) {
|
||||||
|
WDT.CTRL &= ~WDT_CTRL_ENABLE;
|
||||||
|
DPORT.INT_ENABLE |= DPORT_INT_ENABLE_WDT;
|
||||||
|
WDT.REG1 = 0x0000000b;
|
||||||
|
WDT.REG2 = 0x0000000c;
|
||||||
|
WDT.CTRL |= WDT_CTRL_FLAG3 | WDT_CTRL_FLAG4 | WDT_CTRL_FLAG5;
|
||||||
|
WDT.CTRL = SET_FIELD(WDT.CTRL, WDT_CTRL_FIELD0, 0);
|
||||||
|
WDT.CTRL |= WDT_CTRL_ENABLE;
|
||||||
|
sdk_pp_soft_wdt_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// .irom0.text+0x474
|
||||||
|
void sdk_user_init_task(void *params) {
|
||||||
|
int phy_ver, pp_ver;
|
||||||
|
|
||||||
|
sdk_ets_timer_init();
|
||||||
|
printf("\nESP-Open-SDK ver: %s compiled @ %s %s\n", OS_VERSION_STR, __DATE__, __TIME__);
|
||||||
|
phy_ver = RTCMEM_BACKUP[RTCMEM_BACKUP_PHY_VER] >> 16;
|
||||||
|
printf("phy ver: %d, ", phy_ver);
|
||||||
|
pp_ver = RTCMEM_SYSTEM[RTCMEM_SYSTEM_PP_VER];
|
||||||
|
printf("pp ver: %d.%d\n\n", (pp_ver >> 8) & 0xff, pp_ver & 0xff);
|
||||||
|
user_init();
|
||||||
|
sdk_user_init_flag = 1;
|
||||||
|
sdk_wifi_mode_set(sdk_g_ic.s.wifi_mode);
|
||||||
|
if (sdk_g_ic.s.wifi_mode == 1) {
|
||||||
|
sdk_wifi_station_start();
|
||||||
|
netif_set_default(sdk_g_ic.v.station_netif_info->netif);
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s.wifi_mode == 2) {
|
||||||
|
sdk_wifi_softap_start();
|
||||||
|
netif_set_default(sdk_g_ic.v.softap_netif_info->netif);
|
||||||
|
}
|
||||||
|
if (sdk_g_ic.s.wifi_mode == 3) {
|
||||||
|
sdk_wifi_station_start();
|
||||||
|
sdk_wifi_softap_start();
|
||||||
|
netif_set_default(sdk_g_ic.v.softap_netif_info->netif);
|
||||||
|
}
|
||||||
|
if (sdk_wifi_station_get_auto_connect()) {
|
||||||
|
sdk_wifi_station_connect();
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc009 -- .irom0.text+0x5b4
|
||||||
|
static void user_start_phase2(void) {
|
||||||
|
uint8_t *buf;
|
||||||
|
uint8_t *phy_info;
|
||||||
|
|
||||||
|
sdk_system_rtc_mem_read(0, &sdk_rst_if, sizeof(sdk_rst_if));
|
||||||
|
if (sdk_rst_if.version > 3) {
|
||||||
|
// Bad version number. Probably garbage.
|
||||||
|
bzero(&sdk_rst_if, sizeof(sdk_rst_if));
|
||||||
|
}
|
||||||
|
buf = malloc(sizeof(sdk_rst_if));
|
||||||
|
bzero(buf, sizeof(sdk_rst_if));
|
||||||
|
sdk_system_rtc_mem_write(0, buf, sizeof(sdk_rst_if));
|
||||||
|
free(buf);
|
||||||
|
sdk_sleep_reset_analog_rtcreg_8266();
|
||||||
|
get_otp_mac_address(sdk_info.sta_mac_addr);
|
||||||
|
sdk_wifi_softap_cacl_mac(sdk_info.softap_mac_addr, sdk_info.sta_mac_addr);
|
||||||
|
sdk_info._unknown0 = 0x0104a8c0;
|
||||||
|
sdk_info._unknown1 = 0x00ffffff;
|
||||||
|
sdk_info._unknown2 = 0x0104a8c0;
|
||||||
|
init_g_ic();
|
||||||
|
phy_info = malloc(PHY_INFO_SIZE);
|
||||||
|
sdk_spi_flash_read(sdk_flashchip.chip_size - sdk_flashchip.sector_size * 4, (uint32_t *)phy_info, PHY_INFO_SIZE);
|
||||||
|
|
||||||
|
// Wait for UARTs to finish sending anything in their queues.
|
||||||
|
while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS) > 0) {}
|
||||||
|
while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(1).STATUS) > 0) {}
|
||||||
|
|
||||||
|
if (phy_info[0] != 5) {
|
||||||
|
// Bad version byte. Discard what we read and use default values
|
||||||
|
// instead.
|
||||||
|
memcpy(phy_info, default_phy_info, PHY_INFO_SIZE);
|
||||||
|
}
|
||||||
|
init_networking(phy_info, sdk_info.sta_mac_addr);
|
||||||
|
free(phy_info);
|
||||||
|
tcpip_init(NULL, NULL);
|
||||||
|
sdk_wdt_init();
|
||||||
|
xTaskCreate(sdk_user_init_task, (signed char *)"uiT", 1024, 0, 14, &sdk_xUserTaskHandle);
|
||||||
|
vTaskStartScheduler();
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc010 -- .irom0.text+0x710
|
||||||
|
static void dump_flash_sector(uint32_t start_sector, uint32_t length) {
|
||||||
|
uint8_t *buf;
|
||||||
|
int bufsize, i;
|
||||||
|
|
||||||
|
bufsize = (length + 3) & 0xfffc;
|
||||||
|
buf = malloc(bufsize);
|
||||||
|
sdk_spi_flash_read(start_sector * sdk_flashchip.sector_size, (uint32_t *)buf
|
||||||
|
, bufsize);
|
||||||
|
for (i = 0; i < length; i++) {
|
||||||
|
if ((i & 0xf) == 0) {
|
||||||
|
if (i) {
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("%04x:", i);
|
||||||
|
}
|
||||||
|
printf(" %02x", buf[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// .Lfunc011 -- .irom0.text+0x790
|
||||||
|
static void dump_flash_config_sectors(uint32_t start_sector) {
|
||||||
|
printf("system param error\n");
|
||||||
|
// Note: original SDK code didn't dump PHY info
|
||||||
|
printf("phy_info:\n");
|
||||||
|
dump_flash_sector(start_sector, PHY_INFO_SIZE);
|
||||||
|
printf("\ng_ic saved 0:\n");
|
||||||
|
dump_flash_sector(start_sector + 1, sizeof(struct sdk_g_ic_saved_st));
|
||||||
|
printf("\ng_ic saved 1:\n");
|
||||||
|
dump_flash_sector(start_sector + 2, sizeof(struct sdk_g_ic_saved_st));
|
||||||
|
printf("\nboot info:\n");
|
||||||
|
dump_flash_sector(start_sector + 3, BOOT_INFO_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
INC_DIRS += $(core_ROOT)include
|
INC_DIRS += $(core_ROOT)include
|
||||||
|
|
||||||
# args for passing into compile rule generation
|
# args for passing into compile rule generation
|
||||||
core_ROOT = $(ROOT)core/
|
|
||||||
core_SRC_DIR = $(core_ROOT)
|
core_SRC_DIR = $(core_ROOT)
|
||||||
|
|
||||||
$(eval $(call component_compile_rules,core))
|
$(eval $(call component_compile_rules,core))
|
||||||
|
|
|
||||||
25
core/cplusplus_operators.cpp
Normal file
25
core/cplusplus_operators.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* Part of esp-open-rtos
|
||||||
|
* BSD Licensed as described in the file LICENSE
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void *operator new(size_t size)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new[](size_t size)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void * ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[](void * ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
27
core/esp_hwrand.c
Normal file
27
core/esp_hwrand.c
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
/* Hardware Random Number Generator Functions
|
||||||
|
*
|
||||||
|
* For documentation, see http://esp8266-re.foogod.com/wiki/Random_Number_Generator
|
||||||
|
*
|
||||||
|
* Part of esp-open-rtos
|
||||||
|
* Copyright (C) 2015 Angus Gratton
|
||||||
|
* BSD Licensed as described in the file LICENSE
|
||||||
|
*/
|
||||||
|
#include <esp/hwrand.h>
|
||||||
|
#include <esp/wdev_regs.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Return a random 32-bit number */
|
||||||
|
uint32_t hwrand(void)
|
||||||
|
{
|
||||||
|
return WDEV.HWRNG;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fill a variable size buffer with data from the Hardware RNG */
|
||||||
|
void hwrand_fill(uint8_t *buf, size_t len)
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < len; i+=4) {
|
||||||
|
uint32_t random = WDEV.HWRNG;
|
||||||
|
/* using memcpy here in case 'buf' is unaligned */
|
||||||
|
memcpy(buf + i, &random, (i+4 <= len) ? 4 : (len % 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,120 +1,408 @@
|
||||||
/* Xtensa Exception (ie interrupt) Vectors & low-level handler code
|
/* Xtensa Exception (ie interrupt) Vectors & low-level handler code
|
||||||
|
*
|
||||||
Core exception handler code is placed in the .vecbase section,
|
* Core exception handler code is placed in the .vecbase section, which gets
|
||||||
which gets picked up specially in the linker script and placed
|
* picked up specially in the linker script and placed at beginning of IRAM.
|
||||||
at beginning of IRAM.
|
*
|
||||||
|
* The actual VecBase symbol should be the first thing in .vecbase (this is not
|
||||||
The actual VecBase symbol should be the first thing in .vecbase
|
* strictly important as it gets set by symbol lookup not by hardcoded address,
|
||||||
(this is not strictly important as it gets set by symbol lookup not
|
* but having it at 0x40100000 means that the exception vectors have memorable
|
||||||
by hardcoded address, but having it at 0x40100000 means that the
|
* offsets, which match the default Boot ROM vector offsets. So convenient for
|
||||||
exception vectors have memorable offsets, which match the default
|
* human understanding.
|
||||||
Boot ROM vector offsets. So convenient for human understanding.
|
*
|
||||||
|
* Part of esp-open-rtos
|
||||||
Part of esp-open-rtos
|
* Original vector contents Copyright (C) 2014-2015 Espressif Systems
|
||||||
Original vector contents Copyright (C) 2014-2015 Espressif Systems
|
* Additions Copyright (C) Superhouse Automation Pty Ltd and Angus Gratton
|
||||||
Additions Copyright (C) Superhouse Automation Pty Ltd
|
* BSD Licensed as described in the file LICENSE
|
||||||
BSD Licensed as described in the file LICENSE
|
|
||||||
*/
|
|
||||||
.text
|
|
||||||
.section .vecbase.text, "x"
|
|
||||||
.align 256
|
|
||||||
.global VecBase
|
|
||||||
.type VecBase, @function /* it's not really a function, but treat it like one */
|
|
||||||
VecBase:
|
|
||||||
/* IMPORTANT: exception vector literals will go here, but we
|
|
||||||
can't have more than 4 otherwise we push DebugExceptionVector past
|
|
||||||
offset 0x10 relative to VecBase. There should be ways to avoid this,
|
|
||||||
and also keep the VecBase offsets easy to read, but this works for now.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "led_debug.s"
|
||||||
|
|
||||||
|
/* Some UserException causes, see table Table 4–64 in ISA reference */
|
||||||
|
|
||||||
|
#define CAUSE_SYSCALL 1
|
||||||
|
#define CAUSE_LOADSTORE 3
|
||||||
|
#define CAUSE_LVL1INT 4
|
||||||
|
|
||||||
|
.section .bss
|
||||||
|
|
||||||
|
NMIHandlerStack: # stack space for NMI handler
|
||||||
|
.skip 4*0x100
|
||||||
|
.LNMIHandlerStackTop:
|
||||||
|
NMIRegisterSaved: # register space for saving NMI registers
|
||||||
|
.skip 4*(16 + 6)
|
||||||
|
|
||||||
|
LoadStoreErrorHandlerStack:
|
||||||
|
.word 0 # a0
|
||||||
|
.word 0 # (unused)
|
||||||
|
.word 0 # a2
|
||||||
|
.word 0 # a3
|
||||||
|
.word 0 # a4
|
||||||
|
|
||||||
|
/***************************** Exception Vectors *****************************/
|
||||||
|
|
||||||
|
.section .vecbase.text, "x"
|
||||||
|
|
||||||
|
/* Note: Exception vectors must be aligned on a 256-byte (0x100) boundary or
|
||||||
|
* they will not function properly. (This is taken care of in the linker
|
||||||
|
* script by ensuring .vecbase.text is aligned properly, and putting VecBase
|
||||||
|
* right at the beginning of .vecbase.text) */
|
||||||
|
.org 0
|
||||||
|
VecBase:
|
||||||
|
.global VecBase
|
||||||
|
/* IMPORTANT: exception vector literals will go here, but we
|
||||||
|
* can't have more than 4 otherwise we push DebugExceptionVector past
|
||||||
|
* offset 0x10 relative to VecBase. There should be ways to avoid this,
|
||||||
|
* and also keep the VecBase offsets easy to read, but this works for
|
||||||
|
* now. */
|
||||||
.literal_position
|
.literal_position
|
||||||
.align 16
|
|
||||||
|
.org VecBase + 0x10
|
||||||
DebugExceptionVector:
|
DebugExceptionVector:
|
||||||
wsr.excsave2 a0
|
.type DebugExceptionVector, @function
|
||||||
|
|
||||||
|
wsr a0, excsave2
|
||||||
call0 sdk_user_fatal_exception_handler
|
call0 sdk_user_fatal_exception_handler
|
||||||
rfi 2
|
rfi 2
|
||||||
.align 16
|
|
||||||
|
.org VecBase + 0x20
|
||||||
NMIExceptionVector:
|
NMIExceptionVector:
|
||||||
wsr.excsave3 a0
|
.type NMIExceptionVector, @function
|
||||||
|
|
||||||
|
wsr a0, excsave3
|
||||||
call0 CallNMIExceptionHandler
|
call0 CallNMIExceptionHandler
|
||||||
rfi 3 /* CallNMIExceptionHandler should call rfi itself */
|
rfi 3 # Should never be reached
|
||||||
.align 16
|
|
||||||
|
.org VecBase + 0x30
|
||||||
KernelExceptionVector:
|
KernelExceptionVector:
|
||||||
|
.type KernelExceptionVector, @function
|
||||||
|
|
||||||
break 1, 0
|
break 1, 0
|
||||||
call0 sdk_user_fatal_exception_handler
|
call0 sdk_user_fatal_exception_handler
|
||||||
rfe
|
rfe
|
||||||
.align 16
|
|
||||||
.L_EmptyVectorEntry:
|
.org VecBase + 0x50
|
||||||
nop
|
|
||||||
.align 16
|
|
||||||
UserExceptionVector:
|
UserExceptionVector:
|
||||||
wsr.excsave1 a0
|
.type UserExceptionVector, @function
|
||||||
call0 CallUserExceptionHandler
|
|
||||||
rfe /* CallUserExceptionHandler should call rfe itself */
|
wsr a1, excsave1
|
||||||
.align 16
|
rsr a1, exccause
|
||||||
.L_EmptyVectorEntry2:
|
beqi a1, CAUSE_LOADSTORE, LoadStoreErrorHandler
|
||||||
nop
|
j UserExceptionHandler
|
||||||
.align 16
|
|
||||||
|
.org VecBase + 0x70
|
||||||
DoubleExceptionVector:
|
DoubleExceptionVector:
|
||||||
|
.type DoubleExceptionVector, @function
|
||||||
|
|
||||||
break 1, 4
|
break 1, 4
|
||||||
call0 sdk_user_fatal_exception_handler
|
call0 sdk_user_fatal_exception_handler
|
||||||
.align 16
|
|
||||||
.L_UnusedResetVector:
|
|
||||||
/* reset vector slot doesn't get used, as vecbase goes back to mask ROM on reset */
|
|
||||||
nop
|
|
||||||
|
|
||||||
.section .bss
|
/* Reset vector at offset 0x80 is unused, as vecbase gets reset to mask ROM
|
||||||
NMIHandlerStack: /* stack space for NMI handler */
|
* vectors on chip reset. */
|
||||||
.skip 4*0x100
|
|
||||||
NMIRegisterSaved: /* register space for saving NMI registers */
|
|
||||||
.skip 4*(0x16 + 6)
|
|
||||||
|
|
||||||
/* this symbol is _Pri_3_HandlerAddress in the RTOS SDK, appears totally
|
/*************************** LoadStoreError Handler **************************/
|
||||||
unused (stays zero at all times) */
|
|
||||||
.global NMIHandlerAddress
|
.section .vecbase.text, "x"
|
||||||
NMIHandlerAddress:
|
|
||||||
.long 0
|
/* Xtensa "Load/Store Exception" handler:
|
||||||
|
* Completes L8/L16 load instructions from Instruction address space, for which
|
||||||
|
* the architecture only supports 32-bit reads.
|
||||||
|
*
|
||||||
|
* Called from UserExceptionVector if EXCCAUSE is LoadStoreErrorCause
|
||||||
|
*
|
||||||
|
* (Fast path (no branches) is for L8UI)
|
||||||
|
*/
|
||||||
|
.literal_position
|
||||||
|
|
||||||
|
.balign 4
|
||||||
|
LoadStoreErrorHandler:
|
||||||
|
.type LoadStoreErrorHandler, @function
|
||||||
|
|
||||||
|
/* Registers are saved in the address corresponding to their register
|
||||||
|
* number times 4. This allows a quick and easy mapping later on when
|
||||||
|
* needing to store the value to a particular register number. */
|
||||||
|
movi sp, LoadStoreErrorHandlerStack
|
||||||
|
s32i a0, sp, 0
|
||||||
|
s32i a2, sp, 0x08
|
||||||
|
s32i a3, sp, 0x0c
|
||||||
|
s32i a4, sp, 0x10
|
||||||
|
rsr a0, sar # Save SAR in a0 to restore later
|
||||||
|
|
||||||
|
/* Examine the opcode which generated the exception */
|
||||||
|
/* Note: Instructions are in this order to avoid pipeline stalls. */
|
||||||
|
rsr a2, epc1
|
||||||
|
movi a3, ~3
|
||||||
|
ssa8l a2 # sar is now correct shift for aligned read
|
||||||
|
and a2, a2, a3 # a2 now 4-byte aligned address of instruction
|
||||||
|
l32i a4, a2, 0
|
||||||
|
l32i a2, a2, 4
|
||||||
|
movi a3, 0x00700F # opcode mask for l8ui/l16si/l16ui
|
||||||
|
src a2, a2, a4 # a2 now instruction that failed
|
||||||
|
and a3, a2, a3 # a3 is masked instruction
|
||||||
|
bnei a3, 0x000002, .LSE_check_l16
|
||||||
|
|
||||||
|
/* Note: At this point, opcode could technically be one of two things:
|
||||||
|
* xx0xx2 (L8UI)
|
||||||
|
* xx8xx2 (Reserved (invalid) opcode)
|
||||||
|
* It is assumed that we'll never get to this point from an illegal
|
||||||
|
* opcode, so we don't bother to check for that case and presume this
|
||||||
|
* is always an L8UI. */
|
||||||
|
|
||||||
|
movi a4, ~3
|
||||||
|
rsr a3, excvaddr # read faulting address
|
||||||
|
and a4, a3, a4 # a4 now word aligned read address
|
||||||
|
|
||||||
|
l32i a4, a4, 0 # perform the actual read
|
||||||
|
ssa8l a3 # sar is now shift to extract a3's byte
|
||||||
|
srl a3, a4 # shift right correct distance
|
||||||
|
extui a4, a3, 0, 8 # mask off bits we need for an l8
|
||||||
|
|
||||||
|
.LSE_post_fetch:
|
||||||
|
/* We jump back here after either the L8UI or the L16*I routines do the
|
||||||
|
* necessary work to read the value from memory.
|
||||||
|
* At this point, a2 holds the faulting instruction and a4 holds the
|
||||||
|
* correctly read value.
|
||||||
|
|
||||||
|
* Restore original SAR value (saved in a0) and update EPC so we'll
|
||||||
|
* return back to the instruction following the one we just emulated */
|
||||||
|
|
||||||
|
/* Note: Instructions are in this order to avoid pipeline stalls */
|
||||||
|
rsr a3, epc1
|
||||||
|
wsr a0, sar
|
||||||
|
addi a3, a3, 0x3
|
||||||
|
wsr a3, epc1
|
||||||
|
|
||||||
|
/* Stupid opcode tricks: The jumptable we use later on needs 16 bytes
|
||||||
|
* per entry (so we can avoid a second jump by just doing a RFE inside
|
||||||
|
* each entry). Unfortunately, however, Xtensa doesn't have an addx16
|
||||||
|
* operation to make that easy for us. Luckily, all of the faulting
|
||||||
|
* opcodes we're processing are guaranteed to have bit 3 be zero, which
|
||||||
|
* means if we just shift the register bits of the opcode down by 3
|
||||||
|
* instead of 4, we will get the register number multiplied by 2. This
|
||||||
|
* combined with an addx8 will give us an effective addx16 without
|
||||||
|
* needing any extra shift operations. */
|
||||||
|
extui a2, a2, 3, 5 # a2 is now destination register 0-15 times 2
|
||||||
|
|
||||||
|
bgei a2, 10, .LSE_assign_reg # a5..a15 use jumptable
|
||||||
|
beqi a2, 2, .LSE_assign_a1 # a1 uses a special routine
|
||||||
|
|
||||||
|
/* We're storing into a0 or a2..a4, which are all saved in our "stack"
|
||||||
|
* area. Calculate the correct address and stick the value in there,
|
||||||
|
* then just do our normal restore and RFE (no jumps required, which
|
||||||
|
* actually makes a0..a4 substantially faster). */
|
||||||
|
addx2 a2, a2, sp
|
||||||
|
s32i a4, a2, 0
|
||||||
|
|
||||||
|
/* Restore all regs and return */
|
||||||
|
l32i a0, sp, 0
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a3, sp, 0x0c
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1 # restore a1 saved by UserExceptionVector
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.LSE_assign_reg:
|
||||||
|
/* At this point, a2 contains the register number times 2, a4 is the
|
||||||
|
* read value. */
|
||||||
|
|
||||||
|
/* Calculate the jumptable address, and restore all regs except a2 and
|
||||||
|
* a4 so we have less to do after jumping. */
|
||||||
|
/* Note: Instructions are in this order to avoid pipeline stalls. */
|
||||||
|
movi a3, .LSE_jumptable_base
|
||||||
|
l32i a0, sp, 0
|
||||||
|
addx8 a2, a2, a3 # a2 is now the address to jump to
|
||||||
|
l32i a3, sp, 0x0c
|
||||||
|
|
||||||
|
jx a2
|
||||||
|
|
||||||
|
.balign 4
|
||||||
|
.LSE_check_l16:
|
||||||
|
/* At this point, a2 contains the opcode, a3 is masked opcode */
|
||||||
|
movi a4, 0x001002 # l16si or l16ui opcode after masking
|
||||||
|
bne a3, a4, .LSE_wrong_opcode
|
||||||
|
|
||||||
|
/* Note: At this point, the opcode could be one of two things:
|
||||||
|
* xx1xx2 (L16UI)
|
||||||
|
* xx9xx2 (L16SI)
|
||||||
|
* Both of these we can handle. */
|
||||||
|
|
||||||
|
movi a4, ~3
|
||||||
|
rsr a3, excvaddr # read faulting address
|
||||||
|
and a4, a3, a4 # a4 now word aligned read address
|
||||||
|
|
||||||
|
l32i a4, a4, 0 # perform the actual read
|
||||||
|
ssa8l a3 # sar is now shift to extract a3's bytes
|
||||||
|
srl a3, a4 # shift right correct distance
|
||||||
|
extui a4, a3, 0, 16 # mask off bits we need for an l16
|
||||||
|
|
||||||
|
bbci a2, 15, .LSE_post_fetch # Not a signed op
|
||||||
|
bbci a4, 15, .LSE_post_fetch # Value does not need sign-extension
|
||||||
|
|
||||||
|
movi a3, 0xFFFF0000
|
||||||
|
or a4, a3, a4 # set 32-bit sign bits
|
||||||
|
j .LSE_post_fetch
|
||||||
|
|
||||||
|
.LSE_wrong_opcode:
|
||||||
|
/* If we got here it's not an opcode we can try to fix, so bomb out.
|
||||||
|
* Restore registers so any dump the fatal exception routine produces
|
||||||
|
* will have correct values */
|
||||||
|
wsr a0, sar
|
||||||
|
l32i a0, sp, 0
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a3, sp, 0x0c
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
call0 sdk_user_fatal_exception_handler
|
||||||
|
|
||||||
|
.balign 4
|
||||||
|
.LSE_assign_a1:
|
||||||
|
/* a1 is saved in excsave1, so just update that with the value, */
|
||||||
|
wsr a4, excsave1
|
||||||
|
/* Then restore all regs and return */
|
||||||
|
l32i a0, sp, 0
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a3, sp, 0x0c
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.balign 4
|
||||||
|
.LSE_jumptable:
|
||||||
|
/* The first 5 entries (80 bytes) of this table are unused (registers
|
||||||
|
* a0..a4 are handled separately above). Rather than have a whole bunch
|
||||||
|
* of wasted space, we just pretend that the table starts 80 bytes
|
||||||
|
* earlier in memory. */
|
||||||
|
.set .LSE_jumptable_base, .LSE_jumptable - (16 * 5)
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 5)
|
||||||
|
mov a5, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 6)
|
||||||
|
mov a6, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 7)
|
||||||
|
mov a7, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 8)
|
||||||
|
mov a8, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 9)
|
||||||
|
mov a9, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 10)
|
||||||
|
mov a10, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 11)
|
||||||
|
mov a11, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 12)
|
||||||
|
mov a12, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 13)
|
||||||
|
mov a13, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 14)
|
||||||
|
mov a14, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
.org .LSE_jumptable_base + (16 * 15)
|
||||||
|
mov a15, a4
|
||||||
|
l32i a2, sp, 0x08
|
||||||
|
l32i a4, sp, 0x10
|
||||||
|
rsr a1, excsave1
|
||||||
|
rfe
|
||||||
|
|
||||||
|
/****************************** call_user_start ******************************/
|
||||||
|
|
||||||
|
.section .vecbase.text, "x"
|
||||||
|
|
||||||
|
/* This is the first entrypoint called from the ROM after loading the image
|
||||||
|
* into IRAM. It just sets up the VECBASE register to point at our own
|
||||||
|
* exception vectors and then calls sdk_user_start() */
|
||||||
|
|
||||||
|
.literal_position
|
||||||
|
|
||||||
|
.balign 4
|
||||||
|
call_user_start:
|
||||||
|
.global call_user_start
|
||||||
|
.type call_user_start, @function
|
||||||
|
|
||||||
|
movi a2, VecBase
|
||||||
|
wsr a2, vecbase
|
||||||
|
call0 sdk_user_start
|
||||||
|
|
||||||
|
/*************************** NMI Exception Handler ***************************/
|
||||||
|
|
||||||
|
.section .vecbase.text, "x"
|
||||||
|
|
||||||
/* Save register relative to a0 */
|
/* Save register relative to a0 */
|
||||||
.macro SAVE_REG register, regnum
|
.macro SAVE_REG register, regnum
|
||||||
s32i \register, a0, (0x20 + 4 * \regnum)
|
s32i \register, a0, (4 * (\regnum + 6))
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
/* Load register relative to sp */
|
/* Load register relative to sp */
|
||||||
.macro LOAD_REG register, regnum
|
.macro LOAD_REG register, regnum
|
||||||
l32i \register, sp, (0x20 + 4 * \regnum)
|
l32i \register, sp, (4 * (\regnum + 6))
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.text
|
|
||||||
.section .vecbase.text
|
|
||||||
.literal_position
|
.literal_position
|
||||||
.align 4
|
|
||||||
.global call_user_start
|
|
||||||
.type call_user_start, @function
|
|
||||||
call_user_start:
|
|
||||||
movi a2, VecBase
|
|
||||||
wsr.vecbase a2
|
|
||||||
call0 sdk_user_start
|
|
||||||
|
|
||||||
.literal_position
|
.balign 16
|
||||||
.align 16
|
|
||||||
.type CallNMIExceptionHandler, @function
|
|
||||||
CallNMIExceptionHandler:
|
CallNMIExceptionHandler:
|
||||||
|
.type CallNMIExceptionHandler, @function
|
||||||
|
|
||||||
movi a0, NMIRegisterSaved
|
movi a0, NMIRegisterSaved
|
||||||
SAVE_REG a2, 2
|
SAVE_REG a2, 2
|
||||||
movi a2, NMIHandlerAddress
|
|
||||||
l32i a2, a2, 0
|
|
||||||
SAVE_REG sp, 1
|
SAVE_REG sp, 1
|
||||||
SAVE_REG a3, 3
|
SAVE_REG a3, 3
|
||||||
xsr.excsave3 a2 /* excsave3 is now NMIHandlerAddress, a2 is former a0 */
|
rsr a2, excsave3 # a2 is now former a0
|
||||||
SAVE_REG a4, 4
|
SAVE_REG a4, 4
|
||||||
SAVE_REG a2, 0
|
SAVE_REG a2, 0
|
||||||
rsr.epc1 a3
|
rsr a3, epc1
|
||||||
rsr.exccause a4
|
rsr a4, exccause
|
||||||
SAVE_REG a3, -5
|
SAVE_REG a3, -5
|
||||||
SAVE_REG a4, -4
|
SAVE_REG a4, -4
|
||||||
rsr.excvaddr a3
|
rsr a3, excvaddr
|
||||||
SAVE_REG a3, -3
|
SAVE_REG a3, -3
|
||||||
rsr.excsave1 a3
|
rsr a3, excsave1
|
||||||
SAVE_REG a3, -2
|
SAVE_REG a3, -2
|
||||||
SAVE_REG a5, 5
|
SAVE_REG a5, 5
|
||||||
SAVE_REG a6, 6
|
SAVE_REG a6, 6
|
||||||
|
|
@ -127,18 +415,18 @@ CallNMIExceptionHandler:
|
||||||
SAVE_REG a13, 13
|
SAVE_REG a13, 13
|
||||||
SAVE_REG a14, 14
|
SAVE_REG a14, 14
|
||||||
SAVE_REG a15, 15
|
SAVE_REG a15, 15
|
||||||
movi sp, NMIRegisterSaved /* also top of NMIHandlerStack */
|
movi sp, .LNMIHandlerStackTop
|
||||||
movi a0, 0
|
movi a0, 0
|
||||||
movi a2, 0x23 /* argument for handler */
|
movi a2, 0x23 # argument for handler
|
||||||
wsr.ps a2
|
wsr a2, ps
|
||||||
rsync
|
rsync
|
||||||
rsr.sar a14
|
rsr a14, sar
|
||||||
s32i a14, sp, 0 /* this is also NMIRegisterSaved+0 */
|
s32i a14, sp, 0 # this is also NMIRegisterSaved+0
|
||||||
call0 sdk_wDev_ProcessFiq
|
call0 sdk_wDev_ProcessFiq
|
||||||
l32i a15, sp, 0
|
l32i a15, sp, 0
|
||||||
wsr.sar a15
|
wsr a15, sar
|
||||||
movi a2, 0x33
|
movi a2, 0x33
|
||||||
wsr.ps a2
|
wsr a2, ps
|
||||||
rsync
|
rsync
|
||||||
LOAD_REG a4, 4
|
LOAD_REG a4, 4
|
||||||
LOAD_REG a5, 5
|
LOAD_REG a5, 5
|
||||||
|
|
@ -154,101 +442,98 @@ CallNMIExceptionHandler:
|
||||||
LOAD_REG a15, 15
|
LOAD_REG a15, 15
|
||||||
LOAD_REG a2, -5
|
LOAD_REG a2, -5
|
||||||
LOAD_REG a3, -4
|
LOAD_REG a3, -4
|
||||||
wsr.epc1 a2
|
wsr a2, epc1
|
||||||
wsr.exccause a3
|
wsr a3, exccause
|
||||||
LOAD_REG a2, -3
|
LOAD_REG a2, -3
|
||||||
LOAD_REG a3, -2
|
LOAD_REG a3, -2
|
||||||
wsr.excvaddr a2
|
wsr a2, excvaddr
|
||||||
wsr.excsave1 a3
|
wsr a3, excsave1
|
||||||
LOAD_REG a0, 0
|
LOAD_REG a0, 0
|
||||||
/* set dport nmi status bit 0 (wDev_ProcessFiq clears & verifies this bit stays cleared,
|
/* set dport nmi status bit 0 (wDev_ProcessFiq clears & verifies this
|
||||||
see http://esp8266-re.foogod.com/wiki/WDev_ProcessFiq_%28IoT_RTOS_SDK_0.9.9%29) */
|
* bit stays cleared, see
|
||||||
|
* http://esp8266-re.foogod.com/wiki/WDev_ProcessFiq_%28IoT_RTOS_SDK_0.9.9%29)
|
||||||
|
*/
|
||||||
movi a2, 0x3ff00000
|
movi a2, 0x3ff00000
|
||||||
movi a3, 0x1
|
movi a3, 0x1
|
||||||
s32i a3, a2, 0
|
s32i a3, a2, 0
|
||||||
LOAD_REG a2, 2
|
LOAD_REG a2, 2
|
||||||
LOAD_REG a3, 3
|
LOAD_REG a3, 3
|
||||||
LOAD_REG a1, 1
|
LOAD_REG a1, 1
|
||||||
rfi 0x3
|
rfi 3
|
||||||
|
|
||||||
/* Some UserException causes, see table Table 4–64 in ISA reference */
|
/*********************** General UserException Handler ***********************/
|
||||||
#define CAUSE_SYSCALL 1
|
|
||||||
#define CAUSE_LVL1INT 4
|
|
||||||
|
|
||||||
.type CallUserExceptionHandler, @function
|
.section .vecbase.text, "x"
|
||||||
CallUserExceptionHandler:
|
|
||||||
rsr.exccause a0
|
/* Called by UserExceptionVector if EXCCAUSE is anything other than
|
||||||
beqi a0, CAUSE_SYSCALL, UserSyscallHandler
|
* LoadStoreCause. */
|
||||||
mov a0, sp
|
|
||||||
|
.literal_position
|
||||||
|
|
||||||
|
.balign 4
|
||||||
|
UserExceptionHandler:
|
||||||
|
.type UserExceptionHandler, @function
|
||||||
|
xsr a0, excsave1 # a0 now contains sp
|
||||||
|
mov sp, a0
|
||||||
addi sp, sp, -0x50
|
addi sp, sp, -0x50
|
||||||
s32i a0, sp, 0x10
|
s32i a0, sp, 0x10
|
||||||
rsr.ps a0
|
rsr a0, ps
|
||||||
s32i a0, sp, 0x08
|
s32i a0, sp, 0x08
|
||||||
rsr.epc1 a0
|
rsr a0, epc1
|
||||||
s32i a0, sp, 0x04
|
s32i a0, sp, 0x04
|
||||||
rsr.excsave1 a0 /* a0 was saved in UserExceptionVector */
|
rsr a0, excsave1
|
||||||
s32i a0, sp, 0x0c
|
s32i a0, sp, 0x0c
|
||||||
movi a0, _xt_user_exit
|
movi a0, _xt_user_exit
|
||||||
s32i a0, sp, 0x0
|
s32i a0, sp, 0x0
|
||||||
call0 sdk__xt_int_enter
|
call0 sdk__xt_int_enter
|
||||||
movi a0, 0x23
|
movi a0, 0x23
|
||||||
wsr.ps a0
|
wsr a0, ps
|
||||||
rsync
|
rsync
|
||||||
rsr.exccause a2
|
rsr a2, exccause
|
||||||
beqi a2, CAUSE_LVL1INT, UserHandleInterrupt
|
beqi a2, CAUSE_LVL1INT, UserHandleInterrupt
|
||||||
/* Any UserException cause other than level 1 interrupt triggers a panic */
|
/* Any UserException cause other than level 1 interrupt should panic */
|
||||||
UserFailOtherExceptionCause:
|
UserFailOtherExceptionCause:
|
||||||
break 1, 1
|
break 1, 1
|
||||||
call0 sdk_user_fatal_exception_handler
|
call0 sdk_user_fatal_exception_handler
|
||||||
UserHandleInterrupt:
|
UserHandleInterrupt:
|
||||||
rsil a0, 1
|
rsil a0, 1
|
||||||
rsr.intenable a2
|
rsr a2, intenable
|
||||||
rsr.interrupt a3
|
rsr a3, interrupt
|
||||||
movi a4, 0x3fff
|
movi a4, 0x3fff
|
||||||
and a2, a2, a3
|
and a2, a2, a3
|
||||||
and a2, a2, a4 /* a2 = 0x3FFF & INTENABLE & INTERRUPT */
|
and a2, a2, a4 # a2 = 0x3FFF & INTENABLE & INTERRUPT
|
||||||
UserHandleTimer:
|
UserHandleTimer:
|
||||||
movi a3, 0xffbf
|
movi a3, 0xffbf
|
||||||
and a3, a2, a3 /* a3 = a2 & 0xFFBF, ie remove 0x40 from a2 if set */
|
and a3, a2, a3 # a3 = a2 with bit 6 cleared
|
||||||
bnez a3, UserTimerDone /* bits other than 0x40 are set */
|
bnez a3, UserTimerDone # If any non-timer interrupt bits set
|
||||||
movi a3, 0x40
|
movi a3, 0x40
|
||||||
sub a12, a2, a3 /* a12 - a2 - 0x40 - I think a12 _must_ be zero here? */
|
sub a12, a2, a3 # a12 = a2 - 0x40 -- Will be zero if bit 6 set
|
||||||
call0 sdk__xt_timer_int /* tick timer interrupt */
|
call0 sdk__xt_timer_int # tick timer interrupt
|
||||||
mov a2, a12 /* restore a2 from a12, ie zero */
|
mov a2, a12 # restore a2 from a12, ie zero
|
||||||
beqz a2, UserIntDone
|
beqz a2, UserIntDone
|
||||||
UserTimerDone:
|
UserTimerDone:
|
||||||
call0 _xt_isr_handler
|
call0 _xt_isr_handler
|
||||||
bnez a2, UserHandleTimer
|
bnez a2, UserHandleTimer
|
||||||
UserIntDone:
|
UserIntDone:
|
||||||
beqz a2, UserIntExit
|
beqz a2, UserIntExit
|
||||||
break 1, 1 /* non-zero remnant in a2 means fail */
|
/* FIXME: this code will never be reached */
|
||||||
|
break 1, 1
|
||||||
call0 sdk_user_fatal_exception_handler
|
call0 sdk_user_fatal_exception_handler
|
||||||
UserIntExit:
|
UserIntExit:
|
||||||
call0 sdk__xt_int_exit /* calls rfi */
|
call0 sdk__xt_int_exit # jumps to _xt_user_exit. Never returns here
|
||||||
|
|
||||||
/* As far as I can tell, the syscall handler is basically a no-op */
|
.section .text
|
||||||
UserSyscallHandler:
|
|
||||||
addi sp, sp, -0x10
|
|
||||||
s32i a2, sp, 0x08
|
|
||||||
s32i a2, sp, 0x0c
|
|
||||||
rsr.epc1 a2
|
|
||||||
addi a3, a2, 0x3
|
|
||||||
wsr.epc1 a3
|
|
||||||
l32i a2, sp, 0x8
|
|
||||||
l32i a3, sp, 0xc
|
|
||||||
addi sp, sp, 0x10
|
|
||||||
movi a0, 0x7f
|
|
||||||
movnez a2, a0, a2
|
|
||||||
rsr.excsave1 a0
|
|
||||||
rfe
|
|
||||||
|
|
||||||
|
/* _xt_user_exit is used to exit interrupt context. */
|
||||||
|
/* TODO: Find a better place for this to live. */
|
||||||
|
_xt_user_exit:
|
||||||
.global _xt_user_exit
|
.global _xt_user_exit
|
||||||
.type _xt_user_exit, @function
|
.type _xt_user_exit, @function
|
||||||
_xt_user_exit:
|
|
||||||
l32i a0, sp, 0x8
|
l32i a0, sp, 0x8
|
||||||
wsr.ps a0
|
wsr a0, ps
|
||||||
l32i a0, sp, 0x4
|
l32i a0, sp, 0x4
|
||||||
wsr.epc1 a0
|
wsr a0, epc1
|
||||||
l32i a0, sp, 0xc
|
l32i a0, sp, 0xc
|
||||||
l32i sp, sp, 0x10
|
l32i sp, sp, 0x10
|
||||||
rsync
|
rsync
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
#ifndef _COMMON_MACROS_H
|
#ifndef _COMMON_MACROS_H
|
||||||
#define _COMMON_MACROS_H
|
#define _COMMON_MACROS_H
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
#define UNUSED __attributed((unused))
|
#define UNUSED __attributed((unused))
|
||||||
|
|
||||||
#ifndef BIT
|
#ifndef BIT
|
||||||
|
|
@ -20,12 +22,21 @@
|
||||||
* and shift) constants. Used primarily with ESP8266 register access.
|
* and shift) constants. Used primarily with ESP8266 register access.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VAL2FIELD(fieldname, value) (((value) & fieldname##_M) << fieldname##_S)
|
#define VAL2FIELD(fieldname, value) ((value) << fieldname##_S)
|
||||||
#define FIELD2VAL(fieldname, regbits) (((regbits) >> fieldname##_S) & fieldname##_M)
|
#define FIELD2VAL(fieldname, regbits) (((regbits) >> fieldname##_S) & fieldname##_M)
|
||||||
|
|
||||||
#define FIELD_MASK(fieldname) (fieldname##_M << fieldname##_S)
|
#define FIELD_MASK(fieldname) (fieldname##_M << fieldname##_S)
|
||||||
#define SET_FIELD(regbits, fieldname, value) (((regbits) & ~FIELD_MASK(fieldname)) | VAL2FIELD(fieldname, value))
|
#define SET_FIELD(regbits, fieldname, value) (((regbits) & ~FIELD_MASK(fieldname)) | VAL2FIELD(fieldname, value))
|
||||||
|
|
||||||
|
/* VAL2FIELD/SET_FIELD do not normally check to make sure that the passed value
|
||||||
|
* will fit in the specified field (without clobbering other bits). This makes
|
||||||
|
* them faster and is usually fine. If you do need to make sure that the value
|
||||||
|
* will not overflow the field, use VAL2FIELD_M or SET_FIELD_M (which will
|
||||||
|
* first mask the supplied value to only the allowed number of bits) instead.
|
||||||
|
*/
|
||||||
|
#define VAL2FIELD_M(fieldname, value) (((value) & fieldname##_M) << fieldname##_S)
|
||||||
|
#define SET_FIELD_M(regbits, fieldname, value) (((regbits) & ~FIELD_MASK(fieldname)) | VAL2FIELD_M(fieldname, value))
|
||||||
|
|
||||||
/* Use this macro to store constant values in IROM flash instead
|
/* Use this macro to store constant values in IROM flash instead
|
||||||
of having them loaded into rodata (which resides in DRAM)
|
of having them loaded into rodata (which resides in DRAM)
|
||||||
|
|
||||||
|
|
@ -36,7 +47,11 @@
|
||||||
Important to note: IROM flash can only be accessed via 32-bit word
|
Important to note: IROM flash can only be accessed via 32-bit word
|
||||||
aligned reads. It's up to the user of this attribute to ensure this.
|
aligned reads. It's up to the user of this attribute to ensure this.
|
||||||
*/
|
*/
|
||||||
#define IROM __attribute__((section(".irom0.literal"))) const
|
#ifdef __cplusplus
|
||||||
|
#define IROM __attribute__((section(".irom0.literal")))
|
||||||
|
#else
|
||||||
|
#define IROM __attribute__((section(".irom0.literal"))) const
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INLINED inline static __attribute__((always_inline)) __attribute__((unused))
|
#define INLINED inline static __attribute__((always_inline)) __attribute__((unused))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ struct DPORT_REGS {
|
||||||
uint32_t volatile OTP_MAC1; // 0x54
|
uint32_t volatile OTP_MAC1; // 0x54
|
||||||
uint32_t volatile OTP_CHIPID; // 0x58
|
uint32_t volatile OTP_CHIPID; // 0x58
|
||||||
uint32_t volatile OTP_MAC2; // 0x5c
|
uint32_t volatile OTP_MAC2; // 0x5c
|
||||||
} __attribute__ (( packed ));
|
};
|
||||||
|
|
||||||
_Static_assert(sizeof(struct DPORT_REGS) == 0x60, "DPORT_REGS is the wrong size");
|
_Static_assert(sizeof(struct DPORT_REGS) == 0x60, "DPORT_REGS is the wrong size");
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ _Static_assert(sizeof(struct DPORT_REGS) == 0x60, "DPORT_REGS is the wrong size"
|
||||||
|
|
||||||
/* Currently very little known about this register. The following is based on analysis of the startup code in the Espressif SDK: */
|
/* Currently very little known about this register. The following is based on analysis of the startup code in the Espressif SDK: */
|
||||||
|
|
||||||
#define DPORT_DPORT0_FIELD0_M 0x0000007f
|
#define DPORT_DPORT0_FIELD0_M 0x0000001f
|
||||||
#define DPORT_DPORT0_FIELD0_S 0
|
#define DPORT_DPORT0_FIELD0_S 0
|
||||||
|
|
||||||
/* Details for INT_ENABLE register */
|
/* Details for INT_ENABLE register */
|
||||||
|
|
|
||||||
|
|
@ -27,28 +27,26 @@ typedef enum {
|
||||||
INLINED void gpio_enable(const uint8_t gpio_num, const gpio_direction_t direction)
|
INLINED void gpio_enable(const uint8_t gpio_num, const gpio_direction_t direction)
|
||||||
{
|
{
|
||||||
uint32_t iomux_flags;
|
uint32_t iomux_flags;
|
||||||
uint32_t ctrl_val;
|
|
||||||
|
|
||||||
switch(direction) {
|
switch(direction) {
|
||||||
case GPIO_INPUT:
|
case GPIO_INPUT:
|
||||||
iomux_flags = 0;
|
iomux_flags = 0;
|
||||||
ctrl_val = 0;
|
|
||||||
break;
|
break;
|
||||||
case GPIO_OUTPUT:
|
case GPIO_OUTPUT:
|
||||||
iomux_flags = IOMUX_PIN_OUTPUT_ENABLE;
|
iomux_flags = IOMUX_PIN_OUTPUT_ENABLE;
|
||||||
ctrl_val = GPIO_CONF_PUSH_PULL;
|
|
||||||
break;
|
break;
|
||||||
case GPIO_OUT_OPEN_DRAIN:
|
case GPIO_OUT_OPEN_DRAIN:
|
||||||
iomux_flags = IOMUX_PIN_OUTPUT_ENABLE;
|
iomux_flags = IOMUX_PIN_OUTPUT_ENABLE;
|
||||||
ctrl_val = 0;
|
|
||||||
break;
|
break;
|
||||||
case GPIO_INPUT_PULLUP:
|
case GPIO_INPUT_PULLUP:
|
||||||
iomux_flags = IOMUX_PIN_PULLUP;
|
iomux_flags = IOMUX_PIN_PULLUP;
|
||||||
ctrl_val = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
iomux_set_gpio_function(gpio_num, iomux_flags);
|
iomux_set_gpio_function(gpio_num, iomux_flags);
|
||||||
GPIO.CONF[gpio_num] = (GPIO.CONF[gpio_num] & FIELD_MASK(GPIO_CONF_INTTYPE)) | ctrl_val;
|
if(direction == GPIO_OUT_OPEN_DRAIN)
|
||||||
|
GPIO.CONF[gpio_num] |= GPIO_CONF_OPEN_DRAIN;
|
||||||
|
else
|
||||||
|
GPIO.CONF[gpio_num] &= ~GPIO_CONF_OPEN_DRAIN;
|
||||||
if (iomux_flags & IOMUX_PIN_OUTPUT_ENABLE)
|
if (iomux_flags & IOMUX_PIN_OUTPUT_ENABLE)
|
||||||
GPIO.ENABLE_OUT_SET = BIT(gpio_num);
|
GPIO.ENABLE_OUT_SET = BIT(gpio_num);
|
||||||
else
|
else
|
||||||
|
|
@ -124,7 +122,7 @@ INLINED void gpio_set_interrupt(const uint8_t gpio_num, const gpio_inttype_t int
|
||||||
/* Return the interrupt type set for a pin */
|
/* Return the interrupt type set for a pin */
|
||||||
INLINED gpio_inttype_t gpio_get_interrupt(const uint8_t gpio_num)
|
INLINED gpio_inttype_t gpio_get_interrupt(const uint8_t gpio_num)
|
||||||
{
|
{
|
||||||
return FIELD2VAL(GPIO_CONF_INTTYPE, GPIO.CONF[gpio_num]);
|
return (gpio_inttype_t)FIELD2VAL(GPIO_CONF_INTTYPE, GPIO.CONF[gpio_num]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ struct GPIO_REGS {
|
||||||
uint32_t volatile PWM; // 0x68
|
uint32_t volatile PWM; // 0x68
|
||||||
uint32_t volatile RTC_CALIB; // 0x6c
|
uint32_t volatile RTC_CALIB; // 0x6c
|
||||||
uint32_t volatile RTC_CALIB_RESULT; // 0x70
|
uint32_t volatile RTC_CALIB_RESULT; // 0x70
|
||||||
} __attribute__ (( packed ));
|
};
|
||||||
|
|
||||||
_Static_assert(sizeof(struct GPIO_REGS) == 0x74, "GPIO_REGS is the wrong size");
|
_Static_assert(sizeof(struct GPIO_REGS) == 0x74, "GPIO_REGS is the wrong size");
|
||||||
|
|
||||||
|
|
@ -76,10 +76,15 @@ _Static_assert(sizeof(struct GPIO_REGS) == 0x74, "GPIO_REGS is the wrong size");
|
||||||
* Under what conditions this GPIO input should generate an interrupt.
|
* Under what conditions this GPIO input should generate an interrupt.
|
||||||
* (see gpio_inttype_t enum below for values)
|
* (see gpio_inttype_t enum below for values)
|
||||||
*
|
*
|
||||||
* GPIO_CONF_PUSH_PULL (boolean)
|
* GPIO_CONF_OPEN_DRAIN (boolean)
|
||||||
* When set, a high output state will pull the pin up to +Vcc (3.3V). When
|
* If this bit is set, the pin is in "open drain" mode - a high output state
|
||||||
* cleared, output functions in "open drain" mode (low state will pull down
|
* will leave the pin floating but not source any current. If bit is cleared,
|
||||||
* to ground, but high state allows output to "float").
|
* the pin is in push/pull mode so a high output state will drive the pin up
|
||||||
|
* to +Vcc (3.3V). In either case, a low output state will pull the pin down
|
||||||
|
* to ground.
|
||||||
|
*
|
||||||
|
* GPIO_CONF_OPEN_DRAIN does not appear to work on all pins.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* GPIO_CONF_SOURCE_PWM (boolean)
|
* GPIO_CONF_SOURCE_PWM (boolean)
|
||||||
* When set, GPIO pin output will be connected to the sigma-delta PWM
|
* When set, GPIO pin output will be connected to the sigma-delta PWM
|
||||||
|
|
@ -93,7 +98,7 @@ _Static_assert(sizeof(struct GPIO_REGS) == 0x74, "GPIO_REGS is the wrong size");
|
||||||
#define GPIO_CONF_WAKEUP_ENABLE BIT(10)
|
#define GPIO_CONF_WAKEUP_ENABLE BIT(10)
|
||||||
#define GPIO_CONF_INTTYPE_M 0x00000007
|
#define GPIO_CONF_INTTYPE_M 0x00000007
|
||||||
#define GPIO_CONF_INTTYPE_S 7
|
#define GPIO_CONF_INTTYPE_S 7
|
||||||
#define GPIO_CONF_PUSH_PULL BIT(2)
|
#define GPIO_CONF_OPEN_DRAIN BIT(2)
|
||||||
#define GPIO_CONF_SOURCE_PWM BIT(0)
|
#define GPIO_CONF_SOURCE_PWM BIT(0)
|
||||||
|
|
||||||
/* Valid values for the GPIO_CONF_INTTYPE field */
|
/* Valid values for the GPIO_CONF_INTTYPE field */
|
||||||
|
|
|
||||||
30
core/include/esp/hwrand.h
Normal file
30
core/include/esp/hwrand.h
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
/** esp/hwrand.h
|
||||||
|
*
|
||||||
|
* Hardware Random Number Generator functions.
|
||||||
|
*
|
||||||
|
* For documentation, see http://esp8266-re.foogod.com/wiki/Random_Number_Generator
|
||||||
|
*
|
||||||
|
* Part of esp-open-rtos
|
||||||
|
* Copyright (C) 2015 Angus Gratton
|
||||||
|
* BSD Licensed as described in the file LICENSE
|
||||||
|
*/
|
||||||
|
#ifndef _ESP_RNG_H
|
||||||
|
#define _ESP_RNG_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Return a random 32-bit number */
|
||||||
|
uint32_t hwrand(void);
|
||||||
|
|
||||||
|
/* Fill a variable size buffer with data from the Hardware RNG */
|
||||||
|
void hwrand_fill(uint8_t *buf, size_t len);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -11,6 +11,10 @@
|
||||||
#include "esp/types.h"
|
#include "esp/types.h"
|
||||||
#include "esp/iomux_regs.h"
|
#include "esp/iomux_regs.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a GPIO pin number to an iomux register index.
|
* Convert a GPIO pin number to an iomux register index.
|
||||||
*
|
*
|
||||||
|
|
@ -64,4 +68,8 @@ inline static void iomux_set_gpio_function(const uint8_t gpio_number, const uint
|
||||||
declared above */
|
declared above */
|
||||||
#include "esp/iomux_private.h"
|
#include "esp/iomux_private.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
struct IOMUX_REGS {
|
struct IOMUX_REGS {
|
||||||
uint32_t volatile CONF; // 0x00
|
uint32_t volatile CONF; // 0x00
|
||||||
uint32_t volatile PIN[16]; // 0x04 - 0x40
|
uint32_t volatile PIN[16]; // 0x04 - 0x40
|
||||||
} __attribute__ (( packed ));
|
};
|
||||||
|
|
||||||
_Static_assert(sizeof(struct IOMUX_REGS) == 0x44, "IOMUX_REGS is the wrong size");
|
_Static_assert(sizeof(struct IOMUX_REGS) == 0x44, "IOMUX_REGS is the wrong size");
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ _Static_assert(sizeof(struct IOMUX_REGS) == 0x44, "IOMUX_REGS is the wrong size"
|
||||||
#define IOMUX_PIN_FUNC_MASK 0x00001030
|
#define IOMUX_PIN_FUNC_MASK 0x00001030
|
||||||
|
|
||||||
/* WARNING: Macro evaluates argument twice */
|
/* WARNING: Macro evaluates argument twice */
|
||||||
#define IOMUX_FUNC(val) (VAL2FIELD(IOMUX_PIN_FUNC_LOW, val) | VAL2FIELD(IOMUX_PIN_FUNC_HIGH, val))
|
#define IOMUX_FUNC(val) (VAL2FIELD_M(IOMUX_PIN_FUNC_LOW, val) | VAL2FIELD_M(IOMUX_PIN_FUNC_HIGH, val))
|
||||||
|
|
||||||
/* WARNING: Macro evaluates argument twice */
|
/* WARNING: Macro evaluates argument twice */
|
||||||
#define IOMUX_FUNC_VALUE(regbits) (FIELD2VAL(IOMUX_PIN_FUNC_LOW, regbits) | FIELD2VAL(IOMUX_PIN_FUNC_HIGH, regbits))
|
#define IOMUX_FUNC_VALUE(regbits) (FIELD2VAL(IOMUX_PIN_FUNC_LOW, regbits) | FIELD2VAL(IOMUX_PIN_FUNC_HIGH, regbits))
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,12 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _ESP_ROM_H
|
#ifndef _ESP_ROM_H
|
||||||
#define _ESP_ROM_H
|
#define _ESP_ROM_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void Cache_Read_Disable(void);
|
void Cache_Read_Disable(void);
|
||||||
|
|
||||||
/* http://esp8266-re.foogod.com/wiki/Cache_Read_Enable
|
/* http://esp8266-re.foogod.com/wiki/Cache_Read_Enable
|
||||||
|
|
@ -18,4 +21,8 @@ void Cache_Read_Disable(void);
|
||||||
*/
|
*/
|
||||||
void Cache_Read_Enable(uint32_t odd_even, uint32_t mb_count, uint32_t no_idea);
|
void Cache_Read_Enable(uint32_t odd_even, uint32_t mb_count, uint32_t no_idea);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ struct SPI_REGS {
|
||||||
uint32_t volatile EXT1; // 0xf4
|
uint32_t volatile EXT1; // 0xf4
|
||||||
uint32_t volatile EXT2; // 0xf8
|
uint32_t volatile EXT2; // 0xf8
|
||||||
uint32_t volatile EXT3; // 0xfc
|
uint32_t volatile EXT3; // 0xfc
|
||||||
} __attribute__ (( packed ));
|
};
|
||||||
|
|
||||||
_Static_assert(sizeof(struct SPI_REGS) == 0x100, "SPI_REGS is the wrong size");
|
_Static_assert(sizeof(struct SPI_REGS) == 0x100, "SPI_REGS is the wrong size");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@
|
||||||
#include "esp/timer_regs.h"
|
#include "esp/timer_regs.h"
|
||||||
#include "esp/cpu.h"
|
#include "esp/cpu.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FRC1 = 0,
|
FRC1 = 0,
|
||||||
FRC2 = 1,
|
FRC2 = 1,
|
||||||
|
|
@ -129,4 +133,8 @@ INLINED bool timer_set_timeout(const timer_frc_t frc, uint32_t us);
|
||||||
|
|
||||||
#include "timer_private.h"
|
#include "timer_private.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@
|
||||||
#ifndef _ESP_TIMER_PRIVATE_H
|
#ifndef _ESP_TIMER_PRIVATE_H
|
||||||
#define _ESP_TIMER_PRIVATE_H
|
#define _ESP_TIMER_PRIVATE_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -193,7 +197,7 @@ INLINED bool _timer_set_frequency_impl(const timer_frc_t frc, uint32_t freq)
|
||||||
counts = timer_freq_to_count(frc, freq, div);
|
counts = timer_freq_to_count(frc, freq, div);
|
||||||
if(counts == 0)
|
if(counts == 0)
|
||||||
{
|
{
|
||||||
printf("ABORT: No counter for timer %u frequency %lu\r\n", frc, freq);
|
printf("ABORT: No counter for timer %u frequency %u\r\n", frc, freq);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,6 +259,8 @@ INLINED bool timer_set_timeout(const timer_frc_t frc, uint32_t us)
|
||||||
return _timer_set_timeout_runtime(frc, us);
|
return _timer_set_timeout_runtime(frc, us);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ struct TIMER_REGS { // FRC1 FRC2
|
||||||
uint32_t volatile CTRL; // 0x08 0x28
|
uint32_t volatile CTRL; // 0x08 0x28
|
||||||
uint32_t volatile STATUS; // 0x0c 0x2c
|
uint32_t volatile STATUS; // 0x0c 0x2c
|
||||||
uint32_t volatile ALARM; // 0x30
|
uint32_t volatile ALARM; // 0x30
|
||||||
} __attribute__ (( packed ));
|
};
|
||||||
|
|
||||||
_Static_assert(sizeof(struct TIMER_REGS) == 0x14, "TIMER_REGS is the wrong size");
|
_Static_assert(sizeof(struct TIMER_REGS) == 0x14, "TIMER_REGS is the wrong size");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UART_BASE 0x60000000
|
#define UART_BASE 0x60000000
|
||||||
#define UART(i) (*(struct UART_REGS *)(0x60000200 - (i)*0xf00))
|
#define UART(i) (*(struct UART_REGS *)(UART_BASE + (i)*0xf00))
|
||||||
|
|
||||||
#define UART0_BASE UART_BASE
|
#define UART0_BASE UART_BASE
|
||||||
#define UART1_BASE (UART_BASE + 0xf00)
|
#define UART1_BASE (UART_BASE + 0xf00)
|
||||||
|
|
@ -46,7 +46,7 @@ struct UART_REGS {
|
||||||
uint32_t volatile _unused[17]; // 0x34 - 0x74
|
uint32_t volatile _unused[17]; // 0x34 - 0x74
|
||||||
uint32_t volatile DATE; // 0x78
|
uint32_t volatile DATE; // 0x78
|
||||||
uint32_t volatile ID; // 0x7c
|
uint32_t volatile ID; // 0x7c
|
||||||
} __attribute__ (( packed ));
|
};
|
||||||
|
|
||||||
_Static_assert(sizeof(struct UART_REGS) == 0x80, "UART_REGS is the wrong size");
|
_Static_assert(sizeof(struct UART_REGS) == 0x80, "UART_REGS is the wrong size");
|
||||||
|
|
||||||
|
|
|
||||||
42
core/include/esp/wdev_regs.h
Normal file
42
core/include/esp/wdev_regs.h
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* esp/wdev_regs.h
|
||||||
|
*
|
||||||
|
* ESP8266 register definitions for the "wdev" region (0x3FF2xxx)
|
||||||
|
*
|
||||||
|
* In the DPORT memory space, alongside DPORT regs. However mostly
|
||||||
|
* concerned with the WiFi hardware interface.
|
||||||
|
*
|
||||||
|
* Not compatible with ESP SDK register access code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ESP_WDEV_REGS_H
|
||||||
|
#define _ESP_WDEV_REGS_H
|
||||||
|
|
||||||
|
#include "esp/types.h"
|
||||||
|
#include "common_macros.h"
|
||||||
|
|
||||||
|
#define WDEV_BASE 0x3FF20000
|
||||||
|
#define WDEV (*(struct WDEV_REGS *)(WDEV_BASE))
|
||||||
|
|
||||||
|
/* Note: This memory region is not currently well understood. Pretty much all
|
||||||
|
* of the definitions here are from reverse-engineering the Espressif SDK code,
|
||||||
|
* many are just educated guesses, and almost certainly some are misleading or
|
||||||
|
* wrong. If you can improve on any of this, please contribute!
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct WDEV_REGS {
|
||||||
|
uint32_t volatile _unknown0[768]; // 0x0000 - 0x0bfc
|
||||||
|
uint32_t volatile SYS_TIME; // 0x0c00
|
||||||
|
uint32_t volatile _unknown1[144]; // 0x0c04 - 0x0e40
|
||||||
|
uint32_t volatile HWRNG; // 0xe44 HW RNG, see http://esp8266-re.foogod.com/wiki/Random_Number_Generator
|
||||||
|
} __attribute__ (( packed ));
|
||||||
|
|
||||||
|
_Static_assert(sizeof(struct WDEV_REGS) == 0xe48, "WDEV_REGS is the wrong size");
|
||||||
|
|
||||||
|
/* Extra paranoid check about the HWRNG address, as if this becomes
|
||||||
|
wrong there will be no obvious symptoms apart from a lack of
|
||||||
|
entropy.
|
||||||
|
*/
|
||||||
|
_Static_assert(&WDEV.HWRNG == (void*)0x3FF20E44, "HWRNG register is at wrong address");
|
||||||
|
|
||||||
|
#endif /* _ESP_WDEV_REGS_H */
|
||||||
|
|
||||||
|
|
@ -27,10 +27,21 @@ struct WDT_REGS {
|
||||||
uint32_t volatile REG2; // 0x08
|
uint32_t volatile REG2; // 0x08
|
||||||
uint32_t volatile _unused[2]; // 0x0c - 0x10
|
uint32_t volatile _unused[2]; // 0x0c - 0x10
|
||||||
uint32_t volatile FEED; // 0x14
|
uint32_t volatile FEED; // 0x14
|
||||||
} __attribute__ (( packed ));
|
};
|
||||||
|
|
||||||
_Static_assert(sizeof(struct WDT_REGS) == 0x18, "WDT_REGS is the wrong size");
|
_Static_assert(sizeof(struct WDT_REGS) == 0x18, "WDT_REGS is the wrong size");
|
||||||
|
|
||||||
|
/* Details for CTRL register */
|
||||||
|
|
||||||
|
/* Note: these are currently just guesses based on interpretation of the startup code */
|
||||||
|
|
||||||
|
#define WDT_CTRL_ENABLE BIT(0)
|
||||||
|
#define WDT_CTRL_FIELD0_M 0x00000003
|
||||||
|
#define WDT_CTRL_FIELD0_S 1
|
||||||
|
#define WDT_CTRL_FLAG3 BIT(3)
|
||||||
|
#define WDT_CTRL_FLAG4 BIT(4)
|
||||||
|
#define WDT_CTRL_FLAG5 BIT(5)
|
||||||
|
|
||||||
/* Writing WDT_FEED_MAGIC to WDT.FEED register "feeds the dog" and holds off
|
/* Writing WDT_FEED_MAGIC to WDT.FEED register "feeds the dog" and holds off
|
||||||
* triggering for another cycle (unconfirmed) */
|
* triggering for another cycle (unconfirmed) */
|
||||||
#define WDT_FEED_MAGIC 0x73
|
#define WDT_FEED_MAGIC 0x73
|
||||||
|
|
|
||||||
6
core/include/os_version.h
Normal file
6
core/include/os_version.h
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef _VERSION_H
|
||||||
|
#define _VERSION_H
|
||||||
|
|
||||||
|
#define OS_VERSION_STR "0.0.1"
|
||||||
|
|
||||||
|
#endif /* _VERSION_H */
|
||||||
232
core/include/sdk_internal.h
Normal file
232
core/include/sdk_internal.h
Normal file
|
|
@ -0,0 +1,232 @@
|
||||||
|
#ifndef _INTERNAL_SDK_STRUCTURES_H
|
||||||
|
#define _INTERNAL_SDK_STRUCTURES_H
|
||||||
|
|
||||||
|
#include "espressif/esp_wifi.h"
|
||||||
|
#include "espressif/spi_flash.h"
|
||||||
|
#include "lwip/netif.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Internal structures and data objects //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// 'info' is declared in app_main.o at .bss+0x4
|
||||||
|
|
||||||
|
struct sdk_info_st {
|
||||||
|
uint32_t _unknown0;
|
||||||
|
uint32_t _unknown1;
|
||||||
|
uint32_t _unknown2;
|
||||||
|
uint8_t _unknown3[12];
|
||||||
|
uint8_t softap_mac_addr[6];
|
||||||
|
uint8_t sta_mac_addr[6];
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct sdk_info_st sdk_info;
|
||||||
|
|
||||||
|
// 'rst_if' is declared in user_interface.o at .bss+0xfc
|
||||||
|
|
||||||
|
struct sdk_rst_if_st {
|
||||||
|
uint32_t version;
|
||||||
|
uint8_t _unknown[28];
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct sdk_rst_if_st sdk_rst_if;
|
||||||
|
|
||||||
|
// 'g_ic' is declared in libnet80211/ieee80211.o at .bss+0x0
|
||||||
|
// See also: http://esp8266-re.foogod.com/wiki/G_ic_(IoT_RTOS_SDK_0.9.9)
|
||||||
|
|
||||||
|
struct sdk_g_ic_netif_info {
|
||||||
|
struct netif *netif;
|
||||||
|
//TODO: rest of this structure is unknown.
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is the portion of g_ic which is not loaded/saved to the flash ROM, and
|
||||||
|
// starts out zeroed on every boot.
|
||||||
|
struct sdk_g_ic_volatile_st {
|
||||||
|
void *_unknown0;
|
||||||
|
void *_unknown4;
|
||||||
|
|
||||||
|
uint8_t _unknown8[8];
|
||||||
|
|
||||||
|
struct sdk_g_ic_netif_info *station_netif_info;
|
||||||
|
struct sdk_g_ic_netif_info *softap_netif_info;
|
||||||
|
uint8_t _unknown18;
|
||||||
|
uint32_t _unknown1c;
|
||||||
|
uint32_t _unknown20;
|
||||||
|
|
||||||
|
uint8_t _unknown24[8];
|
||||||
|
|
||||||
|
uint8_t _unknown2c;
|
||||||
|
|
||||||
|
uint8_t _unknown30[76];
|
||||||
|
|
||||||
|
uint8_t _unknown7c;
|
||||||
|
uint8_t _unknown7d;
|
||||||
|
uint8_t _unknown7e;
|
||||||
|
uint8_t _unknown7f;
|
||||||
|
|
||||||
|
uint8_t _unknown80[204];
|
||||||
|
|
||||||
|
void *_unknown14c;
|
||||||
|
|
||||||
|
uint8_t _unknown150[20];
|
||||||
|
|
||||||
|
uint32_t _unknown164;
|
||||||
|
void *_unknown168;
|
||||||
|
void *_unknown16c;
|
||||||
|
void *_unknown170;
|
||||||
|
void *_unknown174;
|
||||||
|
void *_unknown178;
|
||||||
|
|
||||||
|
uint8_t _unknown17c[4];
|
||||||
|
|
||||||
|
void *_unknown180;
|
||||||
|
void *_unknown184;
|
||||||
|
struct station_info *station_info_head;
|
||||||
|
struct station_info *station_info_tail;
|
||||||
|
uint32_t _unknown190;
|
||||||
|
uint32_t _unknown194;
|
||||||
|
|
||||||
|
uint8_t _unknown198[40];
|
||||||
|
|
||||||
|
void *_unknown1c0;
|
||||||
|
void *_unknown1c4;
|
||||||
|
uint32_t _unknown1c8;
|
||||||
|
|
||||||
|
uint8_t _unknown1cc[4];
|
||||||
|
|
||||||
|
uint16_t _unknown1d0;
|
||||||
|
|
||||||
|
uint8_t _unknown1d2[2];
|
||||||
|
|
||||||
|
uint8_t _unknown1d4;
|
||||||
|
|
||||||
|
uint8_t _unknown1d5[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sdk_g_ic_unk0_st {
|
||||||
|
uint32_t _unknown1e4;
|
||||||
|
uint8_t _unknown1e8[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is the portion of g_ic which is loaded/saved to the flash ROM, and thus
|
||||||
|
// is preserved across reboots.
|
||||||
|
struct sdk_g_ic_saved_st {
|
||||||
|
uint8_t _unknown1d8;
|
||||||
|
uint8_t boot_info;
|
||||||
|
uint8_t user0_addr[3];
|
||||||
|
uint8_t user1_addr[3];
|
||||||
|
uint8_t wifi_mode;
|
||||||
|
uint8_t wifi_led_enable;
|
||||||
|
uint8_t wifi_led_gpio;
|
||||||
|
uint8_t _unknown1e3;
|
||||||
|
|
||||||
|
struct sdk_g_ic_unk0_st _unknown1e4;
|
||||||
|
|
||||||
|
uint8_t _unknown208;
|
||||||
|
uint8_t _unknown209;
|
||||||
|
uint8_t _unknown20a;
|
||||||
|
uint8_t _unknown20b;
|
||||||
|
uint8_t _unknown20c;
|
||||||
|
uint8_t _unknown20d;
|
||||||
|
uint8_t _unknown20e;
|
||||||
|
uint8_t _unknown20f[64];
|
||||||
|
uint8_t _unknown24f;
|
||||||
|
|
||||||
|
uint8_t _unknown250[49];
|
||||||
|
|
||||||
|
uint8_t _unknown281;
|
||||||
|
|
||||||
|
uint8_t _unknown282[6];
|
||||||
|
|
||||||
|
uint32_t _unknown288;
|
||||||
|
uint8_t _unknown28c;
|
||||||
|
|
||||||
|
uint8_t _unknown28d[31];
|
||||||
|
|
||||||
|
uint8_t _unknown2ac[64];
|
||||||
|
uint8_t _unknonwn2ec;
|
||||||
|
|
||||||
|
uint8_t _unknown2ed[32];
|
||||||
|
|
||||||
|
uint8_t _unknown30d;
|
||||||
|
uint8_t _unknown30e;
|
||||||
|
uint8_t _unknown30f;
|
||||||
|
uint8_t _unknown310;
|
||||||
|
|
||||||
|
uint8_t _unknown311[3];
|
||||||
|
|
||||||
|
uint8_t ap_number;
|
||||||
|
uint8_t current_ap_id;
|
||||||
|
|
||||||
|
uint8_t _unknown316[502];
|
||||||
|
|
||||||
|
uint32_t _unknown50c;
|
||||||
|
uint16_t _unknown510;
|
||||||
|
uint16_t _unknown512;
|
||||||
|
uint16_t _unknown514;
|
||||||
|
|
||||||
|
uint8_t _unknown516[2];
|
||||||
|
|
||||||
|
uint8_t auto_connect;
|
||||||
|
|
||||||
|
uint8_t _unknown519[3];
|
||||||
|
|
||||||
|
enum sdk_phy_mode phy_mode;
|
||||||
|
|
||||||
|
uint8_t _unknown520[36];
|
||||||
|
|
||||||
|
uint16_t _unknown544;
|
||||||
|
|
||||||
|
uint8_t _unknown546[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sdk_g_ic_st {
|
||||||
|
struct sdk_g_ic_volatile_st v; // 0x0 - 0x1d8
|
||||||
|
struct sdk_g_ic_saved_st s; // 0x1d8 - 0x548
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct sdk_g_ic_st sdk_g_ic;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// The above structures all refer to data regions outside our control, and a
|
||||||
|
// simple mistake/misunderstanding editing things here can completely screw up
|
||||||
|
// how we access them, so do some basic sanity checks to make sure that they
|
||||||
|
// appear to match up correctly with the actual data structures other parts of
|
||||||
|
// the SDK are expecting.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
_Static_assert(sizeof(struct sdk_info_st) == 0x24, "info_st is the wrong size!");
|
||||||
|
_Static_assert(sizeof(struct sdk_rst_if_st) == 0x20, "sdk_rst_if_st is the wrong size!");
|
||||||
|
_Static_assert(sizeof(struct sdk_g_ic_volatile_st) == 0x1d8, "sdk_g_ic_volatile_st is the wrong size!");
|
||||||
|
_Static_assert(sizeof(struct sdk_g_ic_saved_st) == 0x370, "sdk_g_ic_saved_st is the wrong size!");
|
||||||
|
_Static_assert(sizeof(struct sdk_g_ic_st) == 0x548, "sdk_g_ic_st is the wrong size!");
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Function Prototypes //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
sdk_SpiFlashOpResult sdk_SPIRead(uint32_t src_addr, uint32_t *des_addr, uint32_t size);
|
||||||
|
sdk_SpiFlashOpResult sdk_SPIWrite(uint32_t des_addr, uint32_t *src_addr, uint32_t size);
|
||||||
|
void sdk_cnx_attach(struct sdk_g_ic_st *);
|
||||||
|
void sdk_ets_timer_init(void);
|
||||||
|
void sdk_ieee80211_ifattach(struct sdk_g_ic_st *, uint8_t *);
|
||||||
|
void sdk_ieee80211_phy_init(enum sdk_phy_mode);
|
||||||
|
void sdk_lmacInit(void);
|
||||||
|
void sdk_phy_disable_agc(void);
|
||||||
|
void sdk_phy_enable_agc(void);
|
||||||
|
void sdk_pm_attach(void);
|
||||||
|
void sdk_pp_attach(void);
|
||||||
|
void sdk_pp_soft_wdt_init(void);
|
||||||
|
int sdk_register_chipv6_phy(uint8_t *);
|
||||||
|
void sdk_sleep_reset_analog_rtcreg_8266(void);
|
||||||
|
uint32_t sdk_system_get_checksum(uint8_t *, uint32_t);
|
||||||
|
void sdk_system_restart_in_nmi(void);
|
||||||
|
void sdk_wDevEnableRx(void);
|
||||||
|
void sdk_wDev_Initialize(void);
|
||||||
|
void sdk_wifi_mode_set(uint8_t);
|
||||||
|
void sdk_wifi_softap_cacl_mac(uint8_t *, uint8_t *);
|
||||||
|
void sdk_wifi_softap_set_default_ssid(void);
|
||||||
|
void sdk_wifi_softap_start(void);
|
||||||
|
void sdk_wifi_station_start(void);
|
||||||
|
|
||||||
|
#endif /* _INTERNAL_SDK_STRUCTURES_H */
|
||||||
21
core/include/xtensa_ops.h
Normal file
21
core/include/xtensa_ops.h
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
/** xtensa_ops.h
|
||||||
|
*
|
||||||
|
* Special macros/etc which deal with Xtensa-specific architecture/CPU
|
||||||
|
* considerations.
|
||||||
|
*
|
||||||
|
* Part of esp-open-rtos
|
||||||
|
* Copyright (C) 2015 Superhouse Automation Pty Ltd
|
||||||
|
* BSD Licensed as described in the file LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _XTENSA_OPS_H
|
||||||
|
#define _XTENSA_OPS_H
|
||||||
|
|
||||||
|
// GCC macros for reading, writing, and exchanging Xtensa processor special
|
||||||
|
// registers:
|
||||||
|
|
||||||
|
#define RSR(var, reg) asm volatile ("rsr %0, " #reg : "=r" (var));
|
||||||
|
#define WSR(var, reg) asm volatile ("wsr %0, " #reg : : "r" (var));
|
||||||
|
#define XSR(var, reg) asm volatile ("xsr %0, " #reg : "+r" (var));
|
||||||
|
|
||||||
|
#endif /* _XTENSA_OPS_H */
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
*
|
*
|
||||||
* To have this work from initial reset, without needing an iomux call
|
* To have this work from initial reset, without needing an iomux call
|
||||||
* first, choose a pin where iomux defaults to GPIO (ie 0,2,4,5)
|
* first, choose a pin where iomux defaults to GPIO (ie 0,2,4,5)
|
||||||
|
*
|
||||||
|
* Current sets on=LOW, as the GPIO2 pin is active low
|
||||||
*/
|
*/
|
||||||
LED_GPIO=2
|
LED_GPIO=2
|
||||||
GPIO_DIR_SET = 0x6000030c
|
GPIO_DIR_SET = 0x6000030c
|
||||||
|
|
@ -19,11 +21,11 @@ GPIO_OUT_CLEAR = 0x60000308
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
// Turn LED on. rega, regb will be clobbered
|
// Turn LED on. rega, regb will be clobbered
|
||||||
.macro led_on rega, regb
|
.macro led_off rega, regb
|
||||||
led_op \rega, \regb, GPIO_OUT_SET
|
led_op \rega, \regb, GPIO_OUT_SET
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
// Turn LED off. rega, regb will be clobbered
|
// Turn LED on. rega, regb will be clobbered
|
||||||
.macro led_off rega, regb
|
.macro led_on rega, regb
|
||||||
led_op \rega, \regb, GPIO_OUT_CLEAR
|
led_op \rega, \regb, GPIO_OUT_CLEAR
|
||||||
.endm
|
.endm
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
#include <sys/reent.h>
|
#include <sys/reent.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/errno.h>
|
||||||
#include <espressif/sdk_private.h>
|
#include <espressif/sdk_private.h>
|
||||||
#include <common_macros.h>
|
#include <common_macros.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -37,6 +38,10 @@ IRAM caddr_t _sbrk_r (struct _reent *r, int incr)
|
||||||
*/
|
*/
|
||||||
long _write_r(struct _reent *r, int fd, const char *ptr, int len )
|
long _write_r(struct _reent *r, int fd, const char *ptr, int len )
|
||||||
{
|
{
|
||||||
|
if(fd != r->_stdout->_file) {
|
||||||
|
r->_errno = EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
for(int i = 0; i < len; i++)
|
for(int i = 0; i < len; i++)
|
||||||
sdk_os_putc(ptr[i]);
|
sdk_os_putc(ptr[i]);
|
||||||
return len;
|
return len;
|
||||||
|
|
@ -49,29 +54,31 @@ long _write_r(struct _reent *r, int fd, const char *ptr, int len )
|
||||||
*/
|
*/
|
||||||
long __attribute__((weak)) _read_r( struct _reent *r, int fd, char *ptr, int len )
|
long __attribute__((weak)) _read_r( struct _reent *r, int fd, char *ptr, int len )
|
||||||
{
|
{
|
||||||
|
if(fd != r->_stdin->_file) {
|
||||||
|
r->_errno = EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
for(int i = 0; i < len; i++) {
|
for(int i = 0; i < len; i++) {
|
||||||
char ch;
|
char ch;
|
||||||
while (sdk_uart_rx_one_char(&ch)) ;
|
while (sdk_uart_rx_one_char(&ch)) ;
|
||||||
ptr[i] = ch;
|
ptr[i] = ch;
|
||||||
|
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These are stub implementations for the reentrant syscalls that
|
/* Stub syscall implementations follow, to allow compiling newlib functions that
|
||||||
* newlib is configured to expect */
|
pull these in via various codepaths
|
||||||
int _fstat_r(struct _reent *r, int fd, void *buf)
|
*/
|
||||||
|
__attribute__((alias("syscall_returns_enosys"))) int _open_r(struct _reent *r, const char *pathname, int flags, int mode);
|
||||||
|
__attribute__((alias("syscall_returns_enosys"))) int _fstat_r(struct _reent *r, int fd, void *buf);
|
||||||
|
__attribute__((alias("syscall_returns_enosys"))) int _close_r(struct _reent *r, int fd);
|
||||||
|
__attribute__((alias("syscall_returns_enosys"))) off_t _lseek_r(struct _reent *r, int fd, off_t offset, int whence);
|
||||||
|
|
||||||
|
/* Generic stub for any newlib syscall that fails with errno ENOSYS
|
||||||
|
("Function not implemented") and a return value equivalent to
|
||||||
|
(int)-1. */
|
||||||
|
static int syscall_returns_enosys(struct _reent *r)
|
||||||
{
|
{
|
||||||
|
r->_errno=ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _close_r(struct _reent *r, int fd)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
off_t _lseek_r(struct _reent *r, int fd, off_t offset, int whence)
|
|
||||||
{
|
|
||||||
return (off_t)-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,18 @@ void IRAM *zalloc(size_t nbytes)
|
||||||
{
|
{
|
||||||
return calloc(1, nbytes);
|
return calloc(1, nbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void (*__init_array_start)(void);
|
||||||
|
extern void (*__init_array_end)(void);
|
||||||
|
|
||||||
|
/* Do things which should be done as part of the startup code, but aren't.
|
||||||
|
|
||||||
|
Can be replaced with _start() once we have open source startup code.
|
||||||
|
*/
|
||||||
|
void sdk_compat_initialise()
|
||||||
|
{
|
||||||
|
/* Call C++ constructors or C functions marked with __attribute__((constructor)) */
|
||||||
|
void (**p)(void);
|
||||||
|
for ( p = &__init_array_start; p != &__init_array_end; ++p)
|
||||||
|
(*p)();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ build-examples: $(EXAMPLES_BUILD)
|
||||||
rebuild-examples: $(EXAMPLES_REBUILD)
|
rebuild-examples: $(EXAMPLES_REBUILD)
|
||||||
|
|
||||||
%.dummybuild:
|
%.dummybuild:
|
||||||
make -C $(dir $@)
|
$(MAKE) -C $(dir $@)
|
||||||
|
|
||||||
%.dummyrebuild:
|
%.dummyrebuild:
|
||||||
make -C $(dir $@) rebuild
|
$(MAKE) -C $(dir $@) rebuild
|
||||||
|
|
||||||
.PHONY: warning rebuild-examples build-examples
|
.PHONY: warning rebuild-examples build-examples
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
|
|
|
||||||
3
examples/bmp180_i2c/Makefile
Normal file
3
examples/bmp180_i2c/Makefile
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
PROGRAM=BMP180_Reader
|
||||||
|
EXTRA_COMPONENTS = extras/i2c extras/bmp180
|
||||||
|
include ../../common.mk
|
||||||
7
examples/bmp180_i2c/README.md
Normal file
7
examples/bmp180_i2c/README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# I2C / BMP180 Example
|
||||||
|
|
||||||
|
This example references two addtional drivers [i2c](https://github.com/kanflo/esp-open-rtos-driver-i2c) and [bmp180](https://github.com/Angus71/esp-open-rtos-driver-bmp180), which are provided in the `../../extras` folder.
|
||||||
|
|
||||||
|
If you plan to use one or both of this drivers in your own projects, please check the main development pages for updated versions or reported issues.
|
||||||
|
|
||||||
|
To run this example connect the BMP085/BMP180 SCL to GPIO0 and SDA to GPIO2.
|
||||||
132
examples/bmp180_i2c/bmp180_i2c.c
Normal file
132
examples/bmp180_i2c/bmp180_i2c.c
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
/* Simple example for I2C / BMP180 / Timer & Event Handling
|
||||||
|
*
|
||||||
|
* This sample code is in the public domain.
|
||||||
|
*/
|
||||||
|
#include "espressif/esp_common.h"
|
||||||
|
#include "espressif/sdk_private.h"
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "timers.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
// BMP180 driver
|
||||||
|
#include "bmp180/bmp180.h"
|
||||||
|
|
||||||
|
#define MY_EVT_TIMER 0x01
|
||||||
|
#define MY_EVT_BMP180 0x02
|
||||||
|
|
||||||
|
#define SCL_PIN GPIO_ID_PIN((0))
|
||||||
|
#define SDA_PIN GPIO_ID_PIN((2))
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t event_type;
|
||||||
|
bmp180_result_t bmp180_data;
|
||||||
|
} my_event_t;
|
||||||
|
|
||||||
|
// Communication Queue
|
||||||
|
static xQueueHandle mainqueue;
|
||||||
|
static xTimerHandle timerHandle;
|
||||||
|
|
||||||
|
// Own BMP180 User Inform Implementation
|
||||||
|
bool bmp180_i2c_informUser(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure)
|
||||||
|
{
|
||||||
|
my_event_t ev;
|
||||||
|
|
||||||
|
ev.event_type = MY_EVT_BMP180;
|
||||||
|
ev.bmp180_data.cmd = cmd;
|
||||||
|
ev.bmp180_data.temperature = temperature;
|
||||||
|
ev.bmp180_data.pressure = pressure;
|
||||||
|
|
||||||
|
return (xQueueSend(*resultQueue, &ev, 0) == pdTRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timer call back
|
||||||
|
static void bmp180_i2c_timer_cb(xTimerHandle xTimer)
|
||||||
|
{
|
||||||
|
my_event_t ev;
|
||||||
|
ev.event_type = MY_EVT_TIMER;
|
||||||
|
|
||||||
|
xQueueSend(mainqueue, &ev, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for communiction events
|
||||||
|
void bmp180_task(void *pvParameters)
|
||||||
|
{
|
||||||
|
// Received pvParameters is communication queue
|
||||||
|
xQueueHandle *com_queue = (xQueueHandle *)pvParameters;
|
||||||
|
|
||||||
|
printf("%s: Started user interface task\n", __FUNCTION__);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
my_event_t ev;
|
||||||
|
|
||||||
|
xQueueReceive(*com_queue, &ev, portMAX_DELAY);
|
||||||
|
|
||||||
|
switch(ev.event_type)
|
||||||
|
{
|
||||||
|
case MY_EVT_TIMER:
|
||||||
|
printf("%s: Received Timer Event\n", __FUNCTION__);
|
||||||
|
|
||||||
|
bmp180_trigger_measurement(com_queue);
|
||||||
|
break;
|
||||||
|
case MY_EVT_BMP180:
|
||||||
|
printf("%s: Received BMP180 Event temp:=%d.%d°C press=%d.%02dhPa\n", __FUNCTION__, \
|
||||||
|
(int32_t)ev.bmp180_data.temperature, abs((int32_t)(ev.bmp180_data.temperature*10)%10), \
|
||||||
|
ev.bmp180_data.pressure/100, ev.bmp180_data.pressure%100 );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup HW
|
||||||
|
void user_setup(void)
|
||||||
|
{
|
||||||
|
// Set UART Parameter
|
||||||
|
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
|
||||||
|
|
||||||
|
// Give the UART some time to settle
|
||||||
|
sdk_os_delay_us(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
void user_init(void)
|
||||||
|
{
|
||||||
|
// Setup HW
|
||||||
|
user_setup();
|
||||||
|
|
||||||
|
// Just some infomations
|
||||||
|
printf("\n");
|
||||||
|
printf("SDK version : %s\n", sdk_system_get_sdk_version());
|
||||||
|
printf("GIT version : %s\n", GITSHORTREV);
|
||||||
|
|
||||||
|
// Use our user inform implementation
|
||||||
|
bmp180_informUser = bmp180_i2c_informUser;
|
||||||
|
|
||||||
|
// Init BMP180 Interface
|
||||||
|
bmp180_init(SCL_PIN, SDA_PIN);
|
||||||
|
|
||||||
|
// Create Main Communication Queue
|
||||||
|
mainqueue = xQueueCreate(10, sizeof(my_event_t));
|
||||||
|
|
||||||
|
// Create user interface task
|
||||||
|
xTaskCreate(bmp180_task, (signed char *)"bmp180_task", 256, &mainqueue, 2, NULL);
|
||||||
|
|
||||||
|
// Create Timer (Trigger a measurement every second)
|
||||||
|
timerHandle = xTimerCreate((signed char *)"BMP180 Trigger", 1000/portTICK_RATE_MS, pdTRUE, NULL, bmp180_i2c_timer_cb);
|
||||||
|
|
||||||
|
if (timerHandle != NULL)
|
||||||
|
{
|
||||||
|
if (xTimerStart(timerHandle, 0) != pdPASS)
|
||||||
|
{
|
||||||
|
printf("%s: Unable to start Timer ...\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%s: Unable to create Timer ...\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -34,7 +34,7 @@ void buttonPollTask(void *pvParameters)
|
||||||
{
|
{
|
||||||
taskYIELD();
|
taskYIELD();
|
||||||
}
|
}
|
||||||
printf("Polled for button press at %ldms\r\n", xTaskGetTickCount()*portTICK_RATE_MS);
|
printf("Polled for button press at %dms\r\n", xTaskGetTickCount()*portTICK_RATE_MS);
|
||||||
vTaskDelay(200 / portTICK_RATE_MS);
|
vTaskDelay(200 / portTICK_RATE_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ void buttonIntTask(void *pvParameters)
|
||||||
xQueueReceive(*tsqueue, &button_ts, portMAX_DELAY);
|
xQueueReceive(*tsqueue, &button_ts, portMAX_DELAY);
|
||||||
button_ts *= portTICK_RATE_MS;
|
button_ts *= portTICK_RATE_MS;
|
||||||
if(last < button_ts-200) {
|
if(last < button_ts-200) {
|
||||||
printf("Button interrupt fired at %ldms\r\n", button_ts);
|
printf("Button interrupt fired at %dms\r\n", button_ts);
|
||||||
last = button_ts;
|
last = button_ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
examples/cpp_01_tasks/Makefile
Normal file
5
examples/cpp_01_tasks/Makefile
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Simple makefile for simple example
|
||||||
|
PROGRAM=cpp_01_tasks
|
||||||
|
OTA=0
|
||||||
|
EXTRA_COMPONENTS=extras/cpp_support
|
||||||
|
include ../../common.mk
|
||||||
106
examples/cpp_01_tasks/cpp_tasks.cpp
Normal file
106
examples/cpp_01_tasks/cpp_tasks.cpp
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* ESP8266 FreeRTOS Firmware
|
||||||
|
* Copyright (c) 2015 Michael Jacobsen (github.com/mikejac)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://github.com/SuperHouse/esp-open-rtos
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "task.hpp"
|
||||||
|
#include "queue.hpp"
|
||||||
|
|
||||||
|
#include "espressif/esp_common.h"
|
||||||
|
|
||||||
|
/******************************************************************************************************************
|
||||||
|
* task_1_t
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class task_1_t: public esp_open_rtos::thread::task_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
esp_open_rtos::thread::queue_t<uint32_t> queue;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void task()
|
||||||
|
{
|
||||||
|
printf("task_1_t::task(): start\n");
|
||||||
|
|
||||||
|
uint32_t count = 0;
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
sleep(1000);
|
||||||
|
queue.post(count);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/******************************************************************************************************************
|
||||||
|
* task_2_t
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class task_2_t: public esp_open_rtos::thread::task_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
esp_open_rtos::thread::queue_t<uint32_t> queue;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void task()
|
||||||
|
{
|
||||||
|
printf("task_2_t::task(): start\n");
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
uint32_t count;
|
||||||
|
|
||||||
|
if(queue.receive(count, 1500) == 0) {
|
||||||
|
printf("task_2_t::task(): got %u\n", count);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("task_2_t::task(): no msg\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/******************************************************************************************************************
|
||||||
|
* globals
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
task_1_t task_1;
|
||||||
|
task_2_t task_2;
|
||||||
|
|
||||||
|
esp_open_rtos::thread::queue_t<uint32_t> MyQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
extern "C" void user_init(void)
|
||||||
|
{
|
||||||
|
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
|
||||||
|
|
||||||
|
MyQueue.queue_create(10);
|
||||||
|
|
||||||
|
task_1.queue = MyQueue;
|
||||||
|
task_2.queue = MyQueue;
|
||||||
|
|
||||||
|
task_1.task_create("tsk1");
|
||||||
|
task_2.task_create("tsk2");
|
||||||
|
}
|
||||||
|
|
@ -20,8 +20,8 @@ IRAM void dump_frc1_seq(void)
|
||||||
uint32_t f1_a = TIMER(0).COUNT;
|
uint32_t f1_a = TIMER(0).COUNT;
|
||||||
uint32_t f1_b = TIMER(0).COUNT;
|
uint32_t f1_b = TIMER(0).COUNT;
|
||||||
uint32_t f1_c = TIMER(0).COUNT;
|
uint32_t f1_c = TIMER(0).COUNT;
|
||||||
printf("FRC1 sequence 0x%08lx 0x%08lx 0x%08lx\r\n", f1_a, f1_b, f1_c);
|
printf("FRC1 sequence 0x%08x 0x%08x 0x%08x\r\n", f1_a, f1_b, f1_c);
|
||||||
printf("FRC1 deltas %ld %ld \r\n", f1_b-f1_a, f1_c-f1_b);
|
printf("FRC1 deltas %d %d \r\n", f1_b-f1_a, f1_c-f1_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
IRAM void dump_frc2_seq(void)
|
IRAM void dump_frc2_seq(void)
|
||||||
|
|
@ -37,8 +37,8 @@ IRAM void dump_frc2_seq(void)
|
||||||
uint32_t f2_a = TIMER(1).COUNT;
|
uint32_t f2_a = TIMER(1).COUNT;
|
||||||
uint32_t f2_b = TIMER(1).COUNT;
|
uint32_t f2_b = TIMER(1).COUNT;
|
||||||
uint32_t f2_c = TIMER(1).COUNT;
|
uint32_t f2_c = TIMER(1).COUNT;
|
||||||
printf("FRC2 sequence 0x%08lx 0x%08lx 0x%08lx\r\n", f2_a, f2_b, f2_c);
|
printf("FRC2 sequence 0x%08x 0x%08x 0x%08x\r\n", f2_a, f2_b, f2_c);
|
||||||
printf("FRC2 deltas %ld %ld \r\n", f2_b-f2_a, f2_c-f2_b);
|
printf("FRC2 deltas %d %d \r\n", f2_b-f2_a, f2_c-f2_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
IRAM void dump_timer_regs(const char *msg)
|
IRAM void dump_timer_regs(const char *msg)
|
||||||
|
|
@ -56,7 +56,7 @@ IRAM void dump_timer_regs(const char *msg)
|
||||||
for(int i = 0; i < DUMP_SZ; i++) {
|
for(int i = 0; i < DUMP_SZ; i++) {
|
||||||
if(i % 4 == 0)
|
if(i % 4 == 0)
|
||||||
printf("%s0x%02x: ", i ? "\r\n" : "", i*4);
|
printf("%s0x%02x: ", i ? "\r\n" : "", i*4);
|
||||||
printf("%08lx ", chunk[i]);
|
printf("%08x ", chunk[i]);
|
||||||
}
|
}
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ static volatile uint32_t frc1_last_count_val;
|
||||||
void timerRegTask(void *pvParameters)
|
void timerRegTask(void *pvParameters)
|
||||||
{
|
{
|
||||||
while(1) {
|
while(1) {
|
||||||
printf("state at task tick count %ld:\r\n", xTaskGetTickCount());
|
printf("state at task tick count %d:\r\n", xTaskGetTickCount());
|
||||||
dump_timer_regs("");
|
dump_timer_regs("");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -87,10 +87,10 @@ void timerRegTask(void *pvParameters)
|
||||||
printf("INUM_MAX count %d\r\n", max_count);
|
printf("INUM_MAX count %d\r\n", max_count);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
printf("frc1 handler called %ld times, last value 0x%08lx\r\n", frc1_handler_call_count,
|
printf("frc1 handler called %d times, last value 0x%08x\r\n", frc1_handler_call_count,
|
||||||
frc1_last_count_val);
|
frc1_last_count_val);
|
||||||
|
|
||||||
printf("frc2 handler called %ld times, last value 0x%08lx\r\n", frc2_handler_call_count,
|
printf("frc2 handler called %d times, last value 0x%08x\r\n", frc2_handler_call_count,
|
||||||
frc2_last_count_val);
|
frc2_last_count_val);
|
||||||
|
|
||||||
vTaskDelay(500 / portTICK_RATE_MS);
|
vTaskDelay(500 / portTICK_RATE_MS);
|
||||||
|
|
|
||||||
2
examples/experiments/unaligned_load/Makefile
Normal file
2
examples/experiments/unaligned_load/Makefile
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
PROGRAM=unaligned_load
|
||||||
|
include ../../../common.mk
|
||||||
432
examples/experiments/unaligned_load/unaligned_load.c
Normal file
432
examples/experiments/unaligned_load/unaligned_load.c
Normal file
|
|
@ -0,0 +1,432 @@
|
||||||
|
/* Very basic example that just demonstrates we can run at all!
|
||||||
|
*/
|
||||||
|
#include "esp/rom.h"
|
||||||
|
#include "esp/timer.h"
|
||||||
|
#include "espressif/esp_common.h"
|
||||||
|
#include "espressif/sdk_private.h"
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
#include "string.h"
|
||||||
|
#include "strings.h"
|
||||||
|
|
||||||
|
#define TESTSTRING "O hai there! %d %d %d"
|
||||||
|
|
||||||
|
const char *dramtest = TESTSTRING;
|
||||||
|
const __attribute__((section(".iram1.notrodata"))) char iramtest[] = TESTSTRING;
|
||||||
|
const __attribute__((section(".text.notrodata"))) char iromtest[] = TESTSTRING;
|
||||||
|
|
||||||
|
INLINED uint32_t get_ccount (void)
|
||||||
|
{
|
||||||
|
uint32_t ccount;
|
||||||
|
asm volatile ("rsr.ccount %0" : "=a" (ccount));
|
||||||
|
return ccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef void (* test_with_fn_t)(const char *string);
|
||||||
|
|
||||||
|
char buf[64];
|
||||||
|
|
||||||
|
void test_memcpy_aligned(const char *string)
|
||||||
|
{
|
||||||
|
memcpy(buf, string, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_memcpy_unaligned(const char *string)
|
||||||
|
{
|
||||||
|
memcpy(buf, string, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_memcpy_unaligned2(const char *string)
|
||||||
|
{
|
||||||
|
memcpy(buf, string+1, 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_strcpy(const char *string)
|
||||||
|
{
|
||||||
|
strcpy(buf, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_sprintf(const char *string)
|
||||||
|
{
|
||||||
|
sprintf(buf, string, 1, 2, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_sprintf_arg(const char *string)
|
||||||
|
{
|
||||||
|
sprintf(buf, "%s", string);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_naive_strcpy(const char *string)
|
||||||
|
{
|
||||||
|
char *to = buf;
|
||||||
|
while((*to++ = *string++))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_naive_strcpy_a0(const char *string)
|
||||||
|
{
|
||||||
|
asm volatile (
|
||||||
|
" mov a8, %0 \n"
|
||||||
|
" mov a9, %1 \n"
|
||||||
|
"tns_loop%=: l8ui a0, a9, 0 \n"
|
||||||
|
" addi.n a9, a9, 1 \n"
|
||||||
|
" s8i a0, a8, 0 \n"
|
||||||
|
" addi.n a8, a8, 1 \n"
|
||||||
|
" bnez a0, tns_loop%=\n"
|
||||||
|
: : "r" (buf), "r" (string) : "a0", "a8", "a9");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_naive_strcpy_a2(const char *string)
|
||||||
|
{
|
||||||
|
asm volatile (
|
||||||
|
" mov a8, %0 \n"
|
||||||
|
" mov a9, %1 \n"
|
||||||
|
"tns_loop%=: l8ui a2, a9, 0 \n"
|
||||||
|
" addi.n a9, a9, 1 \n"
|
||||||
|
" s8i a2, a8, 0 \n"
|
||||||
|
" addi.n a8, a8, 1 \n"
|
||||||
|
" bnez a2, tns_loop%=\n"
|
||||||
|
: : "r" (buf), "r" (string) : "a2", "a8", "a9");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_naive_strcpy_a3(const char *string)
|
||||||
|
{
|
||||||
|
asm volatile (
|
||||||
|
" mov a8, %0 \n"
|
||||||
|
" mov a9, %1 \n"
|
||||||
|
"tns_loop%=: l8ui a3, a9, 0 \n"
|
||||||
|
" addi.n a9, a9, 1 \n"
|
||||||
|
" s8i a3, a8, 0 \n"
|
||||||
|
" addi.n a8, a8, 1 \n"
|
||||||
|
" bnez a3, tns_loop%=\n"
|
||||||
|
: : "r" (buf), "r" (string) : "a3", "a8", "a9");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_naive_strcpy_a4(const char *string)
|
||||||
|
{
|
||||||
|
asm volatile (
|
||||||
|
" mov a8, %0 \n"
|
||||||
|
" mov a9, %1 \n"
|
||||||
|
"tns_loop%=: l8ui a4, a9, 0 \n"
|
||||||
|
" addi.n a9, a9, 1 \n"
|
||||||
|
" s8i a4, a8, 0 \n"
|
||||||
|
" addi.n a8, a8, 1 \n"
|
||||||
|
" bnez a4, tns_loop%=\n"
|
||||||
|
: : "r" (buf), "r" (string) : "a4", "a8", "a9");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_naive_strcpy_a5(const char *string)
|
||||||
|
{
|
||||||
|
asm volatile (
|
||||||
|
" mov a8, %0 \n"
|
||||||
|
" mov a9, %1 \n"
|
||||||
|
"tns_loop%=: l8ui a5, a9, 0 \n"
|
||||||
|
" addi.n a9, a9, 1 \n"
|
||||||
|
" s8i a5, a8, 0 \n"
|
||||||
|
" addi.n a8, a8, 1 \n"
|
||||||
|
" bnez a5, tns_loop%=\n"
|
||||||
|
: : "r" (buf), "r" (string) : "a5", "a8", "a9");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_naive_strcpy_a6(const char *string)
|
||||||
|
{
|
||||||
|
asm volatile (
|
||||||
|
" mov a8, %0 \n"
|
||||||
|
" mov a9, %1 \n"
|
||||||
|
"tns_loop%=: l8ui a6, a9, 0 \n"
|
||||||
|
" addi.n a9, a9, 1 \n"
|
||||||
|
" s8i a6, a8, 0 \n"
|
||||||
|
" addi.n a8, a8, 1 \n"
|
||||||
|
" bnez a6, tns_loop%=\n"
|
||||||
|
: : "r" (buf), "r" (string) : "a6", "a8", "a9");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_l16si(const char *string)
|
||||||
|
{
|
||||||
|
/* This follows most of the l16si path, but as the
|
||||||
|
values in the string are all 7 bit none of them get sign extended.
|
||||||
|
|
||||||
|
See separate test_sign_extension function which validates
|
||||||
|
sign extension works as expected.
|
||||||
|
*/
|
||||||
|
int16_t *src_int16 = (int16_t *)string;
|
||||||
|
int32_t *dst_int32 = (int32_t *)buf;
|
||||||
|
dst_int32[0] = src_int16[0];
|
||||||
|
dst_int32[1] = src_int16[1];
|
||||||
|
dst_int32[2] = src_int16[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TEST_REPEATS 1000
|
||||||
|
|
||||||
|
void test_noop(const char *string)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t IRAM run_test(const char *string, test_with_fn_t testfn, const char *testfn_label, uint32_t nullvalue, bool evict_cache)
|
||||||
|
{
|
||||||
|
printf(" .. against %30s: ", testfn_label);
|
||||||
|
vPortEnterCritical();
|
||||||
|
uint32_t before = get_ccount();
|
||||||
|
for(int i = 0; i < TEST_REPEATS; i++) {
|
||||||
|
testfn(string);
|
||||||
|
if(evict_cache) {
|
||||||
|
Cache_Read_Disable();
|
||||||
|
Cache_Read_Enable(0,0,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint32_t after = get_ccount();
|
||||||
|
vPortExitCritical();
|
||||||
|
uint32_t instructions = (after-before)/TEST_REPEATS - nullvalue;
|
||||||
|
printf("%5d instructions\r\n", instructions);
|
||||||
|
return instructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_string(const char *string, char *label, bool evict_cache)
|
||||||
|
{
|
||||||
|
printf("Testing %s (%p) '%s'\r\n", label, string, string);
|
||||||
|
printf("Formats as: '");
|
||||||
|
printf(string, 1, 2, 3);
|
||||||
|
printf("'\r\n");
|
||||||
|
uint32_t nullvalue = run_test(string, test_noop, "null op", 0, evict_cache);
|
||||||
|
run_test(string, test_memcpy_aligned, "memcpy - aligned len", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_memcpy_unaligned, "memcpy - unaligned len", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_memcpy_unaligned2, "memcpy - unaligned start&len", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_strcpy, "strcpy", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_naive_strcpy, "naive strcpy", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_naive_strcpy_a0, "naive strcpy (a0)", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_naive_strcpy_a2, "naive strcpy (a2)", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_naive_strcpy_a3, "naive strcpy (a3)", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_naive_strcpy_a4, "naive strcpy (a4)", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_naive_strcpy_a5, "naive strcpy (a5)", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_naive_strcpy_a6, "naive strcpy (a6)", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_sprintf, "sprintf", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_sprintf_arg, "sprintf format arg", nullvalue, evict_cache);
|
||||||
|
run_test(string, test_l16si, "load as l16si", nullvalue, evict_cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_isr();
|
||||||
|
static void test_sign_extension();
|
||||||
|
static void test_system_interaction();
|
||||||
|
void sanity_tests(void);
|
||||||
|
|
||||||
|
void user_init(void)
|
||||||
|
{
|
||||||
|
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
|
||||||
|
|
||||||
|
gpio_enable(2, GPIO_OUTPUT); /* used for LED debug */
|
||||||
|
gpio_write(2, 1); /* active low */
|
||||||
|
|
||||||
|
printf("\r\n\r\nSDK version:%s\r\n", sdk_system_get_sdk_version());
|
||||||
|
sanity_tests();
|
||||||
|
test_string(dramtest, "DRAM", 0);
|
||||||
|
test_string(iramtest, "IRAM", 0);
|
||||||
|
test_string(iromtest, "Cached flash", 0);
|
||||||
|
test_string(iromtest, "'Uncached' flash", 1);
|
||||||
|
|
||||||
|
test_isr();
|
||||||
|
test_sign_extension();
|
||||||
|
|
||||||
|
xTaskHandle taskHandle;
|
||||||
|
xTaskCreate(test_system_interaction, (signed char *)"interactionTask", 256, &taskHandle, 2, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static volatile bool frc1_ran;
|
||||||
|
static volatile bool frc1_finished;
|
||||||
|
static volatile char frc1_buf[80];
|
||||||
|
|
||||||
|
static void frc1_interrupt_handler(void)
|
||||||
|
{
|
||||||
|
frc1_ran = true;
|
||||||
|
timer_set_run(FRC1, false);
|
||||||
|
strcpy((char *)frc1_buf, iramtest);
|
||||||
|
frc1_finished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_isr()
|
||||||
|
{
|
||||||
|
printf("Testing behaviour inside ISRs...\r\n");
|
||||||
|
timer_set_interrupts(FRC1, false);
|
||||||
|
timer_set_run(FRC1, false);
|
||||||
|
_xt_isr_attach(INUM_TIMER_FRC1, frc1_interrupt_handler);
|
||||||
|
timer_set_frequency(FRC1, 1000);
|
||||||
|
timer_set_interrupts(FRC1, true);
|
||||||
|
timer_set_run(FRC1, true);
|
||||||
|
sdk_os_delay_us(2000);
|
||||||
|
|
||||||
|
if(!frc1_ran)
|
||||||
|
printf("ERROR: FRC1 timer exception never fired.\r\n");
|
||||||
|
else if(!frc1_finished)
|
||||||
|
printf("ERROR: FRC1 timer exception never finished.\r\n");
|
||||||
|
else if(strcmp((char *)frc1_buf, iramtest))
|
||||||
|
printf("ERROR: FRC1 strcpy from IRAM failed.\r\n");
|
||||||
|
else
|
||||||
|
printf("PASSED\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
const volatile __attribute__((section(".iram1.notliterals"))) int16_t unsigned_shorts[] = { -3, -4, -5, -32767, 44 };
|
||||||
|
|
||||||
|
static void test_sign_extension()
|
||||||
|
{
|
||||||
|
/* this step seems to be necessary so the compiler will actually generate l16si */
|
||||||
|
int16_t *shorts_p = (int16_t *)unsigned_shorts;
|
||||||
|
if(shorts_p[0] == -3 && shorts_p[1] == -4 && shorts_p[2] == -5 && shorts_p[3] == -32767 && shorts_p[4] == 44)
|
||||||
|
{
|
||||||
|
printf("l16si sign extension PASSED.\r\n");
|
||||||
|
} else {
|
||||||
|
printf("ERROR: l16si sign extension failed. Got values %d %d %d %d %d\r\n", shorts_p[0], shorts_p[1], shorts_p[2], shorts_p[3], shorts_p[4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* test that running unaligned loads in a running FreeRTOS system doesn't break things
|
||||||
|
|
||||||
|
The following tests run inside a FreeRTOS task, after everything else.
|
||||||
|
*/
|
||||||
|
static void test_system_interaction()
|
||||||
|
{
|
||||||
|
uint32_t start = xTaskGetTickCount();
|
||||||
|
printf("Starting system/timer interaction test (takes approx 30 seconds)...\n");
|
||||||
|
for(int i = 0; i < 200*1000; i++) {
|
||||||
|
test_naive_strcpy_a0(iromtest);
|
||||||
|
test_naive_strcpy_a2(iromtest);
|
||||||
|
test_naive_strcpy_a3(iromtest);
|
||||||
|
test_naive_strcpy_a4(iromtest);
|
||||||
|
test_naive_strcpy_a5(iromtest);
|
||||||
|
test_naive_strcpy_a6(iromtest);
|
||||||
|
/*
|
||||||
|
const volatile char *string = iromtest;
|
||||||
|
volatile char *to = dest;
|
||||||
|
while((*to++ = *string++))
|
||||||
|
;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
uint32_t ticks = xTaskGetTickCount() - start;
|
||||||
|
printf("Timer interaction test PASSED after %dms.\n", ticks*portTICK_RATE_MS);
|
||||||
|
while(1) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The following "sanity tests" are designed to try to execute every code path
|
||||||
|
* of the LoadStoreError handler, with a variety of offsets and data values
|
||||||
|
* designed to catch any mask/shift errors, sign-extension bugs, etc */
|
||||||
|
|
||||||
|
/* (Contrary to expectations, 'mov a15, a15' in Xtensa is not technically a
|
||||||
|
* no-op, but is officially "undefined and reserved for future use", so we need
|
||||||
|
* a special case in the case where reg == "a15" so we don't end up generating
|
||||||
|
* those opcodes. GCC is smart enough to optimize away the whole conditional
|
||||||
|
* and just insert the correct asm block, since `reg` is a static argument.) */
|
||||||
|
#define LOAD_VIA_REG(op, reg, addr, var) \
|
||||||
|
if (strcmp(reg, "a15")) { \
|
||||||
|
asm volatile ( \
|
||||||
|
"mov a15, " reg "\n\t" \
|
||||||
|
op " " reg ", %1, 0\n\t" \
|
||||||
|
"mov %0, " reg "\n\t" \
|
||||||
|
"mov " reg ", a15\n\t" \
|
||||||
|
: "=r" (var) : "r" (addr) : "a15" ); \
|
||||||
|
} else { \
|
||||||
|
asm volatile ( \
|
||||||
|
op " " reg ", %1, 0\n\t" \
|
||||||
|
"mov %0, " reg "\n\t" \
|
||||||
|
: "=r" (var) : "r" (addr) : "a15" ); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TEST_LOAD(op, reg, addr, value) \
|
||||||
|
{ \
|
||||||
|
int32_t result; \
|
||||||
|
LOAD_VIA_REG(op, reg, addr, result); \
|
||||||
|
if (result != value) sanity_test_failed(op, reg, addr, value, result); \
|
||||||
|
}
|
||||||
|
|
||||||
|
void sanity_test_failed(const char *testname, const char *reg, const void *addr, int32_t value, int32_t result) {
|
||||||
|
uint32_t actual_data = *(uint32_t *)((uint32_t)addr & 0xfffffffc);
|
||||||
|
|
||||||
|
printf("*** SANITY TEST FAILED: '%s %s' from %p (underlying 32-bit value: 0x%x): Expected 0x%08x (%d), got 0x%08x (%d)\n", testname, reg, addr, actual_data, value, value, result, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
const __attribute__((section(".iram1.notrodata"))) char sanity_test_data[] = {
|
||||||
|
0x01, 0x55, 0x7e, 0x2a, 0x81, 0xd5, 0xfe, 0xaa
|
||||||
|
};
|
||||||
|
|
||||||
|
void sanity_test_l8ui(const void *addr, int32_t value) {
|
||||||
|
TEST_LOAD("l8ui", "a0", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a1", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a2", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a3", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a4", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a5", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a6", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a7", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a8", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a9", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a10", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a11", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a12", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a13", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a14", addr, value);
|
||||||
|
TEST_LOAD("l8ui", "a15", addr, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sanity_test_l16ui(const void *addr, int32_t value) {
|
||||||
|
TEST_LOAD("l16ui", "a0", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a1", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a2", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a3", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a4", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a5", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a6", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a7", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a8", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a9", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a10", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a11", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a12", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a13", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a14", addr, value);
|
||||||
|
TEST_LOAD("l16ui", "a15", addr, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sanity_test_l16si(const void *addr, int32_t value) {
|
||||||
|
TEST_LOAD("l16si", "a0", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a1", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a2", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a3", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a4", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a5", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a6", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a7", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a8", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a9", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a10", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a11", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a12", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a13", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a14", addr, value);
|
||||||
|
TEST_LOAD("l16si", "a15", addr, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sanity_tests(void) {
|
||||||
|
printf("== Performing sanity tests (sanity_test_data @ %p)...\n", sanity_test_data);
|
||||||
|
|
||||||
|
sanity_test_l8ui(sanity_test_data + 0, 0x01);
|
||||||
|
sanity_test_l8ui(sanity_test_data + 1, 0x55);
|
||||||
|
sanity_test_l8ui(sanity_test_data + 2, 0x7e);
|
||||||
|
sanity_test_l8ui(sanity_test_data + 3, 0x2a);
|
||||||
|
sanity_test_l8ui(sanity_test_data + 4, 0x81);
|
||||||
|
sanity_test_l8ui(sanity_test_data + 5, 0xd5);
|
||||||
|
sanity_test_l8ui(sanity_test_data + 6, 0xfe);
|
||||||
|
sanity_test_l8ui(sanity_test_data + 7, 0xaa);
|
||||||
|
|
||||||
|
sanity_test_l16ui(sanity_test_data + 0, 0x5501);
|
||||||
|
sanity_test_l16ui(sanity_test_data + 2, 0x2a7e);
|
||||||
|
sanity_test_l16ui(sanity_test_data + 4, 0xd581);
|
||||||
|
sanity_test_l16ui(sanity_test_data + 6, 0xaafe);
|
||||||
|
|
||||||
|
sanity_test_l16si(sanity_test_data + 0, 0x5501);
|
||||||
|
sanity_test_l16si(sanity_test_data + 2, 0x2a7e);
|
||||||
|
sanity_test_l16si(sanity_test_data + 4, -10879);
|
||||||
|
sanity_test_l16si(sanity_test_data + 6, -21762);
|
||||||
|
|
||||||
|
printf("== Sanity tests completed.\n");
|
||||||
|
}
|
||||||
4
examples/http_get_mbedtls/Makefile
Normal file
4
examples/http_get_mbedtls/Makefile
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
PROGRAM=http_get_mbedtls
|
||||||
|
COMPONENTS = FreeRTOS lwip core extras/mbedtls
|
||||||
|
|
||||||
|
include ../../common.mk
|
||||||
39
examples/http_get_mbedtls/cert.c
Normal file
39
examples/http_get_mbedtls/cert.c
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* This is the root certificate for the CA trust chain of
|
||||||
|
www.howsmyssl.com in PEM format, as dumped via:
|
||||||
|
|
||||||
|
openssl s_client -showcerts -connect www.howsmyssl.com:443 </dev/null
|
||||||
|
|
||||||
|
The root cert is the last cert in the chain output by the server.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
const char *server_root_cert = "-----BEGIN CERTIFICATE-----\r\n"
|
||||||
|
"MIIEWTCCA0GgAwIBAgIDAjpjMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\r\n"
|
||||||
|
"MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i\r\n"
|
||||||
|
"YWwgQ0EwHhcNMTIwODI3MjA0MDQwWhcNMjIwNTIwMjA0MDQwWjBEMQswCQYDVQQG\r\n"
|
||||||
|
"EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3Qg\r\n"
|
||||||
|
"U1NMIENBIC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC5J/lP\r\n"
|
||||||
|
"2Pa3FT+Pzc7WjRxr/X/aVCFOA9jK0HJSFbjJgltYeYT/JHJv8ml/vJbZmnrDPqnP\r\n"
|
||||||
|
"UCITDoYZ2+hJ74vm1kfy/XNFCK6PrF62+J589xD/kkNm7xzU7qFGiBGJSXl6Jc5L\r\n"
|
||||||
|
"avDXHHYaKTzJ5P0ehdzgMWUFRxasCgdLLnBeawanazpsrwUSxLIRJdY+lynwg2xX\r\n"
|
||||||
|
"HNil78zs/dYS8T/bQLSuDxjTxa9Akl0HXk7+Yhc3iemLdCai7bgK52wVWzWQct3Y\r\n"
|
||||||
|
"TSHUQCNcj+6AMRaraFX0DjtU6QRN8MxOgV7pb1JpTr6mFm1C9VH/4AtWPJhPc48O\r\n"
|
||||||
|
"bxoj8cnI2d+87FLXAgMBAAGjggFUMIIBUDAfBgNVHSMEGDAWgBTAephojYn7qwVk\r\n"
|
||||||
|
"DBF9qn1luMrMTjAdBgNVHQ4EFgQUEUrQcznVW2kIXLo9v2SaqIscVbwwEgYDVR0T\r\n"
|
||||||
|
"AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAQYwOgYDVR0fBDMwMTAvoC2gK4Yp\r\n"
|
||||||
|
"aHR0cDovL2NybC5nZW90cnVzdC5jb20vY3Jscy9ndGdsb2JhbC5jcmwwNAYIKwYB\r\n"
|
||||||
|
"BQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5nZW90cnVzdC5jb20w\r\n"
|
||||||
|
"TAYDVR0gBEUwQzBBBgpghkgBhvhFAQc2MDMwMQYIKwYBBQUHAgEWJWh0dHA6Ly93\r\n"
|
||||||
|
"d3cuZ2VvdHJ1c3QuY29tL3Jlc291cmNlcy9jcHMwKgYDVR0RBCMwIaQfMB0xGzAZ\r\n"
|
||||||
|
"BgNVBAMTElZlcmlTaWduTVBLSS0yLTI1NDANBgkqhkiG9w0BAQUFAAOCAQEAPOU9\r\n"
|
||||||
|
"WhuiNyrjRs82lhg8e/GExVeGd0CdNfAS8HgY+yKk3phLeIHmTYbjkQ9C47ncoNb/\r\n"
|
||||||
|
"qfixeZeZ0cNsQqWSlOBdDDMYJckrlVPg5akMfUf+f1ExRF73Kh41opQy98nuwLbG\r\n"
|
||||||
|
"mqzemSFqI6A4ZO6jxIhzMjtQzr+t03UepvTp+UJrYLLdRf1dVwjOLVDmEjIWE4ry\r\n"
|
||||||
|
"lKKbR6iGf9mY5ffldnRk2JG8hBYo2CVEMH6C2Kyx5MDkFWzbtiQnAioBEoW6MYhY\r\n"
|
||||||
|
"R3TjuNJkpsMyWS4pS0XxW4lJLoKaxhgVRNAuZAEVaDj59vlmAwxVG52/AECu8Egn\r\n"
|
||||||
|
"TOCAXi25KhV6vGb4NQ==\r\n"
|
||||||
|
"-----END CERTIFICATE-----\r\n";
|
||||||
|
|
||||||
|
|
||||||
347
examples/http_get_mbedtls/http_get_mbedtls.c
Normal file
347
examples/http_get_mbedtls/http_get_mbedtls.c
Normal file
|
|
@ -0,0 +1,347 @@
|
||||||
|
/* http_get_mbedtls - HTTPS version of the http_get example, using mbed TLS.
|
||||||
|
*
|
||||||
|
* Retrieves a JSON response from the howsmyssl.com API via HTTPS over TLS v1.2.
|
||||||
|
*
|
||||||
|
* Validates the server's certificate using the root CA loaded (in PEM format) in cert.c.
|
||||||
|
*
|
||||||
|
* Adapted from the ssl_client1 example in mbedtls.
|
||||||
|
*
|
||||||
|
* Original Copyright (C) 2006-2015, ARM Limited, All Rights Reserved, Apache 2.0 License.
|
||||||
|
* Additions Copyright (C) 2015 Angus Gratton, Apache 2.0 License.
|
||||||
|
*/
|
||||||
|
#include "espressif/esp_common.h"
|
||||||
|
#include "espressif/sdk_private.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/sockets.h"
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
#include "lwip/netdb.h"
|
||||||
|
#include "lwip/dns.h"
|
||||||
|
#include "lwip/api.h"
|
||||||
|
|
||||||
|
#include "ssid_config.h"
|
||||||
|
|
||||||
|
/* mbedtls/config.h MUST appear before all other mbedtls headers, or
|
||||||
|
you'll get the default config.
|
||||||
|
|
||||||
|
(Although mostly that isn't a big problem, you just might get
|
||||||
|
errors at link time if functions don't exist.) */
|
||||||
|
#include "mbedtls/config.h"
|
||||||
|
|
||||||
|
#include "mbedtls/net.h"
|
||||||
|
#include "mbedtls/debug.h"
|
||||||
|
#include "mbedtls/ssl.h"
|
||||||
|
#include "mbedtls/entropy.h"
|
||||||
|
#include "mbedtls/ctr_drbg.h"
|
||||||
|
#include "mbedtls/error.h"
|
||||||
|
#include "mbedtls/certs.h"
|
||||||
|
|
||||||
|
#define WEB_SERVER "howsmyssl.com"
|
||||||
|
#define WEB_PORT "443"
|
||||||
|
#define WEB_URL "https://www.howsmyssl.com/a/check"
|
||||||
|
|
||||||
|
#define GET_REQUEST "GET "WEB_URL" HTTP/1.1\n\n"
|
||||||
|
|
||||||
|
/* Root cert for howsmyssl.com, stored in cert.c */
|
||||||
|
extern const char *server_root_cert;
|
||||||
|
|
||||||
|
/* MBEDTLS_DEBUG_C disabled by default to save substantial bloating of
|
||||||
|
* firmware, define it in
|
||||||
|
* examples/http_get_mbedtls/include/mbedtls/config.h if you'd like
|
||||||
|
* debugging output.
|
||||||
|
*/
|
||||||
|
#ifdef MBEDTLS_DEBUG_C
|
||||||
|
|
||||||
|
|
||||||
|
/* Increase this value to see more TLS debug details,
|
||||||
|
0 prints nothing, 1 will print any errors, 4 will print _everything_
|
||||||
|
*/
|
||||||
|
#define DEBUG_LEVEL 4
|
||||||
|
|
||||||
|
static void my_debug(void *ctx, int level,
|
||||||
|
const char *file, int line,
|
||||||
|
const char *str)
|
||||||
|
{
|
||||||
|
((void) level);
|
||||||
|
|
||||||
|
/* Shorten 'file' from the whole file path to just the filename
|
||||||
|
|
||||||
|
This is a bit wasteful because the macros are compiled in with
|
||||||
|
the full _FILE_ path in each case, so the firmware is bloated out
|
||||||
|
by a few kb. But there's not a lot we can do about it...
|
||||||
|
*/
|
||||||
|
char *file_sep = rindex(file, '/');
|
||||||
|
if(file_sep)
|
||||||
|
file = file_sep+1;
|
||||||
|
|
||||||
|
printf("%s:%04d: %s", file, line, str);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void http_get_task(void *pvParameters)
|
||||||
|
{
|
||||||
|
int successes = 0, failures = 0, ret;
|
||||||
|
printf("HTTP get task starting...\n");
|
||||||
|
|
||||||
|
uint32_t flags;
|
||||||
|
unsigned char buf[1024];
|
||||||
|
const char *pers = "ssl_client1";
|
||||||
|
|
||||||
|
mbedtls_entropy_context entropy;
|
||||||
|
mbedtls_ctr_drbg_context ctr_drbg;
|
||||||
|
mbedtls_ssl_context ssl;
|
||||||
|
mbedtls_x509_crt cacert;
|
||||||
|
mbedtls_ssl_config conf;
|
||||||
|
mbedtls_net_context server_fd;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 0. Initialize the RNG and the session data
|
||||||
|
*/
|
||||||
|
mbedtls_ssl_init(&ssl);
|
||||||
|
mbedtls_x509_crt_init(&cacert);
|
||||||
|
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||||
|
printf("\n . Seeding the random number generator...");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
mbedtls_ssl_config_init(&conf);
|
||||||
|
|
||||||
|
mbedtls_entropy_init(&entropy);
|
||||||
|
if((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
|
||||||
|
(const unsigned char *) pers,
|
||||||
|
strlen(pers))) != 0)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret);
|
||||||
|
while(1) {} /* todo: replace with abort() */
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" ok\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 0. Initialize certificates
|
||||||
|
*/
|
||||||
|
printf(" . Loading the CA root certificate ...");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
ret = mbedtls_x509_crt_parse(&cacert, (uint8_t*)server_root_cert, strlen(server_root_cert)+1);
|
||||||
|
if(ret < 0)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n", -ret);
|
||||||
|
while(1) {} /* todo: replace with abort() */
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" ok (%d skipped)\n", ret);
|
||||||
|
|
||||||
|
/* Hostname set here should match CN in server certificate */
|
||||||
|
if((ret = mbedtls_ssl_set_hostname(&ssl, WEB_SERVER)) != 0)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_ssl_set_hostname returned %d\n\n", ret);
|
||||||
|
while(1) {} /* todo: replace with abort() */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 2. Setup stuff
|
||||||
|
*/
|
||||||
|
printf(" . Setting up the SSL/TLS structure...");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
if((ret = mbedtls_ssl_config_defaults(&conf,
|
||||||
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
|
MBEDTLS_SSL_PRESET_DEFAULT)) != 0)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" ok\n");
|
||||||
|
|
||||||
|
/* OPTIONAL is not optimal for security, in this example it will print
|
||||||
|
a warning if CA verification fails but it will continue to connect.
|
||||||
|
*/
|
||||||
|
mbedtls_ssl_conf_authmode(&conf, MBEDTLS_SSL_VERIFY_OPTIONAL);
|
||||||
|
mbedtls_ssl_conf_ca_chain(&conf, &cacert, NULL);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_ctr_drbg_random, &ctr_drbg);
|
||||||
|
#ifdef MBEDTLS_DEBUG_C
|
||||||
|
mbedtls_debug_set_threshold(DEBUG_LEVEL);
|
||||||
|
mbedtls_ssl_conf_dbg(&conf, my_debug, stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_ssl_setup returned %d\n\n", ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait until we can resolve the DNS for the server, as an indication
|
||||||
|
our network is probably working...
|
||||||
|
*/
|
||||||
|
printf("Waiting for server DNS to resolve... ");
|
||||||
|
fflush(stdout);
|
||||||
|
err_t dns_err;
|
||||||
|
ip_addr_t host_ip;
|
||||||
|
do {
|
||||||
|
vTaskDelay(500 / portTICK_RATE_MS);
|
||||||
|
dns_err = netconn_gethostbyname(WEB_SERVER, &host_ip);
|
||||||
|
} while(dns_err != ERR_OK);
|
||||||
|
printf("done.\n");
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
mbedtls_net_init(&server_fd);
|
||||||
|
printf("top of loop, free heap = %u\n", xPortGetFreeHeapSize());
|
||||||
|
/*
|
||||||
|
* 1. Start the connection
|
||||||
|
*/
|
||||||
|
printf(" . Connecting to %s:%s...", WEB_SERVER, WEB_PORT);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
if((ret = mbedtls_net_connect(&server_fd, WEB_SERVER,
|
||||||
|
WEB_PORT, MBEDTLS_NET_PROTO_TCP)) != 0)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_net_connect returned %d\n\n", ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" ok\n");
|
||||||
|
|
||||||
|
mbedtls_ssl_set_bio(&ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 4. Handshake
|
||||||
|
*/
|
||||||
|
printf(" . Performing the SSL/TLS handshake...");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
while((ret = mbedtls_ssl_handshake(&ssl)) != 0)
|
||||||
|
{
|
||||||
|
if(ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", -ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" ok\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 5. Verify the server certificate
|
||||||
|
*/
|
||||||
|
printf(" . Verifying peer X.509 certificate...");
|
||||||
|
|
||||||
|
/* In real life, we probably want to bail out when ret != 0 */
|
||||||
|
if((flags = mbedtls_ssl_get_verify_result(&ssl)) != 0)
|
||||||
|
{
|
||||||
|
char vrfy_buf[512];
|
||||||
|
|
||||||
|
printf(" failed\n");
|
||||||
|
|
||||||
|
mbedtls_x509_crt_verify_info(vrfy_buf, sizeof(vrfy_buf), " ! ", flags);
|
||||||
|
|
||||||
|
printf("%s\n", vrfy_buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf(" ok\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 3. Write the GET request
|
||||||
|
*/
|
||||||
|
printf(" > Write to server:");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
int len = sprintf((char *) buf, GET_REQUEST);
|
||||||
|
|
||||||
|
while((ret = mbedtls_ssl_write(&ssl, buf, len)) <= 0)
|
||||||
|
{
|
||||||
|
if(ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE)
|
||||||
|
{
|
||||||
|
printf(" failed\n ! mbedtls_ssl_write returned %d\n\n", ret);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len = ret;
|
||||||
|
printf(" %d bytes written\n\n%s", len, (char *) buf);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 7. Read the HTTP response
|
||||||
|
*/
|
||||||
|
printf(" < Read from server:");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
len = sizeof(buf) - 1;
|
||||||
|
memset(buf, 0, sizeof(buf));
|
||||||
|
ret = mbedtls_ssl_read(&ssl, buf, len);
|
||||||
|
|
||||||
|
if(ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret < 0)
|
||||||
|
{
|
||||||
|
printf("failed\n ! mbedtls_ssl_read returned %d\n\n", ret);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret == 0)
|
||||||
|
{
|
||||||
|
printf("\n\nEOF\n\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = ret;
|
||||||
|
printf(" %d bytes read\n\n%s", len, (char *) buf);
|
||||||
|
} while(1);
|
||||||
|
|
||||||
|
mbedtls_ssl_close_notify(&ssl);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
mbedtls_ssl_session_reset(&ssl);
|
||||||
|
mbedtls_net_free(&server_fd);
|
||||||
|
|
||||||
|
if(ret != 0)
|
||||||
|
{
|
||||||
|
char error_buf[100];
|
||||||
|
mbedtls_strerror(ret, error_buf, 100);
|
||||||
|
printf("\n\nLast error was: %d - %s\n\n", ret, error_buf);
|
||||||
|
failures++;
|
||||||
|
} else {
|
||||||
|
successes++;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n\nsuccesses = %d failures = %d\n", successes, failures);
|
||||||
|
for(int countdown = successes ? 10 : 5; countdown >= 0; countdown--) {
|
||||||
|
printf("%d... ", countdown);
|
||||||
|
fflush(stdout);
|
||||||
|
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||||
|
}
|
||||||
|
printf("\nStarting again!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void user_init(void)
|
||||||
|
{
|
||||||
|
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
|
||||||
|
printf("SDK version:%s\n", sdk_system_get_sdk_version());
|
||||||
|
|
||||||
|
struct sdk_station_config config = {
|
||||||
|
.ssid = WIFI_SSID,
|
||||||
|
.password = WIFI_PASS,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* required to call wifi_set_opmode before station_set_config */
|
||||||
|
sdk_wifi_set_opmode(STATION_MODE);
|
||||||
|
sdk_wifi_station_set_config(&config);
|
||||||
|
|
||||||
|
xTaskCreate(&http_get_task, (signed char *)"get_task", 2048, NULL, 2, NULL);
|
||||||
|
}
|
||||||
27
examples/http_get_mbedtls/include/mbedtls/config.h
Normal file
27
examples/http_get_mbedtls/include/mbedtls/config.h
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
/* Special mbedTLS config file for http_get_mbedtls example,
|
||||||
|
overrides supported cipher suite list.
|
||||||
|
|
||||||
|
Overriding the set of cipher suites saves small amounts of ROM and
|
||||||
|
RAM, and is a good practice in general if you know what server(s)
|
||||||
|
you want to connect to.
|
||||||
|
|
||||||
|
However it's extra important here because the howsmyssl API sends
|
||||||
|
back the list of ciphers we send it as a JSON list in the, and we
|
||||||
|
only have a 4096kB receive buffer. If the server supported maximum
|
||||||
|
fragment length option then we wouldn't have this problem either,
|
||||||
|
but we do so this is a good workaround.
|
||||||
|
|
||||||
|
The ciphers chosen below are common ECDHE ciphers, the same ones
|
||||||
|
Firefox uses when connecting to a TLSv1.2 server.
|
||||||
|
*/
|
||||||
|
#ifndef MBEDTLS_CONFIG_H
|
||||||
|
|
||||||
|
/* include_next picks up default config from extras/mbedtls/include/mbedtls/config.h */
|
||||||
|
#include_next<mbedtls/config.h>
|
||||||
|
|
||||||
|
#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
|
||||||
|
|
||||||
|
/* uncomment next line to include debug output from example */
|
||||||
|
//#define MBEDTLS_DEBUG_C
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
PROGRAM=http_get_ssl
|
|
||||||
include ../../common.mk
|
|
||||||
|
|
@ -1,223 +0,0 @@
|
||||||
/* http_get_ssl - HTTPS version of the http_get example.
|
|
||||||
*
|
|
||||||
* Retrieves a web page over HTTPS (TLS) using GET.
|
|
||||||
*
|
|
||||||
* Does not validate server certificate.
|
|
||||||
*
|
|
||||||
* This sample code is in the public domain.,
|
|
||||||
*/
|
|
||||||
#include "espressif/esp_common.h"
|
|
||||||
#include "espressif/sdk_private.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
#include "task.h"
|
|
||||||
|
|
||||||
#include "lwip/err.h"
|
|
||||||
#include "lwip/sockets.h"
|
|
||||||
#include "lwip/sys.h"
|
|
||||||
#include "lwip/netdb.h"
|
|
||||||
#include "lwip/dns.h"
|
|
||||||
|
|
||||||
#include "ssl.h"
|
|
||||||
|
|
||||||
#include "ssid_config.h"
|
|
||||||
|
|
||||||
#define WEB_SERVER "192.168.0.18"
|
|
||||||
#define WEB_PORT "8000"
|
|
||||||
#define WEB_URL "/test"
|
|
||||||
|
|
||||||
static void display_cipher(SSL *ssl);
|
|
||||||
static void display_session_id(SSL *ssl);
|
|
||||||
|
|
||||||
void http_get_task(void *pvParameters)
|
|
||||||
{
|
|
||||||
int successes = 0, failures = 0;
|
|
||||||
SSL_CTX *ssl_ctx;
|
|
||||||
uint32_t options = SSL_SERVER_VERIFY_LATER|SSL_DISPLAY_CERTS;
|
|
||||||
printf("HTTP get task starting...\r\n");
|
|
||||||
|
|
||||||
printf("free heap = %u\r\n", xPortGetFreeHeapSize());
|
|
||||||
if ((ssl_ctx = ssl_ctx_new(options, SSL_DEFAULT_CLNT_SESS)) == NULL)
|
|
||||||
{
|
|
||||||
printf("Error: SSL Client context is invalid\n");
|
|
||||||
while(1) {}
|
|
||||||
}
|
|
||||||
printf("Got SSL context.");
|
|
||||||
|
|
||||||
while(1) {
|
|
||||||
const struct addrinfo hints = {
|
|
||||||
.ai_family = AF_INET,
|
|
||||||
.ai_socktype = SOCK_STREAM,
|
|
||||||
};
|
|
||||||
struct addrinfo *res;
|
|
||||||
|
|
||||||
printf("top of loop, free heap = %u\r\n", xPortGetFreeHeapSize());
|
|
||||||
|
|
||||||
printf("Running DNS lookup for %s...\r\n", WEB_SERVER);
|
|
||||||
int err = getaddrinfo(WEB_SERVER, WEB_PORT, &hints, &res);
|
|
||||||
|
|
||||||
if(err != 0 || res == NULL) {
|
|
||||||
printf("DNS lookup failed err=%d res=%p\r\n", err, res);
|
|
||||||
if(res)
|
|
||||||
freeaddrinfo(res);
|
|
||||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
|
||||||
failures++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Note: inet_ntoa is non-reentrant, look at ipaddr_ntoa_r for "real" code */
|
|
||||||
struct in_addr *addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr;
|
|
||||||
printf("DNS lookup succeeded. IP=%s\r\n", inet_ntoa(*addr));
|
|
||||||
|
|
||||||
int s = socket(res->ai_family, res->ai_socktype, 0);
|
|
||||||
if(s < 0) {
|
|
||||||
printf("... Failed to allocate socket.\r\n");
|
|
||||||
freeaddrinfo(res);
|
|
||||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
|
||||||
failures++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("... allocated socket\r\n");
|
|
||||||
|
|
||||||
if(connect(s, res->ai_addr, res->ai_addrlen) != 0) {
|
|
||||||
close(s);
|
|
||||||
freeaddrinfo(res);
|
|
||||||
printf("... socket connect failed.\r\n");
|
|
||||||
vTaskDelay(4000 / portTICK_RATE_MS);
|
|
||||||
failures++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("... connected. starting TLS session...\r\n");
|
|
||||||
freeaddrinfo(res);
|
|
||||||
|
|
||||||
SSL *ssl = ssl_client_new(ssl_ctx, s, NULL, 0);
|
|
||||||
printf("initial status %p %d\r\n", ssl, ssl_handshake_status(ssl));
|
|
||||||
if((err = ssl_handshake_status(ssl)) != SSL_OK) {
|
|
||||||
ssl_free(ssl);
|
|
||||||
close(s);
|
|
||||||
printf("SSL handshake failed. :( %d\r\n", err);
|
|
||||||
vTaskDelay(4000 / portTICK_RATE_MS);
|
|
||||||
failures++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *common_name = ssl_get_cert_dn(ssl,
|
|
||||||
SSL_X509_CERT_COMMON_NAME);
|
|
||||||
if (common_name)
|
|
||||||
{
|
|
||||||
printf("Common Name:\t\t\t%s\n", common_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
display_session_id(ssl);
|
|
||||||
display_cipher(ssl);
|
|
||||||
|
|
||||||
const char *req =
|
|
||||||
"GET "WEB_URL"\r\n"
|
|
||||||
"User-Agent: esp-open-rtos/0.1 esp8266\r\n"
|
|
||||||
"\r\n";
|
|
||||||
if (ssl_write(ssl, (uint8_t *)req, strlen(req)) < 0) {
|
|
||||||
printf("... socket send failed\r\n");
|
|
||||||
ssl_free(ssl);
|
|
||||||
close(s);
|
|
||||||
vTaskDelay(4000 / portTICK_RATE_MS);
|
|
||||||
failures++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
printf("... socket send success\r\n");
|
|
||||||
|
|
||||||
uint8_t *recv_buf;
|
|
||||||
int r;
|
|
||||||
do {
|
|
||||||
r = ssl_read(ssl, &recv_buf);
|
|
||||||
for(int i = 0; i < r; i++)
|
|
||||||
printf("%c", recv_buf[i]);
|
|
||||||
} while(r > 0);
|
|
||||||
|
|
||||||
printf("... done reading from socket. Last read return=%d errno=%d\r\n", r, errno);
|
|
||||||
if(r != 0)
|
|
||||||
failures++;
|
|
||||||
else
|
|
||||||
successes++;
|
|
||||||
ssl_free(ssl);
|
|
||||||
close(s);
|
|
||||||
printf("successes = %d failures = %d\r\n", successes, failures);
|
|
||||||
for(int countdown = 10; countdown >= 0; countdown--) {
|
|
||||||
printf("%d... ", countdown);
|
|
||||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
|
||||||
}
|
|
||||||
printf("\r\nStarting again!\r\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void user_init(void)
|
|
||||||
{
|
|
||||||
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
|
|
||||||
printf("SDK version:%s\n", sdk_system_get_sdk_version());
|
|
||||||
|
|
||||||
struct sdk_station_config config = {
|
|
||||||
.ssid = WIFI_SSID,
|
|
||||||
.password = WIFI_PASS,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* required to call wifi_set_opmode before station_set_config */
|
|
||||||
sdk_wifi_set_opmode(STATION_MODE);
|
|
||||||
sdk_wifi_station_set_config(&config);
|
|
||||||
|
|
||||||
xTaskCreate(&http_get_task, (signed char *)"get_task", 2048, NULL, 2, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display what session id we have.
|
|
||||||
*/
|
|
||||||
static void display_session_id(SSL *ssl)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const uint8_t *session_id = ssl_get_session_id(ssl);
|
|
||||||
int sess_id_size = ssl_get_session_id_size(ssl);
|
|
||||||
|
|
||||||
if (sess_id_size > 0)
|
|
||||||
{
|
|
||||||
printf("-----BEGIN SSL SESSION PARAMETERS-----\n");
|
|
||||||
for (i = 0; i < sess_id_size; i++)
|
|
||||||
{
|
|
||||||
printf("%02x", session_id[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n-----END SSL SESSION PARAMETERS-----\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display what cipher we are using
|
|
||||||
*/
|
|
||||||
static void display_cipher(SSL *ssl)
|
|
||||||
{
|
|
||||||
printf("CIPHER is ");
|
|
||||||
switch (ssl_get_cipher_id(ssl))
|
|
||||||
{
|
|
||||||
case SSL_AES128_SHA:
|
|
||||||
printf("AES128-SHA");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSL_AES256_SHA:
|
|
||||||
printf("AES256-SHA");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSL_RC4_128_SHA:
|
|
||||||
printf("RC4-SHA");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSL_RC4_128_MD5:
|
|
||||||
printf("RC4-MD5");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
printf("Unknown - %d", ssl_get_cipher_id(ssl));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
@ -26,7 +26,7 @@ void user_init(void)
|
||||||
|
|
||||||
printf("Image addresses in flash:\r\n");
|
printf("Image addresses in flash:\r\n");
|
||||||
for(int i = 0; i <conf.count; i++) {
|
for(int i = 0; i <conf.count; i++) {
|
||||||
printf("%c%d: offset 0x%08lx\r\n", i == conf.current_rom ? '*':' ', i, conf.roms[i]);
|
printf("%c%d: offset 0x%08x\r\n", i == conf.current_rom ? '*':' ', i, conf.roms[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sdk_station_config config = {
|
struct sdk_station_config config = {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ void task2(void *pvParameters)
|
||||||
while(1) {
|
while(1) {
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
if(xQueueReceive(*queue, &count, 1000)) {
|
if(xQueueReceive(*queue, &count, 1000)) {
|
||||||
printf("Got %lu\n", count);
|
printf("Got %u\n", count);
|
||||||
} else {
|
} else {
|
||||||
printf("No msg :(\n");
|
printf("No msg :(\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
examples/simple_cplusplus/Makefile
Normal file
3
examples/simple_cplusplus/Makefile
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Simple makefile for simple example
|
||||||
|
PROGRAM=simple
|
||||||
|
include ../../common.mk
|
||||||
64
examples/simple_cplusplus/simple.cpp
Normal file
64
examples/simple_cplusplus/simple.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* A very basic C++ example, really just proof of concept for C++
|
||||||
|
|
||||||
|
This sample code is in the public domain.
|
||||||
|
*/
|
||||||
|
#include "espressif/esp_common.h"
|
||||||
|
#include "espressif/sdk_private.h"
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
class Counter
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
uint32_t _count;
|
||||||
|
public:
|
||||||
|
Counter(uint32_t initial_count)
|
||||||
|
{
|
||||||
|
this->_count = initial_count;
|
||||||
|
printf("Counter initialised with count %d\r\n", initial_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Increment()
|
||||||
|
{
|
||||||
|
_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t getCount()
|
||||||
|
{
|
||||||
|
return _count;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static Counter static_counter(99);
|
||||||
|
|
||||||
|
void task1(void *pvParameters)
|
||||||
|
{
|
||||||
|
Counter local_counter = Counter(12);
|
||||||
|
Counter *new_counter = new Counter(24);
|
||||||
|
while(1) {
|
||||||
|
Counter *counter = NULL;
|
||||||
|
switch(rand() % 3) {
|
||||||
|
case 0:
|
||||||
|
counter = &local_counter;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
counter = &static_counter;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
counter = new_counter;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
counter->Increment();
|
||||||
|
printf("local counter %d static counter %d newly allocated counter %d\r\n", local_counter.getCount(),
|
||||||
|
static_counter.getCount(), new_counter->getCount());
|
||||||
|
vTaskDelay(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void user_init(void)
|
||||||
|
{
|
||||||
|
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
|
||||||
|
printf("SDK version:%s\n", sdk_system_get_sdk_version());
|
||||||
|
xTaskCreate(task1, (signed char *)"tsk1", 256, NULL, 2, NULL);
|
||||||
|
}
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
PROGRAM=hmac_test
|
PROGRAM=hmac_test
|
||||||
|
EXTRA_COMPONENTS=extras/mbedtls
|
||||||
include ../../../common.mk
|
include ../../../common.mk
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#include "espressif/esp_common.h"
|
#include "espressif/esp_common.h"
|
||||||
#include "espressif/sdk_private.h"
|
#include "espressif/sdk_private.h"
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "ssl.h"
|
#include "mbedtls/md.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
@ -31,9 +31,7 @@ static const uint8_t aa_80_times[] = {0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x
|
||||||
0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
|
0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
|
||||||
0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa};
|
0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa};
|
||||||
|
|
||||||
/* NOTE: Vectors 6 & 7 currently cause a fault as the axTLS
|
const uint8_t NUM_MD5_VECTORS = 7;
|
||||||
routines don't support keys longer than the block size. */
|
|
||||||
const uint8_t NUM_MD5_VECTORS = 5;
|
|
||||||
|
|
||||||
static const struct test_vector md5_vectors[] = {
|
static const struct test_vector md5_vectors[] = {
|
||||||
{ /* vector 1*/
|
{ /* vector 1*/
|
||||||
|
|
@ -88,15 +86,30 @@ static const struct test_vector md5_vectors[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void print_blob(const char *label, const uint8_t *data, const uint32_t len)
|
||||||
|
{
|
||||||
|
printf("%s:", label);
|
||||||
|
for(int i = 0; i < len; i++) {
|
||||||
|
if(i % 16 == 0)
|
||||||
|
printf("\n%02x:", i);
|
||||||
|
printf(" %02x", data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test_md5(void)
|
static void test_md5(void)
|
||||||
{
|
{
|
||||||
printf("\r\nTesting MD5 vectors...\r\n");
|
printf("\r\nTesting MD5 vectors...\r\n");
|
||||||
uint8_t test_digest[16];
|
|
||||||
|
const mbedtls_md_info_t *md5_hmac = mbedtls_md_info_from_type(MBEDTLS_MD_MD5);
|
||||||
|
|
||||||
for(int i = 0; i < NUM_MD5_VECTORS; i++) {
|
for(int i = 0; i < NUM_MD5_VECTORS; i++) {
|
||||||
const struct test_vector *vector = &md5_vectors[i];
|
const struct test_vector *vector = &md5_vectors[i];
|
||||||
printf("Test case %d: ", i+1);
|
printf("Test case %d: ", i+1);
|
||||||
hmac_md5(vector->data, vector->data_len, vector->key, vector->key_len, test_digest);
|
|
||||||
if(memcmp(test_digest, vector->digest, 16)) {
|
uint8_t test_digest[16];
|
||||||
|
mbedtls_md_hmac(md5_hmac, vector->key, vector->key_len, vector->data, vector->data_len, test_digest);
|
||||||
|
|
||||||
|
if(memcmp(vector->digest, test_digest, 16)) {
|
||||||
uint8_t first = 0;
|
uint8_t first = 0;
|
||||||
for(first = 0; first < 16; first++) {
|
for(first = 0; first < 16; first++) {
|
||||||
if(test_digest[first] != vector->digest[first]) {
|
if(test_digest[first] != vector->digest[first]) {
|
||||||
|
|
|
||||||
22
extras/bmp180/LICENSE
Normal file
22
extras/bmp180/LICENSE
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Frank Bargstedt
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
56
extras/bmp180/README.md
Normal file
56
extras/bmp180/README.md
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Driver for BMP085/BMP180 digital pressure sensor
|
||||||
|
|
||||||
|
This driver is written for usage with the ESP8266 and FreeRTOS ([esp-open-rtos](https://github.com/SuperHouse/esp-open-rtos) and [esp-open-rtos-driver-i2c](https://github.com/kanflo/esp-open-rtos-driver-i2c)).
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
Before using the BMP180 module, the function `bmp180_init(SCL_PIN, SDA_PIN)` needs to be called to setup the I2C interface and do validation if the BMP180/BMP085 is accessible.
|
||||||
|
|
||||||
|
If the setup is sucessfully and a measurement is triggered, the result of the measurement is provided to the user as an event send via the `qQueue` provided with `bmp180_trigger_*measurement(pQueue);`
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
|
```
|
||||||
|
#define SCL_PIN GPIO_ID_PIN(0)
|
||||||
|
#define SDA_PIN GPIO_ID_PIN(2)
|
||||||
|
...
|
||||||
|
|
||||||
|
if (!bmp180_init(SCL_PIN, SDA_PIN)) {
|
||||||
|
// An error occured, while dong the init (E.g device not found etc.)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger a measurement
|
||||||
|
bmp180_trigger_measurement(pQueue);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Change queue event
|
||||||
|
|
||||||
|
Per default the event send to the user via the provided queue is of the type `bmp180_result_t`. As this might not always be desired, a way is provided so that the user can provide a function, which creates and sends the event via the provided queue.
|
||||||
|
|
||||||
|
As all data aqquired from the BMP180/BMP085 is provided to the `bmp180_informUser` function, it is also possible to calculate new informations (E.g altitude etc.)
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
```
|
||||||
|
// Own BMP180 User Inform Implementation
|
||||||
|
bool my_informUser(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure) {
|
||||||
|
my_event_t ev;
|
||||||
|
|
||||||
|
ev.event_type = MY_EVT_BMP180;
|
||||||
|
ev.bmp180_data.cmd = cmd;
|
||||||
|
ev.bmp180_data.temperature = temperature;
|
||||||
|
ev.bmp180_data.pressure = pressure;
|
||||||
|
|
||||||
|
return (xQueueSend(*resultQueue, &ev, 0) == pdTRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
// Use our user inform implementation
|
||||||
|
// needs to be set before first measurement is triggered
|
||||||
|
bmp180_informUser = my_informUser;
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
351
extras/bmp180/bmp180.c
Normal file
351
extras/bmp180/bmp180.c
Normal file
|
|
@ -0,0 +1,351 @@
|
||||||
|
#include "bmp180.h"
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "queue.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
#include "espressif/esp_common.h"
|
||||||
|
#include "espressif/sdk_private.h"
|
||||||
|
|
||||||
|
#include "i2c/i2c.h"
|
||||||
|
|
||||||
|
#define BMP180_RX_QUEUE_SIZE 10
|
||||||
|
#define BMP180_TASK_PRIORITY 9
|
||||||
|
|
||||||
|
#define BMP180_DEVICE_ADDRESS 0x77
|
||||||
|
|
||||||
|
#define BMP180_VERSION_REG 0xD0
|
||||||
|
#define BMP180_CONTROL_REG 0xF4
|
||||||
|
#define BMP180_RESET_REG 0xE0
|
||||||
|
#define BMP180_OUT_MSB_REG 0xF6
|
||||||
|
#define BMP180_OUT_LSB_REG 0xF7
|
||||||
|
#define BMP180_OUT_XLSB_REG 0xF8
|
||||||
|
|
||||||
|
#define BMP180_CALIBRATION_REG 0xAA
|
||||||
|
|
||||||
|
//
|
||||||
|
// Values for BMP180_CONTROL_REG
|
||||||
|
//
|
||||||
|
#define BMP180_MEASURE_TEMP 0x2E
|
||||||
|
#define BMP180_MEASURE_PRESS_OSS0 0x34
|
||||||
|
#define BMP180_MEASURE_PRESS_OSS1 0x74
|
||||||
|
#define BMP180_MEASURE_PRESS_OSS2 0xB4
|
||||||
|
#define BMP180_MEASURE_PRESS_OSS3 0xF4
|
||||||
|
|
||||||
|
#define BMP180_DEFAULT_CONV_TIME 5000
|
||||||
|
|
||||||
|
//
|
||||||
|
// CHIP ID stored in BMP180_VERSION_REG
|
||||||
|
//
|
||||||
|
#define BMP180_CHIP_ID 0x55
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reset value for BMP180_RESET_REG
|
||||||
|
//
|
||||||
|
#define BMP180_RESET_VALUE 0xB6
|
||||||
|
|
||||||
|
|
||||||
|
// BMP180_Event_Command
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t cmd;
|
||||||
|
const xQueueHandle* resultQueue;
|
||||||
|
} bmp180_command_t;
|
||||||
|
|
||||||
|
// Just works due to the fact that xQueueHandle is a "void *"
|
||||||
|
static xQueueHandle bmp180_rx_queue = NULL;
|
||||||
|
static xTaskHandle bmp180_task_handle = NULL;
|
||||||
|
|
||||||
|
// Calibration constants
|
||||||
|
static int16_t AC1;
|
||||||
|
static int16_t AC2;
|
||||||
|
static int16_t AC3;
|
||||||
|
static uint16_t AC4;
|
||||||
|
static uint16_t AC5;
|
||||||
|
static uint16_t AC6;
|
||||||
|
|
||||||
|
static int16_t B1;
|
||||||
|
static int16_t B2;
|
||||||
|
|
||||||
|
static int16_t MB;
|
||||||
|
static int16_t MC;
|
||||||
|
static int16_t MD;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Forward declarations
|
||||||
|
//
|
||||||
|
static void bmp180_meassure(const bmp180_command_t* command);
|
||||||
|
static bool bmp180_informUser_Impl(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure);
|
||||||
|
|
||||||
|
// Set default implementation .. User gets result as bmp180_result_t event
|
||||||
|
bool (*bmp180_informUser)(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure) = bmp180_informUser_Impl;
|
||||||
|
|
||||||
|
// I2C Driver Task
|
||||||
|
static void bmp180_driver_task(void *pvParameters)
|
||||||
|
{
|
||||||
|
// Data to be received from user
|
||||||
|
bmp180_command_t current_command;
|
||||||
|
|
||||||
|
#ifdef BMP180_DEBUG
|
||||||
|
// Wait for commands from the outside
|
||||||
|
printf("%s: Started Task\n", __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
// Wait for user to insert commands
|
||||||
|
if (xQueueReceive(bmp180_rx_queue, ¤t_command, portMAX_DELAY) == pdTRUE)
|
||||||
|
{
|
||||||
|
#ifdef BMP180_DEBUG
|
||||||
|
printf("%s: Received user command %d 0x%p\n", __FUNCTION__, current_command.cmd, current_command.resultQueue);
|
||||||
|
#endif
|
||||||
|
// use user provided queue
|
||||||
|
if (current_command.resultQueue != NULL)
|
||||||
|
{
|
||||||
|
// Work on it ...
|
||||||
|
bmp180_meassure(¤t_command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t bmp180_readRegister8(uint8_t reg)
|
||||||
|
{
|
||||||
|
uint8_t r = 0;
|
||||||
|
|
||||||
|
if (!i2c_slave_read(BMP180_DEVICE_ADDRESS, reg, &r, 1))
|
||||||
|
{
|
||||||
|
r = 0;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int16_t bmp180_readRegister16(uint8_t reg)
|
||||||
|
{
|
||||||
|
uint8_t d[] = { 0, 0 };
|
||||||
|
int16_t r = 0;
|
||||||
|
|
||||||
|
if (i2c_slave_read(BMP180_DEVICE_ADDRESS, reg, d, 2))
|
||||||
|
{
|
||||||
|
r = ((int16_t)d[0]<<8) | (d[1]);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bmp180_start_Messurement(uint8_t cmd)
|
||||||
|
{
|
||||||
|
uint8_t d[] = { BMP180_CONTROL_REG, cmd };
|
||||||
|
|
||||||
|
i2c_slave_write(BMP180_DEVICE_ADDRESS, d, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int16_t bmp180_getUncompensatedMessurement(uint8_t cmd)
|
||||||
|
{
|
||||||
|
// Write Start Code into reg 0xF4 (Currently without oversampling ...)
|
||||||
|
bmp180_start_Messurement((cmd==BMP180_TEMPERATURE)?BMP180_MEASURE_TEMP:BMP180_MEASURE_PRESS_OSS0);
|
||||||
|
|
||||||
|
// Wait 5ms Datasheet states 4.5ms
|
||||||
|
sdk_os_delay_us(BMP180_DEFAULT_CONV_TIME);
|
||||||
|
|
||||||
|
return (int16_t)bmp180_readRegister16(BMP180_OUT_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bmp180_fillInternalConstants(void)
|
||||||
|
{
|
||||||
|
AC1 = bmp180_readRegister16(BMP180_CALIBRATION_REG+0);
|
||||||
|
AC2 = bmp180_readRegister16(BMP180_CALIBRATION_REG+2);
|
||||||
|
AC3 = bmp180_readRegister16(BMP180_CALIBRATION_REG+4);
|
||||||
|
AC4 = bmp180_readRegister16(BMP180_CALIBRATION_REG+6);
|
||||||
|
AC5 = bmp180_readRegister16(BMP180_CALIBRATION_REG+8);
|
||||||
|
AC6 = bmp180_readRegister16(BMP180_CALIBRATION_REG+10);
|
||||||
|
|
||||||
|
B1 = bmp180_readRegister16(BMP180_CALIBRATION_REG+12);
|
||||||
|
B2 = bmp180_readRegister16(BMP180_CALIBRATION_REG+14);
|
||||||
|
|
||||||
|
MB = bmp180_readRegister16(BMP180_CALIBRATION_REG+16);
|
||||||
|
MC = bmp180_readRegister16(BMP180_CALIBRATION_REG+18);
|
||||||
|
MD = bmp180_readRegister16(BMP180_CALIBRATION_REG+20);
|
||||||
|
|
||||||
|
#ifdef BMP180_DEBUG
|
||||||
|
printf("%s: AC1:=%d AC2:=%d AC3:=%d AC4:=%u AC5:=%u AC6:=%u \n", __FUNCTION__, AC1, AC2, AC3, AC4, AC5, AC6);
|
||||||
|
printf("%s: B1:=%d B2:=%d\n", __FUNCTION__, B1, B2);
|
||||||
|
printf("%s: MB:=%d MC:=%d MD:=%d\n", __FUNCTION__, MB, MC, MD);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool bmp180_create_communication_queues()
|
||||||
|
{
|
||||||
|
// Just create them once
|
||||||
|
if (bmp180_rx_queue==NULL)
|
||||||
|
{
|
||||||
|
bmp180_rx_queue = xQueueCreate(BMP180_RX_QUEUE_SIZE, sizeof(bmp180_result_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (bmp180_rx_queue!=NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool bmp180_is_avaialble()
|
||||||
|
{
|
||||||
|
return (bmp180_readRegister8(BMP180_VERSION_REG)==BMP180_CHIP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool bmp180_createTask()
|
||||||
|
{
|
||||||
|
// We already have a task
|
||||||
|
portBASE_TYPE x = pdPASS;
|
||||||
|
|
||||||
|
if (bmp180_task_handle==NULL)
|
||||||
|
{
|
||||||
|
x = xTaskCreate(bmp180_driver_task, (signed char *)"bmp180_driver_task", 256, NULL, BMP180_TASK_PRIORITY, &bmp180_task_handle);
|
||||||
|
}
|
||||||
|
return (x==pdPASS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bmp180_meassure(const bmp180_command_t* command)
|
||||||
|
{
|
||||||
|
int32_t T, P;
|
||||||
|
|
||||||
|
// Init result to 0
|
||||||
|
T = P = 0;
|
||||||
|
|
||||||
|
if (command->resultQueue != NULL)
|
||||||
|
{
|
||||||
|
int32_t UT, X1, X2, B5;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Temperature is always needed ... Also required for pressure only
|
||||||
|
//
|
||||||
|
// Calculation taken from BMP180 Datasheet
|
||||||
|
UT = (int32_t)bmp180_getUncompensatedMessurement(BMP180_TEMPERATURE);
|
||||||
|
|
||||||
|
X1 = (UT - (int32_t)AC6) * ((int32_t)AC5) >> 15;
|
||||||
|
X2 = ((int32_t)MC << 11) / (X1 + (int32_t)MD);
|
||||||
|
B5 = X1 + X2;
|
||||||
|
|
||||||
|
T = (B5 + 8) >> 4;
|
||||||
|
|
||||||
|
#ifdef BMP180_DEBUG
|
||||||
|
printf("%s: T:= %ld.%d\n", __FUNCTION__, T/10, abs(T%10));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Do we also need pressure?
|
||||||
|
if (command->cmd & BMP180_PRESSURE)
|
||||||
|
{
|
||||||
|
int32_t X3, B3, B6;
|
||||||
|
uint32_t B4, B7, UP;
|
||||||
|
|
||||||
|
UP = ((uint32_t)bmp180_getUncompensatedMessurement(BMP180_PRESSURE) & 0xFFFF);
|
||||||
|
|
||||||
|
// Calculation taken from BMP180 Datasheet
|
||||||
|
B6 = B5 - 4000;
|
||||||
|
X1 = ((int32_t)B2 * ((B6 * B6) >> 12)) >> 11;
|
||||||
|
X2 = ((int32_t)AC2 * B6) >> 11;
|
||||||
|
X3 = X1 + X2;
|
||||||
|
|
||||||
|
B3 = (((int32_t)AC1 * 4 + X3) + 2) >> 2;
|
||||||
|
X1 = ((int32_t)AC3 * B6) >> 13;
|
||||||
|
X2 = ((int32_t)B1 * ((B6 * B6) >> 12)) >> 16;
|
||||||
|
X3 = ((X1 + X2) + 2) >> 2;
|
||||||
|
B4 = ((uint32_t)AC4 * (uint32_t)(X3 + 32768)) >> 15;
|
||||||
|
B7 = (UP - B3) * (uint32_t)(50000UL);
|
||||||
|
|
||||||
|
if (B7 < 0x80000000)
|
||||||
|
{
|
||||||
|
P = (B7 * 2) / B4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P = (B7 / B4) * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
X1 = (P >> 8) * (P >> 8);
|
||||||
|
X1 = (X1 * 3038) >> 16;
|
||||||
|
X2 = (-7357 * P) >> 16;
|
||||||
|
P = P + ((X1 + X2 + (int32_t)3791) >> 4);
|
||||||
|
|
||||||
|
#ifdef BMP180_DEBUG
|
||||||
|
printf("%s: P:= %ld\n", __FUNCTION__, P);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inform the user ...
|
||||||
|
if (!bmp180_informUser(command->resultQueue, command->cmd, ((bmp180_temp_t)T)/10.0, (bmp180_press_t)P))
|
||||||
|
{
|
||||||
|
// Failed to send info to user
|
||||||
|
printf("%s: Unable to inform user bmp180_informUser returned \"false\"\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default user inform implementation
|
||||||
|
static bool bmp180_informUser_Impl(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure)
|
||||||
|
{
|
||||||
|
bmp180_result_t result;
|
||||||
|
|
||||||
|
result.cmd = cmd;
|
||||||
|
result.temperature = temperature;
|
||||||
|
result.pressure = pressure;
|
||||||
|
|
||||||
|
return (xQueueSend(*resultQueue, &result, 0) == pdTRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just init all needed queues
|
||||||
|
bool bmp180_init(uint8_t scl, uint8_t sda)
|
||||||
|
{
|
||||||
|
// 1. Create required queues
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (bmp180_create_communication_queues())
|
||||||
|
{
|
||||||
|
// 2. Init i2c driver
|
||||||
|
i2c_init(scl, sda);
|
||||||
|
|
||||||
|
// 3. Check for bmp180 ...
|
||||||
|
if (bmp180_is_avaialble())
|
||||||
|
{
|
||||||
|
// 4. Init all internal constants ...
|
||||||
|
bmp180_fillInternalConstants();
|
||||||
|
|
||||||
|
// 5. Start driver task
|
||||||
|
if (bmp180_createTask())
|
||||||
|
{
|
||||||
|
// We are finished
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bmp180_trigger_measurement(const xQueueHandle* resultQueue)
|
||||||
|
{
|
||||||
|
bmp180_command_t c;
|
||||||
|
|
||||||
|
c.cmd = BMP180_PRESSURE + BMP180_TEMPERATURE;
|
||||||
|
c.resultQueue = resultQueue;
|
||||||
|
|
||||||
|
xQueueSend(bmp180_rx_queue, &c, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void bmp180_trigger_pressure_measurement(const xQueueHandle* resultQueue)
|
||||||
|
{
|
||||||
|
bmp180_command_t c;
|
||||||
|
|
||||||
|
c.cmd = BMP180_PRESSURE;
|
||||||
|
c.resultQueue = resultQueue;
|
||||||
|
|
||||||
|
xQueueSend(bmp180_rx_queue, &c, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bmp180_trigger_temperature_measurement(const xQueueHandle* resultQueue)
|
||||||
|
{
|
||||||
|
bmp180_command_t c;
|
||||||
|
|
||||||
|
c.cmd = BMP180_TEMPERATURE;
|
||||||
|
c.resultQueue = resultQueue;
|
||||||
|
|
||||||
|
xQueueSend(bmp180_rx_queue, &c, 0);
|
||||||
|
}
|
||||||
55
extras/bmp180/bmp180.h
Normal file
55
extras/bmp180/bmp180.h
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* bmp180.h
|
||||||
|
*
|
||||||
|
* Created on: 23.08.2015
|
||||||
|
* Author: fbargste
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DRIVER_BMP180_H_
|
||||||
|
#define DRIVER_BMP180_H_
|
||||||
|
|
||||||
|
#include "stdint.h"
|
||||||
|
#include "stdbool.h"
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
// Uncomment to enable debug output
|
||||||
|
//#define BMP180_DEBUG
|
||||||
|
|
||||||
|
#define BMP180_TEMPERATURE (1<<0)
|
||||||
|
#define BMP180_PRESSURE (1<<1)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create bmp180_types
|
||||||
|
//
|
||||||
|
|
||||||
|
// temperature in °C
|
||||||
|
typedef float bmp180_temp_t;
|
||||||
|
// pressure in mPa (To get hPa divide by 100)
|
||||||
|
typedef uint32_t bmp180_press_t;
|
||||||
|
|
||||||
|
// BMP180_Event_Result
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t cmd;
|
||||||
|
bmp180_temp_t temperature;
|
||||||
|
bmp180_press_t pressure;
|
||||||
|
} bmp180_result_t;
|
||||||
|
|
||||||
|
// Init bmp180 driver ...
|
||||||
|
bool bmp180_init(uint8_t scl, uint8_t sda);
|
||||||
|
|
||||||
|
// Trigger a "complete" measurement (temperature and pressure will be valid when given to "bmp180_informUser)
|
||||||
|
void bmp180_trigger_measurement(const xQueueHandle* resultQueue);
|
||||||
|
|
||||||
|
// Trigger a "temperature only" measurement (only temperature will be valid when given to "bmp180_informUser)
|
||||||
|
void bmp180_trigger_temperature_measurement(const xQueueHandle* resultQueue);
|
||||||
|
|
||||||
|
// Trigger a "pressure only" measurement (only pressure will be valid when given to "bmp180_informUser)
|
||||||
|
void bmp180_trigger_pressure_measurement(const xQueueHandle* resultQueue);
|
||||||
|
|
||||||
|
// Give the user the chance to create it's own handler
|
||||||
|
extern bool (*bmp180_informUser)(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure);
|
||||||
|
|
||||||
|
#endif /* DRIVER_BMP180_H_ */
|
||||||
9
extras/bmp180/component.mk
Normal file
9
extras/bmp180/component.mk
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Component makefile for extras/bmp180
|
||||||
|
|
||||||
|
# expected anyone using bmp driver includes it as 'bmp180/bmp180.h'
|
||||||
|
INC_DIRS += $(bmp180_ROOT)..
|
||||||
|
|
||||||
|
# args for passing into compile rule generation
|
||||||
|
bmp180_SRC_DIR = $(bmp180_ROOT)
|
||||||
|
|
||||||
|
$(eval $(call component_compile_rules,bmp180))
|
||||||
8
extras/cpp_support/component.mk
Normal file
8
extras/cpp_support/component.mk
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Component makefile for extras/cpp_support
|
||||||
|
INC_DIRS += $(ROOT)extras/cpp_support/include
|
||||||
|
|
||||||
|
# args for passing into compile rule generation
|
||||||
|
# extras/mqtt-client_INC_DIR = $(ROOT)extras/mqtt-client
|
||||||
|
# extras/mqtt-client_SRC_DIR = $(ROOT)extras/mqtt-client
|
||||||
|
|
||||||
|
# $(eval $(call component_compile_rules,extras/mqtt-client))
|
||||||
102
extras/cpp_support/include/countdown.hpp
Normal file
102
extras/cpp_support/include/countdown.hpp
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* ESP8266 FreeRTOS Firmware
|
||||||
|
* Copyright (c) 2015 Michael Jacobsen (github.com/mikejac)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://github.com/SuperHouse/esp-open-rtos
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ESP_OPEN_RTOS_TIMER_HPP
|
||||||
|
#define ESP_OPEN_RTOS_TIMER_HPP
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
namespace esp_open_rtos {
|
||||||
|
namespace timer {
|
||||||
|
|
||||||
|
#define __millis() (xTaskGetTickCount() * portTICK_RATE_MS)
|
||||||
|
|
||||||
|
/******************************************************************************************************************
|
||||||
|
* countdown_t
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class countdown_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
countdown_t()
|
||||||
|
{
|
||||||
|
interval_end_ms = 0L;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ms
|
||||||
|
*/
|
||||||
|
countdown_t(int ms)
|
||||||
|
{
|
||||||
|
countdown_ms(ms);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool expired()
|
||||||
|
{
|
||||||
|
return (interval_end_ms > 0L) && (__millis() >= interval_end_ms);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ms
|
||||||
|
*/
|
||||||
|
void countdown_ms(unsigned long ms)
|
||||||
|
{
|
||||||
|
interval_end_ms = __millis() + ms;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param seconds
|
||||||
|
*/
|
||||||
|
void countdown(int seconds)
|
||||||
|
{
|
||||||
|
countdown_ms((unsigned long)seconds * 1000L);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int left_ms()
|
||||||
|
{
|
||||||
|
return interval_end_ms - __millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
portTickType interval_end_ms;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace timer {
|
||||||
|
} // namespace esp_open_rtos {
|
||||||
|
|
||||||
|
#endif
|
||||||
113
extras/cpp_support/include/mutex.hpp
Normal file
113
extras/cpp_support/include/mutex.hpp
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* ESP8266 FreeRTOS Firmware
|
||||||
|
* Copyright (c) 2015 Michael Jacobsen (github.com/mikejac)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://github.com/SuperHouse/esp-open-rtos
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ESP_OPEN_RTOS_MUTEX_HPP
|
||||||
|
#define ESP_OPEN_RTOS_MUTEX_HPP
|
||||||
|
|
||||||
|
#include "semphr.h"
|
||||||
|
|
||||||
|
namespace esp_open_rtos {
|
||||||
|
namespace thread {
|
||||||
|
|
||||||
|
/******************************************************************************************************************
|
||||||
|
* class mutex_t
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class mutex_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
inline mutex_t()
|
||||||
|
{
|
||||||
|
mutex = 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline int mutex_create()
|
||||||
|
{
|
||||||
|
mutex = xSemaphoreCreateMutex();
|
||||||
|
|
||||||
|
if(mutex == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
inline void mutex_destroy()
|
||||||
|
{
|
||||||
|
vQueueDelete(mutex);
|
||||||
|
mutex = 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline int lock()
|
||||||
|
{
|
||||||
|
return (xSemaphoreTake(mutex, portMAX_DELAY) == pdTRUE) ? 0 : -1;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ms
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline int try_lock(unsigned long ms)
|
||||||
|
{
|
||||||
|
return (xSemaphoreTake(mutex, ms / portTICK_RATE_MS) == pdTRUE) ? 0 : -1;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline int unlock()
|
||||||
|
{
|
||||||
|
return (xSemaphoreGive(mutex) == pdTRUE) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
xSemaphoreHandle mutex;
|
||||||
|
|
||||||
|
// Disable copy construction and assignment.
|
||||||
|
mutex_t (const mutex_t&);
|
||||||
|
const mutex_t &operator = (const mutex_t&);
|
||||||
|
};
|
||||||
|
|
||||||
|
} //namespace thread {
|
||||||
|
} //namespace esp_open_rtos {
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ESP_OPEN_RTOS_MUTEX_HPP */
|
||||||
|
|
||||||
124
extras/cpp_support/include/queue.hpp
Normal file
124
extras/cpp_support/include/queue.hpp
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* ESP8266 FreeRTOS Firmware
|
||||||
|
* Copyright (c) 2015 Michael Jacobsen (github.com/mikejac)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://github.com/SuperHouse/esp-open-rtos
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ESP_OPEN_RTOS_QUEUE_HPP
|
||||||
|
#define ESP_OPEN_RTOS_QUEUE_HPP
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
namespace esp_open_rtos {
|
||||||
|
namespace thread {
|
||||||
|
|
||||||
|
/******************************************************************************************************************
|
||||||
|
* class queue_t
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template<class Data>
|
||||||
|
class queue_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
inline queue_t()
|
||||||
|
{
|
||||||
|
queue = 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param uxQueueLength
|
||||||
|
* @param uxItemSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline int queue_create(unsigned portBASE_TYPE uxQueueLength)
|
||||||
|
{
|
||||||
|
queue = xQueueCreate(uxQueueLength, sizeof(Data));
|
||||||
|
|
||||||
|
if(queue == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
inline void queue_destroy()
|
||||||
|
{
|
||||||
|
vQueueDelete(queue);
|
||||||
|
queue = 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param ms
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline int post(const Data& data, unsigned long ms = 0)
|
||||||
|
{
|
||||||
|
return (xQueueSend(queue, &data, ms / portTICK_RATE_MS) == pdTRUE) ? 0 : -1;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
* @param ms
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline int receive(Data& data, unsigned long ms = 0)
|
||||||
|
{
|
||||||
|
return (xQueueReceive(queue, &data, ms / portTICK_RATE_MS) == pdTRUE) ? 0 : -1;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param other
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
const queue_t &operator = (const queue_t& other)
|
||||||
|
{
|
||||||
|
if(this != &other) { // protect against invalid self-assignment
|
||||||
|
queue = other.queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
xQueueHandle queue;
|
||||||
|
|
||||||
|
// Disable copy construction.
|
||||||
|
queue_t (const queue_t&);
|
||||||
|
};
|
||||||
|
|
||||||
|
} //namespace thread {
|
||||||
|
} //namespace esp_open_rtos {
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ESP_OPEN_RTOS_QUEUE_HPP */
|
||||||
|
|
||||||
106
extras/cpp_support/include/task.hpp
Normal file
106
extras/cpp_support/include/task.hpp
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* ESP8266 FreeRTOS Firmware
|
||||||
|
* Copyright (c) 2015 Michael Jacobsen (github.com/mikejac)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://github.com/SuperHouse/esp-open-rtos
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ESP_OPEN_RTOS_TASK_HPP
|
||||||
|
#define ESP_OPEN_RTOS_TASK_HPP
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
namespace esp_open_rtos {
|
||||||
|
namespace thread {
|
||||||
|
|
||||||
|
/******************************************************************************************************************
|
||||||
|
* task_t
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class task_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
task_t()
|
||||||
|
{}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pcName
|
||||||
|
* @param usStackDepth
|
||||||
|
* @param uxPriority
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int task_create(const char* const pcName, unsigned short usStackDepth = 256, unsigned portBASE_TYPE uxPriority = 2)
|
||||||
|
{
|
||||||
|
return xTaskCreate(task_t::_task, (signed char *)pcName, usStackDepth, this, uxPriority, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ms
|
||||||
|
*/
|
||||||
|
void sleep(unsigned long ms)
|
||||||
|
{
|
||||||
|
vTaskDelay(ms / portTICK_RATE_MS);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
inline unsigned long millis()
|
||||||
|
{
|
||||||
|
return xTaskGetTickCount() * portTICK_RATE_MS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual void task() = 0;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pvParameters
|
||||||
|
*/
|
||||||
|
static void _task(void* pvParameters)
|
||||||
|
{
|
||||||
|
if(pvParameters != 0) {
|
||||||
|
((task_t*)(pvParameters))->task();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no copy and no = operator
|
||||||
|
task_t(const task_t&);
|
||||||
|
task_t &operator=(const task_t&);
|
||||||
|
};
|
||||||
|
|
||||||
|
} //namespace thread {
|
||||||
|
} //namespace esp_open_rtos {
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ESP_OPEN_RTOS_TASK_HPP */
|
||||||
|
|
||||||
22
extras/i2c/LICENSE
Normal file
22
extras/i2c/LICENSE
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Johan Kanflo
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
40
extras/i2c/README.md
Normal file
40
extras/i2c/README.md
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
# Yet another I2C driver for the ESP8266
|
||||||
|
|
||||||
|
This time a driver for the excellent esp-open-rtos. This is a bit banging I2C driver based on the Wikipedia pesudo C code [1].
|
||||||
|
|
||||||
|
### Adding to your project
|
||||||
|
|
||||||
|
Add the driver to your project as a submodule rather than cloning it:
|
||||||
|
|
||||||
|
````
|
||||||
|
% git submodule add https://github.com/kanflo/esp-open-rtos-driver-i2c.git i2c
|
||||||
|
````
|
||||||
|
The esp-open-rtos makefile-fu will make sure the driver is built.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
|
||||||
|
````
|
||||||
|
#include <i2c.h>
|
||||||
|
|
||||||
|
#define SCL_PIN (0)
|
||||||
|
#define SDA_PIN (2)
|
||||||
|
|
||||||
|
uint8_t slave_addr = 0x20;
|
||||||
|
uint8_t reg_addr = 0x1f;
|
||||||
|
uint8_t reg_data;
|
||||||
|
uint8_t data[] = {reg_addr, 0xc8};
|
||||||
|
|
||||||
|
i2c_init(SCL_PIN, SDA_PIN);
|
||||||
|
|
||||||
|
// Write data to slave
|
||||||
|
bool success = i2c_slave_write(slave_addr, data, sizeof(data));
|
||||||
|
|
||||||
|
// Issue write to slave, sending reg_addr, followed by reading 1 byte
|
||||||
|
success = i2c_slave_read(slave_addr, ®_addr, reg_data, 1);
|
||||||
|
|
||||||
|
````
|
||||||
|
|
||||||
|
The driver is released under the MIT license.
|
||||||
|
|
||||||
|
[1] https://en.wikipedia.org/wiki/I²C#Example_of_bit-banging_the_I.C2.B2C_Master_protocol
|
||||||
10
extras/i2c/component.mk
Normal file
10
extras/i2c/component.mk
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Component makefile for extras/i2c
|
||||||
|
|
||||||
|
# expected anyone using i2c driver includes it as 'i2c/i2c.h'
|
||||||
|
INC_DIRS += $(i2c_ROOT)..
|
||||||
|
|
||||||
|
# args for passing into compile rule generation
|
||||||
|
i2c_INC_DIR =
|
||||||
|
i2c_SRC_DIR = $(i2c_ROOT)
|
||||||
|
|
||||||
|
$(eval $(call component_compile_rules,i2c))
|
||||||
229
extras/i2c/i2c.c
Normal file
229
extras/i2c/i2c.c
Normal file
|
|
@ -0,0 +1,229 @@
|
||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Johan Kanflo (github.com/kanflo)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <esp8266.h>
|
||||||
|
#include <espressif/esp_misc.h> // sdk_os_delay_us
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
|
||||||
|
// I2C driver for ESP8266 written for use with esp-open-rtos
|
||||||
|
// Based on https://en.wikipedia.org/wiki/I²C#Example_of_bit-banging_the_I.C2.B2C_Master_protocol
|
||||||
|
|
||||||
|
// With calling overhead, we end up at ~100kbit/s
|
||||||
|
#define CLK_HALF_PERIOD_US (1)
|
||||||
|
|
||||||
|
#define CLK_STRETCH (10)
|
||||||
|
|
||||||
|
static bool started;
|
||||||
|
static uint8_t g_scl_pin;
|
||||||
|
static uint8_t g_sda_pin;
|
||||||
|
|
||||||
|
void i2c_init(uint8_t scl_pin, uint8_t sda_pin)
|
||||||
|
{
|
||||||
|
started = false;
|
||||||
|
g_scl_pin = scl_pin;
|
||||||
|
g_sda_pin = sda_pin;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void i2c_delay(void)
|
||||||
|
{
|
||||||
|
sdk_os_delay_us(CLK_HALF_PERIOD_US);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set SCL as input and return current level of line, 0 or 1
|
||||||
|
static bool read_scl(void)
|
||||||
|
{
|
||||||
|
gpio_enable(g_scl_pin, GPIO_INPUT);
|
||||||
|
return gpio_read(g_scl_pin); // Clock high, valid ACK
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set SDA as input and return current level of line, 0 or 1
|
||||||
|
static bool read_sda(void)
|
||||||
|
{
|
||||||
|
gpio_enable(g_sda_pin, GPIO_INPUT);
|
||||||
|
// TODO: Without this delay we get arbitration lost in i2c_stop
|
||||||
|
i2c_delay();
|
||||||
|
return gpio_read(g_sda_pin); // Clock high, valid ACK
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actively drive SCL signal low
|
||||||
|
static void clear_scl(void)
|
||||||
|
{
|
||||||
|
gpio_enable(g_scl_pin, GPIO_OUTPUT);
|
||||||
|
gpio_write(g_scl_pin, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actively drive SDA signal low
|
||||||
|
static void clear_sda(void)
|
||||||
|
{
|
||||||
|
gpio_enable(g_sda_pin, GPIO_OUTPUT);
|
||||||
|
gpio_write(g_sda_pin, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output start condition
|
||||||
|
void i2c_start(void)
|
||||||
|
{
|
||||||
|
uint32_t clk_stretch = CLK_STRETCH;
|
||||||
|
if (started) { // if started, do a restart cond
|
||||||
|
// Set SDA to 1
|
||||||
|
(void) read_sda();
|
||||||
|
i2c_delay();
|
||||||
|
while (read_scl() == 0 && clk_stretch--) ;
|
||||||
|
// Repeated start setup time, minimum 4.7us
|
||||||
|
i2c_delay();
|
||||||
|
}
|
||||||
|
if (read_sda() == 0) {
|
||||||
|
printf("I2C: arbitration lost in i2c_start\n");
|
||||||
|
}
|
||||||
|
// SCL is high, set SDA from 1 to 0.
|
||||||
|
clear_sda();
|
||||||
|
i2c_delay();
|
||||||
|
clear_scl();
|
||||||
|
started = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output stop condition
|
||||||
|
void i2c_stop(void)
|
||||||
|
{
|
||||||
|
uint32_t clk_stretch = CLK_STRETCH;
|
||||||
|
// Set SDA to 0
|
||||||
|
clear_sda();
|
||||||
|
i2c_delay();
|
||||||
|
// Clock stretching
|
||||||
|
while (read_scl() == 0 && clk_stretch--) ;
|
||||||
|
// Stop bit setup time, minimum 4us
|
||||||
|
i2c_delay();
|
||||||
|
// SCL is high, set SDA from 0 to 1
|
||||||
|
if (read_sda() == 0) {
|
||||||
|
printf("I2C: arbitration lost in i2c_stop\n");
|
||||||
|
}
|
||||||
|
i2c_delay();
|
||||||
|
started = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write a bit to I2C bus
|
||||||
|
static void i2c_write_bit(bool bit)
|
||||||
|
{
|
||||||
|
uint32_t clk_stretch = CLK_STRETCH;
|
||||||
|
if (bit) {
|
||||||
|
(void) read_sda();
|
||||||
|
} else {
|
||||||
|
clear_sda();
|
||||||
|
}
|
||||||
|
i2c_delay();
|
||||||
|
// Clock stretching
|
||||||
|
while (read_scl() == 0 && clk_stretch--) ;
|
||||||
|
// SCL is high, now data is valid
|
||||||
|
// If SDA is high, check that nobody else is driving SDA
|
||||||
|
if (bit && read_sda() == 0) {
|
||||||
|
printf("I2C: arbitration lost in i2c_write_bit\n");
|
||||||
|
}
|
||||||
|
i2c_delay();
|
||||||
|
clear_scl();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read a bit from I2C bus
|
||||||
|
static bool i2c_read_bit(void)
|
||||||
|
{
|
||||||
|
uint32_t clk_stretch = CLK_STRETCH;
|
||||||
|
bool bit;
|
||||||
|
// Let the slave drive data
|
||||||
|
(void) read_sda();
|
||||||
|
i2c_delay();
|
||||||
|
// Clock stretching
|
||||||
|
while (read_scl() == 0 && clk_stretch--) ;
|
||||||
|
// SCL is high, now data is valid
|
||||||
|
bit = read_sda();
|
||||||
|
i2c_delay();
|
||||||
|
clear_scl();
|
||||||
|
return bit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool i2c_write(uint8_t byte)
|
||||||
|
{
|
||||||
|
bool nack;
|
||||||
|
uint8_t bit;
|
||||||
|
for (bit = 0; bit < 8; bit++) {
|
||||||
|
i2c_write_bit((byte & 0x80) != 0);
|
||||||
|
byte <<= 1;
|
||||||
|
}
|
||||||
|
nack = i2c_read_bit();
|
||||||
|
return !nack;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_read(bool ack)
|
||||||
|
{
|
||||||
|
uint8_t byte = 0;
|
||||||
|
uint8_t bit;
|
||||||
|
for (bit = 0; bit < 8; bit++) {
|
||||||
|
byte = (byte << 1) | i2c_read_bit();
|
||||||
|
}
|
||||||
|
i2c_write_bit(ack);
|
||||||
|
return byte;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool i2c_slave_write(uint8_t slave_addr, uint8_t *data, uint8_t len)
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
do {
|
||||||
|
i2c_start();
|
||||||
|
if (!i2c_write(slave_addr << 1))
|
||||||
|
break;
|
||||||
|
while (len--) {
|
||||||
|
if (!i2c_write(*data++))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i2c_stop();
|
||||||
|
success = true;
|
||||||
|
} while(0);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool i2c_slave_read(uint8_t slave_addr, uint8_t data, uint8_t *buf, uint32_t len)
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
do {
|
||||||
|
i2c_start();
|
||||||
|
if (!i2c_write(slave_addr << 1)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i2c_write(data);
|
||||||
|
i2c_stop();
|
||||||
|
i2c_start();
|
||||||
|
if (!i2c_write(slave_addr << 1 | 1)) { // Slave address + read
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while(len) {
|
||||||
|
*buf = i2c_read(len == 1);
|
||||||
|
buf++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
success = true;
|
||||||
|
} while(0);
|
||||||
|
i2c_stop();
|
||||||
|
if (!success) {
|
||||||
|
printf("I2C: write error\n");
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
51
extras/i2c/i2c.h
Normal file
51
extras/i2c/i2c.h
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Johan Kanflo (github.com/kanflo)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __I2C_H__
|
||||||
|
#define __I2C_H__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
// Init bitbanging I2C driver on given pins
|
||||||
|
void i2c_init(uint8_t scl_pin, uint8_t sda_pin);
|
||||||
|
|
||||||
|
// Write a byte to I2C bus. Return true if slave acked.
|
||||||
|
bool i2c_write(uint8_t byte);
|
||||||
|
|
||||||
|
// Read a byte from I2C bus. Return true if slave acked.
|
||||||
|
uint8_t i2c_read(bool ack);
|
||||||
|
|
||||||
|
// Write 'len' bytes from 'buf' to slave. Return true if slave acked.
|
||||||
|
bool i2c_slave_write(uint8_t slave_addr, uint8_t *buf, uint8_t len);
|
||||||
|
|
||||||
|
// Issue a read operation and send 'data', followed by reading 'len' bytes
|
||||||
|
// from slave into 'buf'. Return true if slave acked.
|
||||||
|
bool i2c_slave_read(uint8_t slave_addr, uint8_t data, uint8_t *buf, uint32_t len);
|
||||||
|
|
||||||
|
// Send start and stop conditions. Only needed when implementing protocols for
|
||||||
|
// devices where the i2c_slave_[read|write] functions above are of no use.
|
||||||
|
void i2c_start(void);
|
||||||
|
void i2c_stop(void);
|
||||||
56
extras/mbedtls/component.mk
Normal file
56
extras/mbedtls/component.mk
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Component makefile for mbedtls
|
||||||
|
|
||||||
|
# mbedtls by default builds into 3 libraries not one. We just use one for now (doesn't make a huge difference when static linking)
|
||||||
|
|
||||||
|
# Config:
|
||||||
|
# We supply our own hand tweaked mbedtls/config.h in our 'include' dir, the rest of upstream mbedtls is not changed.
|
||||||
|
|
||||||
|
MBEDTLS_DIR = $(mbedtls_ROOT)mbedtls/
|
||||||
|
INC_DIRS += $(mbedtls_ROOT)include $(MBEDTLS_DIR)include
|
||||||
|
|
||||||
|
# these OBJS_xxx variables are copied directly from mbedtls/mbedtls/Makefile,
|
||||||
|
# minus a few values (noted in comments)
|
||||||
|
#
|
||||||
|
# If updating to a future mbedtls version you can just copy these in.
|
||||||
|
OBJS_CRYPTO= aes.o aesni.o arc4.o \
|
||||||
|
asn1parse.o asn1write.o base64.o \
|
||||||
|
bignum.o blowfish.o camellia.o \
|
||||||
|
ccm.o cipher.o cipher_wrap.o \
|
||||||
|
ctr_drbg.o des.o dhm.o \
|
||||||
|
ecdh.o ecdsa.o ecp.o \
|
||||||
|
ecp_curves.o entropy.o entropy_poll.o \
|
||||||
|
error.o gcm.o havege.o \
|
||||||
|
hmac_drbg.o md.o md2.o \
|
||||||
|
md4.o md5.o md_wrap.o \
|
||||||
|
memory_buffer_alloc.o oid.o \
|
||||||
|
padlock.o pem.o pk.o \
|
||||||
|
pk_wrap.o pkcs12.o pkcs5.o \
|
||||||
|
pkparse.o pkwrite.o platform.o \
|
||||||
|
ripemd160.o rsa.o sha1.o \
|
||||||
|
sha256.o sha512.o threading.o \
|
||||||
|
timing.o version.o \
|
||||||
|
version_features.o xtea.o
|
||||||
|
# minus net.o
|
||||||
|
|
||||||
|
OBJS_X509= certs.o pkcs11.o x509.o \
|
||||||
|
x509_create.o x509_crl.o x509_crt.o \
|
||||||
|
x509_csr.o x509write_crt.o x509write_csr.o
|
||||||
|
|
||||||
|
OBJS_TLS= debug.o ssl_cache.o \
|
||||||
|
ssl_ciphersuites.o ssl_cli.o \
|
||||||
|
ssl_cookie.o ssl_srv.o ssl_ticket.o \
|
||||||
|
ssl_tls.o
|
||||||
|
|
||||||
|
# args for passing into compile rule generation
|
||||||
|
mbedtls_INC_DIR =
|
||||||
|
mbedtls_SRC_DIR = $(mbedtls_ROOT)
|
||||||
|
mbedtls_EXTRA_SRC_FILES = $(patsubst %.o,$(MBEDTLS_DIR)library/%.c,$(OBJS_CRYPTO) $(OBJS_X509) $(OBJS_TLS))
|
||||||
|
|
||||||
|
# depending on cipher configuration, some mbedTLS variables are unused
|
||||||
|
mbedtls_CFLAGS = -Wno-error=unused-but-set-variable -Wno-error=unused-variable $(CFLAGS)
|
||||||
|
|
||||||
|
$(eval $(call component_compile_rules,mbedtls))
|
||||||
|
|
||||||
|
# Helpful error if git submodule not initialised
|
||||||
|
$(MBEDTLS_DIR):
|
||||||
|
$(error "mbedtls git submodule not installed. Please run 'git submodule update --init'")
|
||||||
22
extras/mbedtls/hardware_entropy.c
Normal file
22
extras/mbedtls/hardware_entropy.c
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* ESP8266 "Hardware RNG" (validity still being confirmed) support for ESP8266
|
||||||
|
*
|
||||||
|
* Based on research done by @foogod.
|
||||||
|
*
|
||||||
|
* Please don't rely on this too much as an entropy source, quite yet...
|
||||||
|
*
|
||||||
|
* Part of esp-open-rtos
|
||||||
|
* Copyright (C) 2015 Angus Gratton
|
||||||
|
* BSD Licensed as described in the file LICENSE
|
||||||
|
*/
|
||||||
|
#include <mbedtls/entropy_poll.h>
|
||||||
|
#include <esp/hwrand.h>
|
||||||
|
|
||||||
|
int mbedtls_hardware_poll( void *data,
|
||||||
|
unsigned char *output, size_t len, size_t *olen )
|
||||||
|
{
|
||||||
|
(void)(data);
|
||||||
|
hwrand_fill(output, len);
|
||||||
|
if(olen)
|
||||||
|
*olen = len;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
2446
extras/mbedtls/include/mbedtls/config.h
Normal file
2446
extras/mbedtls/include/mbedtls/config.h
Normal file
File diff suppressed because it is too large
Load diff
1
extras/mbedtls/mbedtls
Submodule
1
extras/mbedtls/mbedtls
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 0a0c22e0efcf2f8f71d7e16712f80b8f77326f72
|
||||||
510
extras/mbedtls/net_lwip.c
Normal file
510
extras/mbedtls/net_lwip.c
Normal file
|
|
@ -0,0 +1,510 @@
|
||||||
|
/*
|
||||||
|
* TCP/IP or UDP/IP networking functions
|
||||||
|
* modified for LWIP support on ESP8266
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||||
|
* Additions Copyright (C) 2015 Angus Gratton
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||||
|
#include "mbedtls/config.h"
|
||||||
|
#else
|
||||||
|
#include MBEDTLS_CONFIG_FILE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_NET_C)
|
||||||
|
|
||||||
|
#include "mbedtls/net.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prepare for using the sockets interface
|
||||||
|
*/
|
||||||
|
static int net_prepare( void )
|
||||||
|
{
|
||||||
|
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||||
|
!defined(EFI32)
|
||||||
|
WSADATA wsaData;
|
||||||
|
|
||||||
|
if( wsa_init_done == 0 )
|
||||||
|
{
|
||||||
|
if( WSAStartup( MAKEWORD(2,0), &wsaData ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_NET_SOCKET_FAILED );
|
||||||
|
|
||||||
|
wsa_init_done = 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize a context
|
||||||
|
*/
|
||||||
|
void mbedtls_net_init( mbedtls_net_context *ctx )
|
||||||
|
{
|
||||||
|
ctx->fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initiate a TCP connection with host:port and the given protocol
|
||||||
|
*/
|
||||||
|
int mbedtls_net_connect( mbedtls_net_context *ctx, const char *host, const char *port, int proto )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct addrinfo hints, *addr_list, *cur;
|
||||||
|
|
||||||
|
if( ( ret = net_prepare() ) != 0 )
|
||||||
|
return( ret );
|
||||||
|
|
||||||
|
/* Do name resolution with both IPv6 and IPv4 */
|
||||||
|
memset( &hints, 0, sizeof( hints ) );
|
||||||
|
hints.ai_family = AF_UNSPEC;
|
||||||
|
hints.ai_socktype = proto == MBEDTLS_NET_PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM;
|
||||||
|
hints.ai_protocol = proto == MBEDTLS_NET_PROTO_UDP ? IPPROTO_UDP : IPPROTO_TCP;
|
||||||
|
|
||||||
|
if( getaddrinfo( host, port, &hints, &addr_list ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_NET_UNKNOWN_HOST );
|
||||||
|
|
||||||
|
/* Try the sockaddrs until a connection succeeds */
|
||||||
|
ret = MBEDTLS_ERR_NET_UNKNOWN_HOST;
|
||||||
|
for( cur = addr_list; cur != NULL; cur = cur->ai_next )
|
||||||
|
{
|
||||||
|
ctx->fd = (int) socket( cur->ai_family, cur->ai_socktype,
|
||||||
|
cur->ai_protocol );
|
||||||
|
if( ctx->fd < 0 )
|
||||||
|
{
|
||||||
|
ret = MBEDTLS_ERR_NET_SOCKET_FAILED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( connect( ctx->fd, cur->ai_addr, cur->ai_addrlen ) == 0 )
|
||||||
|
{
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
close( ctx->fd );
|
||||||
|
ret = MBEDTLS_ERR_NET_CONNECT_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
freeaddrinfo( addr_list );
|
||||||
|
|
||||||
|
return( ret );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a listening socket on bind_ip:port
|
||||||
|
*/
|
||||||
|
int mbedtls_net_bind( mbedtls_net_context *ctx, const char *bind_ip, const char *port, int proto )
|
||||||
|
{
|
||||||
|
int n, ret;
|
||||||
|
struct addrinfo hints, *addr_list, *cur;
|
||||||
|
|
||||||
|
if( ( ret = net_prepare() ) != 0 )
|
||||||
|
return( ret );
|
||||||
|
|
||||||
|
/* Bind to IPv6 and/or IPv4, but only in the desired protocol */
|
||||||
|
memset( &hints, 0, sizeof( hints ) );
|
||||||
|
hints.ai_family = AF_UNSPEC;
|
||||||
|
hints.ai_socktype = proto == MBEDTLS_NET_PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM;
|
||||||
|
hints.ai_protocol = proto == MBEDTLS_NET_PROTO_UDP ? IPPROTO_UDP : IPPROTO_TCP;
|
||||||
|
|
||||||
|
if( getaddrinfo( bind_ip, port, &hints, &addr_list ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_NET_UNKNOWN_HOST );
|
||||||
|
|
||||||
|
/* Try the sockaddrs until a binding succeeds */
|
||||||
|
ret = MBEDTLS_ERR_NET_UNKNOWN_HOST;
|
||||||
|
for( cur = addr_list; cur != NULL; cur = cur->ai_next )
|
||||||
|
{
|
||||||
|
ctx->fd = (int) socket( cur->ai_family, cur->ai_socktype,
|
||||||
|
cur->ai_protocol );
|
||||||
|
if( ctx->fd < 0 )
|
||||||
|
{
|
||||||
|
ret = MBEDTLS_ERR_NET_SOCKET_FAILED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = 1;
|
||||||
|
if( setsockopt( ctx->fd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
|
(const char *) &n, sizeof( n ) ) != 0 )
|
||||||
|
{
|
||||||
|
close( ctx->fd );
|
||||||
|
ret = MBEDTLS_ERR_NET_SOCKET_FAILED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bind( ctx->fd, cur->ai_addr, cur->ai_addrlen ) != 0 )
|
||||||
|
{
|
||||||
|
close( ctx->fd );
|
||||||
|
ret = MBEDTLS_ERR_NET_BIND_FAILED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Listen only makes sense for TCP */
|
||||||
|
if( proto == MBEDTLS_NET_PROTO_TCP )
|
||||||
|
{
|
||||||
|
if( listen( ctx->fd, MBEDTLS_NET_LISTEN_BACKLOG ) != 0 )
|
||||||
|
{
|
||||||
|
close( ctx->fd );
|
||||||
|
ret = MBEDTLS_ERR_NET_LISTEN_FAILED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* I we ever get there, it's a success */
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
freeaddrinfo( addr_list );
|
||||||
|
|
||||||
|
return( ret );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||||
|
!defined(EFI32)
|
||||||
|
/*
|
||||||
|
* Check if the requested operation would be blocking on a non-blocking socket
|
||||||
|
* and thus 'failed' with a negative return value.
|
||||||
|
*/
|
||||||
|
static int net_would_block( const mbedtls_net_context *ctx )
|
||||||
|
{
|
||||||
|
((void) ctx);
|
||||||
|
return( WSAGetLastError() == WSAEWOULDBLOCK );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Check if the requested operation would be blocking on a non-blocking socket
|
||||||
|
* and thus 'failed' with a negative return value.
|
||||||
|
*
|
||||||
|
* Note: on a blocking socket this function always returns 0!
|
||||||
|
*/
|
||||||
|
static int net_would_block( const mbedtls_net_context *ctx )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Never return 'WOULD BLOCK' on a non-blocking socket
|
||||||
|
*/
|
||||||
|
if( ( fcntl( ctx->fd, F_GETFL, 0) & O_NONBLOCK ) != O_NONBLOCK )
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
|
switch( errno )
|
||||||
|
{
|
||||||
|
#if defined EAGAIN
|
||||||
|
case EAGAIN:
|
||||||
|
#endif
|
||||||
|
#if defined EWOULDBLOCK && EWOULDBLOCK != EAGAIN
|
||||||
|
case EWOULDBLOCK:
|
||||||
|
#endif
|
||||||
|
return( 1 );
|
||||||
|
}
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
#endif /* ( _WIN32 || _WIN32_WCE ) && !EFIX64 && !EFI32 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Accept a connection from a remote client
|
||||||
|
*/
|
||||||
|
int mbedtls_net_accept( mbedtls_net_context *bind_ctx,
|
||||||
|
mbedtls_net_context *client_ctx,
|
||||||
|
void *client_ip, size_t buf_size, size_t *ip_len )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
int type;
|
||||||
|
|
||||||
|
struct sockaddr_in client_addr;
|
||||||
|
|
||||||
|
socklen_t n = (socklen_t) sizeof( client_addr );
|
||||||
|
socklen_t type_len = (socklen_t) sizeof( type );
|
||||||
|
|
||||||
|
/* Is this a TCP or UDP socket? */
|
||||||
|
if( getsockopt( bind_ctx->fd, SOL_SOCKET, SO_TYPE,
|
||||||
|
(void *) &type, (socklen_t *) &type_len ) != 0 ||
|
||||||
|
( type != SOCK_STREAM && type != SOCK_DGRAM ) )
|
||||||
|
{
|
||||||
|
return( MBEDTLS_ERR_NET_ACCEPT_FAILED );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( type == SOCK_STREAM )
|
||||||
|
{
|
||||||
|
/* TCP: actual accept() */
|
||||||
|
ret = client_ctx->fd = (int) accept( bind_ctx->fd,
|
||||||
|
(struct sockaddr *) &client_addr, &n );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* UDP: wait for a message, but keep it in the queue */
|
||||||
|
char buf[1] = { 0 };
|
||||||
|
|
||||||
|
ret = recvfrom( bind_ctx->fd, buf, sizeof( buf ), MSG_PEEK,
|
||||||
|
(struct sockaddr *) &client_addr, &n );
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
if( ret == SOCKET_ERROR &&
|
||||||
|
WSAGetLastError() == WSAEMSGSIZE )
|
||||||
|
{
|
||||||
|
/* We know buf is too small, thanks, just peeking here */
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ret < 0 )
|
||||||
|
{
|
||||||
|
if( net_would_block( bind_ctx ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_SSL_WANT_READ );
|
||||||
|
|
||||||
|
return( MBEDTLS_ERR_NET_ACCEPT_FAILED );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* UDP: hijack the listening socket to communicate with the client,
|
||||||
|
* then bind a new socket to accept new connections */
|
||||||
|
if( type != SOCK_STREAM )
|
||||||
|
{
|
||||||
|
struct sockaddr_in local_addr;
|
||||||
|
int one = 1;
|
||||||
|
|
||||||
|
if( connect( bind_ctx->fd, (struct sockaddr *) &client_addr, n ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_NET_ACCEPT_FAILED );
|
||||||
|
|
||||||
|
client_ctx->fd = bind_ctx->fd;
|
||||||
|
bind_ctx->fd = -1; /* In case we exit early */
|
||||||
|
|
||||||
|
n = sizeof( struct sockaddr_in );
|
||||||
|
if( getsockname( client_ctx->fd,
|
||||||
|
(struct sockaddr *) &local_addr, &n ) != 0 ||
|
||||||
|
( bind_ctx->fd = (int) socket( AF_INET,
|
||||||
|
SOCK_DGRAM, IPPROTO_UDP ) ) < 0 ||
|
||||||
|
setsockopt( bind_ctx->fd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
|
(const char *) &one, sizeof( one ) ) != 0 )
|
||||||
|
{
|
||||||
|
return( MBEDTLS_ERR_NET_SOCKET_FAILED );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bind( bind_ctx->fd, (struct sockaddr *) &local_addr, n ) != 0 )
|
||||||
|
{
|
||||||
|
return( MBEDTLS_ERR_NET_BIND_FAILED );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( client_ip != NULL )
|
||||||
|
{
|
||||||
|
struct sockaddr_in *addr4 = (struct sockaddr_in *) &client_addr;
|
||||||
|
*ip_len = sizeof( addr4->sin_addr.s_addr );
|
||||||
|
|
||||||
|
if( buf_size < *ip_len )
|
||||||
|
return( MBEDTLS_ERR_NET_BUFFER_TOO_SMALL );
|
||||||
|
|
||||||
|
memcpy( client_ip, &addr4->sin_addr.s_addr, *ip_len );
|
||||||
|
}
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the socket blocking or non-blocking
|
||||||
|
*/
|
||||||
|
int mbedtls_net_set_block( mbedtls_net_context *ctx )
|
||||||
|
{
|
||||||
|
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||||
|
!defined(EFI32)
|
||||||
|
u_long n = 0;
|
||||||
|
return( ioctlsocket( ctx->fd, FIONBIO, &n ) );
|
||||||
|
#else
|
||||||
|
return( fcntl( ctx->fd, F_SETFL, fcntl( ctx->fd, F_GETFL, 0 ) & ~O_NONBLOCK ) );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int mbedtls_net_set_nonblock( mbedtls_net_context *ctx )
|
||||||
|
{
|
||||||
|
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||||
|
!defined(EFI32)
|
||||||
|
u_long n = 1;
|
||||||
|
return( ioctlsocket( ctx->fd, FIONBIO, &n ) );
|
||||||
|
#else
|
||||||
|
return( fcntl( ctx->fd, F_SETFL, fcntl( ctx->fd, F_GETFL, 0 ) | O_NONBLOCK ) );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Portable usleep helper
|
||||||
|
*/
|
||||||
|
void mbedtls_net_usleep( unsigned long usec )
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
Sleep( ( usec + 999 ) / 1000 );
|
||||||
|
#else
|
||||||
|
struct timeval tv;
|
||||||
|
tv.tv_sec = usec / 1000000;
|
||||||
|
#if defined(__unix__) || defined(__unix) || \
|
||||||
|
( defined(__APPLE__) && defined(__MACH__) )
|
||||||
|
tv.tv_usec = (suseconds_t) usec % 1000000;
|
||||||
|
#else
|
||||||
|
tv.tv_usec = usec % 1000000;
|
||||||
|
#endif
|
||||||
|
select( 0, NULL, NULL, NULL, &tv );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read at most 'len' characters
|
||||||
|
*/
|
||||||
|
int mbedtls_net_recv( void *ctx, unsigned char *buf, size_t len )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
int fd = ((mbedtls_net_context *) ctx)->fd;
|
||||||
|
|
||||||
|
if( fd < 0 )
|
||||||
|
return( MBEDTLS_ERR_NET_INVALID_CONTEXT );
|
||||||
|
|
||||||
|
ret = (int) read( fd, buf, len );
|
||||||
|
|
||||||
|
if( ret < 0 )
|
||||||
|
{
|
||||||
|
if( net_would_block( ctx ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_SSL_WANT_READ );
|
||||||
|
|
||||||
|
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||||
|
!defined(EFI32)
|
||||||
|
if( WSAGetLastError() == WSAECONNRESET )
|
||||||
|
return( MBEDTLS_ERR_NET_CONN_RESET );
|
||||||
|
#else
|
||||||
|
if( errno == EPIPE || errno == ECONNRESET )
|
||||||
|
return( MBEDTLS_ERR_NET_CONN_RESET );
|
||||||
|
|
||||||
|
if( errno == EINTR )
|
||||||
|
return( MBEDTLS_ERR_SSL_WANT_READ );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return( MBEDTLS_ERR_NET_RECV_FAILED );
|
||||||
|
}
|
||||||
|
|
||||||
|
return( ret );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read at most 'len' characters, blocking for at most 'timeout' ms
|
||||||
|
*/
|
||||||
|
int mbedtls_net_recv_timeout( void *ctx, unsigned char *buf, size_t len,
|
||||||
|
uint32_t timeout )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct timeval tv;
|
||||||
|
fd_set read_fds;
|
||||||
|
int fd = ((mbedtls_net_context *) ctx)->fd;
|
||||||
|
|
||||||
|
if( fd < 0 )
|
||||||
|
return( MBEDTLS_ERR_NET_INVALID_CONTEXT );
|
||||||
|
|
||||||
|
FD_ZERO( &read_fds );
|
||||||
|
FD_SET( fd, &read_fds );
|
||||||
|
|
||||||
|
tv.tv_sec = timeout / 1000;
|
||||||
|
tv.tv_usec = ( timeout % 1000 ) * 1000;
|
||||||
|
|
||||||
|
ret = select( fd + 1, &read_fds, NULL, NULL, timeout == 0 ? NULL : &tv );
|
||||||
|
|
||||||
|
/* Zero fds ready means we timed out */
|
||||||
|
if( ret == 0 )
|
||||||
|
return( MBEDTLS_ERR_SSL_TIMEOUT );
|
||||||
|
|
||||||
|
if( ret < 0 )
|
||||||
|
{
|
||||||
|
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||||
|
!defined(EFI32)
|
||||||
|
if( WSAGetLastError() == WSAEINTR )
|
||||||
|
return( MBEDTLS_ERR_SSL_WANT_READ );
|
||||||
|
#else
|
||||||
|
if( errno == EINTR )
|
||||||
|
return( MBEDTLS_ERR_SSL_WANT_READ );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return( MBEDTLS_ERR_NET_RECV_FAILED );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This call will not block */
|
||||||
|
return( mbedtls_net_recv( ctx, buf, len ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write at most 'len' characters
|
||||||
|
*/
|
||||||
|
int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
int fd = ((mbedtls_net_context *) ctx)->fd;
|
||||||
|
|
||||||
|
if( fd < 0 )
|
||||||
|
return( MBEDTLS_ERR_NET_INVALID_CONTEXT );
|
||||||
|
|
||||||
|
ret = (int) write( fd, buf, len );
|
||||||
|
|
||||||
|
if( ret < 0 )
|
||||||
|
{
|
||||||
|
if( net_would_block( ctx ) != 0 )
|
||||||
|
return( MBEDTLS_ERR_SSL_WANT_WRITE );
|
||||||
|
|
||||||
|
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||||
|
!defined(EFI32)
|
||||||
|
if( WSAGetLastError() == WSAECONNRESET )
|
||||||
|
return( MBEDTLS_ERR_NET_CONN_RESET );
|
||||||
|
#else
|
||||||
|
if( errno == EPIPE || errno == ECONNRESET )
|
||||||
|
return( MBEDTLS_ERR_NET_CONN_RESET );
|
||||||
|
|
||||||
|
if( errno == EINTR )
|
||||||
|
return( MBEDTLS_ERR_SSL_WANT_WRITE );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return( MBEDTLS_ERR_NET_SEND_FAILED );
|
||||||
|
}
|
||||||
|
|
||||||
|
return( ret );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gracefully close the connection
|
||||||
|
*/
|
||||||
|
void mbedtls_net_free( mbedtls_net_context *ctx )
|
||||||
|
{
|
||||||
|
if( ctx->fd == -1 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
shutdown( ctx->fd, 2 );
|
||||||
|
close( ctx->fd );
|
||||||
|
|
||||||
|
ctx->fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_NET_C */
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
# Component makefile for extras/rboot-ota
|
# Component makefile for extras/rboot-ota
|
||||||
|
|
||||||
INC_DIRS += $(ROOT)extras/rboot-ota
|
INC_DIRS += $(rboot-ota_ROOT)
|
||||||
|
|
||||||
# args for passing into compile rule generation
|
# args for passing into compile rule generation
|
||||||
extras/rboot-ota_INC_DIR = $(ROOT)extras/rboot-ota
|
rboot-ota_SRC_DIR = $(rboot-ota_ROOT)
|
||||||
extras/rboot-ota_SRC_DIR = $(ROOT)extras/rboot-ota
|
|
||||||
|
$(eval $(call component_compile_rules,rboot-ota))
|
||||||
|
|
||||||
$(eval $(call component_compile_rules,extras/rboot-ota))
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
#ifndef __ESP8266_H__
|
#ifndef __ESP8266_H__
|
||||||
#define __ESP8266_H__
|
#define __ESP8266_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ets_sys.h"
|
#include "ets_sys.h"
|
||||||
#include "eagle_soc.h"
|
#include "eagle_soc.h"
|
||||||
#include "gpio_register.h"
|
#include "gpio_register.h"
|
||||||
|
|
@ -14,5 +18,9 @@
|
||||||
#include "timer_register.h"
|
#include "timer_register.h"
|
||||||
#include "uart_register.h"
|
#include "uart_register.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
#include "lwip/ip_addr.h"
|
#include "lwip/ip_addr.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||||
|
|
||||||
|
|
@ -23,4 +27,8 @@ void sdk_os_delay_us(uint16_t us);
|
||||||
void sdk_os_install_putc1(void (*p)(char c));
|
void sdk_os_install_putc1(void (*p)(char c));
|
||||||
void sdk_os_putc(char c);
|
void sdk_os_putc(char c);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
#ifndef __ESP_SOFTAP_H__
|
#ifndef __ESP_SOFTAP_H__
|
||||||
#define __ESP_SOFTAP_H__
|
#define __ESP_SOFTAP_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sdk_softap_config {
|
struct sdk_softap_config {
|
||||||
uint8_t ssid[32];
|
uint8_t ssid[32];
|
||||||
uint8_t password[64];
|
uint8_t password[64];
|
||||||
|
|
@ -20,4 +24,8 @@ struct sdk_softap_config {
|
||||||
bool sdk_wifi_softap_get_config(struct sdk_softap_config *config);
|
bool sdk_wifi_softap_get_config(struct sdk_softap_config *config);
|
||||||
bool sdk_wifi_softap_set_config(struct sdk_softap_config *config);
|
bool sdk_wifi_softap_set_config(struct sdk_softap_config *config);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sdk_station_config {
|
struct sdk_station_config {
|
||||||
uint8_t ssid[32];
|
uint8_t ssid[32];
|
||||||
uint8_t password[64];
|
uint8_t password[64];
|
||||||
|
|
@ -68,4 +72,8 @@ enum {
|
||||||
|
|
||||||
uint8_t sdk_wifi_station_get_connect_status(void);
|
uint8_t sdk_wifi_station_get_connect_status(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
#ifndef __ESP_SYSTEM_H__
|
#ifndef __ESP_SYSTEM_H__
|
||||||
#define __ESP_SYSTEM_H__
|
#define __ESP_SYSTEM_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
enum sdk_rst_reason {
|
enum sdk_rst_reason {
|
||||||
DEFAULT_RST = 0,
|
DEFAULT_RST = 0,
|
||||||
WDT_RST = 1,
|
WDT_RST = 1,
|
||||||
|
|
@ -54,4 +58,8 @@ bool sdk_system_rtc_mem_write(uint8_t dst, const void *src, uint16_t n);
|
||||||
|
|
||||||
void sdk_system_uart_swap(void);
|
void sdk_system_uart_swap(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
#ifndef __ESP_TIMER_H__
|
#ifndef __ESP_TIMER_H__
|
||||||
#define __ESP_TIMER_H__
|
#define __ESP_TIMER_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* timer related */
|
/* timer related */
|
||||||
typedef void sdk_os_timer_func_t(void *timer_arg);
|
typedef void sdk_os_timer_func_t(void *timer_arg);
|
||||||
|
|
||||||
|
|
@ -19,4 +23,8 @@ typedef struct _os_timer_t {
|
||||||
void *timer_arg;
|
void *timer_arg;
|
||||||
} sdk_os_timer_t;
|
} sdk_os_timer_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@
|
||||||
|
|
||||||
#include <lwip/ip_addr.h>
|
#include <lwip/ip_addr.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NULL_MODE = 0,
|
NULL_MODE = 0,
|
||||||
STATION_MODE,
|
STATION_MODE,
|
||||||
|
|
@ -67,7 +71,11 @@ enum sdk_phy_mode {
|
||||||
PHY_MODE_11N = 3
|
PHY_MODE_11N = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum phy_mode sdk_wifi_get_phy_mode(void);
|
enum sdk_phy_mode sdk_wifi_get_phy_mode(void);
|
||||||
bool sdk_wifi_set_phy_mode(enum sdk_phy_mode mode);
|
bool sdk_wifi_set_phy_mode(enum sdk_phy_mode mode);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@
|
||||||
#define SDK_PRIVATE_H
|
#define SDK_PRIVATE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ip_addr;
|
struct ip_addr;
|
||||||
|
|
||||||
/*********************************************
|
/*********************************************
|
||||||
|
|
@ -49,4 +54,8 @@ void sdk_system_station_got_ip_set(struct ip_addr *ip_addr, struct ip_addr *sn_m
|
||||||
*/
|
*/
|
||||||
void sdk_system_pp_recycle_rx_pkt(void *eb);
|
void sdk_system_pp_recycle_rx_pkt(void *eb);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
#ifndef __SPI_FLASH_H__
|
#ifndef __SPI_FLASH_H__
|
||||||
#define __SPI_FLASH_H__
|
#define __SPI_FLASH_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SPI_FLASH_RESULT_OK,
|
SPI_FLASH_RESULT_OK,
|
||||||
SPI_FLASH_RESULT_ERR,
|
SPI_FLASH_RESULT_ERR,
|
||||||
|
|
@ -21,6 +25,7 @@ sdk_SpiFlashOpResult sdk_spi_flash_erase_sector(uint16_t sec);
|
||||||
sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, uint32_t *src_addr, uint32_t size);
|
sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, uint32_t *src_addr, uint32_t size);
|
||||||
sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size);
|
sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size);
|
||||||
|
|
||||||
|
|
||||||
/* SDK uses this structure internally to account for flash size.
|
/* SDK uses this structure internally to account for flash size.
|
||||||
|
|
||||||
chip_size field is initialised during startup from the flash size
|
chip_size field is initialised during startup from the flash size
|
||||||
|
|
@ -42,4 +47,9 @@ typedef struct {
|
||||||
|
|
||||||
extern sdk_flashchip_t sdk_flashchip;
|
extern sdk_flashchip_t sdk_flashchip;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ ets_printf = printf;
|
||||||
*/
|
*/
|
||||||
#ifndef OTA
|
#ifndef OTA
|
||||||
|
|
||||||
#define IROM0_START 0x40240000
|
#define IROM0_START 0x40220000
|
||||||
|
|
||||||
/* Non-OTA sizes */
|
/* Non-OTA sizes */
|
||||||
#if FLASH_SIZE == 2 /* 256kB */
|
#if FLASH_SIZE == 2 /* 256kB */
|
||||||
|
|
@ -136,6 +136,68 @@ SECTIONS
|
||||||
_dport0_data_end = ABSOLUTE(.);
|
_dport0_data_end = ABSOLUTE(.);
|
||||||
} >dport0_0_seg :dport0_0_phdr
|
} >dport0_0_seg :dport0_0_phdr
|
||||||
|
|
||||||
|
.text : ALIGN(4) /* IRAM */
|
||||||
|
{
|
||||||
|
_stext = .;
|
||||||
|
_text_start = ABSOLUTE(.);
|
||||||
|
. = ALIGN (16);
|
||||||
|
*(.vecbase.text)
|
||||||
|
*(.entry.text)
|
||||||
|
*(.init.literal)
|
||||||
|
*(.init)
|
||||||
|
/* esp-open-rtos compiled source files use the .iram1.* section names for IRAM
|
||||||
|
functions, etc. */
|
||||||
|
*(.iram1.*)
|
||||||
|
/* SDK libraries expect their .text sections to link to iram, not irom */
|
||||||
|
*sdklib*:*(.literal .text .literal.* .text.*)
|
||||||
|
/* libgcc integer functions also need to be in .text, as some are called before
|
||||||
|
flash is mapped (also performance)
|
||||||
|
*/
|
||||||
|
*libgcc.a:*i3.o(.literal .text .literal.* .text.*)
|
||||||
|
|
||||||
|
/* libc also in IRAM */
|
||||||
|
*libc.a:*malloc.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*mallocr.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*freer.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*memcpy.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*memset.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*memcmp.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*memmove.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*rand.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*bzero.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*lock.o(.literal .text .literal.* .text.*)
|
||||||
|
|
||||||
|
*libc.a:*printf.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*findfp.o(.literal .text .literal.* .text.*)
|
||||||
|
*libc.a:*fputwc.o(.literal .text .literal.* .text.*)
|
||||||
|
|
||||||
|
/* xthal_set_intset() called from PendSV in NMI context */
|
||||||
|
*libhal.a:*set_intset.o(.literal .text .literal.* .text.*)
|
||||||
|
|
||||||
|
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||||
|
*(.fini.literal)
|
||||||
|
*(.fini)
|
||||||
|
*(.gnu.version)
|
||||||
|
_text_end = ABSOLUTE(.);
|
||||||
|
_etext = .;
|
||||||
|
} >iram1_0_seg :iram1_0_phdr
|
||||||
|
|
||||||
|
.irom0.text : ALIGN(4)
|
||||||
|
{
|
||||||
|
_irom0_text_start = ABSOLUTE(.);
|
||||||
|
/* esp-open-rtos compiled code goes into IROM by default
|
||||||
|
(except for libgcc which is matched above.)
|
||||||
|
*/
|
||||||
|
*(.literal .text .literal.* .text.*)
|
||||||
|
/* mbedtls rodata */
|
||||||
|
*mbedtls.a:*.o(.rodata.* .rodata)
|
||||||
|
/* actual certificate in example (TEMPORARY HACK) */
|
||||||
|
*:cert.o(.rodata.* .rodata)
|
||||||
|
/* Anything explicitly marked as "irom" or "irom0" should go here */
|
||||||
|
*(.irom.* .irom.*.* .irom0.*)
|
||||||
|
_irom0_text_end = ABSOLUTE(.);
|
||||||
|
} >irom0_0_seg :irom0_0_phdr
|
||||||
|
|
||||||
.data : ALIGN(4)
|
.data : ALIGN(4)
|
||||||
{
|
{
|
||||||
_data_start = ABSOLUTE(.);
|
_data_start = ABSOLUTE(.);
|
||||||
|
|
@ -166,11 +228,14 @@ SECTIONS
|
||||||
*(.gnu.linkonce.e.*)
|
*(.gnu.linkonce.e.*)
|
||||||
*(.gnu.version_r)
|
*(.gnu.version_r)
|
||||||
*(.eh_frame)
|
*(.eh_frame)
|
||||||
|
. = (. + 3) & ~ 3;
|
||||||
/* C++ constructor and destructor tables, properly ordered: */
|
/* C++ constructor and destructor tables, properly ordered: */
|
||||||
|
__init_array_start = ABSOLUTE(.);
|
||||||
KEEP (*crtbegin.o(.ctors))
|
KEEP (*crtbegin.o(.ctors))
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||||
KEEP (*(SORT(.ctors.*)))
|
KEEP (*(SORT(.ctors.*)))
|
||||||
KEEP (*(.ctors))
|
KEEP (*(.ctors))
|
||||||
|
__init_array_end = ABSOLUTE(.);
|
||||||
KEEP (*crtbegin.o(.dtors))
|
KEEP (*crtbegin.o(.dtors))
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||||
KEEP (*(SORT(.dtors.*)))
|
KEEP (*(SORT(.dtors.*)))
|
||||||
|
|
@ -215,62 +280,6 @@ SECTIONS
|
||||||
} >dram0_0_seg :dram0_0_bss_phdr
|
} >dram0_0_seg :dram0_0_bss_phdr
|
||||||
/* __stack = 0x3ffc8000; */
|
/* __stack = 0x3ffc8000; */
|
||||||
|
|
||||||
.text : ALIGN(4) /* IRAM */
|
|
||||||
{
|
|
||||||
_stext = .;
|
|
||||||
_text_start = ABSOLUTE(.);
|
|
||||||
. = ALIGN (16);
|
|
||||||
*(.vecbase.text)
|
|
||||||
*(.entry.text)
|
|
||||||
*(.init.literal)
|
|
||||||
*(.init)
|
|
||||||
/* esp-open-rtos compiled source files use the .iram1.* section names for IRAM
|
|
||||||
functions, etc. */
|
|
||||||
*(.iram1.*)
|
|
||||||
/* SDK libraries expect their .text sections to link to iram, not irom */
|
|
||||||
*sdklib*:*(.literal .text .literal.* .text.*)
|
|
||||||
/* libgcc integer functions also need to be in .text, as some are called before
|
|
||||||
flash is mapped (also performance)
|
|
||||||
*/
|
|
||||||
*libgcc.a:*i3.o(.literal .text .literal.* .text.*)
|
|
||||||
|
|
||||||
/* libc also in IRAM */
|
|
||||||
*libc.a:*malloc.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*mallocr.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*freer.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*memcpy.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*memset.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*memcmp.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*rand.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*bzero.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*lock.o(.literal .text .literal.* .text.*)
|
|
||||||
|
|
||||||
*libc.a:*printf.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*findfp.o(.literal .text .literal.* .text.*)
|
|
||||||
*libc.a:*fputwc.o(.literal .text .literal.* .text.*)
|
|
||||||
|
|
||||||
/* xthal_set_intset() called from PendSV in NMI context */
|
|
||||||
*libhal.a:*set_intset.o(.literal .text .literal.* .text.*)
|
|
||||||
|
|
||||||
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
|
||||||
*(.fini.literal)
|
|
||||||
*(.fini)
|
|
||||||
*(.gnu.version)
|
|
||||||
_text_end = ABSOLUTE(.);
|
|
||||||
_etext = .;
|
|
||||||
} >iram1_0_seg :iram1_0_phdr
|
|
||||||
|
|
||||||
.irom0.text : ALIGN(4)
|
|
||||||
{
|
|
||||||
_irom0_text_start = ABSOLUTE(.);
|
|
||||||
/* esp-open-rtos compiled code goes into IROM by default
|
|
||||||
(except for libgcc which is matched above.)
|
|
||||||
*/
|
|
||||||
*(.literal .text .literal.* .text.*)
|
|
||||||
/* SDK libraries expect ICACHE_FLASH_ATTR/etc functions to be loaded explicitly as IROM */
|
|
||||||
*sdklib*:*(.irom.* .irom.*.* .irom0.*)
|
|
||||||
_irom0_text_end = ABSOLUTE(.);
|
|
||||||
} >irom0_0_seg :irom0_0_phdr
|
|
||||||
|
|
||||||
.lit4 : ALIGN(4)
|
.lit4 : ALIGN(4)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
835
lib/allsymbols.rename
Normal file
835
lib/allsymbols.rename
Normal file
|
|
@ -0,0 +1,835 @@
|
||||||
|
aes_decrypt_deinit sdk_aes_decrypt_deinit
|
||||||
|
aes_decrypt_init sdk_aes_decrypt_init
|
||||||
|
aes_decrypt sdk_aes_decrypt
|
||||||
|
aes_encrypt_deinit sdk_aes_encrypt_deinit
|
||||||
|
aes_encrypt_init sdk_aes_encrypt_init
|
||||||
|
aes_encrypt sdk_aes_encrypt
|
||||||
|
aes_unwrap sdk_aes_unwrap
|
||||||
|
aes_wrap sdk_aes_wrap
|
||||||
|
ant_switch_init sdk_ant_switch_init
|
||||||
|
auth_type sdk_auth_type
|
||||||
|
bb_init sdk_bb_init
|
||||||
|
bbpll_cal_flag sdk_bbpll_cal_flag
|
||||||
|
bbpll_cal sdk_bbpll_cal
|
||||||
|
cal_rf_ana_gain sdk_cal_rf_ana_gain
|
||||||
|
cannel_scan_connect_state sdk_cannel_scan_connect_state
|
||||||
|
ccmp sdk_ccmp
|
||||||
|
change_bbpll160 sdk_change_bbpll160
|
||||||
|
change_bbpll160_sleep sdk_change_bbpll160_sleep
|
||||||
|
check_data_flag sdk_check_data_flag
|
||||||
|
check_data_func sdk_check_data_func
|
||||||
|
check_result sdk_check_result
|
||||||
|
chip_60_set_channel sdk_chip_60_set_channel
|
||||||
|
chip6_phy_init_ctrl sdk_chip6_phy_init_ctrl
|
||||||
|
chip6_sleep_params sdk_chip6_sleep_params
|
||||||
|
chip_v6_get_sense sdk_chip_v6_get_sense
|
||||||
|
chip_v6_initialize_bb sdk_chip_v6_initialize_bb
|
||||||
|
chip_v6_rf_init sdk_chip_v6_rf_init
|
||||||
|
chip_v6_rxmax_ext_ana sdk_chip_v6_rxmax_ext_ana
|
||||||
|
chip_v6_rxmax_ext_dig sdk_chip_v6_rxmax_ext_dig
|
||||||
|
chip_v6_rxmax_ext sdk_chip_v6_rxmax_ext
|
||||||
|
chip_v6_set_chanfreq sdk_chip_v6_set_chanfreq
|
||||||
|
chip_v6_set_chan_misc sdk_chip_v6_set_chan_misc
|
||||||
|
chip_v6_set_chan_offset sdk_chip_v6_set_chan_offset
|
||||||
|
chip_v6_set_chan_rx_cmp sdk_chip_v6_set_chan_rx_cmp
|
||||||
|
chip_v6_set_chan sdk_chip_v6_set_chan
|
||||||
|
chip_v6_set_chan_wakeup sdk_chip_v6_set_chan_wakeup
|
||||||
|
chip_v6_set_sense sdk_chip_v6_set_sense
|
||||||
|
chip_v6_unset_chanfreq sdk_chip_v6_unset_chanfreq
|
||||||
|
chip_version sdk_chip_version
|
||||||
|
chm_acquire_lock sdk_chm_acquire_lock
|
||||||
|
chm_cancel_op sdk_chm_cancel_op
|
||||||
|
chm_check_same_channel sdk_chm_check_same_channel
|
||||||
|
chm_end_op sdk_chm_end_op
|
||||||
|
chm_freq2index sdk_chm_freq2index
|
||||||
|
chm_get_current_channel sdk_chm_get_current_channel
|
||||||
|
chm_init sdk_chm_init
|
||||||
|
chm_release_lock sdk_chm_release_lock
|
||||||
|
chm_return_home_channel sdk_chm_return_home_channel
|
||||||
|
chm_set_current_channel sdk_chm_set_current_channel
|
||||||
|
chm_start_op sdk_chm_start_op
|
||||||
|
clockgate_watchdog sdk_clockgate_watchdog
|
||||||
|
cnx_add_rc sdk_cnx_add_rc
|
||||||
|
cnx_attach sdk_cnx_attach
|
||||||
|
cnx_bss_alloc sdk_cnx_bss_alloc
|
||||||
|
cnx_connect_timeout sdk_cnx_connect_timeout
|
||||||
|
cnx_node_alloc sdk_cnx_node_alloc
|
||||||
|
cnx_node_join sdk_cnx_node_join
|
||||||
|
cnx_node_leave sdk_cnx_node_leave
|
||||||
|
cnx_node_remove sdk_cnx_node_remove
|
||||||
|
cnx_node_search sdk_cnx_node_search
|
||||||
|
cnx_rc_search sdk_cnx_rc_search
|
||||||
|
cnx_rc_update_age sdk_cnx_rc_update_age
|
||||||
|
cnx_rc_update_rssi sdk_cnx_rc_update_rssi
|
||||||
|
cnx_rc_update_state_metric sdk_cnx_rc_update_state_metric
|
||||||
|
cnx_remove_rc sdk_cnx_remove_rc
|
||||||
|
cnx_sta_associated sdk_cnx_sta_associated
|
||||||
|
cnx_sta_connect_cmd sdk_cnx_sta_connect_cmd
|
||||||
|
cnx_sta_connect_led_timer_cb sdk_cnx_sta_connect_led_timer_cb
|
||||||
|
cnx_sta_leave sdk_cnx_sta_leave
|
||||||
|
cnx_start_handoff_cb sdk_cnx_start_handoff_cb
|
||||||
|
cnx_sta_scan_cmd sdk_cnx_sta_scan_cmd
|
||||||
|
cnx_update_bss_more sdk_cnx_update_bss_more
|
||||||
|
cnx_update_bss sdk_cnx_update_bss
|
||||||
|
correct_rf_ana_gain sdk_correct_rf_ana_gain
|
||||||
|
cpu_overclock sdk_cpu_overclock
|
||||||
|
data_collect sdk_data_collect
|
||||||
|
dbg_stop_hw_wdt sdk_dbg_stop_hw_wdt
|
||||||
|
dbg_stop_sw_wdt sdk_dbg_stop_sw_wdt
|
||||||
|
dcoindex2txbbgain sdk_dcoindex2txbbgain
|
||||||
|
debug_timerfn sdk_debug_timerfn
|
||||||
|
debug_timer sdk_debug_timer
|
||||||
|
deep_sleep_en sdk_deep_sleep_en
|
||||||
|
dhcp_bind_check sdk_dhcp_bind_check
|
||||||
|
dhcpc_flag sdk_dhcpc_flag
|
||||||
|
do_noisefloor_lsleep_v50 sdk_do_noisefloor_lsleep_v50
|
||||||
|
do_noisefloor sdk_do_noisefloor
|
||||||
|
do_pwctrl_flag sdk_do_pwctrl_flag
|
||||||
|
dpd_db2linear sdk_dpd_db2linear
|
||||||
|
dpd_index sdk_dpd_index
|
||||||
|
dpd_init sdk_dpd_init
|
||||||
|
dpd_mem_write sdk_dpd_mem_write
|
||||||
|
dpd_scale_set sdk_dpd_scale_set
|
||||||
|
eagle_auth_done sdk_eagle_auth_done
|
||||||
|
eapol_txcb sdk_eapol_txcb
|
||||||
|
eloop_cancel_timeout sdk_eloop_cancel_timeout
|
||||||
|
eloop_register_timeout sdk_eloop_register_timeout
|
||||||
|
esf_buf_alloc sdk_esf_buf_alloc
|
||||||
|
esf_buf_recycle sdk_esf_buf_recycle
|
||||||
|
esf_buf_setup sdk_esf_buf_setup
|
||||||
|
esf_rx_buf_alloc sdk_esf_rx_buf_alloc
|
||||||
|
ets_delay_us sdk_ets_delay_us
|
||||||
|
ets_timer_arm_ms_us sdk_ets_timer_arm_ms_us
|
||||||
|
ets_timer_arm sdk_ets_timer_arm
|
||||||
|
ets_timer_arm_us sdk_ets_timer_arm_us
|
||||||
|
ets_timer_disarm sdk_ets_timer_disarm
|
||||||
|
ets_timer_done sdk_ets_timer_done
|
||||||
|
ets_timer_handler_isr sdk_ets_timer_handler_isr
|
||||||
|
ets_timer_init sdk_ets_timer_init
|
||||||
|
ets_timer_setfn sdk_ets_timer_setfn
|
||||||
|
ets_update_cpu_frequency sdk_ets_update_cpu_frequency
|
||||||
|
flashchip sdk_flashchip
|
||||||
|
g_cnx_probe_rc_list_cb sdk_g_cnx_probe_rc_list_cb
|
||||||
|
gen_rx_gain_table sdk_gen_rx_gain_table
|
||||||
|
GetAccess sdk_GetAccess
|
||||||
|
get_check_flag sdk_get_check_flag
|
||||||
|
get_chip_version sdk_get_chip_version
|
||||||
|
get_fcc_1m2m_pwr_offset sdk_get_fcc_1m2m_pwr_offset
|
||||||
|
get_noisefloor_sat sdk_get_noisefloor_sat
|
||||||
|
get_pwctrl_correct sdk_get_pwctrl_correct
|
||||||
|
get_rf_gain_qdb sdk_get_rf_gain_qdb
|
||||||
|
get_sar_dout sdk_get_sar_dout
|
||||||
|
get_target_power_offset sdk_get_target_power_offset
|
||||||
|
g_ic sdk_g_ic
|
||||||
|
g_phyFuns_instance sdk_g_phyFuns_instance
|
||||||
|
g_phyFuns sdk_g_phyFuns
|
||||||
|
gpio_output_set sdk_gpio_output_set
|
||||||
|
gScanStruct sdk_gScanStruct
|
||||||
|
hardware_reject sdk_hardware_reject
|
||||||
|
hex2byte sdk_hex2byte
|
||||||
|
hexstr2bin sdk_hexstr2bin
|
||||||
|
hmac_md5 sdk_hmac_md5
|
||||||
|
hmac_md5_vector sdk_hmac_md5_vector
|
||||||
|
hmac_sha1 sdk_hmac_sha1
|
||||||
|
hmac_sha1_vector sdk_hmac_sha1_vector
|
||||||
|
hostapd_config_defaults_bss sdk_hostapd_config_defaults_bss
|
||||||
|
hostapd_config_defaults sdk_hostapd_config_defaults
|
||||||
|
hostapd_get_psk sdk_hostapd_get_psk
|
||||||
|
hostapd_mac_comp_empty sdk_hostapd_mac_comp_empty
|
||||||
|
hostapd_mac_comp sdk_hostapd_mac_comp
|
||||||
|
hostapd_maclist_found sdk_hostapd_maclist_found
|
||||||
|
hostapd_rate_found sdk_hostapd_rate_found
|
||||||
|
hostapd_setup_wpa_psk sdk_hostapd_setup_wpa_psk
|
||||||
|
hostapd_wep_key_cmp sdk_hostapd_wep_key_cmp
|
||||||
|
hostap_handle_timer sdk_hostap_handle_timer
|
||||||
|
hostap_input sdk_hostap_input
|
||||||
|
ic_bss_info_update sdk_ic_bss_info_update
|
||||||
|
ic_disable_interface sdk_ic_disable_interface
|
||||||
|
ic_enable_interface sdk_ic_enable_interface
|
||||||
|
ic_get_addr sdk_ic_get_addr
|
||||||
|
ic_get_gtk_alg sdk_ic_get_gtk_alg
|
||||||
|
ic_get_ptk_alg sdk_ic_get_ptk_alg
|
||||||
|
ic_interface_enabled sdk_ic_interface_enabled
|
||||||
|
ic_interface_is_p2p sdk_ic_interface_is_p2p
|
||||||
|
ic_is_pure_sta sdk_ic_is_pure_sta
|
||||||
|
ic_remove_key sdk_ic_remove_key
|
||||||
|
ic_set_gtk_alg sdk_ic_set_gtk_alg
|
||||||
|
ic_set_key sdk_ic_set_key
|
||||||
|
ic_set_opmode sdk_ic_set_opmode
|
||||||
|
ic_set_ptk_alg sdk_ic_set_ptk_alg
|
||||||
|
ic_set_sta sdk_ic_set_sta
|
||||||
|
ic_set_vif sdk_ic_set_vif
|
||||||
|
ieee80211_addbasicrates sdk_ieee80211_addbasicrates
|
||||||
|
ieee80211_add_htcap sdk_ieee80211_add_htcap
|
||||||
|
ieee80211_add_htcap_vendor sdk_ieee80211_add_htcap_vendor
|
||||||
|
ieee80211_add_htinfo sdk_ieee80211_add_htinfo
|
||||||
|
ieee80211_add_htinfo_vendor sdk_ieee80211_add_htinfo_vendor
|
||||||
|
ieee80211_add_rates sdk_ieee80211_add_rates
|
||||||
|
ieee80211_addr_bcast sdk_ieee80211_addr_bcast
|
||||||
|
ieee80211_add_xrates sdk_ieee80211_add_xrates
|
||||||
|
ieee80211_alloc_challenge sdk_ieee80211_alloc_challenge
|
||||||
|
ieee80211_alloc_proberesp sdk_ieee80211_alloc_proberesp
|
||||||
|
ieee80211_beacon_alloc sdk_ieee80211_beacon_alloc
|
||||||
|
ieee80211_chan2ieee sdk_ieee80211_chan2ieee
|
||||||
|
ieee80211_compute_duration sdk_ieee80211_compute_duration
|
||||||
|
ieee80211_crypto_attach sdk_ieee80211_crypto_attach
|
||||||
|
ieee80211_crypto_available sdk_ieee80211_crypto_available
|
||||||
|
ieee80211_crypto_decap sdk_ieee80211_crypto_decap
|
||||||
|
ieee80211_crypto_encap sdk_ieee80211_crypto_encap
|
||||||
|
ieee80211_crypto_setkey sdk_ieee80211_crypto_setkey
|
||||||
|
ieee80211_decap sdk_ieee80211_decap
|
||||||
|
ieee80211_deliver_data sdk_ieee80211_deliver_data
|
||||||
|
ieee80211_dot11Rate_rix sdk_ieee80211_dot11Rate_rix
|
||||||
|
ieee80211_find_channel_byieee sdk_ieee80211_find_channel_byieee
|
||||||
|
ieee80211_find_channel sdk_ieee80211_find_channel
|
||||||
|
ieee80211_get_11g_ratetable sdk_ieee80211_get_11g_ratetable
|
||||||
|
ieee80211_getcapinfo sdk_ieee80211_getcapinfo
|
||||||
|
ieee80211_getmgtframe sdk_ieee80211_getmgtframe
|
||||||
|
ieee80211_get_ratetable sdk_ieee80211_get_ratetable
|
||||||
|
ieee80211_hostap_attach sdk_ieee80211_hostap_attach
|
||||||
|
ieee80211_ht_attach sdk_ieee80211_ht_attach
|
||||||
|
ieee80211_ht_node_cleanup sdk_ieee80211_ht_node_cleanup
|
||||||
|
ieee80211_ht_node_init sdk_ieee80211_ht_node_init
|
||||||
|
ieee80211_ht_updateparams sdk_ieee80211_ht_updateparams
|
||||||
|
ieee80211_ieee2mhz sdk_ieee80211_ieee2mhz
|
||||||
|
ieee80211_ifattach sdk_ieee80211_ifattach
|
||||||
|
ieee80211_iserp_rateset sdk_ieee80211_iserp_rateset
|
||||||
|
ieee80211_mgmt_output sdk_ieee80211_mgmt_output
|
||||||
|
ieee80211_mhz2ieee sdk_ieee80211_mhz2ieee
|
||||||
|
ieee80211_mlme_connect_bss sdk_ieee80211_mlme_connect_bss
|
||||||
|
ieee80211_node_pwrsave sdk_ieee80211_node_pwrsave
|
||||||
|
ieee80211_opcap sdk_ieee80211_opcap
|
||||||
|
ieee80211_output_pbuf sdk_ieee80211_output_pbuf
|
||||||
|
ieee80211_parse_action sdk_ieee80211_parse_action
|
||||||
|
ieee80211_parse_beacon sdk_ieee80211_parse_beacon
|
||||||
|
ieee80211_parse_htcap sdk_ieee80211_parse_htcap
|
||||||
|
ieee80211_parse_rsn sdk_ieee80211_parse_rsn
|
||||||
|
ieee80211_parse_wmeparams sdk_ieee80211_parse_wmeparams
|
||||||
|
ieee80211_parse_wpa sdk_ieee80211_parse_wpa
|
||||||
|
ieee80211_phy_init sdk_ieee80211_phy_init
|
||||||
|
ieee80211_phy_type_get sdk_ieee80211_phy_type_get
|
||||||
|
ieee80211_proto_attach sdk_ieee80211_proto_attach
|
||||||
|
ieee80211_psq_cleanup sdk_ieee80211_psq_cleanup
|
||||||
|
ieee80211_psq_init sdk_ieee80211_psq_init
|
||||||
|
ieee80211_pwrsave sdk_ieee80211_pwrsave
|
||||||
|
ieee80211_recv_action_register sdk_ieee80211_recv_action_register
|
||||||
|
ieee80211_recv_action sdk_ieee80211_recv_action
|
||||||
|
ieee80211_recv_action_unregister sdk_ieee80211_recv_action_unregister
|
||||||
|
ieee80211_scan_attach sdk_ieee80211_scan_attach
|
||||||
|
ieee80211_send_action_register sdk_ieee80211_send_action_register
|
||||||
|
ieee80211_send_action sdk_ieee80211_send_action
|
||||||
|
ieee80211_send_action_unregister sdk_ieee80211_send_action_unregister
|
||||||
|
ieee80211_send_mgmt sdk_ieee80211_send_mgmt
|
||||||
|
ieee80211_send_nulldata sdk_ieee80211_send_nulldata
|
||||||
|
ieee80211_send_probereq sdk_ieee80211_send_probereq
|
||||||
|
ieee80211_send_proberesp sdk_ieee80211_send_proberesp
|
||||||
|
ieee80211_send_setup sdk_ieee80211_send_setup
|
||||||
|
ieee80211_setbasicrates sdk_ieee80211_setbasicrates
|
||||||
|
ieee80211_set_shortslottime sdk_ieee80211_set_shortslottime
|
||||||
|
ieee80211_set_tim sdk_ieee80211_set_tim
|
||||||
|
ieee80211_setup_basic_htrates sdk_ieee80211_setup_basic_htrates
|
||||||
|
ieee80211_setup_htrates sdk_ieee80211_setup_htrates
|
||||||
|
ieee80211_setup_rateset sdk_ieee80211_setup_rateset
|
||||||
|
ieee80211_setup_rates sdk_ieee80211_setup_rates
|
||||||
|
ieee80211_setup_ratetable sdk_ieee80211_setup_ratetable
|
||||||
|
ieee80211_sta_new_state sdk_ieee80211_sta_new_state
|
||||||
|
ieee80211_tx_mgt_cb sdk_ieee80211_tx_mgt_cb
|
||||||
|
ieee80211_wme_initparams sdk_ieee80211_wme_initparams
|
||||||
|
ieee80211_wme_updateparams sdk_ieee80211_wme_updateparams
|
||||||
|
ieee802_1x_receive sdk_ieee802_1x_receive
|
||||||
|
if_ctrl sdk_if_ctrl
|
||||||
|
inc_byte_array sdk_inc_byte_array
|
||||||
|
info sdk_info
|
||||||
|
init_cal_dcoffset sdk_init_cal_dcoffset
|
||||||
|
interface_mask sdk_interface_mask
|
||||||
|
lmacConfMib sdk_lmacConfMib
|
||||||
|
lmacDiscardAgedMSDU sdk_lmacDiscardAgedMSDU
|
||||||
|
lmacInitAc sdk_lmacInitAc
|
||||||
|
lmacInit sdk_lmacInit
|
||||||
|
lmacIsActive sdk_lmacIsActive
|
||||||
|
lmacIsIdle sdk_lmacIsIdle
|
||||||
|
lmacMSDUAged sdk_lmacMSDUAged
|
||||||
|
lmacProcessAckTimeout sdk_lmacProcessAckTimeout
|
||||||
|
lmacProcessCollision sdk_lmacProcessCollision
|
||||||
|
lmacProcessCollisions sdk_lmacProcessCollisions
|
||||||
|
lmacProcessCtsTimeout sdk_lmacProcessCtsTimeout
|
||||||
|
lmacProcessRtsStart sdk_lmacProcessRtsStart
|
||||||
|
lmacProcessTxError sdk_lmacProcessTxError
|
||||||
|
lmacProcessTxRtsError sdk_lmacProcessTxRtsError
|
||||||
|
lmacProcessTXStartData sdk_lmacProcessTXStartData
|
||||||
|
lmacProcessTxSuccess sdk_lmacProcessTxSuccess
|
||||||
|
lmacRecycleMPDU sdk_lmacRecycleMPDU
|
||||||
|
lmacRxDone sdk_lmacRxDone
|
||||||
|
lmacSetAcParam sdk_lmacSetAcParam
|
||||||
|
lmacTxFrame sdk_lmacTxFrame
|
||||||
|
loop_pwctrl_correct_atten_high_power sdk_loop_pwctrl_correct_atten_high_power
|
||||||
|
loop_pwctrl_pwdet_error_accum_high_power sdk_loop_pwctrl_pwdet_error_accum_high_power
|
||||||
|
low_power_set sdk_low_power_set
|
||||||
|
MacIsrSigPostDefHdl sdk_MacIsrSigPostDefHdl
|
||||||
|
MD5Final sdk_MD5Final
|
||||||
|
MD5Init sdk_MD5Init
|
||||||
|
MD5Update sdk_MD5Update
|
||||||
|
md5_vector sdk_md5_vector
|
||||||
|
meas_tone_pwr_db sdk_meas_tone_pwr_db
|
||||||
|
NMIIrqIsOn sdk_NMIIrqIsOn
|
||||||
|
noise_array sdk_noise_array
|
||||||
|
noise_check_loop sdk_noise_check_loop
|
||||||
|
noise_init sdk_noise_init
|
||||||
|
NoiseTimerInterval sdk_NoiseTimerInterval
|
||||||
|
operation_test sdk_operation_test
|
||||||
|
os_delay_us sdk_os_delay_us
|
||||||
|
os_get_cpu_frequency sdk_os_get_cpu_frequency
|
||||||
|
os_get_time sdk_os_get_time
|
||||||
|
os_install_putc1 sdk_os_install_putc1
|
||||||
|
os_putc sdk_os_putc
|
||||||
|
os_timer_arm sdk_os_timer_arm
|
||||||
|
os_timer_disarm sdk_os_timer_disarm
|
||||||
|
os_timer_setfn sdk_os_timer_setfn
|
||||||
|
os_update_cpu_frequency sdk_os_update_cpu_frequency
|
||||||
|
pbkdf2_sha1 sdk_pbkdf2_sha1
|
||||||
|
pbus_set_rxbbgain sdk_pbus_set_rxbbgain
|
||||||
|
pend_flag_noise_check sdk_pend_flag_noise_check
|
||||||
|
pend_flag_periodic_cal sdk_pend_flag_periodic_cal
|
||||||
|
PendFreeBcnEb sdk_PendFreeBcnEb
|
||||||
|
periodic_cal_dc_num sdk_periodic_cal_dc_num
|
||||||
|
periodic_cal_flag sdk_periodic_cal_flag
|
||||||
|
periodic_cal_sat sdk_periodic_cal_sat
|
||||||
|
periodic_cal sdk_periodic_cal
|
||||||
|
periodic_cal_top sdk_periodic_cal_top
|
||||||
|
phy_bb_rx_cfg sdk_phy_bb_rx_cfg
|
||||||
|
phy_change_channel sdk_phy_change_channel
|
||||||
|
phy_delete_channel sdk_phy_delete_channel
|
||||||
|
phy_dig_spur_prot sdk_phy_dig_spur_prot
|
||||||
|
phy_dig_spur_set sdk_phy_dig_spur_set
|
||||||
|
phy_disable_agc sdk_phy_disable_agc
|
||||||
|
phy_enable_agc sdk_phy_enable_agc
|
||||||
|
phy_freq_offset sdk_phy_freq_offset
|
||||||
|
phy_get_mactime sdk_phy_get_mactime
|
||||||
|
phy_get_romfuncs sdk_phy_get_romfuncs
|
||||||
|
phy_gpio_cfg sdk_phy_gpio_cfg
|
||||||
|
phy_initialize_bb sdk_phy_initialize_bb
|
||||||
|
phy_init sdk_phy_init
|
||||||
|
phy_pbus_soc_cfg sdk_phy_pbus_soc_cfg
|
||||||
|
phy_set_sense sdk_phy_set_sense
|
||||||
|
pm_allow_tx sdk_pm_allow_tx
|
||||||
|
pm_assoc_parse sdk_pm_assoc_parse
|
||||||
|
pm_attach sdk_pm_attach
|
||||||
|
pm_check_mac_idle sdk_pm_check_mac_idle
|
||||||
|
pm_enable_gpio_wakeup sdk_pm_enable_gpio_wakeup
|
||||||
|
pm_force_scan_unlock sdk_pm_force_scan_unlock
|
||||||
|
pm_get_idle_wait_time sdk_pm_get_idle_wait_time
|
||||||
|
pm_get_sleep_type sdk_pm_get_sleep_type
|
||||||
|
pm_goto_sleep sdk_pm_goto_sleep
|
||||||
|
pm_idle_sleep sdk_pm_idle_sleep
|
||||||
|
pm_is_open sdk_pm_is_open
|
||||||
|
pm_is_waked sdk_pm_is_waked
|
||||||
|
pm_onBcnRx sdk_pm_onBcnRx
|
||||||
|
pm_open_rf sdk_pm_open_rf
|
||||||
|
pm_open sdk_pm_open
|
||||||
|
pm_post sdk_pm_post
|
||||||
|
pm_prepare_to_sleep sdk_pm_prepare_to_sleep
|
||||||
|
pm_reset_idle_sleep sdk_pm_reset_idle_sleep
|
||||||
|
pm_rf_is_closed sdk_pm_rf_is_closed
|
||||||
|
pm_rtc2usec sdk_pm_rtc2usec
|
||||||
|
pm_rtc_clock_cali_proc sdk_pm_rtc_clock_cali_proc
|
||||||
|
pm_rtc_clock_cali sdk_pm_rtc_clock_cali
|
||||||
|
pm_scan_lock sdk_pm_scan_lock
|
||||||
|
pm_scan_unlocked sdk_pm_scan_unlocked
|
||||||
|
pm_sdio_nidle sdk_pm_sdio_nidle
|
||||||
|
pm_send_nullfunc sdk_pm_send_nullfunc
|
||||||
|
pm_set_addr sdk_pm_set_addr
|
||||||
|
pm_set_pll_xtal_wait_time sdk_pm_set_pll_xtal_wait_time
|
||||||
|
pm_set_sleep_btco sdk_pm_set_sleep_btco
|
||||||
|
pm_set_sleep_cycles sdk_pm_set_sleep_cycles
|
||||||
|
pm_set_sleep_mode sdk_pm_set_sleep_mode
|
||||||
|
pm_set_sleep_time sdk_pm_set_sleep_time
|
||||||
|
pm_set_sleep_type_from_upper sdk_pm_set_sleep_type_from_upper
|
||||||
|
pm_set_wakeup_btco sdk_pm_set_wakeup_btco
|
||||||
|
pm_set_wakeup_mac sdk_pm_set_wakeup_mac
|
||||||
|
pm_shutdown sdk_pm_shutdown
|
||||||
|
pm_sleep_for sdk_pm_sleep_for
|
||||||
|
pm_sleep_opt_bb_off sdk_pm_sleep_opt_bb_off
|
||||||
|
pm_sleep_opt_bb_on sdk_pm_sleep_opt_bb_on
|
||||||
|
pm_sleep_opt sdk_pm_sleep_opt
|
||||||
|
pm_sleep_set_mac sdk_pm_sleep_set_mac
|
||||||
|
pm_suspend sdk_pm_suspend
|
||||||
|
pm_try_scan_unlock sdk_pm_try_scan_unlock
|
||||||
|
pm_unmask_bt sdk_pm_unmask_bt
|
||||||
|
pm_usec2rtc sdk_pm_usec2rtc
|
||||||
|
pm_wait4wakeup sdk_pm_wait4wakeup
|
||||||
|
pm_wakeup_init sdk_pm_wakeup_init
|
||||||
|
pm_wakeup_opt sdk_pm_wakeup_opt
|
||||||
|
pp_attach sdk_pp_attach
|
||||||
|
ppCalFrameTimes sdk_ppCalFrameTimes
|
||||||
|
ppCalTxop sdk_ppCalTxop
|
||||||
|
ppCheckTxIdle sdk_ppCheckTxIdle
|
||||||
|
ppDequeueTxQ sdk_ppDequeueTxQ
|
||||||
|
pp_disable_idle_timer sdk_pp_disable_idle_timer
|
||||||
|
pp_disable_noise_timer sdk_pp_disable_noise_timer
|
||||||
|
ppDiscardMPDU sdk_ppDiscardMPDU
|
||||||
|
pp_enable_idle_timer sdk_pp_enable_idle_timer
|
||||||
|
pp_enable_noise_timer sdk_pp_enable_noise_timer
|
||||||
|
ppEnqueueRxq sdk_ppEnqueueRxq
|
||||||
|
ppEnqueueTxDone sdk_ppEnqueueTxDone
|
||||||
|
ppFetchTxQFirstAvail sdk_ppFetchTxQFirstAvail
|
||||||
|
ppGetTxQFirstAvail_Locked sdk_ppGetTxQFirstAvail_Locked
|
||||||
|
ppInstallKey sdk_ppInstallKey
|
||||||
|
pp_michael_mic_failure sdk_pp_michael_mic_failure
|
||||||
|
pp_noise_test sdk_pp_noise_test
|
||||||
|
ppPeocessRxPktHdr sdk_ppPeocessRxPktHdr
|
||||||
|
pp_post sdk_pp_post
|
||||||
|
ppProcessTxQ sdk_ppProcessTxQ
|
||||||
|
ppProcessWaitQ sdk_ppProcessWaitQ
|
||||||
|
ppRecordBarRRC sdk_ppRecordBarRRC
|
||||||
|
ppRecycleRxPkt sdk_ppRecycleRxPkt
|
||||||
|
ppRegisterTxCallback sdk_ppRegisterTxCallback
|
||||||
|
ppRollBackTxQ sdk_ppRollBackTxQ
|
||||||
|
pp_soft_wdt_feed sdk_pp_soft_wdt_feed
|
||||||
|
pp_soft_wdt_init sdk_pp_soft_wdt_init
|
||||||
|
ppTask sdk_ppTask
|
||||||
|
pp_try_enable_idle_timer sdk_pp_try_enable_idle_timer
|
||||||
|
ppTxPkt sdk_ppTxPkt
|
||||||
|
ppTxqUpdateBitmap sdk_ppTxqUpdateBitmap
|
||||||
|
PPWdtReset sdk_PPWdtReset
|
||||||
|
promiscuous_cb sdk_promiscuous_cb
|
||||||
|
_putc1 sdk__putc1
|
||||||
|
pwctrl_debug sdk_pwctrl_debug
|
||||||
|
ram_cal_tos_v60 sdk_ram_cal_tos_v60
|
||||||
|
ram_chip_v6_rx_init sdk_ram_chip_v6_rx_init
|
||||||
|
ram_get_bb_atten sdk_ram_get_bb_atten
|
||||||
|
ram_get_corr_power sdk_ram_get_corr_power
|
||||||
|
ram_get_fm_sar_dout sdk_ram_get_fm_sar_dout
|
||||||
|
ram_get_noisefloor sdk_ram_get_noisefloor
|
||||||
|
ram_pbus_debugmode sdk_ram_pbus_debugmode
|
||||||
|
ram_pbus_set_rxgain sdk_ram_pbus_set_rxgain
|
||||||
|
ram_pbus_xpd_tx_on sdk_ram_pbus_xpd_tx_on
|
||||||
|
ram_restart_cal sdk_ram_restart_cal
|
||||||
|
ram_rfcal_pwrctrl sdk_ram_rfcal_pwrctrl
|
||||||
|
ram_rfcal_rxiq sdk_ram_rfcal_rxiq
|
||||||
|
ram_rfcal_txcap sdk_ram_rfcal_txcap
|
||||||
|
ram_rfcal_txiq sdk_ram_rfcal_txiq
|
||||||
|
ram_rfpll_set_freq sdk_ram_rfpll_set_freq
|
||||||
|
ram_rxiq_cover_mg_mp sdk_ram_rxiq_cover_mg_mp
|
||||||
|
ram_rxiq_get_mis sdk_ram_rxiq_get_mis
|
||||||
|
ram_set_channel_freq sdk_ram_set_channel_freq
|
||||||
|
ram_set_noise_floor sdk_ram_set_noise_floor
|
||||||
|
ram_set_txbb_atten sdk_ram_set_txbb_atten
|
||||||
|
ram_start_noisefloor sdk_ram_start_noisefloor
|
||||||
|
ram_tx_mac_disable sdk_ram_tx_mac_disable
|
||||||
|
ram_tx_mac_enable sdk_ram_tx_mac_enable
|
||||||
|
rc4_skip sdk_rc4_skip
|
||||||
|
rcAttach sdk_rcAttach
|
||||||
|
rc_cal sdk_rc_cal
|
||||||
|
rc_disable_trc_by_interface sdk_rc_disable_trc_by_interface
|
||||||
|
rc_disable_trc sdk_rc_disable_trc
|
||||||
|
rc_enable_trc sdk_rc_enable_trc
|
||||||
|
RC_GetAckRate sdk_RC_GetAckRate
|
||||||
|
RC_GetAckTime sdk_RC_GetAckTime
|
||||||
|
RC_GetBlockAckTime sdk_RC_GetBlockAckTime
|
||||||
|
RC_GetCtsTime sdk_RC_GetCtsTime
|
||||||
|
rc_get_mask sdk_rc_get_mask
|
||||||
|
rcGetRate sdk_rcGetRate
|
||||||
|
RC_GetRtsRate sdk_RC_GetRtsRate
|
||||||
|
rcGetSched sdk_rcGetSched
|
||||||
|
rc_get_sta_trc sdk_rc_get_sta_trc
|
||||||
|
rc_get_trc_by_index sdk_rc_get_trc_by_index
|
||||||
|
rc_get_trc sdk_rc_get_trc
|
||||||
|
rcGetTrc sdk_rcGetTrc
|
||||||
|
rc_only_sta_trc sdk_rc_only_sta_trc
|
||||||
|
rcons sdk_rcons
|
||||||
|
rcReachRetryLimit sdk_rcReachRetryLimit
|
||||||
|
RC_SetBasicRate sdk_RC_SetBasicRate
|
||||||
|
rcUpdateDataRxDone sdk_rcUpdateDataRxDone
|
||||||
|
rcUpdatePhyMode sdk_rcUpdatePhyMode
|
||||||
|
rcUpdateRxDone sdk_rcUpdateRxDone
|
||||||
|
rcUpdateTxDone sdk_rcUpdateTxDone
|
||||||
|
read_hw_noisefloor sdk_read_hw_noisefloor
|
||||||
|
read_sar_dout sdk_read_sar_dout
|
||||||
|
readvdd33 sdk_readvdd33
|
||||||
|
register_chipv6_phy_init_param sdk_register_chipv6_phy_init_param
|
||||||
|
register_chipv6_phy sdk_register_chipv6_phy
|
||||||
|
register_phy_ops sdk_register_phy_ops
|
||||||
|
reset_noise_timer sdk_reset_noise_timer
|
||||||
|
RFChannelSel sdk_RFChannelSel
|
||||||
|
rf_init sdk_rf_init
|
||||||
|
rijndaelEncrypt sdk_rijndaelEncrypt
|
||||||
|
rijndaelKeySetupDec sdk_rijndaelKeySetupDec
|
||||||
|
rijndaelKeySetupEnc sdk_rijndaelKeySetupEnc
|
||||||
|
rom_abs_temp sdk_rom_abs_temp
|
||||||
|
rom_ana_inf_gating_en sdk_rom_ana_inf_gating_en
|
||||||
|
rom_cal_tos_v50 sdk_rom_cal_tos_v50
|
||||||
|
rom_chip_50_set_channel sdk_rom_chip_50_set_channel
|
||||||
|
rom_chip_v5_disable_cca sdk_rom_chip_v5_disable_cca
|
||||||
|
rom_chip_v5_enable_cca sdk_rom_chip_v5_enable_cca
|
||||||
|
rom_chip_v5_rx_init sdk_rom_chip_v5_rx_init
|
||||||
|
rom_chip_v5_sense_backoff sdk_rom_chip_v5_sense_backoff
|
||||||
|
rom_chip_v5_tx_init sdk_rom_chip_v5_tx_init
|
||||||
|
rom_dc_iq_est sdk_rom_dc_iq_est
|
||||||
|
rom_en_pwdet sdk_rom_en_pwdet
|
||||||
|
rom_get_bb_atten sdk_rom_get_bb_atten
|
||||||
|
rom_get_corr_power sdk_rom_get_corr_power
|
||||||
|
rom_get_fm_sar_dout sdk_rom_get_fm_sar_dout
|
||||||
|
rom_get_noisefloor sdk_rom_get_noisefloor
|
||||||
|
rom_get_power_db sdk_rom_get_power_db
|
||||||
|
rom_i2c_readReg_Mask sdk_rom_i2c_readReg_Mask
|
||||||
|
rom_i2c_readReg sdk_rom_i2c_readReg
|
||||||
|
rom_i2c_writeReg_Mask sdk_rom_i2c_writeReg_Mask
|
||||||
|
rom_i2c_writeReg sdk_rom_i2c_writeReg
|
||||||
|
rom_iq_est_disable sdk_rom_iq_est_disable
|
||||||
|
rom_iq_est_enable sdk_rom_iq_est_enable
|
||||||
|
rom_linear_to_db sdk_rom_linear_to_db
|
||||||
|
rom_mhz2ieee sdk_rom_mhz2ieee
|
||||||
|
rom_pbus_dco___SA2 sdk_rom_pbus_dco___SA2
|
||||||
|
rom_pbus_debugmode sdk_rom_pbus_debugmode
|
||||||
|
rom_pbus_enter_debugmode sdk_rom_pbus_enter_debugmode
|
||||||
|
rom_pbus_exit_debugmode sdk_rom_pbus_exit_debugmode
|
||||||
|
rom_pbus_force_test sdk_rom_pbus_force_test
|
||||||
|
rom_pbus_rd sdk_rom_pbus_rd
|
||||||
|
rom_pbus_set_rxgain sdk_rom_pbus_set_rxgain
|
||||||
|
rom_pbus_set_txgain sdk_rom_pbus_set_txgain
|
||||||
|
rom_pbus_workmode sdk_rom_pbus_workmode
|
||||||
|
rom_pbus_xpd_rx_off sdk_rom_pbus_xpd_rx_off
|
||||||
|
rom_pbus_xpd_rx_on sdk_rom_pbus_xpd_rx_on
|
||||||
|
rom_pbus_xpd_tx_off sdk_rom_pbus_xpd_tx_off
|
||||||
|
rom_pbus_xpd_tx_on__low_gain sdk_rom_pbus_xpd_tx_on__low_gain
|
||||||
|
rom_pbus_xpd_tx_on sdk_rom_pbus_xpd_tx_on
|
||||||
|
rom_phy_reset_req sdk_rom_phy_reset_req
|
||||||
|
rom_restart_cal sdk_rom_restart_cal
|
||||||
|
rom_rfcal_pwrctrl sdk_rom_rfcal_pwrctrl
|
||||||
|
rom_rfcal_rxiq sdk_rom_rfcal_rxiq
|
||||||
|
rom_rfcal_rxiq_set_reg sdk_rom_rfcal_rxiq_set_reg
|
||||||
|
rom_rfcal_txcap sdk_rom_rfcal_txcap
|
||||||
|
rom_rfcal_txiq_cover sdk_rom_rfcal_txiq_cover
|
||||||
|
rom_rfcal_txiq sdk_rom_rfcal_txiq
|
||||||
|
rom_rfcal_txiq_set_reg sdk_rom_rfcal_txiq_set_reg
|
||||||
|
rom_rfpll_reset sdk_rom_rfpll_reset
|
||||||
|
rom_rfpll_set_freq sdk_rom_rfpll_set_freq
|
||||||
|
rom_rxiq_cover_mg_mp sdk_rom_rxiq_cover_mg_mp
|
||||||
|
rom_rxiq_get_mis sdk_rom_rxiq_get_mis
|
||||||
|
rom_sar_init sdk_rom_sar_init
|
||||||
|
rom_set_ana_inf_tx_scale sdk_rom_set_ana_inf_tx_scale
|
||||||
|
rom_set_channel_freq sdk_rom_set_channel_freq
|
||||||
|
rom_set_loopback_gain sdk_rom_set_loopback_gain
|
||||||
|
rom_set_noise_floor sdk_rom_set_noise_floor
|
||||||
|
rom_set_rxclk_en sdk_rom_set_rxclk_en
|
||||||
|
rom_set_txbb_atten sdk_rom_set_txbb_atten
|
||||||
|
rom_set_txclk_en sdk_rom_set_txclk_en
|
||||||
|
rom_set_txiq_cal sdk_rom_set_txiq_cal
|
||||||
|
rom_start_noisefloor sdk_rom_start_noisefloor
|
||||||
|
rom_start_tx_tone sdk_rom_start_tx_tone
|
||||||
|
rom_stop_tx_tone sdk_rom_stop_tx_tone
|
||||||
|
rom_tx_mac_disable sdk_rom_tx_mac_disable
|
||||||
|
rom_tx_mac_enable sdk_rom_tx_mac_enable
|
||||||
|
rom_txtone_linear_pwr sdk_rom_txtone_linear_pwr
|
||||||
|
rom_write_rfpll_sdm sdk_rom_write_rfpll_sdm
|
||||||
|
rsn_cipher_put_suites sdk_rsn_cipher_put_suites
|
||||||
|
rsn_pmkid sdk_rsn_pmkid
|
||||||
|
rst_if sdk_rst_if
|
||||||
|
rtc_get_reset_reason sdk_rtc_get_reset_reason
|
||||||
|
rtc_mem_backup sdk_rtc_mem_backup
|
||||||
|
rtc_mem_recovery sdk_rtc_mem_recovery
|
||||||
|
rxdc_init_flag sdk_rxdc_init_flag
|
||||||
|
rx_gain_swp sdk_rx_gain_swp
|
||||||
|
rxiq_compute_num sdk_rxiq_compute_num
|
||||||
|
rxiq_cover_fail_num sdk_rxiq_cover_fail_num
|
||||||
|
RxNodeNum sdk_RxNodeNum
|
||||||
|
scan_add_bssid sdk_scan_add_bssid
|
||||||
|
scan_add_probe_ssid sdk_scan_add_probe_ssid
|
||||||
|
scan_cancel sdk_scan_cancel
|
||||||
|
scan_check_hidden sdk_scan_check_hidden
|
||||||
|
scan_clear_channles sdk_scan_clear_channles
|
||||||
|
scan_connect_state sdk_scan_connect_state
|
||||||
|
scan_get_type sdk_scan_get_type
|
||||||
|
scan_hidden_ssid sdk_scan_hidden_ssid
|
||||||
|
scannum sdk_scannum
|
||||||
|
scan_parse_beacon sdk_scan_parse_beacon
|
||||||
|
scan_pm_channel_op_cb sdk_scan_pm_channel_op_cb
|
||||||
|
scan_profile_check sdk_scan_profile_check
|
||||||
|
scan_remove_bssid sdk_scan_remove_bssid
|
||||||
|
scan_remove_probe_ssid sdk_scan_remove_probe_ssid
|
||||||
|
scan_set_desChan sdk_scan_set_desChan
|
||||||
|
scan_start sdk_scan_start
|
||||||
|
SDIO_slp_reject sdk_SDIO_slp_reject
|
||||||
|
sdt_on_noise_start sdk_sdt_on_noise_start
|
||||||
|
set_cal_rxdc sdk_set_cal_rxdc
|
||||||
|
set_crystal_uart sdk_set_crystal_uart
|
||||||
|
set_rfanagain_dc_reg sdk_set_rfanagain_dc_reg
|
||||||
|
set_rf_freq_offset sdk_set_rf_freq_offset
|
||||||
|
set_rx_gain_cal_iq sdk_set_rx_gain_cal_iq
|
||||||
|
set_rx_gain_testchip_50 sdk_set_rx_gain_testchip_50
|
||||||
|
set_txcap_reg sdk_set_txcap_reg
|
||||||
|
set_txdc_pbus sdk_set_txdc_pbus
|
||||||
|
SHA1Final sdk_SHA1Final
|
||||||
|
SHA1Init sdk_SHA1Init
|
||||||
|
sha1_prf sdk_sha1_prf
|
||||||
|
SHA1Transform sdk_SHA1Transform
|
||||||
|
SHA1Update sdk_SHA1Update
|
||||||
|
sha1_vector sdk_sha1_vector
|
||||||
|
sleep_opt_8266 sdk_sleep_opt_8266
|
||||||
|
sleep_opt_bb_on_8266 sdk_sleep_opt_bb_on_8266
|
||||||
|
sleep_reset_analog_rtcreg_8266 sdk_sleep_reset_analog_rtcreg_8266
|
||||||
|
sleep_start_wait_time sdk_sleep_start_wait_time
|
||||||
|
slop_test sdk_slop_test
|
||||||
|
slop_wdt_feed sdk_slop_wdt_feed
|
||||||
|
software_slp_reject sdk_software_slp_reject
|
||||||
|
SPIEraseSector sdk_SPIEraseSector
|
||||||
|
spi_flash_erase_sector sdk_spi_flash_erase_sector
|
||||||
|
spi_flash_get_id sdk_spi_flash_get_id
|
||||||
|
spi_flash_read sdk_spi_flash_read
|
||||||
|
spi_flash_read_status sdk_spi_flash_read_status
|
||||||
|
spi_flash_write sdk_spi_flash_write
|
||||||
|
spi_flash_write_status sdk_spi_flash_write_status
|
||||||
|
SPIReadModeCnfig sdk_SPIReadModeCnfig
|
||||||
|
SPIRead sdk_SPIRead
|
||||||
|
SPIWrite sdk_SPIWrite
|
||||||
|
sta_con_timer sdk_sta_con_timer
|
||||||
|
sta_input sdk_sta_input
|
||||||
|
start_dig_rx sdk_start_dig_rx
|
||||||
|
sta_status_set sdk_sta_status_set
|
||||||
|
stop_dig_rx sdk_stop_dig_rx
|
||||||
|
sw_scan_mode sdk_sw_scan_mode
|
||||||
|
system_adc_read sdk_system_adc_read
|
||||||
|
system_deep_sleep sdk_system_deep_sleep
|
||||||
|
system_get_boot_mode sdk_system_get_boot_mode
|
||||||
|
system_get_boot_version sdk_system_get_boot_version
|
||||||
|
system_get_checksum sdk_system_get_checksum
|
||||||
|
system_get_chip_id sdk_system_get_chip_id
|
||||||
|
system_get_cpu_freq sdk_system_get_cpu_freq
|
||||||
|
system_get_free_heap_size sdk_system_get_free_heap_size
|
||||||
|
system_get_rst_info sdk_system_get_rst_info
|
||||||
|
system_get_rtc_time sdk_system_get_rtc_time
|
||||||
|
system_get_sdk_version sdk_system_get_sdk_version
|
||||||
|
system_get_test_result sdk_system_get_test_result
|
||||||
|
system_get_time sdk_system_get_time
|
||||||
|
system_get_userbin_addr sdk_system_get_userbin_addr
|
||||||
|
system_overclock sdk_system_overclock
|
||||||
|
system_pp_recycle_rx_pkt sdk_system_pp_recycle_rx_pkt
|
||||||
|
system_print_meminfo sdk_system_print_meminfo
|
||||||
|
system_relative_time sdk_system_relative_time
|
||||||
|
system_restart_enhance sdk_system_restart_enhance
|
||||||
|
system_restart_in_nmi sdk_system_restart_in_nmi
|
||||||
|
system_restart sdk_system_restart
|
||||||
|
system_restoreclock sdk_system_restoreclock
|
||||||
|
system_restore sdk_system_restore
|
||||||
|
system_rtc_clock_cali_proc sdk_system_rtc_clock_cali_proc
|
||||||
|
system_rtc_mem_read sdk_system_rtc_mem_read
|
||||||
|
system_rtc_mem_write sdk_system_rtc_mem_write
|
||||||
|
system_station_got_ip_set sdk_system_station_got_ip_set
|
||||||
|
system_uart_swap sdk_system_uart_swap
|
||||||
|
system_update_cpu_freq sdk_system_update_cpu_freq
|
||||||
|
system_upgrade_flag_check sdk_system_upgrade_flag_check
|
||||||
|
system_upgrade_flag_set sdk_system_upgrade_flag_set
|
||||||
|
system_upgrade_reboot sdk_system_upgrade_reboot
|
||||||
|
system_upgrade_userbin_check sdk_system_upgrade_userbin_check
|
||||||
|
system_upgrade_userbin_set sdk_system_upgrade_userbin_set
|
||||||
|
target_power_add_backoff sdk_target_power_add_backoff
|
||||||
|
target_power_backoff sdk_target_power_backoff
|
||||||
|
Td0 sdk_Td0
|
||||||
|
Td4s_rom sdk_Td4s_rom
|
||||||
|
Te0 sdk_Te0
|
||||||
|
test_rffreq_txcap sdk_test_rffreq_txcap
|
||||||
|
test_tout sdk_test_tout
|
||||||
|
tkip sdk_tkip
|
||||||
|
TmpSTAAPCloseAP sdk_TmpSTAAPCloseAP
|
||||||
|
trc_NeedRTS sdk_trc_NeedRTS
|
||||||
|
trc_onDisconnect sdk_trc_onDisconnect
|
||||||
|
trc_onScanDone sdk_trc_onScanDone
|
||||||
|
trc_onScanStart sdk_trc_onScanStart
|
||||||
|
tsen_meas sdk_tsen_meas
|
||||||
|
tx_atten_set_interp sdk_tx_atten_set_interp
|
||||||
|
txbbgain2dcoindex sdk_txbbgain2dcoindex
|
||||||
|
txbk_dpdby_flag sdk_txbk_dpdby_flag
|
||||||
|
tx_cap_init sdk_tx_cap_init
|
||||||
|
tx_cont_cfg sdk_tx_cont_cfg
|
||||||
|
tx_cont_dis sdk_tx_cont_dis
|
||||||
|
tx_cont_en sdk_tx_cont_en
|
||||||
|
Tx_Copy2Queue sdk_Tx_Copy2Queue
|
||||||
|
txiq_cover sdk_txiq_cover
|
||||||
|
txiq_get_mis_pwr sdk_txiq_get_mis_pwr
|
||||||
|
TxNodeNum sdk_TxNodeNum
|
||||||
|
tx_pwctrl_atten_init_en sdk_tx_pwctrl_atten_init_en
|
||||||
|
tx_pwctrl_atten_init sdk_tx_pwctrl_atten_init
|
||||||
|
tx_pwctrl_background sdk_tx_pwctrl_background
|
||||||
|
tx_pwctrl_bg_init sdk_tx_pwctrl_bg_init
|
||||||
|
tx_pwctrl_cal sdk_tx_pwctrl_cal
|
||||||
|
tx_pwctrl_init_cal sdk_tx_pwctrl_init_cal
|
||||||
|
tx_pwctrl_init sdk_tx_pwctrl_init
|
||||||
|
tx_pwctrl_pk_num sdk_tx_pwctrl_pk_num
|
||||||
|
tx_pwctrl_set_chan_flag sdk_tx_pwctrl_set_chan_flag
|
||||||
|
tx_pwr_backoff sdk_tx_pwr_backoff
|
||||||
|
txpwr_offset sdk_txpwr_offset
|
||||||
|
tx_rf_ana_gain sdk_tx_rf_ana_gain
|
||||||
|
uart_buff_switch sdk_uart_buff_switch
|
||||||
|
uart_div_modify sdk_uart_div_modify
|
||||||
|
Uart_Init sdk_Uart_Init
|
||||||
|
uart_rx_one_char sdk_uart_rx_one_char
|
||||||
|
uart_tx_flush sdk_uart_tx_flush
|
||||||
|
uart_wait_idle sdk_uart_wait_idle
|
||||||
|
user_fatal_exception_handler sdk_user_fatal_exception_handler
|
||||||
|
user_init_flag sdk_user_init_flag
|
||||||
|
user_init_task sdk_user_init_task
|
||||||
|
user_start sdk_user_start
|
||||||
|
wait_rfpll_cal_end sdk_wait_rfpll_cal_end
|
||||||
|
wDev_AppendRxAmpduLensBlocks sdk_wDev_AppendRxAmpduLensBlocks
|
||||||
|
wDev_AppendRxBlocks sdk_wDev_AppendRxBlocks
|
||||||
|
wDev_ClearBssid sdk_wDev_ClearBssid
|
||||||
|
wDev_ClearTxqCollisions sdk_wDev_ClearTxqCollisions
|
||||||
|
wDev_ClearWaitingQueue sdk_wDev_ClearWaitingQueue
|
||||||
|
wDev_Crypto_Conf sdk_wDev_Crypto_Conf
|
||||||
|
wDev_Crypto_Disable sdk_wDev_Crypto_Disable
|
||||||
|
wDevCtrl sdk_wDevCtrl
|
||||||
|
wDev_Disable_Beacon_Tsf sdk_wDev_Disable_Beacon_Tsf
|
||||||
|
wDevDisableRx sdk_wDevDisableRx
|
||||||
|
wDev_DisableTransmit sdk_wDev_DisableTransmit
|
||||||
|
wDev_Enable_Beacon_Tsf sdk_wDev_Enable_Beacon_Tsf
|
||||||
|
wDevEnableRx sdk_wDevEnableRx
|
||||||
|
wDev_EnableTransmit sdk_wDev_EnableTransmit
|
||||||
|
wdev_exit_sniffer sdk_wdev_exit_sniffer
|
||||||
|
wDevForceAck6M sdk_wDevForceAck6M
|
||||||
|
wDev_GetBAInfo sdk_wDev_GetBAInfo
|
||||||
|
wDev_Get_Next_TBTT sdk_wDev_Get_Next_TBTT
|
||||||
|
wDev_GetTxqCollisions sdk_wDev_GetTxqCollisions
|
||||||
|
wdev_go_sniffer sdk_wdev_go_sniffer
|
||||||
|
wDev_Initialize sdk_wDev_Initialize
|
||||||
|
wDev_Insert_KeyEntry sdk_wDev_Insert_KeyEntry
|
||||||
|
wDev_MacTim1Arm sdk_wDev_MacTim1Arm
|
||||||
|
wDev_MacTim1SetFunc sdk_wDev_MacTim1SetFunc
|
||||||
|
wDev_MacTimArm sdk_wDev_MacTimArm
|
||||||
|
wDev_MacTimSetFunc sdk_wDev_MacTimSetFunc
|
||||||
|
wDev_Option_Init sdk_wDev_Option_Init
|
||||||
|
wDev_ProcessCollision sdk_wDev_ProcessCollision
|
||||||
|
wDev_ProcessFiq sdk_wDev_ProcessFiq
|
||||||
|
wDev_remove_KeyEntry sdk_wDev_remove_KeyEntry
|
||||||
|
wDev_Reset_TBTT sdk_wDev_Reset_TBTT
|
||||||
|
wDev_Set_Beacon_Int sdk_wDev_Set_Beacon_Int
|
||||||
|
wDev_SetBssid sdk_wDev_SetBssid
|
||||||
|
wDev_SetFrameAckType sdk_wDev_SetFrameAckType
|
||||||
|
wDev_SetMacAddress sdk_wDev_SetMacAddress
|
||||||
|
wDev_SetRxPolicy sdk_wDev_SetRxPolicy
|
||||||
|
wDev_SetWaitingQueue sdk_wDev_SetWaitingQueue
|
||||||
|
WdevTimOffSet sdk_WdevTimOffSet
|
||||||
|
wd_reset_cnt sdk_wd_reset_cnt
|
||||||
|
wdt_init sdk_wdt_init
|
||||||
|
wep sdk_wep
|
||||||
|
wifi_get_channel sdk_wifi_get_channel
|
||||||
|
wifi_get_ip_info sdk_wifi_get_ip_info
|
||||||
|
wifi_get_macaddr sdk_wifi_get_macaddr
|
||||||
|
wifi_get_opmode_default sdk_wifi_get_opmode_default
|
||||||
|
wifi_get_opmode sdk_wifi_get_opmode
|
||||||
|
wifi_get_phy_mode sdk_wifi_get_phy_mode
|
||||||
|
wifi_get_sleep_type sdk_wifi_get_sleep_type
|
||||||
|
wifi_mode_set sdk_wifi_mode_set
|
||||||
|
wifi_param_save_protect sdk_wifi_param_save_protect
|
||||||
|
wifi_promiscuous_enable sdk_wifi_promiscuous_enable
|
||||||
|
wifi_promiscuous_set_mac sdk_wifi_promiscuous_set_mac
|
||||||
|
wifi_set_channel sdk_wifi_set_channel
|
||||||
|
wifi_set_ip_info sdk_wifi_set_ip_info
|
||||||
|
wifi_set_macaddr sdk_wifi_set_macaddr
|
||||||
|
wifi_set_opmode_current sdk_wifi_set_opmode_current
|
||||||
|
wifi_set_opmode_local sdk_wifi_set_opmode_local
|
||||||
|
wifi_set_opmode sdk_wifi_set_opmode
|
||||||
|
wifi_set_phy_mode sdk_wifi_set_phy_mode
|
||||||
|
wifi_set_promiscuous_rx_cb sdk_wifi_set_promiscuous_rx_cb
|
||||||
|
wifi_set_sleep_type sdk_wifi_set_sleep_type
|
||||||
|
wifi_softap_cacl_mac sdk_wifi_softap_cacl_mac
|
||||||
|
wifi_softap_deauth sdk_wifi_softap_deauth
|
||||||
|
wifi_softap_free_station_info sdk_wifi_softap_free_station_info
|
||||||
|
wifi_softap_get_config_default sdk_wifi_softap_get_config_default
|
||||||
|
wifi_softap_get_config sdk_wifi_softap_get_config
|
||||||
|
wifi_softap_get_station_info sdk_wifi_softap_get_station_info
|
||||||
|
wifi_softap_set_config_current sdk_wifi_softap_set_config_current
|
||||||
|
wifi_softap_set_config sdk_wifi_softap_set_config
|
||||||
|
wifi_softap_set_default_ssid sdk_wifi_softap_set_default_ssid
|
||||||
|
wifi_softap_set_station_info sdk_wifi_softap_set_station_info
|
||||||
|
wifi_softap_start sdk_wifi_softap_start
|
||||||
|
wifi_softap_stop sdk_wifi_softap_stop
|
||||||
|
wifi_station_ap_change sdk_wifi_station_ap_change
|
||||||
|
wifi_station_ap_check sdk_wifi_station_ap_check
|
||||||
|
wifi_station_ap_number_set sdk_wifi_station_ap_number_set
|
||||||
|
wifi_station_connect sdk_wifi_station_connect
|
||||||
|
wifi_station_dhcpc_start sdk_wifi_station_dhcpc_start
|
||||||
|
wifi_station_dhcpc_status sdk_wifi_station_dhcpc_status
|
||||||
|
wifi_station_dhcpc_stop sdk_wifi_station_dhcpc_stop
|
||||||
|
wifi_station_disconnect sdk_wifi_station_disconnect
|
||||||
|
wifi_station_get_ap_info sdk_wifi_station_get_ap_info
|
||||||
|
wifi_station_get_auto_connect sdk_wifi_station_get_auto_connect
|
||||||
|
wifi_station_get_config_default sdk_wifi_station_get_config_default
|
||||||
|
wifi_station_get_config sdk_wifi_station_get_config
|
||||||
|
wifi_station_get_connect_status sdk_wifi_station_get_connect_status
|
||||||
|
wifi_station_get_current_ap_id sdk_wifi_station_get_current_ap_id
|
||||||
|
wifi_station_scan sdk_wifi_station_scan
|
||||||
|
wifi_station_set_auto_connect sdk_wifi_station_set_auto_connect
|
||||||
|
wifi_station_set_config_current sdk_wifi_station_set_config_current
|
||||||
|
wifi_station_set_config sdk_wifi_station_set_config
|
||||||
|
wifi_station_start sdk_wifi_station_start
|
||||||
|
wifi_station_stop sdk_wifi_station_stop
|
||||||
|
wifi_status_led_install sdk_wifi_status_led_install
|
||||||
|
wpa_add_kde sdk_wpa_add_kde
|
||||||
|
wpa_attach sdk_wpa_attach
|
||||||
|
wpa_auth_for_each_sta sdk_wpa_auth_for_each_sta
|
||||||
|
wpa_auth_gen_wpa_ie sdk_wpa_auth_gen_wpa_ie
|
||||||
|
wpa_auth_sm_event sdk_wpa_auth_sm_event
|
||||||
|
wpa_auth_sta_associated sdk_wpa_auth_sta_associated
|
||||||
|
wpa_auth_sta_deinit sdk_wpa_auth_sta_deinit
|
||||||
|
wpa_auth_sta_init sdk_wpa_auth_sta_init
|
||||||
|
wpa_auth_sta_no_wpa sdk_wpa_auth_sta_no_wpa
|
||||||
|
wpa_auth_uses_mfp sdk_wpa_auth_uses_mfp
|
||||||
|
wpabuf_alloc_copy sdk_wpabuf_alloc_copy
|
||||||
|
wpabuf_alloc_ext_data sdk_wpabuf_alloc_ext_data
|
||||||
|
wpabuf_alloc sdk_wpabuf_alloc
|
||||||
|
wpabuf_concat sdk_wpabuf_concat
|
||||||
|
wpabuf_dup sdk_wpabuf_dup
|
||||||
|
wpabuf_free sdk_wpabuf_free
|
||||||
|
wpabuf_put sdk_wpabuf_put
|
||||||
|
wpabuf_resize sdk_wpabuf_resize
|
||||||
|
wpabuf_zeropad sdk_wpabuf_zeropad
|
||||||
|
wpa_cipher_key_len sdk_wpa_cipher_key_len
|
||||||
|
wpa_cipher_put_suites sdk_wpa_cipher_put_suites
|
||||||
|
wpa_cipher_to_alg sdk_wpa_cipher_to_alg
|
||||||
|
wpa_cipher_to_suite sdk_wpa_cipher_to_suite
|
||||||
|
wpa_compare_rsn_ie sdk_wpa_compare_rsn_ie
|
||||||
|
wpa_config_assoc_ie sdk_wpa_config_assoc_ie
|
||||||
|
wpa_config_bss sdk_wpa_config_bss
|
||||||
|
wpa_config_parse_string sdk_wpa_config_parse_string
|
||||||
|
wpa_config_profile sdk_wpa_config_profile
|
||||||
|
wpa_eapol_key_mic sdk_wpa_eapol_key_mic
|
||||||
|
wpa_gen_wpa_ie sdk_wpa_gen_wpa_ie
|
||||||
|
wpa_get_ntp_timestamp sdk_wpa_get_ntp_timestamp
|
||||||
|
wpa_init sdk_wpa_init
|
||||||
|
wpa_neg_complete sdk_wpa_neg_complete
|
||||||
|
wpa_parse_kde_ies sdk_wpa_parse_kde_ies
|
||||||
|
wpa_parse_wpa_ie_rsn sdk_wpa_parse_wpa_ie_rsn
|
||||||
|
wpa_parse_wpa_ie sdk_wpa_parse_wpa_ie
|
||||||
|
wpa_parse_wpa_ie_wpa sdk_wpa_parse_wpa_ie_wpa
|
||||||
|
wpa_pmk_to_ptk sdk_wpa_pmk_to_ptk
|
||||||
|
wpa_receive sdk_wpa_receive
|
||||||
|
wpa_register sdk_wpa_register
|
||||||
|
wpa_remove_ptk sdk_wpa_remove_ptk
|
||||||
|
__wpa_send_eapol sdk___wpa_send_eapol
|
||||||
|
wpa_set_bss sdk_wpa_set_bss
|
||||||
|
wpa_set_pmk sdk_wpa_set_pmk
|
||||||
|
wpa_set_profile sdk_wpa_set_profile
|
||||||
|
wpa_sm_alloc_eapol sdk_wpa_sm_alloc_eapol
|
||||||
|
wpa_sm_deauthenticate sdk_wpa_sm_deauthenticate
|
||||||
|
wpa_sm_disassociate sdk_wpa_sm_disassociate
|
||||||
|
wpa_sm_get_beacon_ie sdk_wpa_sm_get_beacon_ie
|
||||||
|
wpa_sm_mlme_setprotection sdk_wpa_sm_mlme_setprotection
|
||||||
|
wpa_sm_rx_eapol sdk_wpa_sm_rx_eapol
|
||||||
|
wpa_sm_set_state sdk_wpa_sm_set_state
|
||||||
|
wpa_supplicant_parse_ies sdk_wpa_supplicant_parse_ies
|
||||||
|
wpa_validate_wpa_ie sdk_wpa_validate_wpa_ie
|
||||||
|
wpa_write_rsn_ie sdk_wpa_write_rsn_ie
|
||||||
|
xieee80211Queue sdk_xieee80211Queue
|
||||||
|
_xt_clear_ints sdk__xt_clear_ints
|
||||||
|
_xt_context_restore sdk__xt_context_restore
|
||||||
|
_xt_context_save sdk__xt_context_save
|
||||||
|
_xt_int_enter sdk__xt_int_enter
|
||||||
|
_xt_int_exit sdk__xt_int_exit
|
||||||
|
_xt_isr_mask sdk__xt_isr_mask
|
||||||
|
_xt_isr_unmask sdk__xt_isr_unmask
|
||||||
|
_xt_read_ints sdk__xt_read_ints
|
||||||
|
_xt_tick_timer_init sdk__xt_tick_timer_init
|
||||||
|
_xt_timer_int1 sdk__xt_timer_int1
|
||||||
|
_xt_timer_int sdk__xt_timer_int
|
||||||
|
xUserTaskHandle sdk_xUserTaskHandle
|
||||||
|
xWatchDogTaskHandle sdk_xWatchDogTaskHandle
|
||||||
|
|
@ -2,3 +2,4 @@
|
||||||
printf-stdarg.o
|
printf-stdarg.o
|
||||||
libc.o
|
libc.o
|
||||||
xtensa_vectors.o
|
xtensa_vectors.o
|
||||||
|
app_main.o
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* $Id$
|
* _default_types implementation for xtensa lx106 arch
|
||||||
|
*
|
||||||
|
* Simplified version of generic _default_types.h, ignores gcc
|
||||||
|
* built-in standard types.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MACHINE__DEFAULT_TYPES_H
|
#ifndef _MACHINE__DEFAULT_TYPES_H
|
||||||
|
|
@ -7,211 +10,44 @@
|
||||||
|
|
||||||
#include <sys/features.h>
|
#include <sys/features.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Guess on types by examining *_MIN / *_MAX defines.
|
|
||||||
*/
|
|
||||||
#if __GNUC_PREREQ (3, 3)
|
|
||||||
/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
|
|
||||||
#define __EXP(x) __##x##__
|
|
||||||
#else
|
|
||||||
/* Fall back to POSIX versions from <limits.h> */
|
|
||||||
#define __EXP(x) x
|
|
||||||
#include <limits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __INT8_TYPE__
|
|
||||||
typedef __INT8_TYPE__ __int8_t;
|
|
||||||
#ifdef __UINT8_TYPE__
|
|
||||||
typedef __UINT8_TYPE__ __uint8_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT8_TYPE__ __uint8_t;
|
|
||||||
#endif
|
|
||||||
#define ___int8_t_defined 1
|
|
||||||
#elif __EXP(SCHAR_MAX) == 0x7f
|
|
||||||
typedef signed char __int8_t ;
|
typedef signed char __int8_t ;
|
||||||
typedef unsigned char __uint8_t ;
|
typedef unsigned char __uint8_t ;
|
||||||
#define ___int8_t_defined 1
|
#define ___int8_t_defined 1
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INT16_TYPE__
|
|
||||||
typedef __INT16_TYPE__ __int16_t;
|
|
||||||
#ifdef __UINT16_TYPE__
|
|
||||||
typedef __UINT16_TYPE__ __uint16_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT16_TYPE__ __uint16_t;
|
|
||||||
#endif
|
|
||||||
#define ___int16_t_defined 1
|
|
||||||
#elif __EXP(INT_MAX) == 0x7fff
|
|
||||||
typedef signed int __int16_t;
|
|
||||||
typedef unsigned int __uint16_t;
|
|
||||||
#define ___int16_t_defined 1
|
|
||||||
#elif __EXP(SHRT_MAX) == 0x7fff
|
|
||||||
typedef signed short __int16_t;
|
typedef signed short __int16_t;
|
||||||
typedef unsigned short __uint16_t;
|
typedef unsigned short __uint16_t;
|
||||||
#define ___int16_t_defined 1
|
#define ___int16_t_defined 1
|
||||||
#elif __EXP(SCHAR_MAX) == 0x7fff
|
|
||||||
typedef signed char __int16_t;
|
|
||||||
typedef unsigned char __uint16_t;
|
|
||||||
#define ___int16_t_defined 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INT32_TYPE__
|
|
||||||
typedef __INT32_TYPE__ __int32_t;
|
|
||||||
#ifdef __UINT32_TYPE__
|
|
||||||
typedef __UINT32_TYPE__ __uint32_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT32_TYPE__ __uint32_t;
|
|
||||||
#endif
|
|
||||||
#define ___int32_t_defined 1
|
|
||||||
#elif __EXP(INT_MAX) == 0x7fffffffL
|
|
||||||
typedef signed int __int32_t;
|
typedef signed int __int32_t;
|
||||||
typedef unsigned int __uint32_t;
|
typedef unsigned int __uint32_t;
|
||||||
#define ___int32_t_defined 1
|
#define ___int32_t_defined 1
|
||||||
#elif __EXP(LONG_MAX) == 0x7fffffffL
|
|
||||||
typedef signed long __int32_t;
|
|
||||||
typedef unsigned long __uint32_t;
|
|
||||||
#define ___int32_t_defined 1
|
|
||||||
#elif __EXP(SHRT_MAX) == 0x7fffffffL
|
|
||||||
typedef signed short __int32_t;
|
|
||||||
typedef unsigned short __uint32_t;
|
|
||||||
#define ___int32_t_defined 1
|
|
||||||
#elif __EXP(SCHAR_MAX) == 0x7fffffffL
|
|
||||||
typedef signed char __int32_t;
|
|
||||||
typedef unsigned char __uint32_t;
|
|
||||||
#define ___int32_t_defined 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INT64_TYPE__
|
|
||||||
typedef __INT64_TYPE__ __int64_t;
|
|
||||||
#ifdef __UINT64_TYPE__
|
|
||||||
typedef __UINT64_TYPE__ __uint64_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT64_TYPE__ __uint64_t;
|
|
||||||
#endif
|
|
||||||
#define ___int64_t_defined 1
|
|
||||||
#elif __EXP(LONG_MAX) > 0x7fffffff
|
|
||||||
typedef signed long __int64_t;
|
|
||||||
typedef unsigned long __uint64_t;
|
|
||||||
#define ___int64_t_defined 1
|
|
||||||
|
|
||||||
/* GCC has __LONG_LONG_MAX__ */
|
|
||||||
#elif defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff)
|
|
||||||
typedef signed long long __int64_t;
|
typedef signed long long __int64_t;
|
||||||
typedef unsigned long long __uint64_t;
|
typedef unsigned long long __uint64_t;
|
||||||
#define ___int64_t_defined 1
|
#define ___int64_t_defined 1
|
||||||
|
|
||||||
/* POSIX mandates LLONG_MAX in <limits.h> */
|
|
||||||
#elif defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
|
|
||||||
typedef signed long long __int64_t;
|
|
||||||
typedef unsigned long long __uint64_t;
|
|
||||||
#define ___int64_t_defined 1
|
|
||||||
|
|
||||||
#elif __EXP(INT_MAX) > 0x7fffffff
|
|
||||||
typedef signed int __int64_t;
|
|
||||||
typedef unsigned int __uint64_t;
|
|
||||||
#define ___int64_t_defined 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INT_LEAST8_TYPE__
|
|
||||||
typedef __INT_LEAST8_TYPE__ __int_least8_t;
|
|
||||||
#ifdef __UINT_LEAST8_TYPE__
|
|
||||||
typedef __UINT_LEAST8_TYPE__ __uint_least8_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT_LEAST8_TYPE__ __uint_least8_t;
|
|
||||||
#endif
|
|
||||||
#define ___int_least8_t_defined 1
|
|
||||||
#elif defined(___int8_t_defined)
|
|
||||||
typedef __int8_t __int_least8_t;
|
typedef __int8_t __int_least8_t;
|
||||||
typedef __uint8_t __uint_least8_t;
|
typedef __uint8_t __uint_least8_t;
|
||||||
#define ___int_least8_t_defined 1
|
#define ___int_least8_t_defined
|
||||||
#elif defined(___int16_t_defined)
|
|
||||||
typedef __int16_t __int_least8_t;
|
|
||||||
typedef __uint16_t __uint_least8_t;
|
|
||||||
#define ___int_least8_t_defined 1
|
|
||||||
#elif defined(___int32_t_defined)
|
|
||||||
typedef __int32_t __int_least8_t;
|
|
||||||
typedef __uint32_t __uint_least8_t;
|
|
||||||
#define ___int_least8_t_defined 1
|
|
||||||
#elif defined(___int64_t_defined)
|
|
||||||
typedef __int64_t __int_least8_t;
|
|
||||||
typedef __uint64_t __uint_least8_t;
|
|
||||||
#define ___int_least8_t_defined 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INT_LEAST16_TYPE__
|
|
||||||
typedef __INT_LEAST16_TYPE__ __int_least16_t;
|
|
||||||
#ifdef __UINT_LEAST16_TYPE__
|
|
||||||
typedef __UINT_LEAST16_TYPE__ __uint_least16_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT_LEAST16_TYPE__ __uint_least16_t;
|
|
||||||
#endif
|
|
||||||
#define ___int_least16_t_defined 1
|
|
||||||
#elif defined(___int16_t_defined)
|
|
||||||
typedef __int16_t __int_least16_t;
|
typedef __int16_t __int_least16_t;
|
||||||
typedef __uint16_t __uint_least16_t;
|
typedef __uint16_t __uint_least16_t;
|
||||||
#define ___int_least16_t_defined 1
|
#define ___int_least16_t_defined
|
||||||
#elif defined(___int32_t_defined)
|
|
||||||
typedef __int32_t __int_least16_t;
|
|
||||||
typedef __uint32_t __uint_least16_t;
|
|
||||||
#define ___int_least16_t_defined 1
|
|
||||||
#elif defined(___int64_t_defined)
|
|
||||||
typedef __int64_t __int_least16_t;
|
|
||||||
typedef __uint64_t __uint_least16_t;
|
|
||||||
#define ___int_least16_t_defined 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INT_LEAST32_TYPE__
|
|
||||||
typedef __INT_LEAST32_TYPE__ __int_least32_t;
|
|
||||||
#ifdef __UINT_LEAST32_TYPE__
|
|
||||||
typedef __UINT_LEAST32_TYPE__ __uint_least32_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT_LEAST32_TYPE__ __uint_least32_t;
|
|
||||||
#endif
|
|
||||||
#define ___int_least32_t_defined 1
|
|
||||||
#elif defined(___int32_t_defined)
|
|
||||||
typedef __int32_t __int_least32_t;
|
typedef __int32_t __int_least32_t;
|
||||||
typedef __uint32_t __uint_least32_t;
|
typedef __uint32_t __uint_least32_t;
|
||||||
#define ___int_least32_t_defined 1
|
#define ___int_least32_t_defined
|
||||||
#elif defined(___int64_t_defined)
|
|
||||||
typedef __int64_t __int_least32_t;
|
|
||||||
typedef __uint64_t __uint_least32_t;
|
|
||||||
#define ___int_least32_t_defined 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INT_LEAST64_TYPE__
|
|
||||||
typedef __INT_LEAST64_TYPE__ __int_least64_t;
|
|
||||||
#ifdef __UINT_LEAST64_TYPE__
|
|
||||||
typedef __UINT_LEAST64_TYPE__ __uint_least64_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned __INT_LEAST64_TYPE__ __uint_least64_t;
|
|
||||||
#endif
|
|
||||||
#define ___int_least64_t_defined 1
|
|
||||||
#elif defined(___int64_t_defined)
|
|
||||||
typedef __int64_t __int_least64_t;
|
typedef __int64_t __int_least64_t;
|
||||||
typedef __uint64_t __uint_least64_t;
|
typedef __uint64_t __uint_least64_t;
|
||||||
#define ___int_least64_t_defined 1
|
#define ___int_least64_t_defined
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INTPTR_TYPE__
|
|
||||||
typedef __INTPTR_TYPE__ __intptr_t;
|
typedef __INTPTR_TYPE__ __intptr_t;
|
||||||
#ifdef __UINTPTR_TYPE__
|
|
||||||
typedef __UINTPTR_TYPE__ __uintptr_t;
|
typedef __UINTPTR_TYPE__ __uintptr_t;
|
||||||
#else
|
|
||||||
typedef unsigned __INTPTR_TYPE__ __uintptr_t;
|
|
||||||
#endif
|
|
||||||
#elif defined(__PTRDIFF_TYPE__)
|
|
||||||
typedef __PTRDIFF_TYPE__ __intptr_t;
|
|
||||||
typedef unsigned __PTRDIFF_TYPE__ __uintptr_t;
|
|
||||||
#else
|
|
||||||
typedef long __intptr_t;
|
|
||||||
typedef unsigned long __uintptr_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef __EXP
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software
|
* Permission to use, copy, modify, and distribute this software
|
||||||
* is freely granted, provided that this notice is preserved.
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*
|
||||||
|
* Modified for xtensa arch & non-long int32_t, removes automatic setting of __have_long32.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SYS__INTSUP_H
|
#ifndef _SYS__INTSUP_H
|
||||||
|
|
@ -11,26 +13,8 @@
|
||||||
|
|
||||||
#include <sys/features.h>
|
#include <sys/features.h>
|
||||||
|
|
||||||
#if __GNUC_PREREQ (3, 2)
|
|
||||||
/* gcc > 3.2 implicitly defines the values we are interested */
|
|
||||||
#define __STDINT_EXP(x) __##x##__
|
#define __STDINT_EXP(x) __##x##__
|
||||||
#else
|
|
||||||
#define __STDINT_EXP(x) x
|
|
||||||
#include <limits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check if "long long" is 64bit wide */
|
|
||||||
/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
|
|
||||||
#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
|
|
||||||
|| ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
|
|
||||||
#define __have_longlong64 1
|
#define __have_longlong64 1
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check if "long" is 64bit or 32bit wide */
|
|
||||||
#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
|
|
||||||
#define __have_long64 1
|
|
||||||
#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
|
|
||||||
#define __have_long32 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _SYS__INTSUP_H */
|
#endif /* _SYS__INTSUP_H */
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue