Update tools to latest IDF

This commit is contained in:
me-no-dev
2016-11-13 17:23:44 +02:00
parent f0b7959425
commit 7e0811ec56
131 changed files with 14619 additions and 766 deletions

View File

@ -20,22 +20,21 @@
//and all variables in shared RAM. These macros can be used to redirect
//particular functions/variables to other memory regions.
// Forces code into IRAM instead of flash
// Forces code into IRAM instead of flash.
#define IRAM_ATTR __attribute__((section(".iram1")))
// Forces data into DRAM instead of flash
#define DRAM_ATTR __attribute__((section(".dram1")))
// Forces code into RTC fast memory
// Forces code into RTC fast memory. See "docs/deep-sleep-stub.rst"
#define RTC_IRAM_ATTR __attribute__((section(".rtc.text")))
// Forces data into RTC slow memory
// Forces data into RTC slow memory. See "docs/deep-sleep-stub.rst"
// Any variable marked with this attribute will keep its value
// during a deep sleep / wake cycle.
#define RTC_DATA_ATTR __attribute__((section(".rtc.data")))
// Forces read-only data into RTC slow memory
// Makes constant data available to RTC wake stubs (see esp_deepsleep.h)
// Forces read-only data into RTC slow memory. See "docs/deep-sleep-stub.rst"
#define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata")))
#endif /* __ESP_ATTR_H__ */

View File

@ -0,0 +1,42 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_CROSSCORE_INT_H
#define __ESP_CROSSCORE_INT_H
/**
* Initialize the crosscore interrupt system for this CPU.
* This needs to be called once on every CPU that is used
* by FreeRTOS.
*
* If multicore FreeRTOS support is enabled, this will be
* called automatically by the startup code and should not
* be called manually.
*/
void esp_crosscore_int_init();
/**
* Send an interrupt to a CPU indicating it should yield its
* currently running task in favour of a higher-priority task
* that presumably just woke up.
*
* This is used internally by FreeRTOS in multicore mode
* and should not be called by the user.
*
* @param coreID Core that should do the yielding
*/
void esp_crosscore_int_send_yield(int coreId);
#endif

View File

@ -54,37 +54,7 @@ void system_deep_sleep(uint64_t time_in_us);
* to run code immediately when the chip wakes from
* sleep.
*
* For example:
* @code
* void RTC_IRAM_ATTR esp_wake_deep_sleep(void) {
* esp_default_wake_deep_sleep();
* // Add additional functionality here
* }
*
* (Implementing this function is not required for normal operation,
* in the usual case your app will start normally when waking from
* deep sleep.)
*
* esp_wake_deep_sleep() functionality is limited:
*
* - Runs immediately on wake, so most of the SoC is freshly reset -
* flash is unmapped and hardware is otherwise uninitialised.
*
* - Can only call functions implemented in ROM, or marked RTC_IRAM_ATTR.
*
* - Static variables marked RTC_DATA_ATTR will have initial values on
* cold boot, and maintain these values between sleep/wake cycles.
*
* - Read-only data should be marked RTC_RODATA_ATTR. Strings must be
* declared as variables also using RTC_RODATA_ATTR, like this:
* RTC_RODATA_ATTR const char message[] = "Hello from very early boot!\n";
*
* - Any other static memory will not be initialised (either to zero,
* or to any predefined value).
*
*
* - If you implement your own stub, the first call the stub makes
should be to esp_default_wake_deep_sleep().
* See docs/deep-sleep-stub.rst for details.
*/
void esp_wake_deep_sleep(void);
@ -115,9 +85,7 @@ esp_deep_sleep_wake_stub_fn_t esp_get_deep_sleep_wake_stub(void);
/* The default esp-idf-provided esp_wake_deep_sleep() stub.
If you replace esp_wake_deep_sleep() in your program, or use
esp_set_deep_sleep_wake_stub(), then it is recommended you call
esp_default_wake_deep_sleep() as the first function in your stub.
See docs/deep-sleep-stub.rst for details.
*/
void esp_default_wake_deep_sleep(void);

View File

@ -31,6 +31,13 @@ typedef int32_t esp_err_t;
#define ESP_ERR_NO_MEM 0x101
#define ESP_ERR_INVALID_ARG 0x102
#define ESP_ERR_INVALID_STATE 0x103
#define ESP_ERR_INVALID_SIZE 0x104
#define ESP_ERR_NOT_FOUND 0x105
#define ESP_ERR_NOT_SUPPORTED 0x106
#define ESP_ERR_TIMEOUT 0x107
#define ESP_ERR_WIFI_BASE 0x3000 /*!< Starting number of WiFi error codes */
/**
* Macro which can be used to check the error code,

View File

@ -0,0 +1,106 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_BIN_TYPES_H__
#define __ESP_BIN_TYPES_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define ESP_PARTITION_TABLE_ADDR 0x4000
#define ESP_PARTITION_MAGIC 0x50AA
/* SPI flash mode, used in esp_image_header_t */
typedef enum {
ESP_IMAGE_SPI_MODE_QIO,
ESP_IMAGE_SPI_MODE_QOUT,
ESP_IMAGE_SPI_MODE_DIO,
ESP_IMAGE_SPI_MODE_DOUT,
ESP_IMAGE_SPI_MODE_FAST_READ,
ESP_IMAGE_SPI_MODE_SLOW_READ
} esp_image_spi_mode_t;
/* SPI flash clock frequency */
enum {
ESP_IMAGE_SPI_SPEED_40M,
ESP_IMAGE_SPI_SPEED_26M,
ESP_IMAGE_SPI_SPEED_20M,
ESP_IMAGE_SPI_SPEED_80M = 0xF
} esp_image_spi_freq_t;
/* Supported SPI flash sizes */
typedef enum {
ESP_IMAGE_FLASH_SIZE_1MB = 0,
ESP_IMAGE_FLASH_SIZE_2MB,
ESP_IMAGE_FLASH_SIZE_4MB,
ESP_IMAGE_FLASH_SIZE_8MB,
ESP_IMAGE_FLASH_SIZE_16MB,
ESP_IMAGE_FLASH_SIZE_MAX
} esp_image_flash_size_t;
/* Main header of binary image */
typedef struct {
uint8_t magic;
uint8_t blocks;
uint8_t spi_mode; /* flash read mode (esp_image_spi_mode_t as uint8_t) */
uint8_t spi_speed: 4; /* flash frequency (esp_image_spi_freq_t as uint8_t) */
uint8_t spi_size: 4; /* flash chip size (esp_image_flash_size_t as uint8_t) */
uint32_t entry_addr;
uint8_t encrypt_flag; /* encrypt flag */
uint8_t secure_boot_flag; /* secure boot flag */
uint8_t extra_header[14]; /* ESP32 additional header, unused by second bootloader */
} esp_image_header_t;
/* Header of binary image segment */
typedef struct {
uint32_t load_addr;
uint32_t data_len;
} esp_image_section_header_t;
/* OTA selection structure (two copies in the OTA data partition.)
Size of 32 bytes is friendly to flash encryption */
typedef struct {
uint32_t ota_seq;
uint8_t seq_label[24];
uint32_t crc; /* CRC32 of ota_seq field only */
} esp_ota_select_entry_t;
typedef struct {
uint32_t offset;
uint32_t size;
} esp_partition_pos_t;
/* Structure which describes the layout of partition table entry.
* See docs/partition_tables.rst for more information about individual fields.
*/
typedef struct {
uint16_t magic;
uint8_t type;
uint8_t subtype;
esp_partition_pos_t pos;
uint8_t label[16];
uint8_t reserved[4];
} esp_partition_info_t;
#ifdef __cplusplus
}
#endif
#endif //__ESP_BIN_TYPES_H__

View File

@ -32,6 +32,13 @@ extern "C" {
* @{
*/
/**
* @attention application don't need to call this function anymore. It do nothing and will
* be removed in future version.
*/
void system_init(void) __attribute__ ((deprecated));
/**
* @brief Get information of the SDK version.
*
@ -169,8 +176,6 @@ bool system_rtc_mem_write(uint16_t dst, const void *src, uint16_t n);
esp_err_t system_efuse_read_mac(uint8_t mac[6]);
void system_init(void);
/**
* @}
*/

View File

@ -70,6 +70,24 @@
extern "C" {
#endif
#define ESP_ERR_WIFI_OK ESP_OK /*!< No error */
#define ESP_ERR_WIFI_FAIL ESP_FAIL /*!< General fail code */
#define ESP_ERR_WIFI_NO_MEM ESP_ERR_NO_MEM /*!< Out of memory */
#define ESP_ERR_WIFI_ARG ESP_ERR_INVALID_ARG /*!< Invalid argument */
#define ESP_ERR_WIFI_NOT_SUPPORT ESP_ERR_NOT_SUPPORTED /*!< Indicates that API is not supported yet */
#define ESP_ERR_WIFI_NOT_INIT (ESP_ERR_WIFI_BASE + 1) /*!< WiFi driver is not installed by esp_wifi_init */
#define ESP_ERR_WIFI_NOT_START (ESP_ERR_WIFI_BASE + 2) /*!< WiFi driver is not started by esp_wifi_start */
#define ESP_ERR_WIFI_IF (ESP_ERR_WIFI_BASE + 3) /*!< WiFi interface error */
#define ESP_ERR_WIFI_MODE (ESP_ERR_WIFI_BASE + 4) /*!< WiFi mode error */
#define ESP_ERR_WIFI_STATE (ESP_ERR_WIFI_BASE + 5) /*!< WiFi internal state error */
#define ESP_ERR_WIFI_CONN (ESP_ERR_WIFI_BASE + 6) /*!< WiFi internal control block of station or soft-AP error */
#define ESP_ERR_WIFI_NVS (ESP_ERR_WIFI_BASE + 7) /*!< WiFi internal NVS module error */
#define ESP_ERR_WIFI_MAC (ESP_ERR_WIFI_BASE + 8) /*!< MAC address is invalid */
#define ESP_ERR_WIFI_SSID (ESP_ERR_WIFI_BASE + 9) /*!< SSID is invalid */
#define ESP_ERR_WIFI_PASSWORD (ESP_ERR_WIFI_BASE + 10) /*!< Passord is invalid */
#define ESP_ERR_WIFI_TIMEOUT (ESP_ERR_WIFI_BASE + 11) /*!< Timeout error */
typedef struct {
system_event_handler_t event_handler; /**< WiFi event handler */
} wifi_init_config_t;
@ -92,8 +110,10 @@ typedef struct {
*
* @param wifi_init_config_t *config : provide WiFi init configuration
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NO_MEM : out of memory
* - others : refer to error code esp_err.h
*/
esp_err_t esp_wifi_init(wifi_init_config_t *config);
@ -104,7 +124,6 @@ esp_err_t esp_wifi_init(wifi_init_config_t *config);
* @attention 1. This API should be called if you want to remove WiFi driver from the system
*
* @return ESP_OK : succeed
* @return others : fail
*/
esp_err_t esp_wifi_deinit(void);
@ -116,8 +135,11 @@ esp_err_t esp_wifi_deinit(void);
*
* @param wifi_mode_t mode : WiFi operating modes:
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - others : refer to error code in esp_err.h
*/
esp_err_t esp_wifi_set_mode(wifi_mode_t mode);
@ -126,8 +148,10 @@ esp_err_t esp_wifi_set_mode(wifi_mode_t mode);
*
* @param wifi_mode_t *mode : store current WiFi mode
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
@ -139,8 +163,13 @@ esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
*
* @param null
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_NO_MEM : out of memory
* - ESP_ERR_WIFI_CONN : WiFi internal error, station or soft-AP control block wrong
* - ESP_ERR_WIFI_FAIL : other WiFi internal errors
*/
esp_err_t esp_wifi_start(void);
@ -152,8 +181,9 @@ esp_err_t esp_wifi_start(void);
*
* @param null
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
*/
esp_err_t esp_wifi_stop(void);
@ -165,8 +195,12 @@ esp_err_t esp_wifi_stop(void);
*
* @param null
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_NOT_START : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_CONN : WiFi internal error, station or soft-AP control block wrong
* - ESP_ERR_WIFI_SSID : SSID of AP which station connects is invalid
*/
esp_err_t esp_wifi_connect(void);
@ -175,8 +209,11 @@ esp_err_t esp_wifi_connect(void);
*
* @param null
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_NOT_START : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_FAIL : other WiFi internal errors
*/
esp_err_t esp_wifi_disconnect(void);
@ -185,8 +222,9 @@ esp_err_t esp_wifi_disconnect(void);
*
* @param null
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - others : fail
*/
esp_err_t esp_wifi_clear_fast_connect(void);
@ -195,8 +233,12 @@ esp_err_t esp_wifi_clear_fast_connect(void);
*
* @param uint16_t aid : when aid is 0, deauthenticate all stations, otherwise deauthenticate station whose associated id is aid
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_NOT_START : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_MODE : WiFi mode is wrong
*/
esp_err_t esp_wifi_deauth_sta(uint16_t aid);
@ -211,8 +253,12 @@ esp_err_t esp_wifi_deauth_sta(uint16_t aid);
* @param bool block : if block is true, this API will block the caller until the scan is done, otherwise
* it will return immediately
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_NOT_START : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_TIMEOUT : blocking scan is timeout
* - others : refer to error code in esp_err.h
*/
esp_err_t esp_wifi_scan_start(wifi_scan_config_t *conf, bool block);
@ -220,8 +266,10 @@ esp_err_t esp_wifi_scan_start(wifi_scan_config_t *conf, bool block);
* @brief Stop the scan in process
*
* @param null
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_NOT_START : WiFi is not started by esp_wifi_start
*/
esp_err_t esp_wifi_scan_stop(void);
@ -232,8 +280,11 @@ esp_err_t esp_wifi_scan_stop(void);
*
* @attention This API can only be called when the scan is completed, otherwise it may get wrong value
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_NOT_START : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
@ -244,8 +295,12 @@ esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number);
the actual AP number this API returns
* @param wifi_ap_record_t *ap_records: wifi_ap_record_t array to hold the found APs
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_NOT_START : WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_NO_MEM : out of memory
*/
esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);
@ -255,8 +310,9 @@ esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_re
*
* @param wifi_ap_record_t *ap_info: the wifi_ap_record_t to hold station assocated AP
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - others : fail
*/
esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);
@ -265,8 +321,7 @@ esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);
*
* @param wifi_ps_type_t type : power save type
*
* @return ESP_OK : succeed
* @return others : fail
* @return ESP_ERR_WIFI_NOT_SUPPORT : not support yet
*/
esp_err_t esp_wifi_set_ps(wifi_ps_type_t type);
@ -275,8 +330,7 @@ esp_err_t esp_wifi_set_ps(wifi_ps_type_t type);
*
* @param wifi_ps_type_t *type : store current power save type
*
* @return ESP_OK : succeed
* @return others : fail
* @return ESP_ERR_WIFI_NOT_SUPPORT : not support yet
*/
esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
@ -289,8 +343,11 @@ esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
* @param wifi_interface_t ifx : interfaces
* @param uint8_t protocol : WiFi protocol bitmap
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_IF : invalid interface
* - others : refer to erro code in esp_err.h
*/
esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
@ -300,8 +357,12 @@ esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
* @param wifi_interface_t ifx : interfaces
* @param uint8_t protocol : store current WiFi protocol bitmap of interface ifx
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_IF : invalid interface
* - ESP_ERR_WIFI_ARG : invalid argument
* - others : refer to error code in esp_err.h
*/
esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
@ -314,8 +375,12 @@ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
* @param wifi_interface_t ifx : interface to be configured
* @param wifi_bandwidth_t bw : bandwidth
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_IF : invalid interface
* - ESP_ERR_WIFI_ARG : invalid argument
* - others : refer to error code in esp_err.h
*/
esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
@ -327,8 +392,11 @@ esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
* @param wifi_interface_t ifx : interface to be configured
* @param wifi_bandwidth_t *bw : store bandwidth of interface ifx
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_IF : invalid interface
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
@ -340,8 +408,11 @@ esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
* @param uint8_t primary : for HT20, primary is the channel number, for HT40, primary is the primary channel
* @param wifi_second_chan_t second : for HT20, second is ignored, for HT40, second is the second channel
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_IF : invalid interface
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
@ -353,8 +424,10 @@ esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
* @param uint8_t *primary : store current primary channel
* @param wifi_second_chan_t *second : store current second channel
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
@ -364,8 +437,11 @@ esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
*
* @param wifi_country_t country : country type
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - others : refer to error code in esp_err.h
*/
esp_err_t esp_wifi_set_country(wifi_country_t country);
@ -374,8 +450,10 @@ esp_err_t esp_wifi_set_country(wifi_country_t country);
*
* @param wifi_country_t country : store current country
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_get_country(wifi_country_t *country);
@ -390,8 +468,14 @@ esp_err_t esp_wifi_get_country(wifi_country_t *country);
* @param wifi_interface_t ifx : interface
* @param uint8 mac[6]: the MAC address.
*
* @return true : succeed
* @return false : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_IF : invalid interface
* - ESP_ERR_WIFI_MAC : invalid mac address
* - ESP_ERR_WIFI_MODE : WiFi mode is wrong
* - others : refer to error code in esp_err.h
*/
esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, uint8_t mac[6]);
@ -400,8 +484,11 @@ esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, uint8_t mac[6]);
*
* @param uint8_t mac[6] : store mac of this interface ifx
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_IF : invalid interface
*/
esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);
@ -413,8 +500,7 @@ esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);
* @param void *buf : the data received
* @param uint16_t len : data length
*
* @return ESP_OK : succeed
* @return others : fail
* @return none
*/
typedef void (* wifi_promiscuous_cb_t)(void *buf, uint16_t len);
@ -425,8 +511,9 @@ typedef void (* wifi_promiscuous_cb_t)(void *buf, uint16_t len);
*
* @param wifi_promiscuous_cb_t cb : callback
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
*/
esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
@ -435,8 +522,9 @@ esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
*
* @param bool promiscuous : false - disable / true - enable
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
*/
esp_err_t esp_wifi_set_promiscuous(bool en);
@ -445,8 +533,10 @@ esp_err_t esp_wifi_set_promiscuous(bool en);
*
* @param bool *enable : store the current status of promiscuous mode
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_get_promiscuous(bool *en);
@ -461,8 +551,15 @@ esp_err_t esp_wifi_get_promiscuous(bool *en);
* @param wifi_interface_t ifx : interface
* @param wifi_config_t *conf : station or soft-AP configuration
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_IF : invalid interface
* - ESP_ERR_WIFI_MODE : invalid mode
* - ESP_ERR_WIFI_PASSWORD : invalid password
* - ESP_ERR_WIFI_NVS : WiFi internal NVS error
* - others : refer to the erro code in esp_err.h
*/
esp_err_t esp_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf);
@ -472,8 +569,11 @@ esp_err_t esp_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf);
* @param wifi_interface_t ifx : interface
* @param wifi_config_t *conf : station or soft-AP configuration
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_IF : invalid interface
*/
esp_err_t esp_wifi_get_config(wifi_interface_t ifx, wifi_config_t *conf);
@ -484,8 +584,12 @@ esp_err_t esp_wifi_get_config(wifi_interface_t ifx, wifi_config_t *conf);
*
* @param wifi_sta_list_t *sta: station list
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_MODE : WiFi mode is wrong
* - ESP_ERR_WIFI_CONN : WiFi internal error, the station/soft-AP control block is invalid
*/
esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
@ -497,42 +601,24 @@ esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
*
* @param wifi_storage_t storage : storage type
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_set_storage(wifi_storage_t storage);
/**
* @brief The WiFi RX callback function
*
* Each time the WiFi need to forward the packets to high layer, the callback function will be called
*
*/
typedef esp_err_t (*wifi_rxcb_t)(void *buffer, uint16_t len, void *eb);
/**
* @brief Set the WiFi RX callback
*
* @attention 1. Currently we support only one RX callback for each interface
*
* @param wifi_interface_t ifx : interface
* @param wifi_rxcb_t fn : WiFi RX callback
*
* @return ESP_OK : succeed
* @return others : fail
*/
esp_err_t esp_wifi_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn);
/**
* @brief Set auto connect
* The default value is true
*
* @attention 1.
*
* @param bool en : true - enable auto connect / false - disable auto connect
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_MODE : WiFi internal error, the station/soft-AP control block is invalid
* - others : refer to error code in esp_err.h
*/
esp_err_t esp_wifi_set_auto_connect(bool en);
@ -541,8 +627,10 @@ esp_err_t esp_wifi_set_auto_connect(bool en);
*
* @param bool *en : store current auto connect configuration
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
*/
esp_err_t esp_wifi_get_auto_connect(bool *en);
@ -559,8 +647,11 @@ esp_err_t esp_wifi_get_auto_connect(bool *en);
1 - WIFI_VND_IE_ID_1
* @param uint8_t *vnd_ie : pointer to a vendor specific element
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
* - ESP_ERR_WIFI_ARG : invalid argument
* - ESP_ERR_WIFI_NO_MEM : out of memory
*/
esp_err_t esp_wifi_set_vendor_ie(bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, uint8_t *vnd_ie);
@ -584,8 +675,9 @@ typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const
* @param esp_vendor_ie_cb_t cb : callback function
* @param void *ctx : reserved
*
* @return ESP_OK : succeed
* @return others : fail
* @return
* - ESP_OK : succeed
* - ESP_ERR_WIFI_NOT_INIT : WiFi is not initialized by eps_wifi_init
*/
esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);

View File

@ -62,16 +62,48 @@ void esp_wifi_internal_free_rx_buffer(void* buffer);
/**
* @brief transmit the buffer via wifi driver
*
* @attention1 TODO should modify the return type from bool to int
*
* @param wifi_interface_t wifi_if : wifi interface id
* @param void *buffer : the buffer to be tansmit
* @param u16_t len : the length of buffer
*
* @return True : success transmit the buffer to wifi driver
* False : failed to transmit the buffer to wifi driver
* @return
* - ERR_OK : Successfully transmit the buffer to wifi driver
* - ERR_MEM : Out of memory
* - ERR_IF : WiFi driver error
* - ERR_ARG : Invalid argument
*/
bool esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, u16_t len);
int esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, u16_t len);
/**
* @brief The WiFi RX callback function
*
* Each time the WiFi need to forward the packets to high layer, the callback function will be called
*
*/
typedef esp_err_t (*wifi_rxcb_t)(void *buffer, uint16_t len, void *eb);
/**
* @brief Set the WiFi RX callback
*
* @attention 1. Currently we support only one RX callback for each interface
*
* @param wifi_interface_t ifx : interface
* @param wifi_rxcb_t fn : WiFi RX callback
*
* @return ESP_OK : succeed
* @return others : fail
*/
esp_err_t esp_wifi_internal_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn);
/**
* @brief Notify WIFI driver that the station got ip successfully
*
* @param none
*
* @return ESP_OK : succeed
* @return others : fail
*/
esp_err_t esp_wifi_internal_set_sta_ip(void);
#ifdef __cplusplus
}

View File

@ -154,10 +154,10 @@ typedef struct {
uint8_t mac[6]; /**< mac address of sta that associated with ESP32 soft-AP */
}wifi_sta_info_t;
#define ESP_WIFI_MAX_CONN_NUM (8+2) /**< max number of sta the eSP32 soft-AP can connect */
#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32 soft-AP */
typedef struct {
wifi_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< station list */
uint8_t num; /**< number of station that associated with ESP32 soft-AP */
int num; /**< number of station that associated with ESP32 soft-AP */
}wifi_sta_list_t;
typedef enum {

View File

@ -3830,6 +3830,11 @@
#define DPORT_DATE_S 0
#define DPORT_DPORT_DATE_VERSION 0x1605190
/* Flash MMU table for PRO CPU */
#define DPORT_PRO_FLASH_MMU_TABLE ((volatile uint32_t*) 0x3FF10000)
/* Flash MMU table for APP CPU */
#define DPORT_APP_FLASH_MMU_TABLE ((volatile uint32_t*) 0x3FF12000)

View File

@ -0,0 +1,49 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _SOC_FRC_TIMER_REG_H_
#define _SOC_FRC_TIMER_REG_H_
#include "soc.h"
/**
* These are the register definitions for "legacy" timers
*/
#define REG_FRC_TIMER_BASE(i) (DR_REG_FRC_TIMER_BASE + i*0x20)
#define FRC_TIMER_LOAD_REG(i) (REG_FRC_TIMER_BASE(i) + 0x0) // timer load value (23 bit for i==0, 32 bit for i==1)
#define FRC_TIMER_LOAD_VALUE(i) ((i == 0)?0x007FFFFF:0xffffffff)
#define FRC_TIMER_LOAD_VALUE_S 0
#define FRC_TIMER_COUNT_REG(i) (REG_FRC_TIMER_BASE(i) + 0x4) // timer count value (23 bit for i==0, 32 bit for i==1)
#define FRC_TIMER_COUNT ((i == 0)?0x007FFFFF:0xffffffff)
#define FRC_TIMER_COUNT_S 0
#define FRC_TIMER_CTRL_REG(i) (REG_FRC_TIMER_BASE(i) + 0x8)
#define FRC_TIMER_INT_ENABLE (BIT(8)) // enable interrupt
#define FRC_TIMER_ENABLE (BIT(7)) // enable timer
#define FRC_TIMER_AUTOLOAD (BIT(6)) // enable autoload
#define FRC_TIMER_PRESCALER 0x00000007 // 0: divide by 1, 2: divide by 16, 4: divide by 256
#define FRC_TIMER_PRESCALER_S 1
#define FRC_TIMER_EDGE_INT (BIT(0)) // 0: level, 1: edge
#define FRC_TIMER_INT_REG(i) (REG_FRC_TIMER_BASE(i) + 0xC)
#define FRC_TIMER_INT_CLR (BIT(0)) // clear interrupt
#define FRC_TIMER_ALARM_REG(i) (REG_FRC_TIMER_BASE(i) + 0x10) // timer alarm value; register only present for i == 1
#define FRC_TIMER_ALARM 0xFFFFFFFF
#define FRC_TIMER_ALARM_S 0
#endif //_SOC_FRC_TIMER_REG_H_

View File

@ -231,11 +231,10 @@ typedef volatile struct {
struct {
union {
struct {
uint32_t level1: 1;
uint32_t duration1: 15;
uint32_t level0: 1;
uint32_t duration0: 15;
uint32_t level0: 1;
uint32_t duration1: 15;
uint32_t level1: 1;
};
uint32_t val;
} data[64];

View File

@ -239,6 +239,9 @@
#define RTC_CNTL_TIME_VALID_V 0x1
#define RTC_CNTL_TIME_VALID_S 30
/* frequency of RTC slow clock, Hz */
#define RTC_CTNL_SLOWCLK_FREQ 150000
#define RTC_CNTL_TIME0_REG (DR_REG_RTCCNTL_BASE + 0x10)
/* RTC_CNTL_TIME_LO : RO ;bitpos:[31:0] ;default: 32'h0 ; */
/*description: RTC timer low 32 bits*/

View File

@ -148,6 +148,7 @@
#define DR_REG_GPIO_SD_BASE 0x3ff44f00
#define DR_REG_FE2_BASE 0x3ff45000
#define DR_REG_FE_BASE 0x3ff46000
#define DR_REG_FRC_TIMER_BASE 0x3ff47000
#define DR_REG_RTCCNTL_BASE 0x3ff48000
#define DR_REG_RTCIO_BASE 0x3ff48400
#define DR_REG_SARADC_BASE 0x3ff48800
@ -281,9 +282,9 @@
* 19 2 extern level
* 20 2 extern level
* 21 2 extern level
* 22 3 extern edge
* 22 3 extern edge FRC1 timer
* 23 3 extern level
* 24 4 extern level
* 24 4 extern level TG1_WDT
* 25 4 extern level Reserved Reserved
* 26 5 extern level Reserved Reserved
* 27 3 extern level Reserved Reserved
@ -301,8 +302,10 @@
#define ETS_T0_WDT_INUM 3
#define ETS_WBB_INUM 4
#define ETS_TG0_T1_INUM 10 /**< use edge interrupt*/
#define ETS_FRC1_INUM 22
#define ETS_T1_WDT_INUM 24
//CPU0 Intrrupt number used in ROM, should be cancelled in SDK
//CPU0 Interrupt number used in ROM, should be cancelled in SDK
#define ETS_SLC_INUM 1
#define ETS_UART0_INUM 5
#define ETS_UART1_INUM 5

View File

@ -18,8 +18,10 @@
#include "soc.h"
#define REG_UART_BASE( i ) (DR_REG_UART_BASE + (i) * 0x10000 + ( i > 1 ? 0xe000 : 0 ) )
#define REG_UART_AHB_BASE(i) (0x60000000 + (i) * 0x10000 + ( i > 1 ? 0xe000 : 0 ) )
#define UART_FIFO_AHB_REG(i) (REG_UART_AHB_BASE(i) + 0x0)
#define UART_FIFO_REG(i) (REG_UART_BASE(i) + 0x0)
/* UART_RXFIFO_RD_BYTE : RO ;bitpos:[7:0] ;default: 8'b0 ; */
/*description: This register stores one byte data read by rx fifo.*/
#define UART_RXFIFO_RD_BYTE 0x000000FF