1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Update to SDK 0.9.5

This commit is contained in:
Ivan Grokhotkov
2015-02-03 11:44:46 +03:00
parent b88ab3b29a
commit 30086663f1
20 changed files with 215 additions and 62 deletions

View File

@ -66,6 +66,7 @@ typedef enum {
#ifdef ICACHE_FLASH
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
#else
#define ICACHE_FLASH_ATTR
#endif /* ICACHE_FLASH */

View File

@ -87,6 +87,12 @@ struct espconn {
void *reverse;
};
enum espconn_option{
ESPCONN_REUSEADDR = 1,
ESPCONN_NODELAY,
ESPCONN_END
};
/******************************************************************************
* FunctionName : espconn_connect
* Description : The function given as the connect
@ -132,6 +138,43 @@ sint8 espconn_accept(struct espconn *espconn);
sint8 espconn_create(struct espconn *espconn);
/******************************************************************************
* FunctionName : espconn_tcp_get_max_con
* Description : get the number of simulatenously active TCP connections
* Parameters : none
* Returns : none
*******************************************************************************/
uint8 espconn_tcp_get_max_con(void);
/******************************************************************************
* FunctionName : espconn_tcp_set_max_con
* Description : set the number of simulatenously active TCP connections
* Parameters : num -- total number
* Returns : none
*******************************************************************************/
sint8 espconn_tcp_set_max_con(uint8 num);
/******************************************************************************
* FunctionName : espconn_tcp_get_max_con_allow
* Description : get the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to get the count
* Returns : result
*******************************************************************************/
sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);
/******************************************************************************
* FunctionName : espconn_tcp_set_max_con_allow
* Description : set the count of simulatenously active connections on the server
* Parameters : espconn -- espconn to set the count
* num -- support the connection number
* Returns : result
*******************************************************************************/
sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);
/******************************************************************************
* FunctionName : espconn_regist_time
* Description : used to specify the time that should be called when don't recv data
@ -228,6 +271,16 @@ sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback
uint32 espconn_port(void);
/******************************************************************************
* FunctionName : espconn_set_opt
* Description : access port value for client so that we don't end up bouncing
* all connections at the same time .
* Parameters : none
* Returns : access port value
*******************************************************************************/
sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);
/******************************************************************************
* TypedefName : dns_found_callback
* Description : Callback which is invoked when a hostname is found.
@ -317,5 +370,21 @@ sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
*******************************************************************************/
sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
/******************************************************************************
* FunctionName : espconn_recv_hold
* Description : hold tcp receive
* Parameters : espconn -- espconn to hold
* Returns : none
*******************************************************************************/
sint8 espconn_recv_hold(struct espconn *pespconn);
/******************************************************************************
* FunctionName : espconn_recv_unhold
* Description : unhold tcp receive
* Parameters : espconn -- espconn to unhold
* Returns : none
*******************************************************************************/
sint8 espconn_recv_unhold(struct espconn *pespconn);
#endif

View File

@ -36,6 +36,10 @@ typedef struct _ETSTIMER_ {
} ETSTimer;
/* interrupt related */
typedef void (*int_handler_t)(void*);
#define ETS_SPI_INUM 2
#define ETS_GPIO_INUM 4
#define ETS_UART_INUM 5
#define ETS_UART1_INUM 5
@ -48,13 +52,16 @@ typedef struct _ETSTIMER_ {
ets_intr_unlock()
#define ETS_FRC_TIMER1_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_FRC_TIMER1_INUM, (void *)(func), (void *)(arg))
ets_isr_attach(ETS_FRC_TIMER1_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_GPIO_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_GPIO_INUM, (void *)(func), (void *)(arg))
ets_isr_attach(ETS_GPIO_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_UART_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_UART_INUM, (void *)(func), (void *)(arg))
ets_isr_attach(ETS_UART_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_SPI_INTR_ATTACH(func, arg) \
ets_isr_attach(ETS_SPI_INUM, (int_handler_t)(func), (void *)(arg))
#define ETS_INTR_ENABLE(inum) \
ets_isr_unmask((1<<inum))
@ -62,6 +69,9 @@ typedef struct _ETSTIMER_ {
#define ETS_INTR_DISABLE(inum) \
ets_isr_mask((1<<inum))
#define ETS_SPI_INTR_ENABLE() \
ETS_INTR_ENABLE(ETS_SPI_INUM)
#define ETS_UART_INTR_ENABLE() \
ETS_INTR_ENABLE(ETS_UART_INUM)
@ -105,7 +115,7 @@ void ets_install_putc1(void* routine);
void uart_div_modify(int no, int freq);
void ets_isr_mask(int intr);
void ets_isr_unmask(int intr);
void ets_isr_attach(int intr, void *handler, void *arg);
void ets_isr_attach(int intr, int_handler_t handler, void *arg);
void ets_intr_lock();
void ets_intr_unlock();

View File

@ -52,6 +52,11 @@ struct ip_info {
#define ip4_addr3_16(ipaddr) ((uint16)ip4_addr3(ipaddr))
#define ip4_addr4_16(ipaddr) ((uint16)ip4_addr4(ipaddr))
/** 255.255.255.255 */
#define IPADDR_NONE ((uint32)0xffffffffUL)
/** 0.0.0.0 */
#define IPADDR_ANY ((uint32)0x00000000UL)
uint32 ipaddr_addr(const char *cp);
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \

View File

@ -42,8 +42,16 @@
#define os_timer_setfn ets_timer_setfn
#define os_sprintf ets_sprintf
#define os_printf ets_printf
#define os_update_cpu_frequency ets_update_cpu_frequency
#ifdef USE_OPTIMIZE_PRINTF
#define os_printf(fmt, ...) do { \
static const char flash_str[] ICACHE_RODATA_ATTR = fmt; \
os_printf_plus(flash_str, ##__VA_ARGS__); \
} while(0)
#else
#define os_printf os_printf_plus
#endif
#endif

View File

@ -0,0 +1,32 @@
#ifndef __PING_H__
#define __PING_H__
typedef void (* ping_recv_function)(void* arg, void *pdata);
typedef void (* ping_sent_function)(void* arg, void *pdata);
struct ping_option{
uint32 count;
uint32 ip;
uint32 coarse_time;
ping_recv_function recv_function;
ping_sent_function sent_function;
void* reverse;
};
struct ping_resp{
uint32 total_count;
uint32 resp_time;
uint32 seqno;
uint32 timeout_count;
uint32 bytes;
uint32 total_bytes;
uint32 total_time;
sint8 ping_err;
};
bool ping_start(struct ping_option *ping_opt);
bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv);
bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent);
#endif /* __PING_H__ */

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2015 -2018 Espressif System
*
*/
#ifndef __SMARTCONFIG_H__
#define __SMARTCONFIG_H__
typedef void (*sc_callback_t)(void *data);
typedef enum {
SC_STATUS_FIND_CHANNEL = 0,
SC_STATUS_GETTING_SSID_PSWD,
SC_STATUS_GOT_SSID_PSWD,
SC_STATUS_LINK,
} sc_status;
typedef enum {
SC_TYPE_ESPTOUCH = 0,
SC_TYPE_AIRKISS,
} sc_type;
sc_status smartconfig_get_status(void);
const char *smartconfig_get_version(void);
bool smartconfig_start(sc_type type, sc_callback_t cb);
bool smartconfig_stop(void);
#endif

View File

@ -23,6 +23,7 @@ typedef struct{
#define SPI_FLASH_SEC_SIZE 4096
uint32 spi_flash_get_id(void);
SpiFlashOpResult spi_flash_erase_sector(uint16 sec);
SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size);
SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size);

View File

@ -41,33 +41,17 @@ struct rst_info{
#define UPGRADE_FW_BIN1 0x00
#define UPGRADE_FW_BIN2 0x01
typedef void (*upgrade_states_check_callback)(void * arg);
struct upgrade_server_info {
uint8 ip[4];
uint16 port;
uint8 upgrade_flag;
uint8 pre_version[8];
uint8 upgrade_version[8];
uint32 check_times;
uint8 *url;
upgrade_states_check_callback check_cb;
struct espconn *pespconn;
};
bool system_upgrade_start(struct upgrade_server_info *server);
bool system_upgrade_start_ssl(struct upgrade_server_info *server);
uint8 system_upgrade_userbin_check(void);
void system_upgrade_reboot(void);
void system_restore(void);
void system_restart(void);
bool system_deep_sleep_set_option(uint8 option);
void system_deep_sleep(uint32 time_in_us);
uint8 system_upgrade_userbin_check(void);
void system_upgrade_reboot(void);
uint8 system_upgrade_flag_check();
void system_upgrade_flag_set(uint8 flag);
void system_timer_reinit(void);
uint32 system_get_time(void);
@ -79,13 +63,14 @@ enum {
USER_TASK_PRIO_MAX
};
void system_os_task(os_task_t task, uint8 prio, os_event_t *queue, uint8 qlen);
void system_os_post(uint8 prio, os_signal_t sig, os_param_t par);
bool system_os_task(os_task_t task, uint8 prio, os_event_t *queue, uint8 qlen);
bool system_os_post(uint8 prio, os_signal_t sig, os_param_t par);
void system_print_meminfo(void);
uint32 system_get_free_heap_size(void);
void system_set_os_print(uint8 onoff);
uint8 system_get_os_print();
uint64 system_mktime(uint32 year, uint32 mon, uint32 day, uint32 hour, uint32 min, uint32 sec);
@ -105,11 +90,22 @@ void system_uart_swap(void);
uint16 system_adc_read(void);
const char *system_get_sdk_version(void);
#define NULL_MODE 0x00
#define STATION_MODE 0x01
#define SOFTAP_MODE 0x02
#define STATIONAP_MODE 0x03
typedef enum _auth_mode {
AUTH_OPEN = 0,
AUTH_WEP,
AUTH_WPA_PSK,
AUTH_WPA2_PSK,
AUTH_WPA_WPA2_PSK,
AUTH_MAX
} AUTH_MODE;
uint8 wifi_get_opmode(void);
bool wifi_set_opmode(uint8 opmode);
@ -120,7 +116,7 @@ struct bss_info {
uint8 ssid[32];
uint8 channel;
sint8 rssi;
uint8 authmode;
AUTH_MODE authmode;
uint8 is_hidden;
};
@ -138,7 +134,8 @@ typedef void (* scan_done_cb_t)(void *arg, STATUS status);
struct station_config {
uint8 ssid[32];
uint8 password[64];
uint8 bssid_set;
uint8 bssid_set; // Note: If bssid_set is 1, station will just connect to the router
// with both ssid[] and bssid[] matched. Please check about this.
uint8 bssid[6];
};
@ -149,10 +146,10 @@ bool wifi_station_connect(void);
bool wifi_station_disconnect(void);
struct scan_config {
uint8 *ssid;
uint8 *bssid;
uint8 channel;
uint8 show_hidden;
uint8 *ssid; // Note: ssid == NULL, don't filter ssid.
uint8 *bssid; // Note: bssid == NULL, don't filter bssid.
uint8 channel; // Note: channel == 0, scan all channels, otherwise scan set channel.
uint8 show_hidden; // Note: show_hidden == 1, can get hidden ssid routers' info.
};
bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb);
@ -169,6 +166,11 @@ enum {
STATION_GOT_IP
};
enum dhcp_status {
DHCP_STOPPED,
DHCP_STARTED
};
uint8 wifi_station_get_connect_status(void);
uint8 wifi_station_get_current_ap_id(void);
@ -177,23 +179,17 @@ bool wifi_station_ap_number_set(uint8 ap_number);
bool wifi_station_dhcpc_start(void);
bool wifi_station_dhcpc_stop(void);
typedef enum _auth_mode {
AUTH_OPEN = 0,
AUTH_WEP,
AUTH_WPA_PSK,
AUTH_WPA2_PSK,
AUTH_WPA_WPA2_PSK
} AUTH_MODE;
enum dhcp_status wifi_station_dhcpc_status(void);
struct softap_config {
uint8 ssid[32];
uint8 password[64];
uint8 ssid_len;
uint8 channel;
uint8 authmode;
uint8 ssid_hidden;
uint8 max_connection;
uint8 ssid_len; // Note: Recommend to set it according to your ssid
uint8 channel; // Note: support 1 ~ 13
AUTH_MODE authmode; // Note: Don't support AUTH_WEP in softAP mode.
uint8 ssid_hidden; // Note: default 0
uint8 max_connection; // Note: default 4, max 4
uint16 beacon_interval; // Note: support 100 ~ 60000 ms, default 100
};
bool wifi_softap_get_config(struct softap_config *config);
@ -213,10 +209,12 @@ struct dhcps_lease {
struct station_info * wifi_softap_get_station_info(void);
void wifi_softap_free_station_info(void);
uint8 wifi_station_get_ap_info(struct station_config config[]);
bool wifi_softap_dhcps_start(void);
bool wifi_softap_dhcps_stop(void);
bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please);
enum dhcp_status wifi_softap_dhcps_status(void);
#define STATION_IF 0x00
#define SOFTAP_IF 0x01
@ -230,6 +228,7 @@ uint8 wifi_get_channel(void);
bool wifi_set_channel(uint8 channel);
void wifi_status_led_install(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func);
void wifi_status_led_uninstall();
/** Get the absolute difference between 2 u32_t values (correcting overflows)
* 'a' is expected to be 'higher' (without overflow) than 'b'. */
@ -250,4 +249,13 @@ enum phy_mode {
enum phy_mode wifi_get_phy_mode(void);
bool wifi_set_phy_mode(enum phy_mode mode);
enum sleep_type {
NONE_SLEEP_T = 0,
LIGHT_SLEEP_T,
MODEM_SLEEP_T
};
bool wifi_set_sleep_type(enum sleep_type type);
enum sleep_type wifi_get_sleep_type(void);
#endif

View File

@ -1,12 +0,0 @@
#ifndef __SDK_VERSION_H__
#define __SDK_VERSION_H__
#define SDK_VERSION_MAJOR 0U
#define SDK_VERSION_MINOR 9U
#define SDK_VERSION_REVISION 3U
#define SDK_VERSION_INTERNAL 0U
#define SDK_VERSION (SDK_VERSION_MAJOR << 16 | SDK_VERSION_MINOR << 8 | SDK_VERSION_REVISION)
#endif

View File

@ -17,6 +17,9 @@ PROVIDE ( SHA1Init = 0x4000b584 );
PROVIDE ( SHA1Transform = 0x4000a364 );
PROVIDE ( SHA1Update = 0x4000b5a8 );
PROVIDE ( Wait_SPI_Idle = 0x4000448c );
PROVIDE ( SPI_read_status = 0x400043c8 );
PROVIDE ( SPI_write_status = 0x40004400 );
PROVIDE ( SPI_write_enable = 0x4000443c );
PROVIDE ( SPIEraseArea = 0x40004b44 );
PROVIDE ( SPIEraseBlock = 0x400049b4 );
PROVIDE ( SPIEraseChip = 0x40004984 );

Binary file not shown.

View File

@ -1 +1 @@
0.9.3
0.9.5