fix: Fix all files when change to use standard typedef

This commit is contained in:
Wu Jian Gang
2018-05-24 17:39:25 +08:00
parent 27892430ee
commit 91f7080231
42 changed files with 435 additions and 372 deletions

View File

@ -15,8 +15,11 @@
#include <stdint.h>
#include "c_types.h"
#include "esp8266/eagle_soc.h"
#include "esp8266/pin_mux_register.h"
#include "esp8266/ets_sys.h"
#include "FreeRTOS.h"

View File

@ -19,6 +19,7 @@
#include "esp8266/pin_mux_register.h"
#include "esp8266/uart_register.h"
#include "esp8266/rom_functions.h"
#include "esp8266/ets_sys.h"
#include "esp_misc.h"

View File

@ -35,11 +35,11 @@ extern "C" {
#define BIT(nr) (1UL << (nr))
#define REG_WRITE(_r, _v) (*(volatile uint32 *)(_r)) = (_v)
#define REG_READ(_r) (*(volatile uint32 *)(_r))
#define REG_WRITE(_r, _v) (*(volatile uint32_t *)(_r)) = (_v)
#define REG_READ(_r) (*(volatile uint32_t *)(_r))
#define REG_SET_BIT(_r, _b) (*(volatile uint32 *)(_r) |= (_b))
#define REG_CLR_BIT(_r, _b) (*(volatile uint32 *)(_r) &= ~(_b))
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t *)(_r) |= (_b))
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t *)(_r) &= ~(_b))
#ifdef __cplusplus
}

View File

@ -27,6 +27,8 @@
#include <stdint.h>
#include "c_types.h"
/* interrupt related */
#define ETS_SPI_INUM 2
#define ETS_GPIO_INUM 4

View File

@ -25,6 +25,8 @@
#ifndef __ESP_MISC_H__
#define __ESP_MISC_H__
#include <stdint.h>
#include "lwip/ip_addr.h"
#ifdef __cplusplus
@ -52,11 +54,11 @@ extern "C" {
/**
* @brief Delay function, maximum value: 65535 us.
*
* @param uint16 us : delay time, uint: us, maximum value: 65535 us
* @param uint16_t us : delay time, uint: us, maximum value: 65535 us
*
* @return null
*/
void os_delay_us(uint16 us);
void os_delay_us(uint16_t us);
/**
* @brief Register the print output function.

View File

@ -25,6 +25,9 @@
#ifndef __ESP_SOFTAP_H__
#define __ESP_SOFTAP_H__
#include <stdint.h>
#include <stdbool.h>
#include "queue.h"
#ifdef __cplusplus
@ -49,20 +52,20 @@ extern "C" {
*/
struct softap_config {
uint8 ssid[32]; /**< SSID of ESP8266 soft-AP */
uint8 password[64]; /**< Password of ESP8266 soft-AP */
uint8 ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
uint8 channel; /**< Channel of ESP8266 soft-AP */
uint8_t ssid[32]; /**< SSID of ESP8266 soft-AP */
uint8_t password[64]; /**< Password of ESP8266 soft-AP */
uint8_t ssid_len; /**< Length of SSID. If softap_config.ssid_len==0, check the SSID until there is a termination character; otherwise, set the SSID length according to softap_config.ssid_len. */
uint8_t channel; /**< Channel of ESP8266 soft-AP */
AUTH_MODE authmode; /**< Auth mode of ESP8266 soft-AP. Do not support AUTH_WEP in soft-AP mode */
uint8 ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8 max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */
uint16 beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 */
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8_t max_connection; /**< Max number of stations allowed to connect in, default 4, max 4 */
uint16_t beacon_interval; /**< Beacon interval, 100 ~ 60000 ms, default 100 */
};
struct station_info {
STAILQ_ENTRY(station_info) next; /**< Information of next AP */
uint8 bssid[6]; /**< BSSID of AP */
uint8_t bssid[6]; /**< BSSID of AP */
struct ip4_addr ip; /**< IP address of AP */
};
@ -127,7 +130,7 @@ bool wifi_softap_set_config_current(struct softap_config *config);
*
* @return the number of stations connected to the ESP8266 soft-AP
*/
uint8 wifi_softap_get_station_num(void);
uint8_t wifi_softap_get_station_num(void);
/**
* @brief Get the information of stations connected to the ESP8266 soft-AP,
@ -230,7 +233,7 @@ bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please);
*
* @return lease time, uint: minute.
*/
uint32 wifi_softap_get_dhcps_lease_time(void);
uint32_t wifi_softap_get_dhcps_lease_time(void);
/**
* @brief Set ESP8266 soft-AP DHCP server lease time, default is 120 minutes.
@ -242,7 +245,7 @@ uint32 wifi_softap_get_dhcps_lease_time(void);
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_dhcps_lease_time(uint32 minute);
bool wifi_softap_set_dhcps_lease_time(uint32_t minute);
/**
* @brief Reset ESP8266 soft-AP DHCP server lease time which is 120 minutes by default.
@ -273,7 +276,7 @@ bool wifi_softap_reset_dhcps_lease_time(void);
* @return true : succeed
* @return false : fail
*/
bool wifi_softap_set_dhcps_offer_option(uint8 level, void *optarg);
bool wifi_softap_set_dhcps_offer_option(uint8_t level, void *optarg);
/**
* @}

View File

@ -25,6 +25,8 @@
#ifndef __ESP_SSC_H__
#define __ESP_SSC_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -34,8 +36,8 @@ extern "C" {
typedef struct cmd_s {
char *cmd_str;
uint8 flag;
uint8 id;
uint8_t flag;
uint8_t id;
void (* cmd_func)(void);
void (* cmd_callback)(void *arg);
} ssc_cmd_t;
@ -112,7 +114,7 @@ int ssc_parse_param(char *pLine, char *argv[]);
*
* @return null
*/
void ssc_register(ssc_cmd_t *cmdset, uint8 cmdnum, void (* help)(void));
void ssc_register(ssc_cmd_t *cmdset, uint8_t cmdnum, void (* help)(void));
/**
* @}

View File

@ -25,8 +25,12 @@
#ifndef __ESP_STA_H__
#define __ESP_STA_H__
#include <stdbool.h>
#include <stdint.h>
#include "queue.h"
#include "esp_wifi.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -50,10 +54,10 @@ extern "C" {
*/
struct station_config {
uint8 ssid[32]; /**< SSID of target AP*/
uint8 password[64]; /**< password of target AP*/
uint8 bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8 bssid[6]; /**< MAC address of target AP*/
uint8_t ssid[32]; /**< SSID of target AP*/
uint8_t password[64]; /**< password of target AP*/
uint8_t bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8_t bssid[6]; /**< MAC address of target AP*/
};
/**
@ -162,12 +166,12 @@ typedef union {
} wifi_scan_time_t;
struct scan_config {
uint8 *ssid; /**< SSID of AP */
uint8 *bssid; /**< MAC address of AP */
uint8 channel; /**< channel, scan the specific channel */
uint8 show_hidden; /**< enable to scan AP whose SSID is hidden */
wifi_scan_type_t scan_type; /**< scan type, active or passive */
wifi_scan_time_t scan_time; /**< scan time per channel */
uint8_t *ssid; /**< SSID of AP */
uint8_t *bssid; /**< MAC address of AP */
uint8_t channel; /**< channel, scan the specific channel */
uint8_t show_hidden; /**< enable to scan AP whose SSID is hidden */
wifi_scan_type_t scan_type; /**< scan type, active or passive */
wifi_scan_time_t scan_time; /**< scan time per channel */
};
typedef enum {
@ -183,16 +187,16 @@ typedef enum {
struct bss_info {
STAILQ_ENTRY(bss_info) next; /**< information of next AP */
uint8 bssid[6]; /**< MAC address of AP */
uint8 ssid[32]; /**< SSID of AP */
uint8 ssid_len; /**< SSID length */
uint8 channel; /**< channel of AP */
sint8 rssi; /**< single strength of AP */
uint8_t bssid[6]; /**< MAC address of AP */
uint8_t ssid[32]; /**< SSID of AP */
uint8_t ssid_len; /**< SSID length */
uint8_t channel; /**< channel of AP */
int8_t rssi; /**< single strength of AP */
AUTH_MODE authmode; /**< authmode of AP */
uint8 is_hidden; /**< SSID of current AP is hidden or not. */
sint16 freq_offset; /**< frequency offset */
sint16 freqcal_val;
uint8 *esp_mesh_ie;
uint8_t is_hidden; /**< SSID of current AP is hidden or not. */
int16_t freq_offset; /**< frequency offset */
int16_t freqcal_val;
uint8_t *esp_mesh_ie;
CIPHER_TYPE pairwise_cipher; /**< pairwise cipher of AP */
CIPHER_TYPE group_cipher; /**< group cipher of AP */
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
@ -313,17 +317,17 @@ STATION_STATUS wifi_station_get_connect_status(void);
*
* @return The number of APs recorded.
*/
uint8 wifi_station_get_current_ap_id(void);
uint8_t wifi_station_get_current_ap_id(void);
/**
* @brief Switch the ESP8266 station connection to a recorded AP.
*
* @param uint8 new_ap_id : AP's record id, start counting from 0.
* @param uint8_t new_ap_id : AP's record id, start counting from 0.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_ap_change(uint8 current_ap_id);
bool wifi_station_ap_change(uint8_t current_ap_id);
/**
* @brief Set the number of APs that can be recorded in the ESP8266 station.
@ -332,12 +336,12 @@ bool wifi_station_ap_change(uint8 current_ap_id);
*
* @attention This configuration will be saved in the Flash system parameter area if changed.
*
* @param uint8 ap_number : the number of APs that can be recorded (MAX: 5)
* @param uint8_t ap_number : the number of APs that can be recorded (MAX: 5)
*
* @return true : succeed
* @return false : fail
*/
bool wifi_station_ap_number_set(uint8 ap_number);
bool wifi_station_ap_number_set(uint8_t ap_number);
/**
* @brief Get the information of APs (5 at most) recorded by ESP8266 station.
@ -352,7 +356,7 @@ bool wifi_station_ap_number_set(uint8 ap_number);
*
* @return The number of APs recorded.
*/
uint8 wifi_station_get_ap_info(struct station_config config[]);
uint8_t wifi_station_get_ap_info(struct station_config config[]);
/**
* @brief Get rssi of the AP which ESP8266 station connected to.
@ -362,7 +366,7 @@ uint8 wifi_station_get_ap_info(struct station_config config[]);
* @return 31 : fail, invalid value.
* @return others : succeed, value of rssi. In general, rssi value < 10
*/
sint8 wifi_station_get_rssi(void);
int8_t wifi_station_get_rssi(void);
/**
* @brief Enable the ESP8266 station DHCP client.

View File

@ -25,7 +25,8 @@
#ifndef __ESP_SYSTEM_H__
#define __ESP_SYSTEM_H__
#include "c_types.h"
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@ -40,24 +41,24 @@ extern "C" {
*/
typedef enum {
REASON_DEFAULT_RST = 0, /**< normal startup by power on */
REASON_WDT_RST, /**< hardware watch dog reset */
REASON_EXCEPTION_RST, /**< exception reset, GPIO status won't change */
REASON_SOFT_WDT_RST, /**< software watch dog reset, GPIO status won't change */
REASON_SOFT_RESTART, /**< software restart ,system_restart , GPIO status won't change */
REASON_DEEP_SLEEP_AWAKE, /**< wake up from deep-sleep */
REASON_EXT_SYS_RST /**< external system reset */
REASON_DEFAULT_RST = 0, /**< normal startup by power on */
REASON_WDT_RST, /**< hardware watch dog reset */
REASON_EXCEPTION_RST, /**< exception reset, GPIO status won't change */
REASON_SOFT_WDT_RST, /**< software watch dog reset, GPIO status won't change */
REASON_SOFT_RESTART, /**< software restart ,system_restart , GPIO status won't change */
REASON_DEEP_SLEEP_AWAKE, /**< wake up from deep-sleep */
REASON_EXT_SYS_RST /**< external system reset */
} rst_reason;
struct rst_info {
rst_reason reason; /**< enum rst_reason */
uint32 exccause;
uint32 epc1;
uint32 epc2;
uint32 epc3;
uint32 excvaddr;
uint32 depc;
uint32 rtn_addr;
uint32_t exccause;
uint32_t epc1;
uint32_t epc2;
uint32_t epc3;
uint32_t excvaddr;
uint32_t depc;
uint32_t rtn_addr;
};
/**
@ -112,11 +113,11 @@ void system_restart(void);
* up, connect a GPIO to pin RST, the chip will wake up by a falling-edge
* on pin RST
*
* @param uint32 time_in_us : deep-sleep time, unit: microsecond
* @param uint32_t time_in_us : deep-sleep time, unit: microsecond
*
* @return null
*/
void system_deep_sleep(uint32 time_in_us);
void system_deep_sleep(uint32_t time_in_us);
/**
* @brief Call this API before system_deep_sleep to set the activity after the
@ -138,7 +139,7 @@ void system_deep_sleep(uint32 time_in_us);
* @return true : succeed
* @return false : fail
*/
bool system_deep_sleep_set_option(uint8 option);
bool system_deep_sleep_set_option(uint8_t option);
/**
* @brief Get system time, unit: microsecond.
@ -147,7 +148,7 @@ bool system_deep_sleep_set_option(uint8 option);
*
* @return System time, unit: microsecond.
*/
uint32 system_get_time(void);
uint32_t system_get_time(void);
/**
* @brief Print the system memory distribution, including data/rodata/bss/heap.
@ -165,7 +166,7 @@ void system_print_meminfo(void);
*
* @return Available heap size.
*/
uint32 system_get_free_heap_size(void);
uint32_t system_get_free_heap_size(void);
/**
* @brief Get the chip ID.
@ -174,7 +175,7 @@ uint32 system_get_free_heap_size(void);
*
* @return The chip ID.
*/
uint32 system_get_chip_id(void);
uint32_t system_get_chip_id(void);
/**
* @brief Get the RTC clock cycle.
@ -187,7 +188,7 @@ uint32 system_get_chip_id(void);
*
* @return RTC clock period (unit: microsecond), bit11~ bit0 are decimal.
*/
uint32 system_rtc_clock_cali_proc(void);
uint32_t system_rtc_clock_cali_proc(void);
/**
* @brief Get RTC time, unit: RTC clock cycle.
@ -210,7 +211,7 @@ uint32 system_rtc_clock_cali_proc(void);
*
* @return RTC time.
*/
uint32 system_get_rtc_time(void);
uint32_t system_get_rtc_time(void);
/**
* @brief Read user data from the RTC memory.
@ -231,7 +232,7 @@ uint32 system_get_rtc_time(void);
* @return true : succeed
* @return false : fail
*/
bool system_rtc_mem_read(uint8 src, void *dst, uint16 n);
bool system_rtc_mem_read(uint8_t src, void *dst, uint16_t n);
/**
* @brief Write user data to the RTC memory.
@ -254,7 +255,7 @@ bool system_rtc_mem_read(uint8 src, void *dst, uint16 n);
* @return true : succeed
* @return false : fail
*/
bool system_rtc_mem_write(uint8 dst, const void *src, uint16 n);
bool system_rtc_mem_write(uint8_t dst, const void *src, uint16_t n);
/**
* @brief UART0 swap.
@ -295,7 +296,7 @@ void system_uart_de_swap(void);
*
* @return Input voltage of TOUT pin 6, unit : 1/1024 V
*/
uint16 system_adc_read(void);
uint16_t system_adc_read(void);
/**
* @brief Measure the power voltage of VDD3P3 pin 3 and 4, unit : 1/1024 V.
@ -310,7 +311,7 @@ uint16 system_adc_read(void);
*
* @return Power voltage of VDD33, unit : 1/1024 V
*/
uint16 system_get_vdd33(void);
uint16_t system_get_vdd33(void);
/**
* @brief Write data into flash with protection.
@ -333,7 +334,7 @@ uint16 system_get_vdd33(void);
* @return true : succeed
* @return false : fail
*/
bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
bool system_param_save_with_protect(uint16_t start_sec, void *param, uint16_t len);
/**
* @brief Read the data saved into flash with the read/write protection.
@ -358,7 +359,7 @@ bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
* @return true : succeed
* @return false : fail
*/
bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len);
bool system_param_load(uint16_t start_sec, uint16_t offset, void *param, uint16_t len);
/**
* @brief Set the maximum value of RF TX Power, unit : 0.25dBm.
@ -369,7 +370,7 @@ bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len)
*
* @return null
*/
void system_phy_set_max_tpw(uint8 max_tpw);
void system_phy_set_max_tpw(uint8_t max_tpw);
/**
* @brief Adjust the RF TX Power according to VDD33, unit : 1/1024 V.
@ -382,7 +383,7 @@ void system_phy_set_max_tpw(uint8 max_tpw);
*
* @return null
*/
void system_phy_set_tpw_via_vdd33(uint16 vdd33);
void system_phy_set_tpw_via_vdd33(uint16_t vdd33);
/**
* @brief Enable RF or not when wakeup from deep-sleep.
@ -406,7 +407,7 @@ void system_phy_set_tpw_via_vdd33(uint16 vdd33);
*
* @return null
*/
void system_phy_set_rfoption(uint8 option);
void system_phy_set_rfoption(uint8_t option);
/** @addtogroup Upgrade_APIs
* @{
@ -420,7 +421,7 @@ void system_phy_set_rfoption(uint8 option);
* @return 0x00 : UPGRADE_FW_BIN1, i.e. user1.bin
* @return 0x01 : UPGRADE_FW_BIN2, i.e. user2.bin
*/
uint8 system_upgrade_userbin_check(void);
uint8_t system_upgrade_userbin_check(void);
/**
* @brief Reboot system to use the new software.
@ -440,7 +441,7 @@ void system_upgrade_reboot(void);
* @return #define UPGRADE_FLAG_START 0x01
* @return #define UPGRADE_FLAG_FINISH 0x02
*/
uint8 system_upgrade_flag_check();
uint8_t system_upgrade_flag_check();
/**
* @brief Set the upgrade status flag.
@ -456,7 +457,7 @@ uint8 system_upgrade_flag_check();
*
* @return null
*/
void system_upgrade_flag_set(uint8 flag);
void system_upgrade_flag_set(uint8_t flag);
/**
* @}
@ -486,7 +487,7 @@ void system_upgrade_flag_set(uint8 flag);
*
* @return Information of the boot version.
*/
uint8 system_get_boot_version(void);
uint8_t system_get_boot_version(void);
/**
* @brief Get the address of the current running user bin (user1.bin or user2.bin).
@ -495,7 +496,7 @@ uint8 system_get_boot_version(void);
*
* @return The address of the current running user bin.
*/
uint32 system_get_userbin_addr(void);
uint32_t system_get_userbin_addr(void);
/**
* @brief Get the boot mode.
@ -505,7 +506,7 @@ uint32 system_get_userbin_addr(void);
* @return #define SYS_BOOT_ENHANCE_MODE 0
* @return #define SYS_BOOT_NORMAL_MODE 1
*/
uint8 system_get_boot_mode(void);
uint8_t system_get_boot_mode(void);
/**
* @brief Restarts the system, and enters the enhanced boot mode.
@ -516,12 +517,12 @@ uint8 system_get_boot_mode(void);
* @param uint8 bin_type : type of bin
* - #define SYS_BOOT_NORMAL_BIN 0 // user1.bin or user2.bin
* - #define SYS_BOOT_TEST_BIN 1 // can only be Espressif test bin
* @param uint32 bin_addr : starting address of the bin file
* @param uint32_t bin_addr : starting address of the bin file
*
* @return true : succeed
* @return false : fail
*/
bool system_restart_enhance(uint8 bin_type, uint32 bin_addr);
bool system_restart_enhance(uint8_t bin_type, uint32_t bin_addr);
typedef enum {
FLASH_SIZE_4M_MAP_256_256 = 0, /**< Flash size : 4Mbits. Map : 256KBytes + 256KBytes */
@ -565,7 +566,7 @@ flash_size_map system_get_flash_size_map(void);
* @return true : succeed
* @return false : fail
*/
bool system_update_cpu_freq(uint8 freq);
bool system_update_cpu_freq(uint8_t freq);
/**
* @brief Get CPU frequency.
@ -574,7 +575,7 @@ bool system_update_cpu_freq(uint8 freq);
*
* @return CPU frequency, unit : MHz.
*/
uint8 system_get_cpu_freq(void);
uint8_t system_get_cpu_freq(void);
/**
* @}

View File

@ -25,6 +25,9 @@
#ifndef __ESP_TIMER_H__
#define __ESP_TIMER_H__
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -35,8 +38,8 @@ typedef void os_timer_func_t(void *timer_arg);
typedef struct _os_timer_t {
struct _os_timer_t *timer_next;
void *timer_handle;
uint32 timer_expire;
uint32 timer_period;
uint32_t timer_expire;
uint32_t timer_period;
os_timer_func_t *timer_func;
bool timer_repeat_flag;
void *timer_arg;
@ -79,7 +82,7 @@ void os_timer_setfn(os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg);
*
* @return null
*/
void os_timer_arm(os_timer_t *ptimer, uint32 msec, bool repeat_flag);
void os_timer_arm(os_timer_t *ptimer, uint32_t msec, bool repeat_flag);
/**
* @brief Disarm the timer

View File

@ -25,6 +25,8 @@
#ifndef __ESP_WIFI_H__
#define __ESP_WIFI_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -109,7 +111,7 @@ WIFI_MODE wifi_get_opmode_default(void);
*
* @attention This configuration will be saved in the Flash system parameter area if changed.
*
* @param uint8 opmode : WiFi operating modes:
* @param uint8_t opmode : WiFi operating modes:
* - 0x01: station mode;
* - 0x02: soft-AP mode
* - 0x03: station+soft-AP mode
@ -125,7 +127,7 @@ bool wifi_set_opmode(WIFI_MODE opmode);
* Set the WiFi operating mode as station, soft-AP or station+soft-AP, and
* the mode won't be saved to the Flash.
*
* @param uint8 opmode : WiFi operating modes:
* @param uint8_t opmode : WiFi operating modes:
* - 0x01: station mode;
* - 0x02: soft-AP mode
* - 0x03: station+soft-AP mode
@ -185,12 +187,12 @@ bool wifi_set_ip_info(WIFI_INTERFACE if_index, struct ip_info *info);
*
* @param WIFI_INTERFACE if_index : get the IP address of the station or the soft-AP interface,
* 0x00 for STATION_IF, 0x01 for SOFTAP_IF.
* @param uint8 *macaddr : the MAC address.
* @param uint8_t *macaddr : the MAC address.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_get_macaddr(WIFI_INTERFACE if_index, uint8 *macaddr);
bool wifi_get_macaddr(WIFI_INTERFACE if_index, uint8_t *macaddr);
/**
* @brief Set MAC address of the ESP8266 WiFi station or the soft-AP interface.
@ -203,23 +205,23 @@ bool wifi_get_macaddr(WIFI_INTERFACE if_index, uint8 *macaddr);
*
* @param WIFI_INTERFACE if_index : get the IP address of the station or the soft-AP interface,
* 0x00 for STATION_IF, 0x01 for SOFTAP_IF.
* @param uint8 *macaddr : the MAC address.
* @param uint8_t *macaddr : the MAC address.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_set_macaddr(WIFI_INTERFACE if_index, uint8 *macaddr);
bool wifi_set_macaddr(WIFI_INTERFACE if_index, uint8_t *macaddr);
/**
* @brief Install the WiFi status LED.
*
* @param uint8 gpio_id : GPIO ID
* @param uint8 gpio_name : GPIO mux name
* @param uint8 gpio_func : GPIO function
* @param uint8_t gpio_id : GPIO ID
* @param uint8_t gpio_name : GPIO mux name
* @param uint8_t gpio_func : GPIO function
*
* @return null
*/
void wifi_status_led_install(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func);
void wifi_status_led_install(uint8_t gpio_id, uint32_t gpio_name, uint8_t gpio_func);
/**
* @brief Uninstall the WiFi status LED.
@ -303,27 +305,27 @@ enum {
};
typedef struct {
uint32 status; /**< status of scanning APs*/
uint32_t status; /**< status of scanning APs*/
struct bss_info *bss; /**< list of APs found*/
} Event_StaMode_ScanDone_t;
typedef struct {
uint8 ssid[32]; /**< SSID of connected AP */
uint8 ssid_len; /**< SSID length of connected AP */
uint8 bssid[6]; /**< BSSID of connected AP*/
uint8 channel; /**< channel of connected AP*/
uint8_t ssid[32]; /**< SSID of connected AP */
uint8_t ssid_len; /**< SSID length of connected AP */
uint8_t bssid[6]; /**< BSSID of connected AP*/
uint8_t channel; /**< channel of connected AP*/
} Event_StaMode_Connected_t;
typedef struct {
uint8 ssid[32]; /**< SSID of disconnected AP */
uint8 ssid_len; /**< SSID length of disconnected AP */
uint8 bssid[6]; /**< BSSID of disconnected AP */
uint8 reason; /**< reason of disconnection */
uint8_t ssid[32]; /**< SSID of disconnected AP */
uint8_t ssid_len; /**< SSID length of disconnected AP */
uint8_t bssid[6]; /**< BSSID of disconnected AP */
uint8_t reason; /**< reason of disconnection */
} Event_StaMode_Disconnected_t;
typedef struct {
uint8 old_mode; /**< the old auth mode of AP */
uint8 new_mode; /**< the new auth mode of AP */
uint8_t old_mode; /**< the old auth mode of AP */
uint8_t new_mode; /**< the new auth mode of AP */
} Event_StaMode_AuthMode_Change_t;
typedef struct {
@ -333,18 +335,18 @@ typedef struct {
} Event_StaMode_Got_IP_t;
typedef struct {
uint8 mac[6]; /**< MAC address of the station connected to ESP8266 soft-AP */
uint8 aid; /**< the aid that ESP8266 soft-AP gives to the station connected to */
uint8_t mac[6]; /**< MAC address of the station connected to ESP8266 soft-AP */
uint8_t aid; /**< the aid that ESP8266 soft-AP gives to the station connected to */
} Event_SoftAPMode_StaConnected_t;
typedef struct {
uint8 mac[6]; /**< MAC address of the station disconnects to ESP8266 soft-AP */
uint8 aid; /**< the aid that ESP8266 soft-AP gave to the station disconnects to */
uint8_t mac[6]; /**< MAC address of the station disconnects to ESP8266 soft-AP */
uint8_t aid; /**< the aid that ESP8266 soft-AP gave to the station disconnects to */
} Event_SoftAPMode_StaDisconnected_t;
typedef struct {
int rssi; /**< Received probe request signal strength */
uint8 mac[6]; /**< MAC address of the station which send probe request */
uint8_t mac[6]; /**< MAC address of the station which send probe request */
} Event_SoftAPMode_ProbeReqRecved_t;
typedef union {
@ -388,11 +390,11 @@ bool wifi_set_event_handler_cb(wifi_event_handler_cb_t cb);
/**
* @brief Callback of sending user-define 802.11 packets.
*
* @param uint8 status : 0, packet sending succeed; otherwise, fail.
* @param uint8_t status : 0, packet sending succeed; otherwise, fail.
*
* @return null
*/
typedef void (*freedom_outside_cb_t)(uint8 status);
typedef void (*freedom_outside_cb_t)(uint8_t status);
/**
* @brief Register a callback for sending user-define 802.11 packets.
@ -405,7 +407,7 @@ typedef void (*freedom_outside_cb_t)(uint8 status);
* @return 0, succeed;
* @return -1, fail.
*/
sint32 wifi_register_send_pkt_freedom_cb(freedom_outside_cb_t cb);
int32_t wifi_register_send_pkt_freedom_cb(freedom_outside_cb_t cb);
/**
* @brief Unregister the callback for sending user-define 802.11 packets.
@ -429,8 +431,8 @@ void wifi_unregister_send_pkt_freedom_cb(void);
* the next packet is allowed to send. Otherwise, wifi_send_pkt_freedom
* will return fail.
*
* @param uint8 *buf : pointer of packet
* @param uint16 len : packet length
* @param uint8_t *buf : pointer of packet
* @param uint16_t len : packet length
* @param bool sys_seq : follow the system's 802.11 packets sequence number or not,
* if it is true, the sequence number will be increased 1 every
* time a packet sent.
@ -438,7 +440,7 @@ void wifi_unregister_send_pkt_freedom_cb(void);
* @return 0, succeed;
* @return -1, fail.
*/
sint32 wifi_send_pkt_freedom(uint8 *buf, uint16 len, bool sys_seq);
int32_t wifi_send_pkt_freedom(uint8_t *buf, uint16_t len, bool sys_seq);
/**
* @brief Enable RFID LOCP (Location Control Protocol) to receive WDS packets.
@ -448,7 +450,7 @@ sint32 wifi_send_pkt_freedom(uint8 *buf, uint16 len, bool sys_seq);
* @return 0, succeed;
* @return otherwise, fail.
*/
sint32 wifi_rfid_locp_recv_open(void);
int32_t wifi_rfid_locp_recv_open(void);
/**
* @brief Disable RFID LOCP (Location Control Protocol) .
@ -462,13 +464,13 @@ void wifi_rfid_locp_recv_close(void);
/**
* @brief RFID LOCP (Location Control Protocol) receive callback .
*
* @param uint8 *frm : point to the head of 802.11 packet
* @param uint8_t *frm : point to the head of 802.11 packet
* @param int len : packet length
* @param int rssi : signal strength
*
* @return null
*/
typedef void (*rfid_locp_cb_t)(uint8 *frm, int len, sint8 rssi);
typedef void (*rfid_locp_cb_t)(uint8_t *frm, int len, int8_t rssi);
/**
* @brief Register a callback of receiving WDS packets.
@ -481,7 +483,7 @@ typedef void (*rfid_locp_cb_t)(uint8 *frm, int len, sint8 rssi);
* @return 0, succeed;
* @return otherwise, fail.
*/
sint32 wifi_register_rfid_locp_recv_cb(rfid_locp_cb_t cb);
int32_t wifi_register_rfid_locp_recv_cb(rfid_locp_cb_t cb);
/**
* @brief Unregister the callback of receiving WDS packets.
@ -596,7 +598,7 @@ void wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb);
* in the system idle task. Please do not call other WiFi related function right
* after calling this API.
*
* @param uint32 sleep_time_in_us : sleep time, ESP8266 will wake up automatically
* @param uint32_t sleep_time_in_us : sleep time, ESP8266 will wake up automatically
* when time out. Unit: us. Range: 10000 ~ 268435455(0xFFFFFFF).
* - If sleep_time_in_us is 0xFFFFFFF, the ESP8266 will sleep till
* - if wifi_fpm_set_sleep_type is set to be LIGHT_SLEEP_T, ESP8266 can wake up by GPIO.
@ -606,7 +608,7 @@ void wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb);
* @return -1, fail to sleep, sleep status error;
* @return -2, fail to sleep, force sleep function is not enabled.
*/
sint8 wifi_fpm_do_sleep(uint32 sleep_time_in_us);
int8_t wifi_fpm_do_sleep(uint32_t sleep_time_in_us);
/**
* @brief Set sleep type for force sleep function.
@ -666,16 +668,16 @@ enum FIXED_RATE {
* @attention 3. ESP8266 station and soft-AP share the same rate, they can not be
* set into the different rate.
*
* @param uint8 enable_mask : 0x00 - disable the fixed rate
* @param uint8_t enable_mask : 0x00 - disable the fixed rate
* - 0x01 - use the fixed rate on ESP8266 station
* - 0x02 - use the fixed rate on ESP8266 soft-AP
* - 0x03 - use the fixed rate on ESP8266 station and soft-AP
* @param uint8 rate : value of the fixed rate
* @param uint8_t rate : value of the fixed rate
*
* @return 0 : succeed
* @return otherwise : fail
*/
sint32 wifi_set_user_fixed_rate(uint8 enable_mask, uint8 rate);
int32_t wifi_set_user_fixed_rate(uint8_t enable_mask, uint8_t rate);
/**
* @brief Get the fixed rate and mask of ESP8266.
@ -686,7 +688,7 @@ sint32 wifi_set_user_fixed_rate(uint8 enable_mask, uint8 rate);
* @return 0 : succeed
* @return otherwise : fail
*/
int wifi_get_user_fixed_rate(uint8 *enable_mask, uint8 *rate);
int wifi_get_user_fixed_rate(uint8_t *enable_mask, uint8_t *rate);
enum support_rate {
RATE_11B5M = 0,
@ -714,13 +716,13 @@ enum support_rate {
*
* @attention This API can only support 802.11g now, but it will support 802.11b in next version.
*
* @param uint8 min : the minimum value of the support rate, according to enum support_rate.
* @param uint8 max : the maximum value of the support rate, according to enum support_rate.
* @param uint8_t min : the minimum value of the support rate, according to enum support_rate.
* @param uint8_t max : the maximum value of the support rate, according to enum support_rate.
*
* @return 0 : succeed
* @return otherwise : fail
*/
sint32 wifi_set_user_sup_rate(uint8 min, uint8 max);
int32_t wifi_set_user_sup_rate(uint8_t min, uint8_t max);
enum RATE_11B_ID {
RATE_11B_B11M = 0,
@ -778,22 +780,22 @@ enum RATE_11N_ID {
*
* @attention The rate of retransmission is not limited by this API.
*
* @param uint8 mode : WiFi mode
* @param uint8_t mode : WiFi mode
* - #define RC_LIMIT_11B 0
* - #define RC_LIMIT_11G 1
* - #define RC_LIMIT_11N 2
* @param uint8 ifidx : interface of ESP8266
* - 0x00 - ESP8266 station
* - 0x01 - ESP8266 soft-AP
* @param uint8 max : the maximum value of the rate, according to the enum rate
* @param uint8_t max : the maximum value of the rate, according to the enum rate
* corresponding to the first parameter mode.
* @param uint8 min : the minimum value of the rate, according to the enum rate
* @param uint8_t min : the minimum value of the rate, according to the enum rate
* corresponding to the first parameter mode.
*
* @return 0 : succeed
* @return otherwise : fail
*/
bool wifi_set_user_rate_limit(uint8 mode, uint8 ifidx, uint8 max, uint8 min);
bool wifi_set_user_rate_limit(uint8_t mode, uint8_t ifidx, uint8_t max, uint8_t min);
/**
* @brief Get the interfaces of ESP8266 whose rate of sending data is limited by
@ -806,13 +808,13 @@ bool wifi_set_user_rate_limit(uint8 mode, uint8 ifidx, uint8 max, uint8 min);
* @return LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
* @return LIMIT_RATE_MASK_ALL - enable the limitation on both ESP8266 station and soft-AP
*/
uint8 wifi_get_user_limit_rate_mask(void);
uint8_t wifi_get_user_limit_rate_mask(void);
/**
* @brief Set the interfaces of ESP8266 whose rate of sending packets is limited by
* wifi_set_user_rate_limit.
*
* @param uint8 enable_mask :
* @param uint8_t enable_mask :
* - LIMIT_RATE_MASK_NONE - disable the limitation on both ESP8266 station and soft-AP
* - LIMIT_RATE_MASK_STA - enable the limitation on ESP8266 station
* - LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
@ -821,7 +823,7 @@ uint8 wifi_get_user_limit_rate_mask(void);
* @return true : succeed
* @return false : fail
*/
bool wifi_set_user_limit_rate_mask(uint8 enable_mask);
bool wifi_set_user_limit_rate_mask(uint8_t enable_mask);
/**
* @}
@ -848,13 +850,13 @@ typedef enum {
* @brief Vendor IE received callback.
*
* @param vendor_ie_type type : type of vendor IE.
* @param const uint8 sa[6] : source address of the packet.
* @param uint8 *vendor_ie : pointer of vendor IE.
* @param sint32 rssi : signal strength.
* @param const uint8_t sa[6] : source address of the packet.
* @param uint8_t *vendor_ie : pointer of vendor IE.
* @param int32_t rssi : signal strength.
*
* @return null
*/
typedef void (*vendor_ie_recv_cb_t)(vendor_ie_type type, const uint8 sa[6], const uint8 *vnd_ie, sint32 rssi);
typedef void (*vendor_ie_recv_cb_t)(vendor_ie_type type, const uint8_t sa[6], const uint8_t *vnd_ie, int32_t rssi);
/**
* @brief Set Vendor IE of ESP8266.
@ -884,7 +886,7 @@ bool wifi_set_vnd_ie(bool enable, vendor_ie_type type, uint8_t idx, uint8_t *vnd
* @return 0 : succeed
* @return -1 : fail
*/
sint32 wifi_register_vnd_ie_recv_cb(vendor_ie_recv_cb_t cb);
int32_t wifi_register_vnd_ie_recv_cb(vendor_ie_recv_cb_t cb);
/**
* @brief Unregister vendor IE received callback.
@ -920,15 +922,15 @@ typedef enum {
* @brief User IE received callback.
*
* @param user_ie_type type : type of user IE.
* @param const uint8 sa[6] : source address of the packet.
* @param const uint8 m_oui[3] : factory tag.
* @param uint8 *user_ie : pointer of user IE.
* @param uint8 ie_len : length of user IE.
* @param sint32 rssi : signal strength.
* @param const uint8_t sa[6] : source address of the packet.
* @param const uint8_t m_oui[3] : factory tag.
* @param uint8_t *user_ie : pointer of user IE.
* @param uint8_t ie_len : length of user IE.
* @param int32_t rssi : signal strength.
*
* @return null
*/
typedef void (*user_ie_manufacturer_recv_cb_t)(user_ie_type type, const uint8 sa[6], const uint8 m_oui[3], uint8 *ie, uint8 ie_len, sint32 rssi);
typedef void (*user_ie_manufacturer_recv_cb_t)(user_ie_type type, const uint8_t sa[6], const uint8_t m_oui[3], uint8_t *ie, uint8_t ie_len, int32_t rssi);
/**
* @brief Set user IE of ESP8266.
@ -939,19 +941,19 @@ typedef void (*user_ie_manufacturer_recv_cb_t)(user_ie_type type, const uint8 sa
* - true, enable the corresponding user IE function, all parameters below have to be set.
* - false, disable the corresponding user IE function and release the resource,
* only the parameter "type" below has to be set.
* @param uint8 *m_oui : factory tag, apply for it from Espressif System.
* @param uint8_t *m_oui : factory tag, apply for it from Espressif System.
* @param user_ie_type type : IE type. If it is USER_IE_BEACON, please disable the
* IE function and enable again to take the configuration
* effect immediately .
* @param uint8 *user_ie : user-defined information elements, need not input the whole
* @param uint8_t *user_ie : user-defined information elements, need not input the whole
* 802.11 IE, need only the user-define part.
* @param uint8 len : length of user IE, 247 bytes at most.
* @param uint8_t len : length of user IE, 247 bytes at most.
*
* @return true : succeed
* @return false : fail
*/
bool wifi_set_user_ie(bool enable, uint8 *m_oui, user_ie_type type, uint8 *user_ie, uint8 len);
bool wifi_set_user_ie(bool enable, uint8_t *m_oui, user_ie_type type, uint8_t *user_ie, uint8_t len);
/**
* @brief Register user IE received callback.
@ -961,7 +963,7 @@ bool wifi_set_user_ie(bool enable, uint8 *m_oui, user_ie_type type, uint8 *user_
* @return 0 : succeed
* @return -1 : fail
*/
sint32 wifi_register_user_ie_manufacturer_recv_cb(user_ie_manufacturer_recv_cb_t cb);
int32_t wifi_register_user_ie_manufacturer_recv_cb(user_ie_manufacturer_recv_cb_t cb);
/**
* @brief Unregister user IE received callback.
@ -989,12 +991,12 @@ void wifi_unregister_user_ie_manufacturer_recv_cb(void);
*
* Each time a packet is received, the callback function will be called.
*
* @param uint8 *buf : the data received
* @param uint16 len : data length
* @param uint8_t *buf : the data received
* @param uint16_t len : data length
*
* @return null
*/
typedef void (* wifi_promiscuous_cb_t)(uint8 *buf, uint16 len);
typedef void (* wifi_promiscuous_cb_t)(uint8_t *buf, uint16_t len);
/**
* @brief Register the RX callback function in the promiscuous mode.
@ -1014,17 +1016,17 @@ void wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
*
* @return channel number
*/
uint8 wifi_get_channel(void);
uint8_t wifi_get_channel(void);
/**
* @brief Set the channel number for sniffer functions.
*
* @param uint8 channel : channel number
* @param uint8_t channel : channel number
*
* @return true : succeed
* @return false : fail
*/
bool wifi_set_channel(uint8 channel);
bool wifi_set_channel(uint8_t channel);
/**
* @brief Set the MAC address filter for the sniffer mode.
@ -1049,13 +1051,13 @@ bool wifi_promiscuous_set_mac(const uint8_t *address);
* @attention 4. Don't call any other APIs when in the promiscuous mode. Call
* wifi_promiscuous_enable(0) to quit sniffer before calling other APIs.
*
* @param uint8 promiscuous :
* @param uint8_t promiscuous :
* - 0: to disable the promiscuous mode
* - 1: to enable the promiscuous mode
*
* @return null
*/
void wifi_promiscuous_enable(uint8 promiscuous);
void wifi_promiscuous_enable(uint8_t promiscuous);
/**
* @}

View File

@ -22,8 +22,10 @@
*
*/
#ifndef __ESPWPS_H__
#define __ESPWPS_H__
#ifndef __ESP_WPS_H__
#define __ESP_WPS_H__
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {

View File

@ -25,6 +25,8 @@
#ifndef __ESPNOW_H__
#define __ESPNOW_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -66,13 +68,13 @@ enum esp_now_role {
* @attention The status will be OK, if ESP-NOW send packet successfully. But users
* need to make sure by themselves that key of communication is correct.
*
* @param uint8 *mac_addr : MAC address of target device
* @param uint8 *data : data received
* @param uint8 len : data length
* @param uint8_t *mac_addr : MAC address of target device
* @param uint8_t *data : data received
* @param uint8_t len : data length
*
* @return null
*/
typedef void (*esp_now_recv_cb_t)(uint8 *mac_addr, uint8 *data, uint8 len);
typedef void (*esp_now_recv_cb_t)(uint8_t *mac_addr, uint8_t *data, uint8_t len);
/**
* @brief ESP-NOW send callback.
@ -80,12 +82,12 @@ typedef void (*esp_now_recv_cb_t)(uint8 *mac_addr, uint8 *data, uint8 len);
* @attention The status will be OK, if ESP-NOW send packet successfully. But users
* need to make sure by themselves that key of communication is correct.
*
* @param uint8 *mac_addr : MAC address of target device
* @param uint8 status : status of ESP-NOW sending packet, 0, OK; 1, fail.
* @param uint8_t *mac_addr : MAC address of target device
* @param uint8_t status : status of ESP-NOW sending packet, 0, OK; 1, fail.
*
* @return null
*/
typedef void (*esp_now_send_cb_t)(uint8 *mac_addr, uint8 status);
typedef void (*esp_now_send_cb_t)(uint8_t *mac_addr, uint8_t status);
/**
* @brief ESP-NOW initialization.
@ -95,7 +97,7 @@ typedef void (*esp_now_send_cb_t)(uint8 *mac_addr, uint8 status);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_init(void);
int32_t esp_now_init(void);
/**
* @brief Deinitialize ESP-NOW.
@ -105,7 +107,7 @@ sint32 esp_now_init(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_deinit(void);
int32_t esp_now_deinit(void);
/**
* @brief Register ESP-NOW send callback.
@ -115,7 +117,7 @@ sint32 esp_now_deinit(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_register_send_cb(esp_now_send_cb_t cb);
int32_t esp_now_register_send_cb(esp_now_send_cb_t cb);
/**
* @brief Unregister ESP-NOW send callback.
@ -125,7 +127,7 @@ sint32 esp_now_register_send_cb(esp_now_send_cb_t cb);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_unregister_send_cb(void);
int32_t esp_now_unregister_send_cb(void);
/**
* @brief Register ESP-NOW receive callback.
@ -135,7 +137,7 @@ sint32 esp_now_unregister_send_cb(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_register_recv_cb(esp_now_recv_cb_t cb);
int32_t esp_now_register_recv_cb(esp_now_recv_cb_t cb);
/**
* @brief Unregister ESP-NOW receive callback.
@ -145,7 +147,7 @@ sint32 esp_now_register_recv_cb(esp_now_recv_cb_t cb);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_unregister_recv_cb(void);
int32_t esp_now_unregister_recv_cb(void);
/**
* @brief Send ESP-NOW packet.
@ -159,7 +161,7 @@ sint32 esp_now_unregister_recv_cb(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_send(uint8 *da, uint8 *data, uint8 len);
int32_t esp_now_send(uint8_t *da, uint8_t *data, uint8_t len);
/**
* @brief Add an ESP-NOW peer, store MAC address of target device into ESP-NOW MAC list.
@ -173,7 +175,7 @@ sint32 esp_now_send(uint8 *da, uint8 *data, uint8 len);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_add_peer(uint8 *mac_addr, uint8 role, uint8 channel, uint8 *key, uint8 key_len);
int32_t esp_now_add_peer(uint8_t *mac_addr, uint8_t role, uint8_t channel, uint8_t *key, uint8_t key_len);
/**
* @brief Delete an ESP-NOW peer, delete MAC address of the device from ESP-NOW MAC list.
@ -183,17 +185,17 @@ sint32 esp_now_add_peer(uint8 *mac_addr, uint8 role, uint8 channel, uint8 *key,
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_del_peer(uint8 *mac_addr);
int32_t esp_now_del_peer(uint8_t *mac_addr);
/**
* @brief Set ESP-NOW role of device itself.
*
* @param uint8 role : role type of device, enum esp_now_role.
* @param uint8_t role : role type of device, enum esp_now_role.
*
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_self_role(uint8 role);
int32_t esp_now_set_self_role(uint8_t role);
/**
* @brief Get ESP-NOW role of device itself.
@ -203,7 +205,7 @@ sint32 esp_now_set_self_role(uint8 role);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_get_self_role(void);
int32_t esp_now_get_self_role(void);
/**
* @brief Set ESP-NOW role for a target device. If it is set multiple times,
@ -215,18 +217,18 @@ sint32 esp_now_get_self_role(void);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_peer_role(uint8 *mac_addr, uint8 role);
int32_t esp_now_set_peer_role(uint8_t *mac_addr, uint8_t role);
/**
* @brief Get ESP-NOW role of a target device.
*
* @param uint8 *mac_addr : MAC address of device.
* @param uint8_t *mac_addr : MAC address of device.
*
* @return ESP_NOW_ROLE_CONTROLLER, role type : controller
* @return ESP_NOW_ROLE_SLAVE, role type : slave
* @return otherwise : fail
*/
sint32 esp_now_get_peer_role(uint8 *mac_addr);
int32_t esp_now_get_peer_role(uint8_t *mac_addr);
/**
* @brief Record channel information of a ESP-NOW device.
@ -235,55 +237,55 @@ sint32 esp_now_get_peer_role(uint8 *mac_addr);
* - call esp_now_get_peer_channel to get its channel first,
* - then call wifi_set_channel to be in the same channel and do communication.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8 channel : channel, usually to be 1 ~ 13, some area may use channel 14.
* @param uint8_t *mac_addr : MAC address of target device.
* @param uint8_t channel : channel, usually to be 1 ~ 13, some area may use channel 14.
*
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_peer_channel(uint8 *mac_addr, uint8 channel);
int32_t esp_now_set_peer_channel(uint8_t *mac_addr, uint8_t channel);
/**
* @brief Get channel information of a ESP-NOW device.
*
* @attention ESP-NOW communication needs to be at the same channel.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8_t *mac_addr : MAC address of target device.
*
* @return 1 ~ 13 (some area may get 14) : channel number
* @return Non-0 : fail
*/
sint32 esp_now_get_peer_channel(uint8 *mac_addr);
int32_t esp_now_get_peer_channel(uint8_t *mac_addr);
/**
* @brief Set ESP-NOW key for a target device.
*
* If it is set multiple times, new key will cover the old one.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8 *key : 16 bytes key which is needed for ESP-NOW communication,
* @param uint8_t *mac_addr : MAC address of target device.
* @param uint8_t *key : 16 bytes key which is needed for ESP-NOW communication,
* if it is NULL, current key will be reset to be none.
* @param uint8 key_len : key length, has to be 16 bytes now
* @param uint8_t key_len : key length, has to be 16 bytes now
*
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_peer_key(uint8 *mac_addr, uint8 *key, uint8 key_len);
int32_t esp_now_set_peer_key(uint8_t *mac_addr, uint8_t *key, uint8_t key_len);
/**
* @brief Get ESP-NOW key of a target device.
*
* If it is set multiple times, new key will cover the old one.
*
* @param uint8 *mac_addr : MAC address of target device.
* @param uint8 *key : pointer of key, buffer size has to be 16 bytes at least
* @param uint8 key_len : key length
* @param uint8_t *mac_addr : MAC address of target device.
* @param uint8_t *key : pointer of key, buffer size has to be 16 bytes at least
* @param uint8_t key_len : key length
*
* @return 0 : succeed
* @return > 0 : find target device but can't get key
* @return < 0 : fail
*/
sint32 esp_now_get_peer_key(uint8 *mac_addr, uint8 *key, uint8 *key_len);
int32_t esp_now_get_peer_key(uint8_t *mac_addr, uint8_t *key, uint8_t *key_len);
/**
* @brief Get MAC address of ESP-NOW device.
@ -301,7 +303,7 @@ sint32 esp_now_get_peer_key(uint8 *mac_addr, uint8 *key, uint8 *key_len);
* @return NULL, no ESP-NOW devices exist
* @return Otherwise, MAC address of ESP-NOW device which is pointed now
*/
uint8 *esp_now_fetch_peer(bool restart);
uint8_t *esp_now_fetch_peer(bool restart);
/**
* @brief Check if target device exists or not.
@ -312,7 +314,7 @@ uint8 *esp_now_fetch_peer(bool restart);
* @return < 0 : error occur, check fail
* @return > 0 : device exists
*/
sint32 esp_now_is_peer_exist(uint8 *mac_addr);
int32_t esp_now_is_peer_exist(uint8_t *mac_addr);
/**
* @brief Get the total number of ESP-NOW devices which are associated, and the
@ -324,7 +326,7 @@ sint32 esp_now_is_peer_exist(uint8 *mac_addr);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_get_cnt_info(uint8 *all_cnt, uint8 *encrypt_cnt);
int32_t esp_now_get_cnt_info(uint8_t *all_cnt, uint8_t *encrypt_cnt);
/**
* @brief Set the encrypt key of communication key.
@ -338,7 +340,7 @@ sint32 esp_now_get_cnt_info(uint8 *all_cnt, uint8 *encrypt_cnt);
* @return 0 : succeed
* @return Non-0 : fail
*/
sint32 esp_now_set_kok(uint8 *key, uint8 len);
int32_t esp_now_set_kok(uint8_t *key, uint8_t len);
/**
* @}

View File

@ -25,6 +25,8 @@
#ifndef __PWM_H__
#define __PWM_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -46,9 +48,9 @@ extern "C" {
*/
struct pwm_param {
uint32 period; /**< PWM period */
uint32 freq; /**< PWM frequency */
uint32 duty[8]; /**< PWM duty */
uint32_t period; /**< PWM period */
uint32_t freq; /**< PWM frequency */
uint32_t duty[8]; /**< PWM duty */
};
#define PWM_DEPTH 1023
@ -58,16 +60,16 @@ struct pwm_param {
*
* @attention This API can be called only once.
*
* @param uint32 period : pwm frequency
* @param uint32 *duty : duty cycle
* @param uint32 pwm_channel_num : PWM channel number
* @param uint32 (*pin_info_list)[3] : GPIO parameter of PWM channel, it is a pointer
* @param uint32_t period : pwm frequency
* @param uint32_t *duty : duty cycle
* @param uint32_t pwm_channel_num : PWM channel number
* @param uint32_t (*pin_info_list)[3] : GPIO parameter of PWM channel, it is a pointer
* of n x 3 array which defines GPIO register, IO
* reuse of corresponding pin and GPIO number.
*
* @return null
*/
void pwm_init(uint32 period, uint32 *duty, uint32 pwm_channel_num, uint32(*pin_info_list)[3]);
void pwm_init(uint32_t period, uint32_t *duty, uint32_t pwm_channel_num, uint32_t(*pin_info_list)[3]);
/**
* @brief Set the duty cycle of a PWM channel.
@ -78,21 +80,21 @@ void pwm_init(uint32 period, uint32 *duty, uint32 pwm_channel_num, uint32(*pin_i
*
* @attention After set configuration, pwm_start needs to be called to take effect.
*
* @param uint32 duty : duty cycle
* @param uint8 channel : PWM channel number
* @param uint32_t duty : duty cycle
* @param uint8_t channel : PWM channel number
*
* @return null
*/
void pwm_set_duty(uint32 duty, uint8 channel);
void pwm_set_duty(uint32_t duty, uint8_t channel);
/**
* @brief Get the duty cycle of a PWM channel.
*
* @param uint8 channel : PWM channel number
* @param uint8_t channel : PWM channel number
*
* @return Duty cycle of PWM output.
*/
uint32 pwm_get_duty(uint8 channel);
uint32_t pwm_get_duty(uint8_t channel);
/**
* @brief Set PWM period, unit : us.
@ -105,7 +107,7 @@ uint32 pwm_get_duty(uint8 channel);
*
* @return null
*/
void pwm_set_period(uint32 period);
void pwm_set_period(uint32_t period);
/**
* @brief Get PWM period, unit : us.
@ -114,7 +116,7 @@ void pwm_set_period(uint32 period);
*
* @return PWM period, unit : us.
*/
uint32 pwm_get_period(void);
uint32_t pwm_get_period(void);
/**
* @brief Starts PWM.

View File

@ -25,6 +25,9 @@
#ifndef __SMARTCONFIG_H__
#define __SMARTCONFIG_H__
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -135,7 +138,7 @@ bool smartconfig_stop(void);
* @return true : succeed
* @return false : fail
*/
bool esptouch_set_timeout(uint8 time_s);
bool esptouch_set_timeout(uint8_t time_s);
/**
* @brief Set protocol type of SmartConfig.

View File

@ -25,6 +25,8 @@
#ifndef __SPI_FLASH_H__
#define __SPI_FLASH_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -52,12 +54,12 @@ typedef enum {
} SpiFlashOpResult;
typedef struct{
uint32 deviceId;
uint32 chip_size; // chip size in byte
uint32 block_size;
uint32 sector_size;
uint32 page_size;
uint32 status_mask;
uint32_t deviceId;
uint32_t chip_size; // chip size in byte
uint32_t block_size;
uint32_t sector_size;
uint32_t page_size;
uint32_t status_mask;
} SpiFlashChip;
#define SPI_FLASH_SEC_SIZE 4096 /**< SPI Flash sector size */
@ -69,56 +71,56 @@ typedef struct{
*
* @return SPI Flash ID
*/
uint32 spi_flash_get_id(void);
uint32_t spi_flash_get_id(void);
/**
* @brief Read state register of SPI Flash.
*
* @param uint32 *status : the read value (pointer) of state register.
* @param uint32_t *status : the read value (pointer) of state register.
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_read_status(uint32 *status);
SpiFlashOpResult spi_flash_read_status(uint32_t *status);
/**
* @brief Write state register of SPI Flash.
*
* @param uint32 status_value : Write state register value.
* @param uint32_t status_value : Write state register value.
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_write_status(uint32 status_value);
SpiFlashOpResult spi_flash_write_status(uint32_t status_value);
/**
* @brief Erase the Flash sector.
*
* @param uint16 sec : Sector number, the count starts at sector 0, 4KB per sector.
* @param uint16_t sec : Sector number, the count starts at sector 0, 4KB per sector.
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_erase_sector(uint16 sec);
SpiFlashOpResult spi_flash_erase_sector(uint16_t sec);
/**
* @brief Write data to Flash.
*
* @param uint32 des_addr : destination address in Flash.
* @param uint32 *src_addr : source address of the data.
* @param uint32 size : length of data
* @param uint32_t des_addr : destination address in Flash.
* @param uint32_t *src_addr : source address of the data.
* @param uint32_t size : length of data
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size);
SpiFlashOpResult spi_flash_write(uint32_t des_addr, uint32_t *src_addr, uint32_t size);
/**
* @brief Read data from Flash.
*
* @param uint32 src_addr : source address of the data.
* @param uint32 *des_addr : destination address in Flash.
* @param uint32 size : length of data
* @param uint32_t src_addr : source address of the data.
* @param uint32_t *des_addr : destination address in Flash.
* @param uint32_t size : length of data
*
* @return SpiFlashOpResult
*/
SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size);
SpiFlashOpResult spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size);
/**
* @brief Registered function for spi_flash_set_read_func.
@ -126,17 +128,17 @@ SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size);
* @attention used for sdk internal, don't need to care about params
*
* @param SpiFlashChip *spi : spi flash struct pointer.
* @param uint32 src_addr : source address of the data.
* @param uint32 *des_addr : destination address in Flash.
* @param uint32 size : length of data
* @param uint32_t src_addr : source address of the data.
* @param uint32_t *des_addr : destination address in Flash.
* @param uint32_t size : length of data
*
* @return SpiFlashOpResult
*/
typedef SpiFlashOpResult (* user_spi_flash_read)(
SpiFlashChip *spi,
uint32 src_addr,
uint32 *des_addr,
uint32 size);
uint32_t src_addr,
uint32_t *des_addr,
uint32_t size);
/**
* @brief Register user-define SPI flash read API.

View File

@ -25,7 +25,10 @@
#ifndef __UPGRADE_H__
#define __UPGRADE_H__
#include "lwip/sockets.h"
#include <stdbool.h>
#include <stdint.h>
#include <sys/socket.h>
#ifdef __cplusplus
extern "C" {
@ -73,12 +76,12 @@ typedef void (*upgrade_states_check_callback)(void *arg);
struct upgrade_server_info {
struct sockaddr_in sockaddrin; /**< socket of upgrading */
upgrade_states_check_callback check_cb; /**< callback of upgrading */
uint32 check_times; /**< time out of upgrading, unit : ms */
uint8 pre_version[16]; /**< previous version of firmware */
uint8 upgrade_version[16]; /**< the new version of firmware */
uint8 *url; /**< the url of upgrading server */
uint32_t check_times; /**< time out of upgrading, unit : ms */
uint8_t pre_version[16]; /**< previous version of firmware */
uint8_t upgrade_version[16]; /**< the new version of firmware */
uint8_t *url; /**< the url of upgrading server */
void *pclient_param;
uint8 upgrade_flag; /**< true, upgrade succeed; false, upgrade fail */
uint8_t upgrade_flag; /**< true, upgrade succeed; false, upgrade fail */
};
/**
@ -88,7 +91,7 @@ struct upgrade_server_info {
*
* @return null
*/
void system_upgrade_init();
void system_upgrade_init(void);
/**
* @brief Upgrade function de-initialization.
@ -97,7 +100,7 @@ void system_upgrade_init();
*
* @return null
*/
void system_upgrade_deinit();
void system_upgrade_deinit(void);
/**
* @brief Upgrade function de-initialization.
@ -107,7 +110,7 @@ void system_upgrade_deinit();
*
* @return null
*/
bool system_upgrade(uint8 *data, uint32 len);
bool system_upgrade(uint8_t *data, uint32_t len);
#ifdef UPGRADE_SSL_ENABLE

View File

@ -12,10 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "esp_wifi_os_adapter.h"
#include "esp_libc.h"
#include "esp_system.h"
#include "c_types.h"
#include "esp_wifi_os_adapter.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

View File

@ -106,6 +106,7 @@
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
@ -239,7 +240,7 @@ void pvShowMalloc()
Wait_SPI_Idle(&flashchip);
Cache_Read_Enable_New();
//ets_printf("sh1,");
os_printf("--------Show Malloc--------\n");
printf("--------Show Malloc--------\n");
for( pxIterator = &yStart; pxIterator->pxNextFreeBlock != NULL;pxIterator = pxIterator->pxNextFreeBlock) {
BlockLink_t *blk = pxIterator->pxNextFreeBlock;
//ets_printf("sh2,");
@ -266,38 +267,38 @@ void pvShowMalloc()
} else {
basename = "";
}
os_printf("F:%-30sL:%4u malloc %10d @ %p\n", basename, blk->line, blk->xBlockSize - 0x80000000, ( void * ) ( ( ( unsigned char * ) blk ) + uxHeapStructSize));
printf("F:%-30sL:%4u malloc %10d @ %p\n", basename, blk->line, blk->xBlockSize - 0x80000000, ( void * ) ( ( ( unsigned char * ) blk ) + uxHeapStructSize));
//ets_printf("sh3,");
// ets_delay_us(2000);
system_soft_wdt_feed();
}
os_printf("--------Free %d--------\n\n", xFreeBytesRemaining);
printf("--------Free %d--------\n\n", xFreeBytesRemaining);
#if 0
uint32 last_link = (uint32)yStart.pxNextFreeBlock;
uint32 index = 0;
os_printf("'*':used, '-'free, each %d bytes\n", portBYTE_ALIGNMENT_v);
os_printf("%x:", last_link);
uint32_t last_link = (uint32_t)yStart.pxNextFreeBlock;
uint32_t index = 0;
printf("'*':used, '-'free, each %d bytes\n", portBYTE_ALIGNMENT_v);
printf("%x:", last_link);
for( pxIterator = &yStart; pxIterator->pxNextFreeBlock != NULL;pxIterator = pxIterator->pxNextFreeBlock) {
uint16 i;
for (i = 0; i < ((uint32)pxIterator->pxNextFreeBlock - last_link) / portBYTE_ALIGNMENT_v; i++) {
uint16_t i;
for (i = 0; i < ((uint32_t)pxIterator->pxNextFreeBlock - last_link) / portBYTE_ALIGNMENT_v; i++) {
index++;
os_printf("-");
printf("-");
if (index % 64 == 0) {
os_printf("\n%x:", (uint32)yStart.pxNextFreeBlock + index * portBYTE_ALIGNMENT_v);
printf("\n%x:", (uint32_t)yStart.pxNextFreeBlock + index * portBYTE_ALIGNMENT_v);
}
}
for (i = 0; i < pxIterator->pxNextFreeBlock->xBlockSize / portBYTE_ALIGNMENT_v; i++) {
index++;
os_printf("*");
printf("*");
if (index % 64 == 0) {
os_printf("\n%x:", (uint32)yStart.pxNextFreeBlock + index * portBYTE_ALIGNMENT_v);
printf("\n%x:", (uint32_t)yStart.pxNextFreeBlock + index * portBYTE_ALIGNMENT_v);
}
}
last_link = ((uint32)pxIterator->pxNextFreeBlock + pxIterator->pxNextFreeBlock->xBlockSize);
last_link = ((uint32_t)pxIterator->pxNextFreeBlock + pxIterator->pxNextFreeBlock->xBlockSize);
system_soft_wdt_feed();
}
os_printf("\n\n");
printf("\n\n");
#endif
//ets_printf("sh4\n");
@ -343,10 +344,10 @@ static bool is_inited = false;
if (!is_inited) {
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
xHeapRegions[0].pucStartAddress = ( uint8_t * )&_heap_start;
xHeapRegions[0].xSizeInBytes = (( size_t)( 0x40000000 - (uint32)&_heap_start));
xHeapRegions[0].xSizeInBytes = (( size_t)( 0x40000000 - (uint32_t)&_heap_start));
xHeapRegions[1].pucStartAddress = ( uint8_t * )&_lit4_end;
xHeapRegions[1].xSizeInBytes = (( size_t)( 0x4010C000 - (uint32)&_lit4_end));
xHeapRegions[1].xSizeInBytes = (( size_t)( 0x4010C000 - (uint32_t)&_lit4_end));
is_inited = true;
vPortDefineHeapRegions(xHeapRegions);
@ -400,7 +401,7 @@ static bool is_inited = false;
than the block being inserted. */
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock != 0; pxIterator = pxIterator->pxNextFreeBlock )
{
if ((line == 0 || use_iram == true) && (uint32)pxIterator->pxNextFreeBlock > 0x40000000 && pxIterator->pxNextFreeBlock->xBlockSize > xWantedSize) {
if ((line == 0 || use_iram == true) && (uint32_t)pxIterator->pxNextFreeBlock > 0x40000000 && pxIterator->pxNextFreeBlock->xBlockSize > xWantedSize) {
pxPreviousBlock = pxIterator;
pxBlock = pxIterator->pxNextFreeBlock;
break;
@ -552,7 +553,7 @@ BlockLink_t *pxLink;
ETS_INTR_LOCK();
#ifdef MEMLEAK_DEBUG
if(prvRemoveBlockFromUsedList(pxLink) < 0){
ets_printf("%p already freed\n", pv);
printf("%p already freed\n", pv);
}
else
#endif

View File

@ -70,10 +70,10 @@
extern "C" {
#endif
#include "c_types.h"
#include "esp_libc.h"
#include <stdbool.h>
#include <stdint.h>
#include "esp_attr.h"
#include "esp8266/ets_sys.h"
#include <xtensa/xtruntime.h>
#include "xtensa_rtos.h"
@ -100,13 +100,13 @@ extern "C" {
*/
/* Type definitions. */
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE unsigned portLONG
#define portBASE_TYPE long
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE unsigned portLONG
#define portBASE_TYPE long
#define BaseType_t portBASE_TYPE
#define TickType_t unsigned portLONG
@ -191,19 +191,19 @@ not necessary for to use this port. They are defined so the common demo files
void _xt_user_exit (void);
void _xt_tick_timer_init (void);
void _xt_isr_unmask (uint32 unmask);
void _xt_isr_mask (uint32 mask);
uint32 _xt_read_ints (void);
void _xt_clear_ints(uint32 mask);
void _xt_isr_unmask (uint32_t unmask);
void _xt_isr_mask (uint32_t mask);
uint32_t _xt_read_ints (void);
void _xt_clear_ints(uint32_t mask);
/* interrupt related */
typedef void (* _xt_isr)(void *arg);
void _xt_isr_attach (uint8 i, _xt_isr func, void *arg);
void _xt_isr_attach (uint8_t i, _xt_isr func, void *arg);
typedef struct _xt_isr_entry_ {
_xt_isr handler;
void * arg;
_xt_isr handler;
void * arg;
} _xt_isr_entry;
#ifdef __cplusplus

View File

@ -67,6 +67,9 @@
*----------------------------------------------------------*/
/* Scheduler includes. */
#include <stdint.h>
#include <xtensa/config/core.h>
#include <xtensa/tie/xt_interrupt.h>
#include <xtensa/tie/xt_timer.h>
@ -75,6 +78,11 @@
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/xtensa_rtos.h"
#include "esp_attr.h"
#include "esp_libc.h"
#include "esp8266/ets_sys.h"
#include "esp8266/rom_functions.h"
#define PORT_ASSERT(x) do { if (!(x)) {ets_printf("%s %u\n", "rtos_port", __LINE__); while(1){}; }} while (0)
@ -242,7 +250,7 @@ void IRAM_ATTR vPortExitCritical(void)
}
}
} else {
ets_printf("E:C:%u\n", uxCriticalNesting);
ets_printf(DRAM_STR("E:C:%u\n"), uxCriticalNesting);
PORT_ASSERT((uxCriticalNesting > 0));
}
}
@ -296,15 +304,15 @@ void ResetCcountVal(unsigned int cnt_val)
_xt_isr_entry isr[16];
char _xt_isr_status = 0;
void _xt_isr_attach(uint8 i, _xt_isr func, void* arg)
void _xt_isr_attach(uint8_t i, _xt_isr func, void* arg)
{
isr[i].handler = func;
isr[i].arg = arg;
}
uint16 IRAM_ATTR _xt_isr_handler(uint16 i)
uint16_t IRAM_ATTR _xt_isr_handler(uint16_t i)
{
uint8 index;
uint8_t index;
if (i & (1 << ETS_WDT_INUM)) {
index = ETS_WDT_INUM;

View File

@ -1022,7 +1022,7 @@ bool wifi_softap_set_dhcps_lease(struct dhcps_lease* please)
u32_t start_ip = 0;
u32_t end_ip = 0;
uint8 opmode = wifi_get_opmode();
u8_t opmode = wifi_get_opmode();
if (opmode == STATION_MODE || opmode == NULL_MODE) {
return false;
@ -1174,7 +1174,7 @@ bool wifi_softap_set_dhcps_offer_option(u8_t level, void* optarg)
switch (level) {
case OFFER_ROUTER:
offer = (*(uint8*)optarg) & 0x01;
offer = (*(u8_t*)optarg) & 0x01;
offer_flag = true;
break;

View File

@ -43,15 +43,15 @@ extern "C" {
*/
struct esp_spiffs_config {
uint32 phys_size; /**< physical size of the SPI Flash */
uint32 phys_addr; /**< physical offset in spi flash used for spiffs, must be on block boundary */
uint32 phys_erase_block; /**< physical size when erasing a block */
u32_t phys_size; /**< physical size of the SPI Flash */
u32_t phys_addr; /**< physical offset in spi flash used for spiffs, must be on block boundary */
u32_t phys_erase_block; /**< physical size when erasing a block */
uint32 log_block_size; /**< logical size of a block, must be on physical block size boundary and must never be less than a physical block */
uint32 log_page_size; /**< logical size of a page, at least log_block_size/8 */
u32_t log_block_size; /**< logical size of a block, must be on physical block size boundary and must never be less than a physical block */
u32_t log_page_size; /**< logical size of a page, at least log_block_size/8 */
uint32 fd_buf_size; /**< file descriptor memory area size */
uint32 cache_buf_size; /**< cache buffer size */
u32_t fd_buf_size; /**< file descriptor memory area size */
u32_t cache_buf_size; /**< cache buffer size */
};
/**
@ -62,7 +62,7 @@ struct esp_spiffs_config {
* @return 0 : succeed
* @return otherwise : fail
*/
sint32 esp_spiffs_init(struct esp_spiffs_config *config);
s32_t esp_spiffs_init(struct esp_spiffs_config *config);
/**
* @brief Deinitialize spiffs
@ -71,7 +71,7 @@ sint32 esp_spiffs_init(struct esp_spiffs_config *config);
*
* @return null
*/
void esp_spiffs_deinit(uint8 format);
void esp_spiffs_deinit(u8_t format);
/**
* @}

View File

@ -15,11 +15,20 @@
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdint.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
// ----------- >8 ------------
typedef uint8_t u8_t;
typedef int8_t s8_t;
typedef uint16_t u16_t;
typedef int16_t s16_t;
typedef uint32_t u32_t;
typedef int32_t s32_t;
// compile time switches
// Set generic spiffs debug output call.

View File

@ -1,9 +1,9 @@
#include "esp_common.h"
#include "esp_spiffs.h"
#include <fcntl.h>
#include <stdio.h>
#include "esp_spiffs.h"
#include "spi_flash.h"
#define NUM_SYS_FD 3
static spiffs fs;

View File

@ -41,7 +41,7 @@
extern "C" {
#endif
#include "esp_common.h"
#include <stdint.h>
#if 0
#define ssl_printf(fmt, args...) printf(fmt,## args)
@ -57,30 +57,30 @@ extern "C" {
// long tv_usec; /* and microseconds */
//};
#define tls_htons(x) ((uint16)((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)))
#define tls_htons(x) ((uint16_t)((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)))
#define tls_ntohs(x) tls_htons(x)
#define tls_htonl(_n) ((uint32)( (((_n) & 0xff) << 24) | (((_n) & 0xff00) << 8) | (((_n) >> 8) & 0xff00) | (((_n) >> 24) & 0xff) ))
#define tls_htonl(_n) ((uint32_t)( (((_n) & 0xff) << 24) | (((_n) & 0xff00) << 8) | (((_n) >> 8) & 0xff00) | (((_n) >> 24) & 0xff) ))
#define tls_ntohl(x) tls_htonl(x)
#ifndef be16toh
#define be16toh(x) ((uint16)tls_ntohs((uint16)(x)))
#define be16toh(x) ((uint16_t)tls_ntohs((uint16_t)(x)))
#endif
#ifndef htobe16
#define htobe16(x) ((uint16)tls_htons((uint16)(x)))
#define htobe16(x) ((uint16_t)tls_htons((uint16_t)(x)))
#endif
#ifndef be32toh
#define be32toh(x) ((uint32)tls_ntohl((uint32)(x)))
#define be32toh(x) ((uint32_t)tls_ntohl((uint32_t)(x)))
#endif
#ifndef htobe32
#define htobe32(x) ((uint32)tls_htonl((uint32)(x)))
#define htobe32(x) ((uint32_t)tls_htonl((uint32_t)(x)))
#endif
#ifndef be64toh
static __inline__ uint64 be64toh(uint64 __x);
static __inline__ uint64 be64toh(uint64 __x) {return (((uint64)be32toh(__x & (uint64)0xFFFFFFFFULL)) << 32) | ((uint64)be32toh((__x & (uint64)0xFFFFFFFF00000000ULL) >> 32));}
static __inline__ uint64_t be64toh(uint64_t __x);
static __inline__ uint64_t be64toh(uint64_t __x) {return (((uint64_t)be32toh(__x & (uint64_t)0xFFFFFFFFULL)) << 32) | ((uint64_t)be32toh((__x & (uint64_t)0xFFFFFFFF00000000ULL) >> 32));}
#define be64toh(x) be64toh(x)
#endif

View File

@ -281,7 +281,7 @@ void AES_cbc_encrypt(AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
memcpy(iv, ctx->iv, AES_IV_SIZE);
for (i = 0; i < 4; i++)
tout[i] = ntohl(iv[i]);
tout[i] = tls_ntohl(iv[i]);
for (length -= AES_BLOCKSIZE; length >= 0; length -= AES_BLOCKSIZE)
{
@ -291,14 +291,14 @@ void AES_cbc_encrypt(AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
msg += AES_BLOCKSIZE;
for (i = 0; i < 4; i++)
tin[i] = ntohl(msg_32[i])^tout[i];
tin[i] = tls_ntohl(msg_32[i])^tout[i];
AES_encrypt(ctx, tin);
for (i = 0; i < 4; i++)
{
tout[i] = tin[i];
out_32[i] = htonl(tout[i]);
out_32[i] = tls_htonl(tout[i]);
}
memcpy(out, out_32, AES_BLOCKSIZE);
@ -306,7 +306,7 @@ void AES_cbc_encrypt(AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
}
for (i = 0; i < 4; i++)
iv[i] = htonl(tout[i]);
iv[i] = tls_htonl(tout[i]);
memcpy(ctx->iv, iv, AES_IV_SIZE);
}
@ -320,7 +320,7 @@ void AES_cbc_decrypt(AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
memcpy(iv, ctx->iv, AES_IV_SIZE);
for (i = 0; i < 4; i++)
xor[i] = ntohl(iv[i]);
xor[i] = tls_ntohl(iv[i]);
for (length -= 16; length >= 0; length -= 16)
{
@ -331,7 +331,7 @@ void AES_cbc_decrypt(AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
for (i = 0; i < 4; i++)
{
tin[i] = ntohl(msg_32[i]);
tin[i] = tls_ntohl(msg_32[i]);
data[i] = tin[i];
}
@ -341,7 +341,7 @@ void AES_cbc_decrypt(AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
{
tout[i] = data[i]^xor[i];
xor[i] = tin[i];
out_32[i] = htonl(tout[i]);
out_32[i] = tls_htonl(tout[i]);
}
memcpy(out, out_32, AES_BLOCKSIZE);
@ -349,7 +349,7 @@ void AES_cbc_decrypt(AES_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
}
for (i = 0; i < 4; i++)
iv[i] = htonl(xor[i]);
iv[i] = tls_htonl(xor[i]);
memcpy(ctx->iv, iv, AES_IV_SIZE);
}

View File

@ -355,7 +355,7 @@ EXP_FUNC int STDCALL base64_decode(const char *in, int len,
int g, t, x, y, z;
uint8_t c;
int ret = -1;
uint8* base64_map = (uint8*)SSL_ZALLOC(128);
uint8_t* base64_map = (uint8_t*)SSL_ZALLOC(128);
memcpy(base64_map, map, 128);
g = 3;

View File

@ -32,6 +32,9 @@
* Some primitive asn methods for extraction ASN.1 data.
*/
#include <stdint.h>
#include <string.h>
#include "ssl/ssl_os_port.h"
#include "ssl/ssl_ssl.h"
#include "ssl/ssl_crypto.h"
@ -246,7 +249,7 @@ int asn1_get_private_key(const uint8_t *buf, int len, RSA_CTX **rsa_ctx)
static time_t mktime(struct tm *ptm)
{
uint16 year = 0,mon = 0,day = 0,hour = 0,min = 0,sec = 0;
uint16_t year = 0,mon = 0,day = 0,hour = 0,min = 0,sec = 0;
if (ptm == NULL)
return 0;

View File

@ -110,7 +110,7 @@ EXP_FUNC int STDCALL ssl_obj_memory_load(SSL_CTX *ssl_ctx, int mem_type,
{
int ret;
SSLObjLoader *ssl_obj;
uint32 sign_len = (len + 3)&(~3);
uint32_t sign_len = (len + 3)&(~3);
ssl_obj = (SSLObjLoader *)SSL_ZALLOC(sizeof(SSLObjLoader));
ssl_obj->buf = (uint8_t *)SSL_MALLOC(sign_len);

View File

@ -35,6 +35,9 @@
* Only really tested on mini_httpd, so I'm not too sure how extensive this
* port is.
*/
#include <stdint.h>
#include "ssl/ssl_platform.h"
#include "lwip/err.h"
@ -46,7 +49,7 @@
* length -- length of data to send
* Returns : none
*******************************************************************************/
void esp_EVP_DigestInit(MD5_CTX *ctx, uint8 *out)
void esp_EVP_DigestInit(MD5_CTX *ctx, uint8_t *out)
{
return ;
}
@ -72,7 +75,7 @@ void esp_EVP_DigestUpdate(MD5_CTX *ctx, const uint8_t *input, int ilen)
* length -- length of data to send
* Returns : none
*******************************************************************************/
void esp_EVP_DigestFinal(MD5_CTX *ctx, uint8_t *output, uint16* olen)
void esp_EVP_DigestFinal(MD5_CTX *ctx, uint8_t *output, uint16_t* olen)
{
return ;
}
@ -122,7 +125,7 @@ static const unsigned char base64_enc_map[64] =
* length -- length of data to send
* Returns : none
*******************************************************************************/
EXP_FUNC int STDCALL esp_base64_encode(uint8 *dst, size_t dlen, size_t *olen,
EXP_FUNC int STDCALL esp_base64_encode(uint8_t *dst, size_t dlen, size_t *olen,
const uint8_t *src, size_t slen)
{
size_t i, n;
@ -1033,7 +1036,7 @@ int esp_ERR_get_error(void)
* length -- length of data to send
* Returns : none
*******************************************************************************/
void esp_ERR_error_string_n(uint32 error, char* out, uint32 olen)
void esp_ERR_error_string_n(uint32_t error, char* out, uint32_t olen)
{
return;
}
@ -1046,7 +1049,7 @@ void esp_ERR_error_string_n(uint32 error, char* out, uint32 olen)
* length -- length of data to send
* Returns : none
*******************************************************************************/
void esp_ERR_error_string(uint32 error, char* out)
void esp_ERR_error_string(uint32_t error, char* out)
{
return;
}
@ -1085,12 +1088,12 @@ void esp_CRYPTO_cleanup_all_ex_data(void)
* length -- length of data to send
* Returns : none
*******************************************************************************/
const char* esp_ERR_strerror(uint32 error)
const char* esp_ERR_strerror(uint32_t error)
{
return lwip_strerr(error);
}
void esp_ssl_sleep(uint16 mseconds)
void esp_ssl_sleep(uint16_t mseconds)
{
vTaskDelay(mseconds / portTICK_RATE_MS);
}

View File

@ -531,7 +531,7 @@ EXP_FUNC int STDCALL ssl_renegotiate(SSL *ssl)
else
#endif
{
uint8 g_hello_request_ram[4];
uint8_t g_hello_request_ram[4];
memcpy(g_hello_request_ram, g_hello_request, sizeof(g_hello_request));
send_packet(ssl, PT_HANDSHAKE_PROTOCOL,
@ -1497,7 +1497,7 @@ error:
*/
int send_change_cipher_spec(SSL *ssl)
{
uint8 g_chg_cipher_spec_pkt_ram[4];
uint8_t g_chg_cipher_spec_pkt_ram[4];
memcpy(g_chg_cipher_spec_pkt_ram, g_chg_cipher_spec_pkt, 4);
int ret = send_packet(ssl, PT_CHANGE_CIPHER_SPEC,

View File

@ -376,7 +376,7 @@ static int process_client_key_xchg(SSL *ssl)
int pkt_size = ssl->bm_index;
int premaster_size, secret_length = (buf[2] << 8) + buf[3];
// uint8_t premaster_secret[MAX_KEY_BYTE_SIZE];
uint8* premaster_secret = (uint8*)SSL_ZALLOC(MAX_KEY_BYTE_SIZE);
uint8_t* premaster_secret = (uint8_t*)SSL_ZALLOC(MAX_KEY_BYTE_SIZE);
RSA_CTX *rsa_ctx = ssl->ssl_ctx->rsa_ctx;
int offset = 4;
int ret = SSL_OK;
@ -455,7 +455,7 @@ static int process_cert_verify(SSL *ssl)
uint8_t *buf = &ssl->bm_data[ssl->dc->bm_proc_index];
int pkt_size = ssl->bm_index;
// uint8_t dgst_buf[MAX_KEY_BYTE_SIZE];
uint8* dgst_buf = (uint8*)SSL_ZALLOC(MAX_KEY_BYTE_SIZE);
uint8_t* dgst_buf = (uint8_t*)SSL_ZALLOC(MAX_KEY_BYTE_SIZE);
uint8_t dgst[MD5_SIZE+SHA1_SIZE];
X509_CTX *x509_ctx = ssl->x509_ctx;
int ret = SSL_OK;

View File

@ -36,6 +36,8 @@
* Only really tested on mini_httpd, so I'm not too sure how extensive this
* port is.
*/
#include <stdint.h>
#include "ssl_pm.h"
#include "lwip/err.h"
#include "openssl/ssl.h"
@ -48,7 +50,7 @@ Sets up digest context ctx to use a digest type from ENGINE impl.
Type will typically be supplied by a function such as EVP_sha1().
If impl is NULL then the default implementation of digest type is used.
*/
void EVP_DigestInit(MD5_CTX* ctx, uint8* out)
void EVP_DigestInit(MD5_CTX* ctx, uint8_t* out)
{
return;
}
@ -69,7 +71,7 @@ will be written to the integer at s, at most EVP_MAX_MD_SIZE bytes will be writt
After calling EVP_DigestFinal() no additional calls to EVP_DigestUpdate() can be made,
but EVP_DigestInit() can be called to initialize a new digest operation.
*/
void EVP_DigestFinal(MD5_CTX* ctx, uint8_t* output, uint16* olen)
void EVP_DigestFinal(MD5_CTX* ctx, uint8_t* output, uint16_t* olen)
{
return;
}
@ -111,7 +113,7 @@ static const unsigned char base64_enc_map[64] = {
* slen -- source buffer len
* Returns : none
*******************************************************************************/
int base64_encode(uint8* dst, size_t dlen, size_t* olen,
int base64_encode(uint8_t* dst, size_t dlen, size_t* olen,
const uint8_t* src, size_t slen)
{
size_t i, n;
@ -331,7 +333,7 @@ Generates a human-readable string representing the error code e,
and places it at buf. buf must be at least 120 bytes long.
Buf may not be NULL.
*/
void ERR_error_string_n(uint32 error, char* out, uint32 olen)
void ERR_error_string_n(uint32_t error, char* out, uint32_t olen)
{
return;
}
@ -357,7 +359,7 @@ void ERR_free_strings(void)
/*
Convert an internal error to a string representation.
*/
const char* ERR_strerror(uint32 error)
const char* ERR_strerror(uint32_t error)
{
return lwip_strerr(error);
}

View File

@ -446,10 +446,10 @@ bool wifi_softap_dhcps_stop()
}
bool wifi_station_dhcpc_start()
bool wifi_station_dhcpc_start(void)
{
uint8_t opmode = NULL_MODE;
s8 ret;
err_t ret;
taskENTER_CRITICAL();
opmode = wifi_get_opmode();
@ -553,7 +553,7 @@ bool wifi_station_set_hostname(char* name)
return false;
}
uint32 len = strlen(name);
uint32_t len = strlen(name);
if (len > 32) {
return false;

View File

@ -20,10 +20,10 @@
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
uint32_t user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
uint32_t rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:
@ -56,6 +56,7 @@ uint32 user_rf_cal_sector_set(void)
return rf_cal_sec;
}
/******************************************************************************
* FunctionName : user_init
* Description : entry of user application, init user function here

View File

@ -25,10 +25,10 @@
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
uint32_t user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
uint32_t rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:

View File

@ -266,10 +266,10 @@ void user_conn_init(void)
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
uint32_t user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
uint32_t rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:

View File

@ -25,10 +25,10 @@
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
uint32_t user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
uint32_t rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:

View File

@ -260,10 +260,10 @@ void user_conn_init(void)
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
uint32_t user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
uint32_t rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:

View File

@ -24,10 +24,10 @@ static os_timer_t timer;
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
uint32_t user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
uint32_t rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:
@ -61,7 +61,7 @@ uint32 user_rf_cal_sector_set(void)
return rf_cal_sec;
}
static void wait_for_connection_ready(uint8 flag)
static void wait_for_connection_ready(uint8_t flag)
{
os_timer_disarm(&timer);
if(wifi_station_connected()){

View File

@ -51,10 +51,10 @@ static void user_wps_start(void)
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
uint32_t user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
uint32_t rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256: