Added the (possibly modified) Espressif SDK to the project to avoid problems with building. This may not be OK license wise, but who cares
This commit is contained in:
Executable
+122
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* airkiss.h
|
||||
*
|
||||
* Created on: 2015-1-26
|
||||
* Author: peterfan
|
||||
*/
|
||||
|
||||
#ifndef AIRKISS_H_
|
||||
#define AIRKISS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef void* (*airkiss_memset_fn) (void* ptr, int value, unsigned int num);
|
||||
typedef void* (*airkiss_memcpy_fn) (void* dst, const void* src, unsigned int num);
|
||||
typedef int (*airkiss_memcmp_fn) (const void* ptr1, const void* ptr2, unsigned int num);
|
||||
typedef int (*airkiss_printf_fn) (const char* format, ...);
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
airkiss_memset_fn memset;
|
||||
airkiss_memcpy_fn memcpy;
|
||||
airkiss_memcmp_fn memcmp;
|
||||
airkiss_printf_fn printf;
|
||||
|
||||
} airkiss_config_t;
|
||||
|
||||
/**
|
||||
* @brief Get airkiss lib version.
|
||||
*
|
||||
* @attention The lenth of version is unknown
|
||||
*
|
||||
* @param null.
|
||||
*
|
||||
* @return const char*
|
||||
*/
|
||||
|
||||
const char* airkiss_version(void);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* the length of the data buffer is lack*/
|
||||
AIRKISS_LAN_ERR_OVERFLOW = -5,
|
||||
|
||||
/* Do not support the type of instruction */
|
||||
AIRKISS_LAN_ERR_CMD = -4,
|
||||
|
||||
/* Error reading data package */
|
||||
AIRKISS_LAN_ERR_PAKE = -3,
|
||||
|
||||
/* Error function passing parameters */
|
||||
AIRKISS_LAN_ERR_PARA = -2,
|
||||
|
||||
/* Packet data error */
|
||||
AIRKISS_LAN_ERR_PKG = -1,
|
||||
|
||||
/* Message format is correct */
|
||||
AIRKISS_LAN_CONTINUE = 0,
|
||||
|
||||
/* Find equipment request packet is received */
|
||||
AIRKISS_LAN_SSDP_REQ = 1,
|
||||
|
||||
/* Packet packaging complete */
|
||||
AIRKISS_LAN_PAKE_READY = 2
|
||||
|
||||
|
||||
} airkiss_lan_ret_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AIRKISS_LAN_SSDP_REQ_CMD = 0x1,
|
||||
AIRKISS_LAN_SSDP_RESP_CMD = 0x1001,
|
||||
AIRKISS_LAN_SSDP_NOTIFY_CMD = 0x1002
|
||||
} airkiss_lan_cmdid_t;
|
||||
|
||||
/**
|
||||
* @brief Receive UDP packet and input this API for analyzing.
|
||||
*
|
||||
* @attention null.
|
||||
*
|
||||
* @param const void* body : The start of the UDP message body data pointer.
|
||||
* @param unsigned short length : the effective length of data.
|
||||
* @param const airkiss_config_t* config : input struct airkiss_config_t
|
||||
*
|
||||
* @return >=0 : succeed (reference airkiss_lan_ret_t)
|
||||
* @return <0 : error code (reference airkiss_lan_ret_t)
|
||||
*/
|
||||
|
||||
int airkiss_lan_recv(const void* body, unsigned short length, const airkiss_config_t* config);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Packaging the UDP packet to send.
|
||||
*
|
||||
* @attention null.
|
||||
*
|
||||
* @param airkiss_lan_cmdid_t ak_lan_cmdid : The packet type.
|
||||
* @param void* appid : Vendor's Wechat public number id.
|
||||
* @param void* deviceid : device model id.
|
||||
* @param void* _datain : the data to be sent.
|
||||
* @param unsigned short inlength : the lenth of data to be sent.
|
||||
* @param void* _dataout : Data buffer addr.
|
||||
* @param unsigned short* outlength : the size of data buffer.
|
||||
* @param const airkiss_config_t* config : input struct airkiss_config_t
|
||||
*
|
||||
* @return >=0 : succeed (reference airkiss_lan_ret_t)
|
||||
* @return <0 : error code (reference airkiss_lan_ret_t)
|
||||
*/
|
||||
|
||||
int airkiss_lan_pack(airkiss_lan_cmdid_t ak_lan_cmdid, void* appid, void* deviceid, void* _datain, unsigned short inlength, void* _dataout, unsigned short* outlength, const airkiss_config_t* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AIRKISS_H_ */
|
||||
Executable
+161
@@ -0,0 +1,161 @@
|
||||
|
||||
/*
|
||||
* custom_at.h
|
||||
*
|
||||
* This file is part of Espressif's AT+ command set program.
|
||||
* Copyright (C) 2013 - 2016, Espressif Systems
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of version 3 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CUSTOM_AT_H_
|
||||
#define CUSTOM_AT_H_
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *at_cmdName;
|
||||
int8_t at_cmdLen;
|
||||
void (*at_testCmd)(uint8_t id);
|
||||
void (*at_queryCmd)(uint8_t id);
|
||||
void (*at_setupCmd)(uint8_t id, char *pPara);
|
||||
void (*at_exeCmd)(uint8_t id);
|
||||
}at_funcationType;
|
||||
|
||||
typedef void (*at_custom_uart_rx_intr)(uint8* data,int32 len);
|
||||
|
||||
typedef void (*at_custom_response_func_type)(const char *str);
|
||||
|
||||
typedef void (*at_fake_uart_tx_func_type)(const uint8*data,uint32 length);
|
||||
|
||||
extern uint8 at_customLinkMax;
|
||||
|
||||
/**
|
||||
* @brief Response "OK" to uart.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_response_ok(void);
|
||||
/**
|
||||
* @brief Response "ERROR" to uart.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_response_error(void);
|
||||
/**
|
||||
* @brief Response string.
|
||||
* It is equivalent to at_port_print,if not call at_register_response_func or call at_register_response_func(NULL);
|
||||
* It will run custom response function,if call at_register_response_func and parameter is not NULL.
|
||||
* @param string
|
||||
* @retval None
|
||||
*/
|
||||
void at_response(const char *str);
|
||||
/**
|
||||
* @brief register custom response function.
|
||||
* @param response_func: the function that will run when call at_response
|
||||
* @retval None
|
||||
*/
|
||||
void at_register_response_func(at_custom_response_func_type response_func);
|
||||
/**
|
||||
* @brief Task of process command or txdata.
|
||||
* @param custom_at_cmd_array: the array of at cmd that custom defined
|
||||
* cmd_num : the num of at cmd that custom defined
|
||||
* @retval None
|
||||
*/
|
||||
void at_cmd_array_regist(at_funcationType *custom_at_cmd_array,uint32 cmd_num);
|
||||
/**
|
||||
* @brief get digit form at cmd line.the maybe alter pSrc
|
||||
* @param p_src: at cmd line string
|
||||
* result:the buffer to be placed result
|
||||
* err : err num
|
||||
* @retval TRUE:
|
||||
* FALSE:
|
||||
*/
|
||||
bool at_get_next_int_dec(char **p_src,int*result,int* err);
|
||||
/**
|
||||
* @brief get string form at cmd line.the maybe alter pSrc
|
||||
* @param p_dest: the buffer to be placed result
|
||||
* p_src: at cmd line string
|
||||
* max_len :max len of string excepted to get
|
||||
* @retval None
|
||||
*/
|
||||
int32 at_data_str_copy(char *p_dest, char **p_src, int32 max_len);
|
||||
|
||||
/**
|
||||
* @brief initialize at module
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_init(void);
|
||||
/**
|
||||
* @brief print string to at port
|
||||
* @param string
|
||||
* @retval None
|
||||
*/
|
||||
void at_port_print(const char *str);
|
||||
/**
|
||||
* @brief print custom information when AT+GMR
|
||||
* @param string
|
||||
* @retval None
|
||||
*/
|
||||
void at_set_custom_info(char* info);
|
||||
/**
|
||||
* @brief if current at command is processing,you can call at_enter_special_state,
|
||||
* then if other comamnd coming,it will return busy.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_enter_special_state(void);
|
||||
/**
|
||||
* @brief
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_leave_special_state(void);
|
||||
/**
|
||||
* @brief get at version
|
||||
* @param None
|
||||
* @retval at version
|
||||
* bit24~31: at main version
|
||||
* bit23~16: at sub version
|
||||
* bit15~8 : at test version
|
||||
* bit7~0 : customized version
|
||||
*/
|
||||
uint32 at_get_version(void);
|
||||
|
||||
/**
|
||||
* @brief register custom uart rx interrupt function
|
||||
* @param rx_func: custom uart rx interrupt function.
|
||||
* If rx_func is non-void,when rx interrupt comming,it will call rx_func(data,len),
|
||||
* data is the buffer of data,len is the length of data.Otherwise,it will run AT rx function.
|
||||
* @retval None
|
||||
*/
|
||||
void at_register_uart_rx_intr(at_custom_uart_rx_intr rx_func);
|
||||
/**
|
||||
* @brief notify at module that has receive data
|
||||
* @param data: data buffer.
|
||||
* @param length: data length
|
||||
* @retval data len,if ok len == length
|
||||
*/
|
||||
uint32 at_fake_uart_rx(uint8* data,uint32 length);
|
||||
|
||||
/**
|
||||
* @brief enable fake uart,and register fake uart tx
|
||||
* @param enable: enable fake uart.
|
||||
* @param at_fake_uart_tx_func:
|
||||
* @retval data len,if ok len == length
|
||||
*/
|
||||
bool at_fake_uart_enable(bool enable,at_fake_uart_tx_func_type at_fake_uart_tx_func);
|
||||
|
||||
#endif
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _C_TYPES_H_
|
||||
#define _C_TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
//typedef unsigned char uint8_t;
|
||||
typedef signed char sint8_t;
|
||||
//typedef signed char int8_t;
|
||||
//typedef unsigned short uint16_t;
|
||||
typedef signed short sint16_t;
|
||||
//typedef signed short int16_t;
|
||||
//typedef unsigned long uint32_t;
|
||||
typedef signed long sint32_t;
|
||||
//typedef signed long int32_t;
|
||||
typedef signed long long sint64_t;
|
||||
//typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long u_int64_t;
|
||||
typedef float real32_t;
|
||||
typedef double real64_t;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char u8;
|
||||
typedef signed char sint8;
|
||||
typedef signed char int8;
|
||||
typedef signed char s8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned short u16;
|
||||
typedef signed short sint16;
|
||||
typedef signed short s16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned int u32;
|
||||
typedef signed int sint32;
|
||||
typedef signed int s32;
|
||||
typedef int int32;
|
||||
typedef signed long long sint64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned long long u64;
|
||||
typedef float real32;
|
||||
typedef double real64;
|
||||
|
||||
#define __le16 u16
|
||||
|
||||
typedef unsigned int size_t;
|
||||
|
||||
#define __packed __attribute__((packed))
|
||||
|
||||
#define LOCAL static
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif /* NULL */
|
||||
|
||||
/* probably should not put STATUS here */
|
||||
typedef enum {
|
||||
OK = 0,
|
||||
FAIL,
|
||||
PENDING,
|
||||
BUSY,
|
||||
CANCEL,
|
||||
} STATUS;
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
|
||||
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
|
||||
|
||||
#define DMEM_ATTR __attribute__((section(".bss")))
|
||||
#define SHMEM_ATTR
|
||||
|
||||
#ifdef ICACHE_FLASH
|
||||
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
|
||||
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
|
||||
#else
|
||||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#endif /* ICACHE_FLASH */
|
||||
|
||||
#define STORE_ATTR __attribute__((aligned(4)))
|
||||
|
||||
#ifndef __cplusplus
|
||||
//typedef unsigned char bool;
|
||||
#define BOOL bool
|
||||
//#define true (1)
|
||||
//#define false (0)
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#endif /* _C_TYPES_H_ */
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _C_TYPES_H_
|
||||
#define _C_TYPES_H_
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char sint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short sint16_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef signed long sint32_t;
|
||||
typedef signed long int32_t;
|
||||
typedef signed long long sint64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long u_int64_t;
|
||||
typedef float real32_t;
|
||||
typedef double real64_t;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char u8;
|
||||
typedef signed char sint8;
|
||||
typedef signed char int8;
|
||||
typedef signed char s8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned short u16;
|
||||
typedef signed short sint16;
|
||||
typedef signed short s16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned int u32;
|
||||
typedef signed int sint32;
|
||||
typedef signed int s32;
|
||||
typedef int int32;
|
||||
typedef signed long long sint64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned long long u64;
|
||||
typedef float real32;
|
||||
typedef double real64;
|
||||
|
||||
#define __le16 u16
|
||||
|
||||
typedef unsigned int size_t;
|
||||
|
||||
#define __packed __attribute__((packed))
|
||||
|
||||
#define LOCAL static
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif /* NULL */
|
||||
|
||||
/* probably should not put STATUS here */
|
||||
typedef enum {
|
||||
OK = 0,
|
||||
FAIL,
|
||||
PENDING,
|
||||
BUSY,
|
||||
CANCEL,
|
||||
} STATUS;
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
|
||||
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
|
||||
|
||||
#define DMEM_ATTR __attribute__((section(".bss")))
|
||||
#define SHMEM_ATTR
|
||||
|
||||
#ifdef ICACHE_FLASH
|
||||
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
|
||||
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
|
||||
#else
|
||||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#endif /* ICACHE_FLASH */
|
||||
|
||||
#define STORE_ATTR __attribute__((aligned(4)))
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef unsigned char bool;
|
||||
#define BOOL bool
|
||||
#define true (1)
|
||||
#define false (0)
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#endif /* _C_TYPES_H_ */
|
||||
Executable
+315
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* Copyright (c) Espressif System 2010 - 2012
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _EAGLE_SOC_H_
|
||||
#define _EAGLE_SOC_H_
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
#define UL(x) ((unsigned long)(x))
|
||||
|
||||
//Register Bits{{
|
||||
#define BIT31 BIT(31)
|
||||
#define BIT30 BIT(30)
|
||||
#define BIT29 BIT(29)
|
||||
#define BIT28 BIT(28)
|
||||
#define BIT27 BIT(27)
|
||||
#define BIT26 BIT(26)
|
||||
#define BIT25 BIT(25)
|
||||
#define BIT24 BIT(24)
|
||||
#define BIT23 BIT(23)
|
||||
#define BIT22 BIT(22)
|
||||
#define BIT21 BIT(21)
|
||||
#define BIT20 BIT(20)
|
||||
#define BIT19 BIT(19)
|
||||
#define BIT18 BIT(18)
|
||||
#define BIT17 BIT(17)
|
||||
#define BIT16 BIT(16)
|
||||
#define BIT15 BIT(15)
|
||||
#define BIT14 BIT(14)
|
||||
#define BIT13 BIT(13)
|
||||
#define BIT12 BIT(12)
|
||||
#define BIT11 BIT(11)
|
||||
#define BIT10 BIT(10)
|
||||
#define BIT9 BIT(9)
|
||||
#define BIT8 BIT(8)
|
||||
#define BIT7 BIT(7)
|
||||
#define BIT6 BIT(6)
|
||||
#define BIT5 BIT(5)
|
||||
#define BIT4 BIT(4)
|
||||
#define BIT3 BIT(3)
|
||||
#define BIT2 BIT(2)
|
||||
#define BIT1 BIT(1)
|
||||
#define BIT0 BIT(0)
|
||||
//}}
|
||||
|
||||
//Registers Operation {{
|
||||
#define ETS_UNCACHED_ADDR(addr) (addr)
|
||||
#define ETS_CACHED_ADDR(addr) (addr)
|
||||
|
||||
|
||||
#define READ_PERI_REG(addr) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr)))
|
||||
#define WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)
|
||||
#define CLEAR_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~((uint32_t)mask))))
|
||||
#define SET_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|((uint32_t)mask)))
|
||||
#define GET_PERI_REG_BITS(reg, hipos,lowpos) ((READ_PERI_REG(reg)>>(lowpos))&((1<<((hipos)-(lowpos)+1))-1))
|
||||
#define SET_PERI_REG_BITS(reg,bit_map,value,shift) (WRITE_PERI_REG((reg), (READ_PERI_REG(reg) & (~(UL(bit_map)<<(shift)))) | (UL(value)<<UL(shift)) ))
|
||||
//}}
|
||||
|
||||
//Periheral Clock {{
|
||||
#define CPU_CLK_FREQ 80*1000000 //unit: Hz
|
||||
#define APB_CLK_FREQ CPU_CLK_FREQ
|
||||
#define UART_CLK_FREQ APB_CLK_FREQ
|
||||
#define TIMER_CLK_FREQ (APB_CLK_FREQ>>8) //divided by 256
|
||||
//}}
|
||||
|
||||
//Peripheral device base address define{{
|
||||
#define PERIPHS_DPORT_BASEADDR 0x3ff00000
|
||||
#define PERIPHS_GPIO_BASEADDR 0x60000300
|
||||
#define PERIPHS_TIMER_BASEDDR 0x60000600
|
||||
#define PERIPHS_RTC_BASEADDR 0x60000700
|
||||
#define PERIPHS_IO_MUX 0x60000800
|
||||
//}}
|
||||
|
||||
//Interrupt remap control registers define{{
|
||||
#define EDGE_INT_ENABLE_REG (PERIPHS_DPORT_BASEADDR+0x04)
|
||||
#define TM1_EDGE_INT_ENABLE() SET_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT1)
|
||||
#define TM1_EDGE_INT_DISABLE() CLEAR_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT1)
|
||||
//}}
|
||||
|
||||
//GPIO reg {{
|
||||
#define GPIO_REG_READ(reg) READ_PERI_REG(PERIPHS_GPIO_BASEADDR + reg)
|
||||
#define GPIO_REG_WRITE(reg, val) WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + reg, val)
|
||||
#define GPIO_OUT_ADDRESS 0x00
|
||||
#define GPIO_OUT_W1TS_ADDRESS 0x04
|
||||
#define GPIO_OUT_W1TC_ADDRESS 0x08
|
||||
|
||||
#define GPIO_ENABLE_ADDRESS 0x0c
|
||||
#define GPIO_ENABLE_W1TS_ADDRESS 0x10
|
||||
#define GPIO_ENABLE_W1TC_ADDRESS 0x14
|
||||
#define GPIO_OUT_W1TC_DATA_MASK 0x0000ffff
|
||||
|
||||
#define GPIO_IN_ADDRESS 0x18
|
||||
|
||||
#define GPIO_STATUS_ADDRESS 0x1c
|
||||
#define GPIO_STATUS_W1TS_ADDRESS 0x20
|
||||
#define GPIO_STATUS_W1TC_ADDRESS 0x24
|
||||
#define GPIO_STATUS_INTERRUPT_MASK 0x0000ffff
|
||||
|
||||
#define GPIO_RTC_CALIB_SYNC PERIPHS_GPIO_BASEADDR+0x6c
|
||||
#define RTC_CALIB_START BIT31 //first write to zero, then to one to start
|
||||
#define RTC_PERIOD_NUM_MASK 0x3ff //max 8ms
|
||||
#define GPIO_RTC_CALIB_VALUE PERIPHS_GPIO_BASEADDR+0x70
|
||||
#define RTC_CALIB_RDY_S 31 //after measure, flag to one, when start from zero to one, turn to zero
|
||||
#define RTC_CALIB_VALUE_MASK 0xfffff
|
||||
|
||||
#define GPIO_PIN0_ADDRESS 0x28
|
||||
|
||||
#define GPIO_ID_PIN0 0
|
||||
#define GPIO_ID_PIN(n) (GPIO_ID_PIN0+(n))
|
||||
#define GPIO_LAST_REGISTER_ID GPIO_ID_PIN(15)
|
||||
#define GPIO_ID_NONE 0xffffffff
|
||||
|
||||
#define GPIO_PIN_COUNT 16
|
||||
|
||||
#define GPIO_PIN_CONFIG_MSB 12
|
||||
#define GPIO_PIN_CONFIG_LSB 11
|
||||
#define GPIO_PIN_CONFIG_MASK 0x00001800
|
||||
#define GPIO_PIN_CONFIG_GET(x) (((x) & GPIO_PIN_CONFIG_MASK) >> GPIO_PIN_CONFIG_LSB)
|
||||
#define GPIO_PIN_CONFIG_SET(x) (((x) << GPIO_PIN_CONFIG_LSB) & GPIO_PIN_CONFIG_MASK)
|
||||
|
||||
#define GPIO_WAKEUP_ENABLE 1
|
||||
#define GPIO_WAKEUP_DISABLE (~GPIO_WAKEUP_ENABLE)
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_MSB 10
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_LSB 10
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_MASK 0x00000400
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN_WAKEUP_ENABLE_MASK) >> GPIO_PIN_WAKEUP_ENABLE_LSB)
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN_WAKEUP_ENABLE_LSB) & GPIO_PIN_WAKEUP_ENABLE_MASK)
|
||||
|
||||
#define GPIO_PIN_INT_TYPE_MASK 0x380
|
||||
#define GPIO_PIN_INT_TYPE_MSB 9
|
||||
#define GPIO_PIN_INT_TYPE_LSB 7
|
||||
#define GPIO_PIN_INT_TYPE_GET(x) (((x) & GPIO_PIN_INT_TYPE_MASK) >> GPIO_PIN_INT_TYPE_LSB)
|
||||
#define GPIO_PIN_INT_TYPE_SET(x) (((x) << GPIO_PIN_INT_TYPE_LSB) & GPIO_PIN_INT_TYPE_MASK)
|
||||
|
||||
#define GPIO_PAD_DRIVER_ENABLE 1
|
||||
#define GPIO_PAD_DRIVER_DISABLE (~GPIO_PAD_DRIVER_ENABLE)
|
||||
#define GPIO_PIN_PAD_DRIVER_MSB 2
|
||||
#define GPIO_PIN_PAD_DRIVER_LSB 2
|
||||
#define GPIO_PIN_PAD_DRIVER_MASK 0x00000004
|
||||
#define GPIO_PIN_PAD_DRIVER_GET(x) (((x) & GPIO_PIN_PAD_DRIVER_MASK) >> GPIO_PIN_PAD_DRIVER_LSB)
|
||||
#define GPIO_PIN_PAD_DRIVER_SET(x) (((x) << GPIO_PIN_PAD_DRIVER_LSB) & GPIO_PIN_PAD_DRIVER_MASK)
|
||||
|
||||
#define GPIO_AS_PIN_SOURCE 0
|
||||
#define SIGMA_AS_PIN_SOURCE (~GPIO_AS_PIN_SOURCE)
|
||||
#define GPIO_PIN_SOURCE_MSB 0
|
||||
#define GPIO_PIN_SOURCE_LSB 0
|
||||
#define GPIO_PIN_SOURCE_MASK 0x00000001
|
||||
#define GPIO_PIN_SOURCE_GET(x) (((x) & GPIO_PIN_SOURCE_MASK) >> GPIO_PIN_SOURCE_LSB)
|
||||
#define GPIO_PIN_SOURCE_SET(x) (((x) << GPIO_PIN_SOURCE_LSB) & GPIO_PIN_SOURCE_MASK)
|
||||
// }}
|
||||
|
||||
// TIMER reg {{
|
||||
#define RTC_REG_READ(addr) READ_PERI_REG(PERIPHS_TIMER_BASEDDR + addr)
|
||||
#define RTC_REG_WRITE(addr, val) WRITE_PERI_REG(PERIPHS_TIMER_BASEDDR + addr, val)
|
||||
#define RTC_CLR_REG_MASK(reg, mask) CLEAR_PERI_REG_MASK(PERIPHS_TIMER_BASEDDR +reg, mask)
|
||||
/* Returns the current time according to the timer timer. */
|
||||
#define NOW() RTC_REG_READ(FRC2_COUNT_ADDRESS)
|
||||
|
||||
//load initial_value to timer1
|
||||
#define FRC1_LOAD_ADDRESS 0x00
|
||||
|
||||
//timer1's counter value(count from initial_value to 0)
|
||||
#define FRC1_COUNT_ADDRESS 0x04
|
||||
|
||||
#define FRC1_CTRL_ADDRESS 0x08
|
||||
|
||||
//clear timer1's interrupt when write this address
|
||||
#define FRC1_INT_ADDRESS 0x0c
|
||||
#define FRC1_INT_CLR_MASK 0x00000001
|
||||
|
||||
//timer2's counter value(count from initial_value to 0)
|
||||
#define FRC2_COUNT_ADDRESS 0x24
|
||||
// }}
|
||||
|
||||
//RTC reg {{
|
||||
#define REG_RTC_BASE PERIPHS_RTC_BASEADDR
|
||||
|
||||
#define RTC_GPIO_OUT (REG_RTC_BASE + 0x068)
|
||||
#define RTC_GPIO_ENABLE (REG_RTC_BASE + 0x074)
|
||||
#define RTC_GPIO_IN_DATA (REG_RTC_BASE + 0x08C)
|
||||
#define RTC_GPIO_CONF (REG_RTC_BASE + 0x090)
|
||||
#define PAD_XPD_DCDC_CONF (REG_RTC_BASE + 0x0A0)
|
||||
//}}
|
||||
|
||||
//PIN Mux reg {{
|
||||
#define PERIPHS_IO_MUX_FUNC 0x13
|
||||
#define PERIPHS_IO_MUX_FUNC_S 4
|
||||
#define PERIPHS_IO_MUX_PULLUP BIT7
|
||||
#define PERIPHS_IO_MUX_PULLUP2 BIT6
|
||||
#define PERIPHS_IO_MUX_SLEEP_PULLUP BIT3
|
||||
#define PERIPHS_IO_MUX_SLEEP_PULLUP2 BIT2
|
||||
#define PERIPHS_IO_MUX_SLEEP_OE BIT1
|
||||
#define PERIPHS_IO_MUX_OE BIT0
|
||||
|
||||
#define PERIPHS_IO_MUX_CONF_U (PERIPHS_IO_MUX + 0x00)
|
||||
#define SPI0_CLK_EQU_SYS_CLK BIT8
|
||||
#define SPI1_CLK_EQU_SYS_CLK BIT9
|
||||
|
||||
#define PERIPHS_IO_MUX_MTDI_U (PERIPHS_IO_MUX + 0x04)
|
||||
#define FUNC_MTDI 0
|
||||
#define FUNC_I2SI_DATA 1
|
||||
#define FUNC_HSPIQ_MISO 2
|
||||
#define FUNC_GPIO12 3
|
||||
#define FUNC_UART0_DTR 4
|
||||
|
||||
#define PERIPHS_IO_MUX_MTCK_U (PERIPHS_IO_MUX + 0x08)
|
||||
#define FUNC_MTCK 0
|
||||
#define FUNC_I2SI_BCK 1
|
||||
#define FUNC_HSPID_MOSI 2
|
||||
#define FUNC_GPIO13 3
|
||||
#define FUNC_UART0_CTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_MTMS_U (PERIPHS_IO_MUX + 0x0C)
|
||||
#define FUNC_MTMS 0
|
||||
#define FUNC_I2SI_WS 1
|
||||
#define FUNC_HSPI_CLK 2
|
||||
#define FUNC_GPIO14 3
|
||||
#define FUNC_UART0_DSR 4
|
||||
|
||||
#define PERIPHS_IO_MUX_MTDO_U (PERIPHS_IO_MUX + 0x10)
|
||||
#define FUNC_MTDO 0
|
||||
#define FUNC_I2SO_BCK 1
|
||||
#define FUNC_HSPI_CS0 2
|
||||
#define FUNC_GPIO15 3
|
||||
#define FUNC_U0RTS 4
|
||||
#define FUNC_UART0_RTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_U0RXD_U (PERIPHS_IO_MUX + 0x14)
|
||||
#define FUNC_U0RXD 0
|
||||
#define FUNC_I2SO_DATA 1
|
||||
#define FUNC_GPIO3 3
|
||||
#define FUNC_CLK_XTAL_BK 4
|
||||
|
||||
#define PERIPHS_IO_MUX_U0TXD_U (PERIPHS_IO_MUX + 0x18)
|
||||
#define FUNC_U0TXD 0
|
||||
#define FUNC_SPICS1 1
|
||||
#define FUNC_GPIO1 3
|
||||
#define FUNC_CLK_RTC_BK 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_CLK_U (PERIPHS_IO_MUX + 0x1c)
|
||||
#define FUNC_SDCLK 0
|
||||
#define FUNC_SPICLK 1
|
||||
#define FUNC_GPIO6 3
|
||||
#define UART1_CTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA0_U (PERIPHS_IO_MUX + 0x20)
|
||||
#define FUNC_SDDATA0 0
|
||||
#define FUNC_SPIQ_MISO 1
|
||||
#define FUNC_SPIQ 1
|
||||
#define FUNC_GPIO7 3
|
||||
#define FUNC_U1TXD 4
|
||||
#define FUNC_UART1_TXD 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA1_U (PERIPHS_IO_MUX + 0x24)
|
||||
#define FUNC_SDDATA1 0
|
||||
#define FUNC_SPID_MOSI 1
|
||||
#define FUNC_SPID 1
|
||||
#define FUNC_GPIO8 3
|
||||
#define FUNC_U1RXD 4
|
||||
#define FUNC_UART1_RXD 4
|
||||
#define FUNC_SDDATA1_U1RXD 7
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA2_U (PERIPHS_IO_MUX + 0x28)
|
||||
#define FUNC_SDDATA2 0
|
||||
#define FUNC_SPIHD 1
|
||||
#define FUNC_GPIO9 3
|
||||
#define UFNC_HSPIHD 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA3_U (PERIPHS_IO_MUX + 0x2c)
|
||||
#define FUNC_SDDATA3 0
|
||||
#define FUNC_SPIWP 1
|
||||
#define FUNC_GPIO10 3
|
||||
#define FUNC_HSPIWP 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_CMD_U (PERIPHS_IO_MUX + 0x30)
|
||||
#define FUNC_SDCMD 0
|
||||
#define FUNC_SPICS0 1
|
||||
#define FUNC_GPIO11 3
|
||||
#define U1RTS 4
|
||||
#define UART1_RTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO0_U (PERIPHS_IO_MUX + 0x34)
|
||||
#define FUNC_GPIO0 0
|
||||
#define FUNC_SPICS2 1
|
||||
#define FUNC_CLK_OUT 4
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO2_U (PERIPHS_IO_MUX + 0x38)
|
||||
#define FUNC_GPIO2 0
|
||||
#define FUNC_I2SO_WS 1
|
||||
#define FUNC_U1TXD_BK 2
|
||||
#define FUNC_UART1_TXD_BK 2
|
||||
#define FUNC_U0TXD_BK 4
|
||||
#define FUNC_UART0_TXD_BK 4
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO4_U (PERIPHS_IO_MUX + 0x3C)
|
||||
#define FUNC_GPIO4 0
|
||||
#define FUNC_CLK_XTAL 1
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO5_U (PERIPHS_IO_MUX + 0x40)
|
||||
#define FUNC_GPIO5 0
|
||||
#define FUNC_CLK_RTC 1
|
||||
|
||||
#define PIN_PULLUP_DIS(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
|
||||
#define PIN_PULLUP_EN(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
|
||||
#define PIN_FUNC_SELECT(PIN_NAME, FUNC) do { \
|
||||
WRITE_PERI_REG(PIN_NAME, READ_PERI_REG(PIN_NAME) \
|
||||
& UL(~(PERIPHS_IO_MUX_FUNC << PERIPHS_IO_MUX_FUNC_S)) \
|
||||
| UL((((FUNC & BIT2) << 2) | (FUNC & 0x3)) << PERIPHS_IO_MUX_FUNC_S)); \
|
||||
} while (0)
|
||||
|
||||
//}}
|
||||
|
||||
#endif //_EAGLE_SOC_H_
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#undef ESP_SDK_VERSION
|
||||
#define ESP_SDK_VERSION 010502
|
||||
Executable
+918
@@ -0,0 +1,918 @@
|
||||
#ifndef __ESPCONN_H__
|
||||
#define __ESPCONN_H__
|
||||
|
||||
#include <c_types.h>
|
||||
#include <ip_addr.h>
|
||||
|
||||
typedef sint8 err_t;
|
||||
|
||||
typedef void *espconn_handle;
|
||||
|
||||
/**
|
||||
* @brief Connect callback.
|
||||
*
|
||||
* Callback which will be called if successful listening (ESP8266 as TCP server)
|
||||
* or connection (ESP8266 as TCP client) callback, register by espconn_regist_connectcb.
|
||||
*
|
||||
* @attention The pointer "void *arg" may be different in different callbacks, please don't
|
||||
* use this pointer directly to distinguish one from another in multiple connections,
|
||||
* use remote_ip and remote_port in espconn instead.
|
||||
*
|
||||
* @param void *arg : pointer corresponding structure espconn.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
typedef void (* espconn_connect_callback)(void *arg);
|
||||
|
||||
/**
|
||||
* @brief Reconnect callback.
|
||||
*
|
||||
* Enter this callback when error occurred, TCP connection broke. This callback is
|
||||
* registered by espconn_regist_reconcb.
|
||||
*
|
||||
* @attention The pointer "void *arg" may be different in different callbacks, please don't
|
||||
* use this pointer directly to distinguish one from another in multiple connections,
|
||||
* use remote_ip and remote_port in espconn instead.
|
||||
*
|
||||
* @param void *arg : pointer corresponding structure espconn.
|
||||
* @param sint8 err : error code
|
||||
* - ESCONN_TIMEOUT - Timeout
|
||||
* - ESPCONN_ABRT - TCP connection aborted
|
||||
* - ESPCONN_RST - TCP connection abort
|
||||
* - ESPCONN_CLSD - TCP connection closed
|
||||
* - ESPCONN_CONN - TCP connection
|
||||
* - ESPCONN_HANDSHAKE - TCP SSL handshake fail
|
||||
* - ESPCONN_PROTO_MSG - SSL application invalid
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
|
||||
|
||||
/* Definitions for error constants. */
|
||||
|
||||
#define ESPCONN_OK 0 /* No error, everything OK. */
|
||||
#define ESPCONN_MEM -1 /* Out of memory error. */
|
||||
#define ESPCONN_TIMEOUT -3 /* Timeout. */
|
||||
#define ESPCONN_RTE -4 /* Routing problem. */
|
||||
#define ESPCONN_INPROGRESS -5 /* Operation in progress */
|
||||
#define ESPCONN_MAXNUM -7 /* Total number exceeds the set maximum*/
|
||||
|
||||
#define ESPCONN_ABRT -8 /* Connection aborted. */
|
||||
#define ESPCONN_RST -9 /* Connection reset. */
|
||||
#define ESPCONN_CLSD -10 /* Connection closed. */
|
||||
#define ESPCONN_CONN -11 /* Not connected. */
|
||||
|
||||
#define ESPCONN_ARG -12 /* Illegal argument. */
|
||||
#define ESPCONN_IF -14 /* UDP send error */
|
||||
#define ESPCONN_ISCONN -15 /* Already connected. */
|
||||
|
||||
#define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
|
||||
#define ESPCONN_SSL_INVALID_DATA -61 /* ssl application invalid */
|
||||
|
||||
/** Protocol family and type of the espconn */
|
||||
enum espconn_type {
|
||||
ESPCONN_INVALID = 0, /**< invalid type */
|
||||
ESPCONN_TCP = 0x10, /**< TCP */
|
||||
ESPCONN_UDP = 0x20, /**< UDP */
|
||||
};
|
||||
|
||||
/** Current state of the espconn. */
|
||||
enum espconn_state {
|
||||
ESPCONN_NONE, /**< idle state, no connection */
|
||||
ESPCONN_WAIT, /**< ESP8266 is as TCP client, and waiting for connection */
|
||||
ESPCONN_LISTEN, /**< ESP8266 is as TCP server, and waiting for connection */
|
||||
ESPCONN_CONNECT, /**< connected */
|
||||
ESPCONN_WRITE, /**< sending data */
|
||||
ESPCONN_READ, /**< receiving data */
|
||||
ESPCONN_CLOSE /**< connection closed */
|
||||
};
|
||||
|
||||
typedef struct _esp_tcp {
|
||||
int remote_port; /**< remote port of TCP connection */
|
||||
int local_port; /**< ESP8266's local port of TCP connection */
|
||||
uint8 local_ip[4]; /**< local IP of ESP8266 */
|
||||
uint8 remote_ip[4]; /**< remote IP of TCP connection */
|
||||
espconn_connect_callback connect_callback; /**< connected callback */
|
||||
espconn_reconnect_callback reconnect_callback; /**< as error handler, the TCP connection broke unexpectedly */
|
||||
espconn_connect_callback disconnect_callback; /**< disconnected callback */
|
||||
espconn_connect_callback write_finish_fn; /**< data send by espconn_send has wrote into buffer waiting for sending, or has sent successfully */
|
||||
} esp_tcp;
|
||||
|
||||
typedef struct _esp_udp {
|
||||
int remote_port; /**< remote port of UDP transmission */
|
||||
int local_port; /**< ESP8266's local port for UDP transmission */
|
||||
uint8 local_ip[4]; /**< local IP of ESP8266 */
|
||||
uint8 remote_ip[4]; /**< remote IP of UDP transmission */
|
||||
} esp_udp;
|
||||
|
||||
typedef struct _remot_info {
|
||||
enum espconn_state state; /**< state of espconn */
|
||||
int remote_port; /**< remote port */
|
||||
uint8 remote_ip[4]; /**< remote IP address */
|
||||
} remot_info;
|
||||
|
||||
/** A callback prototype to inform about events for a espconn */
|
||||
typedef void (* espconn_recv_callback)(void *arg, char *pdata, unsigned short len);
|
||||
typedef void (* espconn_sent_callback)(void *arg);
|
||||
|
||||
/** A espconn descriptor */
|
||||
struct espconn {
|
||||
enum espconn_type type; /**< type of the espconn (TCP or UDP) */
|
||||
enum espconn_state state; /**< current state of the espconn */
|
||||
union {
|
||||
esp_tcp *tcp;
|
||||
esp_udp *udp;
|
||||
} proto;
|
||||
espconn_recv_callback recv_callback; /**< data received callback */
|
||||
espconn_sent_callback sent_callback; /**< data sent callback */
|
||||
uint8 link_cnt; /**< link count */
|
||||
void *reserve; /**< reserved for user data */
|
||||
};
|
||||
|
||||
enum espconn_option {
|
||||
ESPCONN_START = 0x00, /**< no option, start enum. */
|
||||
ESPCONN_REUSEADDR = 0x01, /**< free memory after TCP disconnection happen, need not wait 2 minutes. */
|
||||
ESPCONN_NODELAY = 0x02, /**< disable nagle algorithm during TCP data transmission, quicken the data transmission. */
|
||||
ESPCONN_COPY = 0x04, /**< enable espconn_regist_write_finish, enter write_finish_callback means that the data espconn_send sending was written into 2920 bytes write-buffer waiting for sending or already sent. */
|
||||
ESPCONN_KEEPALIVE = 0x08, /**< enable TCP keep alive. */
|
||||
ESPCONN_END /**< no option, end enum. */
|
||||
};
|
||||
|
||||
enum espconn_level {
|
||||
ESPCONN_KEEPIDLE, /**< TCP keep-alive interval, unit : second. */
|
||||
ESPCONN_KEEPINTVL, /**< packet interval during TCP keep-alive, unit : second. */
|
||||
ESPCONN_KEEPCNT /**< maximum packet retry count of TCP keep-alive. */
|
||||
};
|
||||
|
||||
enum {
|
||||
ESPCONN_IDLE = 0,
|
||||
ESPCONN_CLIENT,
|
||||
ESPCONN_SERVER,
|
||||
ESPCONN_BOTH,
|
||||
ESPCONN_MAX
|
||||
};
|
||||
|
||||
struct espconn_packet {
|
||||
uint16 sent_length; /* sent length successful*/
|
||||
uint16 snd_buf_size; /* Available buffer size for sending */
|
||||
uint16 snd_queuelen; /* Available buffer space for sending */
|
||||
uint16 total_queuelen; /* total Available buffer space for sending */
|
||||
uint32 packseqno; /* seqno to be sent */
|
||||
uint32 packseq_nxt; /* seqno expected */
|
||||
uint32 packnum;
|
||||
};
|
||||
|
||||
struct mdns_info {
|
||||
char *host_name;
|
||||
char *server_name;
|
||||
uint16 server_port;
|
||||
unsigned long ipAddr;
|
||||
char *txt_data[10];
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Connect to a TCP server (ESP8266 acting as TCP client).
|
||||
*
|
||||
* @attention If espconn_connect fail, returns non-0 value, there is no connection, so it
|
||||
* won't enter any espconn callback.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure, the espconn to
|
||||
* listen to the connection
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_RTE - Routing Problem
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_connect(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Disconnect a TCP connection.
|
||||
*
|
||||
* @attention Don't call this API in any espconn callback. If needed, please use system
|
||||
* task to trigger espconn_disconnect.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_disconnect(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Delete a transmission.
|
||||
*
|
||||
* @attention Corresponding creation API :
|
||||
* - TCP: espconn_accept,
|
||||
* - UDP: espconn_create
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_delete(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Creates a TCP server (i.e. accepts connections).
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_accept(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Create UDP transmission.
|
||||
*
|
||||
* @attention Parameter remote_ip and remote_port need to be set, do not set to be 0.
|
||||
*
|
||||
* @param struct espconn *espconn : the UDP control block structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding UDP transmission
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_create(struct espconn *espconn);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get maximum number of how many TCP connections are allowed.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return Maximum number of how many TCP connections are allowed.
|
||||
*/
|
||||
uint8 espconn_tcp_get_max_con(void);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum number of how many TCP connection is allowed.
|
||||
*
|
||||
* @param uint8 num : Maximum number of how many TCP connection is allowed.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_tcp_set_max_con(uint8 num);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum number of TCP clients which are allowed to connect to ESP8266 TCP server.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP server structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum number of TCP clients allowed to connect to ESP8266 TCP server.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP server structure
|
||||
* @param uint8 num : Maximum number of TCP clients which are allowed
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);
|
||||
|
||||
/**
|
||||
* @brief Register timeout interval of ESP8266 TCP server.
|
||||
*
|
||||
* @attention 1. If timeout is set to 0, timeout will be disable and ESP8266 TCP server will
|
||||
* not disconnect TCP clients has stopped communication. This usage of timeout=0,
|
||||
* is deprecated.
|
||||
* @attention 2. This timeout interval is not very precise, only as reference.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint32 interval : timeout interval, unit: second, maximum: 7200 seconds
|
||||
* @param uint8 type_flag : 0, set for all connections; 1, set for a specific connection
|
||||
* - If the type_flag set to be 0, please call this API after espconn_accept, before listened
|
||||
* a TCP connection.
|
||||
* - If the type_flag set to be 1, the first parameter *espconn is the specific connection.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag);
|
||||
|
||||
/**
|
||||
* @brief Get the information about a TCP connection or UDP transmission.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param remot_info **pcon_info : connect to client info
|
||||
* @param uint8 typeflags : 0, regular server; 1, ssl server
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding transmission according to
|
||||
* structure espconn
|
||||
*/
|
||||
sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_get_packet_info
|
||||
* Description : get the packet info with host
|
||||
* Parameters : espconn -- the espconn used to disconnect the connection
|
||||
* infoarg -- the packet info
|
||||
* Returns : the errur code
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_get_packet_info(struct espconn *espconn, struct espconn_packet* infoarg);
|
||||
|
||||
/**
|
||||
* @brief Register data sent callback which will be called back when data are successfully sent.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param espconn_sent_callback sent_cb : registered callback function which will be called if
|
||||
* the data is successfully sent
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding transmission according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
|
||||
|
||||
/**
|
||||
* @brief Register a callback which will be called when all sending TCP data is completely
|
||||
* write into write-buffer or sent.
|
||||
*
|
||||
* Need to call espconn_set_opt to enable write-buffer first.
|
||||
*
|
||||
* @attention 1. write-buffer is used to keep TCP data that waiting to be sent, queue number
|
||||
* of the write-buffer is 8 which means that it can keep 8 packets at most.
|
||||
* The size of write-buffer is 2920 bytes.
|
||||
* @attention 2. Users can enable it by using espconn_set_opt.
|
||||
* @attention 3. Users can call espconn_send to send the next packet in write_finish_callback
|
||||
* instead of using espconn_sent_callback.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param espconn_connect_callback write_finish_fn : registered callback function which will
|
||||
* be called if the data is completely write
|
||||
* into write buffer or sent.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);
|
||||
|
||||
/**
|
||||
* @brief Send data through network.
|
||||
*
|
||||
* @attention 1. Please call espconn_send after espconn_sent_callback of the pre-packet.
|
||||
* @attention 2. If it is a UDP transmission, it is suggested to set espconn->proto.udp->remote_ip
|
||||
* and remote_port before every calling of espconn_send.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param uint8 *psent : pointer of data
|
||||
* @param uint16 length : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network transmission
|
||||
* according to structure espconn
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
sint8 espconn_send(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/**
|
||||
* @brief Send data through network.
|
||||
*
|
||||
* This API is deprecated, please use espconn_send instead.
|
||||
*
|
||||
* @attention 1. Please call espconn_sent after espconn_sent_callback of the pre-packet.
|
||||
* @attention 2. If it is a UDP transmission, it is suggested to set espconn->proto.udp->remote_ip
|
||||
* and remote_port before every calling of espconn_sent.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param uint8 *psent : pointer of data
|
||||
* @param uint16 length : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network transmission
|
||||
* according to structure espconn
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/**
|
||||
* @brief Send UDP data.
|
||||
*
|
||||
* @param struct espconn *espconn : the UDP structure
|
||||
* @param uint8 *psent : pointer of data
|
||||
* @param uint16 length : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
sint16 espconn_sendto(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/**
|
||||
* @brief Register connection function which will be called back under successful TCP connection.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param espconn_connect_callback connect_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb);
|
||||
|
||||
/**
|
||||
* @brief register data receive function which will be called back when data are received.
|
||||
*
|
||||
* @param struct espconn *espconn : the network transmission structure
|
||||
* @param espconn_recv_callback recv_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb);
|
||||
|
||||
/**
|
||||
* @brief Register reconnect callback.
|
||||
*
|
||||
* @attention espconn_reconnect_callback is more like a network-broken error handler; it handles
|
||||
* errors that occurs in any phase of the connection.
|
||||
* For instance, if espconn_send fails, espconn_reconnect_callback will be called
|
||||
* because the network is broken.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param espconn_reconnect_callback recon_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb);
|
||||
|
||||
/**
|
||||
* @brief Register disconnection function which will be called back under successful TCP
|
||||
* disconnection.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param espconn_connect_callback discon_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb);
|
||||
|
||||
/**
|
||||
* @brief Get an available port for network.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return Port number.
|
||||
*/
|
||||
uint32 espconn_port(void);
|
||||
|
||||
/**
|
||||
* @brief Set option of TCP connection.
|
||||
*
|
||||
* @attention In general, we need not call this API. If call espconn_set_opt, please call
|
||||
* it in espconn_connect_callback.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 opt : option of TCP connection, refer to enum espconn_option
|
||||
* - bit 0: 1: free memory after TCP disconnection happen need not wait 2 minutes;
|
||||
* - bit 1: 1: disable nagle algorithm during TCP data transmission, quiken the data transmission.
|
||||
* - bit 2: 1: enable espconn_regist_write_finish, enter write finish callback means
|
||||
* the data espconn_send sending was written into 2920 bytes write-buffer
|
||||
* waiting for sending or already sent.
|
||||
* - bit 3: 1: enable TCP keep alive
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);
|
||||
|
||||
/**
|
||||
* @brief Clear option of TCP connection.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 opt : enum espconn_option
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_clear_opt(struct espconn *espconn, uint8 opt);
|
||||
|
||||
/**
|
||||
* @brief Set configuration of TCP keep alive.
|
||||
*
|
||||
* @attention In general, we need not call this API. If needed, please call it in
|
||||
* espconn_connect_callback and call espconn_set_opt to enable keep alive first.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 level : To do TCP keep-alive detection every ESPCONN_KEEPIDLE. If there
|
||||
* is no response, retry ESPCONN_KEEPCNT times every ESPCONN_KEEPINTVL.
|
||||
* If still no response, considers it as TCP connection broke, goes
|
||||
* into espconn_reconnect_callback. Notice, keep alive interval is not
|
||||
* precise, only for reference, it depends on priority.
|
||||
* @param void* optarg : value of parameter
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_set_keepalive(struct espconn *espconn, uint8 level, void *optarg);
|
||||
|
||||
/**
|
||||
* @brief Get configuration of TCP keep alive.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 level : enum espconn_level
|
||||
* @param void* optarg : value of parameter
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg);
|
||||
|
||||
/**
|
||||
* @brief Callback which is invoked when a hostname is found.
|
||||
*
|
||||
* @param const char *name : hostname
|
||||
* @param ip_addr_t *ipaddr : IP address of the hostname, or to be NULL if the name could
|
||||
* not be found (or on any other error).
|
||||
* @param void *callback_arg : callback argument.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
|
||||
|
||||
/**
|
||||
* @brief DNS function.
|
||||
*
|
||||
* Parse a hostname (string) to an IP address.
|
||||
*
|
||||
* @param struct espconn *pespconn : espconn to parse a hostname.
|
||||
* @param const char *hostname : the hostname.
|
||||
* @param ip_addr_t *addr : IP address.
|
||||
* @param dns_found_callback found : callback of DNS
|
||||
*
|
||||
* @return err_t :
|
||||
* - ESPCONN_OK - succeed
|
||||
* - ESPCONN_INPROGRESS - error code : already connected
|
||||
* - ESPCONN_ARG - error code : illegal argument, can't find network transmission
|
||||
* according to structure espconn
|
||||
*/
|
||||
err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ip_addr_t *addr, dns_found_callback found);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_abort
|
||||
* Description : Forcely abort with host
|
||||
* Parameters : espconn -- the espconn used to connect with the host
|
||||
* Returns : result
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_abort(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_encry_connect
|
||||
* Description : The function given as connection
|
||||
* Parameters : espconn -- the espconn used to connect with the host
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_connect(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_encry_disconnect
|
||||
* Description : The function given as the disconnection
|
||||
* Parameters : espconn -- the espconn used to disconnect with the host
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_disconnect(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_send
|
||||
* Description : sent data for client or server
|
||||
* Parameters : espconn -- espconn to set for client or server
|
||||
* psent -- data to send
|
||||
* length -- length of data to send
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_send(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_encry_sent
|
||||
* Description : sent data for client or server
|
||||
* Parameters : espconn -- espconn to set for client or server
|
||||
* psent -- data to send
|
||||
* length -- length of data to send
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_set_size
|
||||
* Description : set the buffer size for client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* size -- buffer size
|
||||
* Returns : true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_set_size(uint8 level, uint16 size);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_get_size
|
||||
* Description : get buffer size for client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* Returns : buffer size for client or server
|
||||
*******************************************************************************/
|
||||
|
||||
sint16 espconn_secure_get_size(uint8 level);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_ca_enable
|
||||
* Description : enable the certificate authenticate and set the flash sector
|
||||
* as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* flash_sector -- flash sector for save certificate
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_ca_enable(uint8 level, uint8 flash_sector);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_ca_disable
|
||||
* Description : disable the certificate authenticate as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_ca_disable(uint8 level);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_cert_req_enable
|
||||
* Description : enable the client certificate authenticate and set the flash sector
|
||||
* as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* flash_sector -- flash sector for save certificate
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_cert_req_enable(uint8 level, uint8 flash_sector);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_ca_disable
|
||||
* Description : disable the client certificate authenticate as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_cert_req_disable(uint8 level);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_set_default_certificate
|
||||
* Description : Load the certificates in memory depending on compile-time
|
||||
* and user options.
|
||||
* Parameters : certificate -- Load the certificate
|
||||
* length -- Load the certificate length
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_set_default_certificate(const uint8* certificate, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_set_default_private_key
|
||||
* Description : Load the key in memory depending on compile-time
|
||||
* and user options.
|
||||
* Parameters : private_key -- Load the key
|
||||
* length -- Load the key length
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_set_default_private_key(const uint8* private_key, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_accept
|
||||
* Description : The function given as the listen
|
||||
* Parameters : espconn -- the espconn used to listen the connection
|
||||
* Returns : result
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_accept(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_accepts
|
||||
* Description : delete the secure server host
|
||||
* Parameters : espconn -- the espconn used to listen the connection
|
||||
* Returns : result
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_delete(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Join a multicast group.
|
||||
*
|
||||
* @attention This API can only be called after the ESP8266 station connects to a router.
|
||||
*
|
||||
* @param ip_addr_t *host_ip : IP of UDP host
|
||||
* @param ip_addr_t *multicast_ip : IP of multicast group
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
*/
|
||||
sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
|
||||
|
||||
/**
|
||||
* @brief Leave a multicast group.
|
||||
*
|
||||
* @attention This API can only be called after the ESP8266 station connects to a router.
|
||||
*
|
||||
* @param ip_addr_t *host_ip : IP of UDP host
|
||||
* @param ip_addr_t *multicast_ip : IP of multicast group
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
*/
|
||||
sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
|
||||
|
||||
/**
|
||||
* @brief Puts in a request to block the TCP receive function.
|
||||
*
|
||||
* @attention The function does not act immediately; we recommend calling it while
|
||||
* reserving 5*1460 bytes of memory. This API can be called more than once.
|
||||
*
|
||||
* @param struct espconn *espconn : corresponding TCP connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn.
|
||||
*/
|
||||
sint8 espconn_recv_hold(struct espconn *pespconn);
|
||||
|
||||
/**
|
||||
* @brief Unblock TCP receiving data (i.e. undo espconn_recv_hold).
|
||||
*
|
||||
* @attention This API takes effect immediately.
|
||||
*
|
||||
* @param struct espconn *espconn : corresponding TCP connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn.
|
||||
*/
|
||||
sint8 espconn_recv_unhold(struct espconn *pespconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_init
|
||||
* Description : register a device with mdns
|
||||
* Parameters : ipAddr -- the ip address of device
|
||||
* hostname -- the hostname of device
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_init(struct mdns_info *info);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_close
|
||||
* Description : close a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_close(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_server_register
|
||||
* Description : register a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_server_register(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_server_unregister
|
||||
* Description : unregister a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_server_unregister(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_get_servername
|
||||
* Description : get server name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
******************************************************************************/
|
||||
char* espconn_mdns_get_servername(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_set_servername
|
||||
* Description : set server name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_set_servername(const char *name);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_set_hostname
|
||||
* Description : set host name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_set_hostname(char *name);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_get_hostname
|
||||
* Description : get host name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
char* espconn_mdns_get_hostname(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_disable
|
||||
* Description : disable a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_disable(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_enable
|
||||
* Description : disable a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Set default DNS server. Two DNS server is allowed to be set.
|
||||
*
|
||||
* @attention Only if ESP8266 DHCP client is disabled (wifi_station_dhcpc_stop),
|
||||
* this API can be used.
|
||||
*
|
||||
* @param char numdns : DNS server ID, 0 or 1
|
||||
* @param ip_addr_t *dnsserver : DNS server IP
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_dns_setserver(char numdns, ip_addr_t *dnsserver);
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2015 -2018 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ESPNOW_H__
|
||||
#define __ESPNOW_H__
|
||||
|
||||
#include <c_types.h>
|
||||
|
||||
enum esp_now_role {
|
||||
ESP_NOW_ROLE_IDLE = 0,
|
||||
ESP_NOW_ROLE_CONTROLLER,
|
||||
ESP_NOW_ROLE_SLAVE,
|
||||
ESP_NOW_ROLE_MAX,
|
||||
};
|
||||
|
||||
typedef void (*esp_now_recv_cb_t)(u8 *mac_addr, u8 *data, u8 len);
|
||||
typedef void (*esp_now_send_cb_t)(u8 *mac_addr, u8 status);
|
||||
|
||||
int esp_now_init(void);
|
||||
int esp_now_deinit(void);
|
||||
|
||||
int esp_now_register_send_cb(esp_now_send_cb_t cb);
|
||||
int esp_now_unregister_send_cb(void);
|
||||
|
||||
int esp_now_register_recv_cb(esp_now_recv_cb_t cb);
|
||||
int esp_now_unregister_recv_cb(void);
|
||||
|
||||
int esp_now_send(u8 *da, u8 *data, int len);
|
||||
|
||||
int esp_now_add_peer(u8 *mac_addr, u8 role, u8 channel, u8 *key, u8 key_len);
|
||||
int esp_now_del_peer(u8 *mac_addr);
|
||||
|
||||
int esp_now_set_self_role(u8 role);
|
||||
int esp_now_get_self_role(void);
|
||||
|
||||
int esp_now_set_peer_role(u8 *mac_addr, u8 role);
|
||||
int esp_now_get_peer_role(u8 *mac_addr);
|
||||
|
||||
int esp_now_set_peer_channel(u8 *mac_addr, u8 channel);
|
||||
int esp_now_get_peer_channel(u8 *mac_addr);
|
||||
|
||||
int esp_now_set_peer_key(u8 *mac_addr, u8 *key, u8 key_len);
|
||||
int esp_now_get_peer_key(u8 *mac_addr, u8 *key, u8 *key_len);
|
||||
|
||||
u8 *esp_now_fetch_peer(bool restart);
|
||||
|
||||
int esp_now_is_peer_exist(u8 *mac_addr);
|
||||
|
||||
int esp_now_get_cnt_info(u8 *all_cnt, u8 *encrypt_cnt);
|
||||
|
||||
int esp_now_set_kok(u8 *key, u8 len);
|
||||
|
||||
#endif
|
||||
Executable
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* copyright (c) 2008 - 2011 Espressif System
|
||||
*
|
||||
* Define user specified Event signals and Task priorities here
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ETS_SYS_H
|
||||
#define _ETS_SYS_H
|
||||
|
||||
#include "c_types.h"
|
||||
#include "eagle_soc.h"
|
||||
|
||||
typedef uint32_t ETSSignal;
|
||||
typedef uint32_t ETSParam;
|
||||
|
||||
typedef struct ETSEventTag ETSEvent;
|
||||
|
||||
struct ETSEventTag {
|
||||
ETSSignal sig;
|
||||
ETSParam par;
|
||||
};
|
||||
|
||||
typedef void (*ETSTask)(ETSEvent *e);
|
||||
|
||||
/* timer related */
|
||||
typedef uint32_t ETSHandle;
|
||||
typedef void ETSTimerFunc(void *timer_arg);
|
||||
|
||||
typedef struct _ETSTIMER_ {
|
||||
struct _ETSTIMER_ *timer_next;
|
||||
uint32_t timer_expire;
|
||||
uint32_t timer_period;
|
||||
ETSTimerFunc *timer_func;
|
||||
void *timer_arg;
|
||||
} ETSTimer;
|
||||
|
||||
/* interrupt related */
|
||||
#define ETS_SDIO_INUM 1
|
||||
#define ETS_SPI_INUM 2
|
||||
#define ETS_GPIO_INUM 4
|
||||
#define ETS_UART_INUM 5
|
||||
#define ETS_UART1_INUM 5
|
||||
#define ETS_FRC_TIMER1_INUM 9 /* use edge*/
|
||||
|
||||
#define ETS_INTR_LOCK() \
|
||||
ets_intr_lock()
|
||||
|
||||
#define ETS_INTR_UNLOCK() \
|
||||
ets_intr_unlock()
|
||||
|
||||
#define ETS_FRC_TIMER1_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_FRC_TIMER1_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_FRC_TIMER1_NMI_INTR_ATTACH(func) \
|
||||
NmiTimSetFunc(func)
|
||||
|
||||
#define ETS_SDIO_INTR_ATTACH(func, arg)\
|
||||
ets_isr_attach(ETS_SDIO_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_GPIO_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_GPIO_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_UART_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_UART_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_SPI_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_SPI_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_INTR_ENABLE(inum) \
|
||||
ets_isr_unmask((1<<inum))
|
||||
|
||||
#define ETS_INTR_DISABLE(inum) \
|
||||
ets_isr_mask((1<<inum))
|
||||
|
||||
#define ETS_UART_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_UART_INUM)
|
||||
|
||||
#define ETS_UART_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_UART_INUM)
|
||||
|
||||
#define ETS_FRC1_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_FRC_TIMER1_INUM)
|
||||
|
||||
#define ETS_FRC1_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_FRC_TIMER1_INUM)
|
||||
|
||||
#define ETS_GPIO_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_GPIO_INUM)
|
||||
|
||||
#define ETS_GPIO_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_GPIO_INUM)
|
||||
|
||||
#define ETS_SPI_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_SPI_INUM)
|
||||
|
||||
#define ETS_SPI_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_SPI_INUM)
|
||||
|
||||
#define ETS_SDIO_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_SDIO_INUM)
|
||||
|
||||
#define ETS_SDIO_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_SDIO_INUM)
|
||||
#endif /* _ETS_SYS_H */
|
||||
Executable
+100
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* copyright (c) Espressif System 2010
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GPIO_H_
|
||||
#define _GPIO_H_
|
||||
|
||||
#define GPIO_PIN_ADDR(i) (GPIO_PIN0_ADDRESS + i*4)
|
||||
|
||||
#define GPIO_ID_IS_PIN_REGISTER(reg_id) \
|
||||
((reg_id >= GPIO_ID_PIN0) && (reg_id <= GPIO_ID_PIN(GPIO_PIN_COUNT-1)))
|
||||
|
||||
#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0)
|
||||
|
||||
typedef enum {
|
||||
GPIO_PIN_INTR_DISABLE = 0,
|
||||
GPIO_PIN_INTR_POSEDGE = 1,
|
||||
GPIO_PIN_INTR_NEGEDGE = 2,
|
||||
GPIO_PIN_INTR_ANYEDGE = 3,
|
||||
GPIO_PIN_INTR_LOLEVEL = 4,
|
||||
GPIO_PIN_INTR_HILEVEL = 5
|
||||
} GPIO_INT_TYPE;
|
||||
|
||||
#define GPIO_OUTPUT_SET(gpio_no, bit_value) \
|
||||
gpio_output_set((bit_value)<<gpio_no, ((~(bit_value))&0x01)<<gpio_no, 1<<gpio_no,0)
|
||||
#define GPIO_DIS_OUTPUT(gpio_no) gpio_output_set(0,0,0, 1<<gpio_no)
|
||||
#define GPIO_INPUT_GET(gpio_no) ((gpio_input_get()>>gpio_no)&BIT0)
|
||||
|
||||
/* GPIO interrupt handler, registered through gpio_intr_handler_register */
|
||||
typedef void (* gpio_intr_handler_fn_t)(uint32 intr_mask, void *arg);
|
||||
|
||||
|
||||
/*
|
||||
* Initialize GPIO. This includes reading the GPIO Configuration DataSet
|
||||
* to initialize "output enables" and pin configurations for each gpio pin.
|
||||
* Must be called once during startup.
|
||||
*/
|
||||
void gpio_init(void);
|
||||
|
||||
/*
|
||||
* Change GPIO pin output by setting, clearing, or disabling pins.
|
||||
* In general, it is expected that a bit will be set in at most one
|
||||
* of these masks. If a bit is clear in all masks, the output state
|
||||
* remains unchanged.
|
||||
*
|
||||
* There is no particular ordering guaranteed; so if the order of
|
||||
* writes is significant, calling code should divide a single call
|
||||
* into multiple calls.
|
||||
*/
|
||||
void gpio_output_set(uint32 set_mask,
|
||||
uint32 clear_mask,
|
||||
uint32 enable_mask,
|
||||
uint32 disable_mask);
|
||||
|
||||
/*
|
||||
* Sample the value of GPIO input pins and returns a bitmask.
|
||||
*/
|
||||
uint32 gpio_input_get(void);
|
||||
|
||||
/*
|
||||
* Set the specified GPIO register to the specified value.
|
||||
* This is a very general and powerful interface that is not
|
||||
* expected to be used during normal operation. It is intended
|
||||
* mainly for debug, or for unusual requirements.
|
||||
*/
|
||||
void gpio_register_set(uint32 reg_id, uint32 value);
|
||||
|
||||
/* Get the current value of the specified GPIO register. */
|
||||
uint32 gpio_register_get(uint32 reg_id);
|
||||
|
||||
/*
|
||||
* Register an application-specific interrupt handler for GPIO pin
|
||||
* interrupts. Once the interrupt handler is called, it will not
|
||||
* be called again until after a call to gpio_intr_ack. Any GPIO
|
||||
* interrupts that occur during the interim are masked.
|
||||
*
|
||||
* The application-specific handler is called with a mask of
|
||||
* pending GPIO interrupts. After processing pin interrupts, the
|
||||
* application-specific handler may wish to use gpio_intr_pending
|
||||
* to check for any additional pending interrupts before it returns.
|
||||
*/
|
||||
void gpio_intr_handler_register(gpio_intr_handler_fn_t fn, void *arg);
|
||||
|
||||
/* Determine which GPIO interrupts are pending. */
|
||||
uint32 gpio_intr_pending(void);
|
||||
|
||||
/*
|
||||
* Acknowledge GPIO interrupts.
|
||||
* Intended to be called from the gpio_intr_handler_fn.
|
||||
*/
|
||||
void gpio_intr_ack(uint32 ack_mask);
|
||||
|
||||
void gpio_pin_wakeup_enable(uint32 i, GPIO_INT_TYPE intr_state);
|
||||
|
||||
void gpio_pin_wakeup_disable();
|
||||
|
||||
void gpio_pin_intr_state_set(uint32 i, GPIO_INT_TYPE intr_state);
|
||||
|
||||
#endif // _GPIO_H_
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#ifndef __IP_ADDR_H__
|
||||
#define __IP_ADDR_H__
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
struct ip_addr {
|
||||
uint32 addr;
|
||||
};
|
||||
|
||||
typedef struct ip_addr ip_addr_t;
|
||||
|
||||
struct ip_info {
|
||||
struct ip_addr ip;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if two address are on the same network.
|
||||
*
|
||||
* @arg addr1 IP address 1
|
||||
* @arg addr2 IP address 2
|
||||
* @arg mask network identifier mask
|
||||
* @return !0 if the network identifiers of both address match
|
||||
*/
|
||||
#define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \
|
||||
(mask)->addr) == \
|
||||
((addr2)->addr & \
|
||||
(mask)->addr))
|
||||
|
||||
/** Set an IP address given by the four byte-parts.
|
||||
Little-endian version that prevents the use of htonl. */
|
||||
#define IP4_ADDR(ipaddr, a,b,c,d) \
|
||||
(ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \
|
||||
((uint32)((c) & 0xff) << 16) | \
|
||||
((uint32)((b) & 0xff) << 8) | \
|
||||
(uint32)((a) & 0xff)
|
||||
|
||||
#define ip4_addr1(ipaddr) (((uint8*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((uint8*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((uint8*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((uint8*)(ipaddr))[3])
|
||||
|
||||
#define ip4_addr1_16(ipaddr) ((uint16)ip4_addr1(ipaddr))
|
||||
#define ip4_addr2_16(ipaddr) ((uint16)ip4_addr2(ipaddr))
|
||||
#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), \
|
||||
ip4_addr2_16(ipaddr), \
|
||||
ip4_addr3_16(ipaddr), \
|
||||
ip4_addr4_16(ipaddr)
|
||||
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
#endif /* __IP_ADDR_H__ */
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* A few JSON defines used for parsing and generating JSON.
|
||||
* \author
|
||||
* Niclas Finne <nfi@sics.se>
|
||||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __JSON_H__
|
||||
#define __JSON_H__
|
||||
|
||||
#define JSON_TYPE_ARRAY '['
|
||||
#define JSON_TYPE_OBJECT '{'
|
||||
#define JSON_TYPE_PAIR ':'
|
||||
#define JSON_TYPE_PAIR_NAME 'N' /* for N:V pairs */
|
||||
#define JSON_TYPE_STRING '"'
|
||||
#define JSON_TYPE_INT 'I'
|
||||
#define JSON_TYPE_NUMBER '0'
|
||||
#define JSON_TYPE_ERROR 0
|
||||
|
||||
/* how should we handle null vs false - both can be 0? */
|
||||
#define JSON_TYPE_NULL 'n'
|
||||
#define JSON_TYPE_TRUE 't'
|
||||
#define JSON_TYPE_FALSE 'f'
|
||||
|
||||
#define JSON_TYPE_CALLBACK 'C'
|
||||
|
||||
enum {
|
||||
JSON_ERROR_OK,
|
||||
JSON_ERROR_SYNTAX,
|
||||
JSON_ERROR_UNEXPECTED_ARRAY,
|
||||
JSON_ERROR_UNEXPECTED_END_OF_ARRAY,
|
||||
JSON_ERROR_UNEXPECTED_OBJECT,
|
||||
JSON_ERROR_UNEXPECTED_STRING
|
||||
};
|
||||
|
||||
#define JSON_CONTENT_TYPE "application/json"
|
||||
|
||||
#endif /* __JSON_H__ */
|
||||
Executable
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
#ifndef __JSONPARSE_H__
|
||||
#define __JSONPARSE_H__
|
||||
|
||||
#include "c_types.h"
|
||||
#include "json/json.h"
|
||||
|
||||
#ifdef JSONPARSE_CONF_MAX_DEPTH
|
||||
#define JSONPARSE_MAX_DEPTH JSONPARSE_CONF_MAX_DEPTH
|
||||
#else
|
||||
#define JSONPARSE_MAX_DEPTH 10
|
||||
#endif
|
||||
|
||||
struct jsonparse_state {
|
||||
const char *json;
|
||||
int pos;
|
||||
int len;
|
||||
int depth;
|
||||
/* for handling atomic values */
|
||||
int vstart;
|
||||
int vlen;
|
||||
char vtype;
|
||||
char error;
|
||||
char stack[JSONPARSE_MAX_DEPTH];
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Initialize a JSON parser state.
|
||||
* \param state A pointer to a JSON parser state
|
||||
* \param json The string to parse as JSON
|
||||
* \param len The length of the string to parse
|
||||
*
|
||||
* This function initializes a JSON parser state for
|
||||
* parsing a string as JSON.
|
||||
*/
|
||||
void jsonparse_setup(struct jsonparse_state *state, const char *json,
|
||||
int len);
|
||||
|
||||
/* move to next JSON element */
|
||||
int jsonparse_next(struct jsonparse_state *state);
|
||||
|
||||
/* copy the current JSON value into the specified buffer */
|
||||
int jsonparse_copy_value(struct jsonparse_state *state, char *buf,
|
||||
int buf_size);
|
||||
|
||||
/* get the current JSON value parsed as an int */
|
||||
int jsonparse_get_value_as_int(struct jsonparse_state *state);
|
||||
|
||||
/* get the current JSON value parsed as a long */
|
||||
long jsonparse_get_value_as_long(struct jsonparse_state *state);
|
||||
|
||||
/* get the current JSON value parsed as a unsigned long */
|
||||
unsigned long jsonparse_get_value_as_ulong(struct jsonparse_state *state);
|
||||
|
||||
/* get the length of the current JSON value */
|
||||
int jsonparse_get_len(struct jsonparse_state *state);
|
||||
|
||||
/* get the type of the current JSON value */
|
||||
int jsonparse_get_type(struct jsonparse_state *state);
|
||||
|
||||
/* compare the JSON value with the specified string */
|
||||
int jsonparse_strcmp_value(struct jsonparse_state *state, const char *str);
|
||||
|
||||
#endif /* __JSONPARSE_H__ */
|
||||
Executable
+145
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* JSON output generation
|
||||
* \author
|
||||
* Niclas Finne <nfi@sics.se>
|
||||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __JSONTREE_H__
|
||||
#define __JSONTREE_H__
|
||||
|
||||
#include "c_types.h"
|
||||
#include "json/json.h"
|
||||
|
||||
#ifdef JSONTREE_CONF_MAX_DEPTH
|
||||
#define JSONTREE_MAX_DEPTH JSONTREE_CONF_MAX_DEPTH
|
||||
#else
|
||||
#define JSONTREE_MAX_DEPTH 10
|
||||
#endif /* JSONTREE_CONF_MAX_DEPTH */
|
||||
|
||||
struct jsontree_context {
|
||||
struct jsontree_value *values[JSONTREE_MAX_DEPTH];
|
||||
uint16_t index[JSONTREE_MAX_DEPTH];
|
||||
int (* putchar)(int);
|
||||
uint8_t depth;
|
||||
uint8_t path;
|
||||
int callback_state;
|
||||
};
|
||||
|
||||
struct jsontree_value {
|
||||
uint8_t type;
|
||||
/* followed by a value */
|
||||
};
|
||||
|
||||
struct jsontree_string {
|
||||
uint8_t type;
|
||||
const char *value;
|
||||
};
|
||||
|
||||
struct jsontree_int {
|
||||
uint8_t type;
|
||||
int value;
|
||||
};
|
||||
|
||||
/* NOTE: the jsontree_callback set will receive a jsonparse state */
|
||||
struct jsonparse_state;
|
||||
struct jsontree_callback {
|
||||
uint8_t type;
|
||||
int (* output)(struct jsontree_context *js_ctx);
|
||||
int (* set)(struct jsontree_context *js_ctx, struct jsonparse_state *parser);
|
||||
};
|
||||
|
||||
struct jsontree_pair {
|
||||
const char *name;
|
||||
struct jsontree_value *value;
|
||||
};
|
||||
|
||||
struct jsontree_object {
|
||||
uint8_t type;
|
||||
uint8_t count;
|
||||
struct jsontree_pair *pairs;
|
||||
};
|
||||
|
||||
struct jsontree_array {
|
||||
uint8_t type;
|
||||
uint8_t count;
|
||||
struct jsontree_value **values;
|
||||
};
|
||||
|
||||
#define JSONTREE_STRING(text) {JSON_TYPE_STRING, (text)}
|
||||
#define JSONTREE_PAIR(name, value) {(name), (struct jsontree_value *)(value)}
|
||||
#define JSONTREE_CALLBACK(output, set) {JSON_TYPE_CALLBACK, (output), (set)}
|
||||
|
||||
#define JSONTREE_OBJECT(name, ...) \
|
||||
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
|
||||
static struct jsontree_object name = { \
|
||||
JSON_TYPE_OBJECT, \
|
||||
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
|
||||
jsontree_pair_##name }
|
||||
|
||||
#define JSONTREE_PAIR_ARRAY(value) (struct jsontree_value *)(value)
|
||||
#define JSONTREE_ARRAY(name, ...) \
|
||||
static struct jsontree_value* jsontree_value_##name[] = {__VA_ARGS__}; \
|
||||
static struct jsontree_array name = { \
|
||||
JSON_TYPE_ARRAY, \
|
||||
sizeof(jsontree_value_##name)/sizeof(struct jsontree_value*), \
|
||||
jsontree_value_##name }
|
||||
|
||||
#define JSONTREE_OBJECT_EXT(name, ...) \
|
||||
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
|
||||
struct jsontree_object name = { \
|
||||
JSON_TYPE_OBJECT, \
|
||||
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
|
||||
jsontree_pair_##name }
|
||||
|
||||
void jsontree_setup(struct jsontree_context *js_ctx,
|
||||
struct jsontree_value *root, int (* putchar)(int));
|
||||
void jsontree_reset(struct jsontree_context *js_ctx);
|
||||
|
||||
const char *jsontree_path_name(const struct jsontree_context *js_ctx,
|
||||
int depth);
|
||||
|
||||
void jsontree_write_int(const struct jsontree_context *js_ctx, int value);
|
||||
void jsontree_write_int_array(const struct jsontree_context *js_ctx, const int *text, uint32 length);
|
||||
|
||||
void jsontree_write_atom(const struct jsontree_context *js_ctx,
|
||||
const char *text);
|
||||
void jsontree_write_string(const struct jsontree_context *js_ctx,
|
||||
const char *text);
|
||||
int jsontree_print_next(struct jsontree_context *js_ctx);
|
||||
struct jsontree_value *jsontree_find_next(struct jsontree_context *js_ctx,
|
||||
int type);
|
||||
|
||||
#endif /* __JSONTREE_H__ */
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#ifndef __MEM_H__
|
||||
#define __MEM_H__
|
||||
|
||||
/* Note: check_memleak_debug_enable is a weak function inside SDK.
|
||||
* please copy following codes to user_main.c.
|
||||
#include "mem.h"
|
||||
|
||||
bool ICACHE_FLASH_ATTR check_memleak_debug_enable(void)
|
||||
{
|
||||
return MEMLEAK_DEBUG_ENABLE;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifndef MEMLEAK_DEBUG
|
||||
#define MEMLEAK_DEBUG_ENABLE 0
|
||||
#define os_free(s) vPortFree(s, "", 0)
|
||||
#define os_malloc(s) pvPortMalloc(s, "", 0)
|
||||
#define os_calloc(s) pvPortCalloc(s, "", 0);
|
||||
#define os_realloc(p, s) pvPortRealloc(p, s, "", 0)
|
||||
#define os_zalloc(s) pvPortZalloc(s, "", 0)
|
||||
#else
|
||||
#define MEMLEAK_DEBUG_ENABLE 1
|
||||
|
||||
#define os_free(s) \
|
||||
do{\
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
vPortFree(s, mem_debug_file, __LINE__);\
|
||||
}while(0)
|
||||
|
||||
#define os_malloc(s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortMalloc(s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#define os_calloc(s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortCalloc(s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#define os_realloc(p, s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortRealloc(p, s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#define os_zalloc(s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortZalloc(s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+341
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* ESPRSSIF MIT License
|
||||
*
|
||||
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
|
||||
*
|
||||
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
|
||||
* it is free of charge, to any person obtaining a copy of this software and associated
|
||||
* documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
|
||||
* to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef __LWIP_API_MESH_H__
|
||||
#define __LWIP_API_MESH_H__
|
||||
|
||||
#include "ip_addr.h"
|
||||
#include "user_interface.h"
|
||||
#include "espconn.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_MESH_GROUP_ID_LEN (6)
|
||||
|
||||
typedef void (* espconn_mesh_callback)();
|
||||
typedef void (* espconn_mesh_scan_callback)(void *arg, int8_t status);
|
||||
|
||||
enum mesh_type {
|
||||
MESH_CLOSE = 0,
|
||||
MESH_LOCAL,
|
||||
MESH_ONLINE,
|
||||
MESH_NONE = 0xFF
|
||||
};
|
||||
/** \defgroup Mesh_APIs Mesh APIs
|
||||
* @brief Mesh APIs
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup Mesh_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum mesh_status {
|
||||
MESH_DISABLE = 0,
|
||||
MESH_WIFI_CONN,
|
||||
MESH_NET_CONN,
|
||||
MESH_LOCAL_AVAIL,
|
||||
MESH_ONLINE_AVAIL
|
||||
};
|
||||
|
||||
enum mesh_node_type {
|
||||
MESH_NODE_PARENT = 0,
|
||||
MESH_NODE_CHILD,
|
||||
MESH_NODE_ALL
|
||||
};
|
||||
|
||||
struct mesh_scan_para_type {
|
||||
espconn_mesh_scan_callback usr_scan_cb; // scan done callback
|
||||
uint8_t grp_id[ESP_MESH_GROUP_ID_LEN]; // group id
|
||||
bool grp_set; // group set
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check whether the IP address is mesh local IP address or not.
|
||||
*
|
||||
* @attention 1. The range of mesh local IP address is 2.255.255.* ~ max_hop.255.255.*.
|
||||
* @attention 2. IP pointer should not be NULL. If the IP pointer is NULL, it will return false.
|
||||
*
|
||||
* @param struct ip_addr *ip : IP address
|
||||
*
|
||||
* @return true : the IP address is mesh local IP address
|
||||
* @return false : the IP address is not mesh local IP address
|
||||
*/
|
||||
bool espconn_mesh_local_addr(struct ip_addr *ip);
|
||||
|
||||
/**
|
||||
* @brief Get the information of router used by mesh network.
|
||||
*
|
||||
* @attention 1. The function should be called after mesh_enable_done
|
||||
*
|
||||
* @param struct station_config *router: router inforamtion
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_get_router(struct station_config *router);
|
||||
|
||||
/**
|
||||
* @brief Set the information of router used by mesh network.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param struct station_config *router: router information.
|
||||
* user should initialize the ssid and password.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_router(struct station_config *router);
|
||||
|
||||
/**
|
||||
* @brief Set server setup by user.
|
||||
*
|
||||
* @attention If users wants to use themself server, they use the function.
|
||||
* but the function must be called before espconn_mesh_enable.
|
||||
* at the same time, users need to implement the server.
|
||||
*
|
||||
* @param struct ip_addr *ip : ip address of server.
|
||||
* @param uint16_t port : port used by server.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_server_init(struct ip_addr *ip, uint16_t port);
|
||||
|
||||
/**
|
||||
* @brief Get the information of mesh node.
|
||||
*
|
||||
* @param enum mesh_node_type typ : mesh node type.
|
||||
* @param uint8_t **info : the information will be saved in *info.
|
||||
* @param uint8_t *count : the node count in *info.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_get_node_info(enum mesh_node_type type,
|
||||
uint8_t **info, uint8_t *count);
|
||||
|
||||
/**
|
||||
* @brief Set WiFi cryption algrithm and password for mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param AUTH_MODE mode : cryption algrithm (WPA/WAP2/WPA_WPA2).
|
||||
* @param uint8_t *passwd : password of WiFi.
|
||||
* @param uint8_t passwd_len : length of password (8 <= passwd_len <= 64).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len);
|
||||
/**
|
||||
* @brief Set prefix of SSID for mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t *prefix : prefix of SSID.
|
||||
* @param uint8_t prefix_len : length of prefix (0 < passwd_len <= 22).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len);
|
||||
|
||||
/**
|
||||
* @brief Set max hop for mesh network.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t max_hops : max hop of mesh network (1 <= max_hops < 10, 4 is recommended).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_max_hops(uint8_t max_hops);
|
||||
|
||||
/**
|
||||
* @brief Set group ID of mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t *grp_id : group ID.
|
||||
* @param uint16_t gid_len: length of group ID, now gid_len = 6.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_group_id_init(uint8_t *grp_id, uint16_t gid_len);
|
||||
|
||||
/**
|
||||
* @brief Set the curent device type.
|
||||
*
|
||||
* @param uint8_t dev_type : device type of mesh node
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_dev_type(uint8_t dev_type);
|
||||
/**
|
||||
* @brief Get the curent device type.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return device type
|
||||
*/
|
||||
uint8_t espconn_mesh_get_dev_type();
|
||||
|
||||
/**
|
||||
* @brief Try to establish mesh connection to server.
|
||||
*
|
||||
* @attention If espconn_mesh_connect fail, returns non-0 value, there is no connection, so it
|
||||
* won't enter any espconn callback.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure, the usr_esp to
|
||||
* listen to the connection
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_RTE - Routing Problem
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - Illegal argument, can't find the corresponding connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
int8_t espconn_mesh_connect(struct espconn *usr_esp);
|
||||
|
||||
/**
|
||||
* @brief Disconnect a mesh connection.
|
||||
*
|
||||
* @attention Do not call this API in any espconn callback. If needed, please use system
|
||||
* task to trigger espconn_mesh_disconnect.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
|
||||
int8_t espconn_mesh_disconnect(struct espconn *usr_esp);
|
||||
|
||||
/**
|
||||
* @brief Get current mesh status.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return the current mesh status, please refer to enum mesh_status.
|
||||
*/
|
||||
int8_t espconn_mesh_get_status();
|
||||
|
||||
/**
|
||||
* @brief Send data through mesh network.
|
||||
*
|
||||
* @attention Please call espconn_mesh_sent after espconn_sent_callback of the pre-packet.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure
|
||||
* @param uint8 *pdata : pointer of data
|
||||
* @param uint16 len : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - out of memory
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network transmission
|
||||
* according to structure espconn
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
int8_t espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len);
|
||||
|
||||
/**
|
||||
* @brief Get max hop of mesh network.
|
||||
*
|
||||
* @param null.
|
||||
*
|
||||
* @return the current max hop of mesh
|
||||
*/
|
||||
uint8_t espconn_mesh_get_max_hops();
|
||||
|
||||
/**
|
||||
* @brief To enable mesh network.
|
||||
*
|
||||
* @attention 1. the function should be called in user_init.
|
||||
* @attention 2. if mesh node can not scan the mesh AP, it will be isolate node without trigger enable_cb.
|
||||
* user can use espconn_mesh_get_status to get current status of node.
|
||||
* @attention 3. if user try to enable online mesh, but node fails to establish mesh connection
|
||||
* the node will work with local mesh.
|
||||
*
|
||||
* @param espconn_mesh_callback enable_cb : callback function of mesh-enable
|
||||
* @param enum mesh_type type : type of mesh, local or online.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type);
|
||||
|
||||
/**
|
||||
* @brief To disable mesh network.
|
||||
*
|
||||
* @attention When mesh network is disabed, the system will trigger disable_cb.
|
||||
*
|
||||
* @param espconn_mesh_callback disable_cb : callback function of mesh-disable
|
||||
* @param enum mesh_type type : type of mesh, local or online.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_disable(espconn_mesh_callback disable_cb);
|
||||
|
||||
/**
|
||||
* @brief To print version of mesh.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_print_ver();
|
||||
|
||||
/**
|
||||
* @brief To get AP around node.
|
||||
*
|
||||
* @attention User can get normal AP or mesh AP using the function.
|
||||
* If user plans to get normal AP, he/she needs to clear grp_set flag in para.
|
||||
* If user plans to get mesh AP, he/she needs to set grp_set and grp_id;
|
||||
*
|
||||
* @param struct mesh_scan_para_type *para : callback function of mesh-disable
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_scan(struct mesh_scan_para_type *para);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* copyright (c) Espressif System 2010
|
||||
*
|
||||
* mapping to ETS structures
|
||||
*
|
||||
*/
|
||||
#ifndef _OS_TYPES_H_
|
||||
#define _OS_TYPES_H_
|
||||
|
||||
#include "ets_sys.h"
|
||||
|
||||
#define os_signal_t ETSSignal
|
||||
#define os_param_t ETSParam
|
||||
#define os_event_t ETSEvent
|
||||
#define os_task_t ETSTask
|
||||
#define os_timer_t ETSTimer
|
||||
#define os_timer_func_t ETSTimerFunc
|
||||
|
||||
#endif
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2010 Espressif System
|
||||
*/
|
||||
|
||||
#ifndef _OSAPI_H_
|
||||
#define _OSAPI_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "user_config.h"
|
||||
|
||||
#define os_bzero ets_bzero
|
||||
#define os_delay_us ets_delay_us
|
||||
#define os_install_putc1 ets_install_putc1
|
||||
|
||||
#define os_memcmp ets_memcmp
|
||||
#define os_memcpy ets_memcpy
|
||||
#define os_memmove ets_memmove
|
||||
#define os_memset ets_memset
|
||||
#define os_strcat strcat
|
||||
#define os_strchr strchr
|
||||
#define os_strcmp ets_strcmp
|
||||
#define os_strcpy ets_strcpy
|
||||
#define os_strlen ets_strlen
|
||||
#define os_strncmp ets_strncmp
|
||||
#define os_strncpy ets_strncpy
|
||||
#define os_strstr ets_strstr
|
||||
#ifdef USE_US_TIMER
|
||||
#define os_timer_arm_us(a, b, c) ets_timer_arm_new(a, b, c, 0)
|
||||
#endif
|
||||
#define os_timer_arm(timer, time_ms, repeat) ets_timer_arm_new(timer, time_ms, repeat, 1)
|
||||
#define os_timer_disarm ets_timer_disarm
|
||||
#define os_timer_setfn ets_timer_setfn
|
||||
|
||||
#define os_sprintf ets_sprintf
|
||||
#define os_snprintf ets_snprintf
|
||||
|
||||
#ifdef USE_OPTIMIZE_PRINTF
|
||||
#define os_printf(fmt, ...) do { \
|
||||
static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
|
||||
os_printf_plus(flash_str, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define os_printf os_printf_plus
|
||||
#endif
|
||||
|
||||
unsigned long os_random(void);
|
||||
int os_get_random(unsigned char *buf, size_t len);
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#ifndef __PING_H__
|
||||
#define __PING_H__
|
||||
|
||||
#include <c_types.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__ */
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#ifndef __PWM_H__
|
||||
#define __PWM_H__
|
||||
|
||||
/*pwm.h: function and macro definition of PWM API , driver level */
|
||||
/*user_light.h: user interface for light API, user level*/
|
||||
/*user_light_adj: API for color changing and lighting effects, user level*/
|
||||
|
||||
|
||||
/*NOTE!! : DO NOT CHANGE THIS FILE*/
|
||||
|
||||
/*SUPPORT UP TO 8 PWM CHANNEL*/
|
||||
#define PWM_CHANNEL_NUM_MAX 8
|
||||
|
||||
struct pwm_param {
|
||||
uint32 period;
|
||||
uint32 freq;
|
||||
uint32 duty[PWM_CHANNEL_NUM_MAX]; //PWM_CHANNEL<=8
|
||||
};
|
||||
|
||||
|
||||
/* pwm_init should be called only once, for now */
|
||||
void pwm_init(uint32 period, uint32 *duty,uint32 pwm_channel_num,uint32 (*pin_info_list)[3]);
|
||||
void pwm_start(void);
|
||||
|
||||
void pwm_set_duty(uint32 duty, uint8 channel);
|
||||
uint32 pwm_get_duty(uint8 channel);
|
||||
void pwm_set_period(uint32 period);
|
||||
uint32 pwm_get_period(void);
|
||||
|
||||
uint32 get_pwm_version(void);
|
||||
void set_pwm_debug_en(uint8 print_en);
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+204
@@ -0,0 +1,204 @@
|
||||
#ifndef _SYS_QUEUE_H_
|
||||
#define _SYS_QUEUE_H_
|
||||
|
||||
#define QMD_SAVELINK(name, link)
|
||||
#define TRASHIT(x)
|
||||
|
||||
/*
|
||||
* Singly-linked List declarations.
|
||||
*/
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
|
||||
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for ((var) = SLIST_FIRST((head)); \
|
||||
(var); \
|
||||
(var) = SLIST_NEXT((var), field))
|
||||
|
||||
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = SLIST_FIRST((head)); \
|
||||
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
||||
for ((varp) = &SLIST_FIRST((head)); \
|
||||
((var) = *(varp)) != NULL; \
|
||||
(varp) = &SLIST_NEXT((var), field))
|
||||
|
||||
#define SLIST_INIT(head) do { \
|
||||
SLIST_FIRST((head)) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
|
||||
SLIST_NEXT((slistelm), field) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
|
||||
SLIST_FIRST((head)) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
#define SLIST_REMOVE(head, elm, type, field) do { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
|
||||
if (SLIST_FIRST((head)) == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = SLIST_FIRST((head)); \
|
||||
while (SLIST_NEXT(curelm, field) != (elm)) \
|
||||
curelm = SLIST_NEXT(curelm, field); \
|
||||
SLIST_REMOVE_AFTER(curelm, field); \
|
||||
} \
|
||||
TRASHIT(*oldnext); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_AFTER(elm, field) do { \
|
||||
SLIST_NEXT(elm, field) = \
|
||||
SLIST_NEXT(SLIST_NEXT(elm, field), field); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue declarations.
|
||||
*/
|
||||
#define STAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *stqh_first;/* first element */ \
|
||||
struct type **stqh_last;/* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define STAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).stqh_first }
|
||||
|
||||
#define STAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *stqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue functions.
|
||||
*/
|
||||
#define STAILQ_CONCAT(head1, head2) do { \
|
||||
if (!STAILQ_EMPTY((head2))) { \
|
||||
*(head1)->stqh_last = (head2)->stqh_first; \
|
||||
(head1)->stqh_last = (head2)->stqh_last; \
|
||||
STAILQ_INIT((head2)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
|
||||
|
||||
#define STAILQ_FIRST(head) ((head)->stqh_first)
|
||||
|
||||
#define STAILQ_FOREACH(var, head, field) \
|
||||
for((var) = STAILQ_FIRST((head)); \
|
||||
(var); \
|
||||
(var) = STAILQ_NEXT((var), field))
|
||||
|
||||
|
||||
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = STAILQ_FIRST((head)); \
|
||||
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define STAILQ_INIT(head) do { \
|
||||
STAILQ_FIRST((head)) = NULL; \
|
||||
(head)->stqh_last = &STAILQ_FIRST((head)); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
|
||||
if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
STAILQ_NEXT((tqelm), field) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
STAILQ_FIRST((head)) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
STAILQ_NEXT((elm), field) = NULL; \
|
||||
*(head)->stqh_last = (elm); \
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_LAST(head, type, field) \
|
||||
(STAILQ_EMPTY((head)) ? \
|
||||
NULL : \
|
||||
((struct type *)(void *) \
|
||||
((char *)((head)->stqh_last) - __offsetof(struct type, field))))
|
||||
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
#define STAILQ_REMOVE(head, elm, type, field) do { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
|
||||
if (STAILQ_FIRST((head)) == (elm)) { \
|
||||
STAILQ_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = STAILQ_FIRST((head)); \
|
||||
while (STAILQ_NEXT(curelm, field) != (elm)) \
|
||||
curelm = STAILQ_NEXT(curelm, field); \
|
||||
STAILQ_REMOVE_AFTER(head, curelm, field); \
|
||||
} \
|
||||
TRASHIT(*oldnext); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_REMOVE_HEAD(head, field) do { \
|
||||
if ((STAILQ_FIRST((head)) = \
|
||||
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
|
||||
(head)->stqh_last = &STAILQ_FIRST((head)); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
|
||||
if ((STAILQ_NEXT(elm, field) = \
|
||||
STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_SWAP(head1, head2, type) do { \
|
||||
struct type *swap_first = STAILQ_FIRST(head1); \
|
||||
struct type **swap_last = (head1)->stqh_last; \
|
||||
STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
|
||||
(head1)->stqh_last = (head2)->stqh_last; \
|
||||
STAILQ_FIRST(head2) = swap_first; \
|
||||
(head2)->stqh_last = swap_last; \
|
||||
if (STAILQ_EMPTY(head1)) \
|
||||
(head1)->stqh_last = &STAILQ_FIRST(head1); \
|
||||
if (STAILQ_EMPTY(head2)) \
|
||||
(head2)->stqh_last = &STAILQ_FIRST(head2); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_CHAIN_HEAD(head, elm_chead, elm_ctail, field) do { \
|
||||
if ((STAILQ_NEXT(elm_ctail, field) = STAILQ_FIRST(head)) == NULL ) { \
|
||||
(head)->stqh_last = &STAILQ_NEXT(elm_ctail, field); \
|
||||
} \
|
||||
STAILQ_FIRST(head) = (elm_chead); \
|
||||
} while (0)
|
||||
|
||||
#endif /* !_SYS_QUEUE_H_ */
|
||||
Executable
+283
@@ -0,0 +1,283 @@
|
||||
//Generated at 2012-10-23 19:55:03
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SLC_REGISTER_H_
|
||||
#define SLC_REGISTER_H_
|
||||
|
||||
#define REG_SLC_BASE 0x60000B00
|
||||
//version value:32'h091700
|
||||
|
||||
#define SLC_CONF0 (REG_SLC_BASE + 0x0)
|
||||
#ifndef ESP_MAC_5
|
||||
#define SLC_MODE 0x00000003
|
||||
#define SLC_MODE_S 12
|
||||
#endif
|
||||
#define SLC_DATA_BURST_EN (BIT(9))
|
||||
#define SLC_DSCR_BURST_EN (BIT(8))
|
||||
#define SLC_RX_NO_RESTART_CLR (BIT(7))
|
||||
#define SLC_RX_AUTO_WRBACK (BIT(6))
|
||||
#define SLC_RX_LOOP_TEST (BIT(5))
|
||||
#define SLC_TX_LOOP_TEST (BIT(4))
|
||||
#define SLC_AHBM_RST (BIT(3))
|
||||
#define SLC_AHBM_FIFO_RST (BIT(2))
|
||||
#define SLC_RXLINK_RST (BIT(1))
|
||||
#define SLC_TXLINK_RST (BIT(0))
|
||||
|
||||
#define SLC_INT_RAW (REG_SLC_BASE + 0x4)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_RAW (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_RAW (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_RAW (BIT(19))
|
||||
#define SLC_TOHOST_INT_RAW (BIT(18))
|
||||
#define SLC_RX_EOF_INT_RAW (BIT(17))
|
||||
#define SLC_RX_DONE_INT_RAW (BIT(16))
|
||||
#define SLC_TX_EOF_INT_RAW (BIT(15))
|
||||
#define SLC_TX_DONE_INT_RAW (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_RAW (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_RAW (BIT(12))
|
||||
#define SLC_TX_OVF_INT_RAW (BIT(11))
|
||||
#define SLC_RX_UDF_INT_RAW (BIT(10))
|
||||
#define SLC_TX_START_INT_RAW (BIT(9))
|
||||
#define SLC_RX_START_INT_RAW (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_RAW (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_RAW (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_RAW (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_RAW (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_RAW (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_RAW (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_RAW (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_RAW (BIT(0))
|
||||
|
||||
#define SLC_INT_STATUS (REG_SLC_BASE + 0x8)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_ST (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_ST (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_ST (BIT(19))
|
||||
#define SLC_TOHOST_INT_ST (BIT(18))
|
||||
#define SLC_RX_EOF_INT_ST (BIT(17))
|
||||
#define SLC_RX_DONE_INT_ST (BIT(16))
|
||||
#define SLC_TX_EOF_INT_ST (BIT(15))
|
||||
#define SLC_TX_DONE_INT_ST (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_ST (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_ST (BIT(12))
|
||||
#define SLC_TX_OVF_INT_ST (BIT(11))
|
||||
#define SLC_RX_UDF_INT_ST (BIT(10))
|
||||
#define SLC_TX_START_INT_ST (BIT(9))
|
||||
#define SLC_RX_START_INT_ST (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_ST (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_ST (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_ST (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_ST (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_ST (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_ST (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_ST (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_ST (BIT(0))
|
||||
|
||||
#define SLC_INT_ENA (REG_SLC_BASE + 0xC)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_ENA (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_ENA (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_ENA (BIT(19))
|
||||
#define SLC_TOHOST_INT_ENA (BIT(18))
|
||||
#define SLC_RX_EOF_INT_ENA (BIT(17))
|
||||
#define SLC_RX_DONE_INT_ENA (BIT(16))
|
||||
#define SLC_TX_EOF_INT_ENA (BIT(15))
|
||||
#define SLC_TX_DONE_INT_ENA (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_ENA (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_ENA (BIT(12))
|
||||
#define SLC_TX_OVF_INT_ENA (BIT(11))
|
||||
#define SLC_RX_UDF_INT_ENA (BIT(10))
|
||||
#define SLC_TX_START_INT_ENA (BIT(9))
|
||||
#define SLC_RX_START_INT_ENA (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_ENA (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_ENA (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_ENA (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_ENA (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_ENA (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_ENA (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_ENA (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_ENA (BIT(0))
|
||||
|
||||
#define SLC_FRHOST_BIT_INT_ENA_ALL 0xff
|
||||
|
||||
#define SLC_INT_CLR (REG_SLC_BASE + 0x10)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_CLR (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_CLR (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_CLR (BIT(19))
|
||||
#define SLC_TOHOST_INT_CLR (BIT(18))
|
||||
#define SLC_RX_EOF_INT_CLR (BIT(17))
|
||||
#define SLC_RX_DONE_INT_CLR (BIT(16))
|
||||
#define SLC_TX_EOF_INT_CLR (BIT(15))
|
||||
#define SLC_TX_DONE_INT_CLR (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_CLR (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_CLR (BIT(12))
|
||||
#define SLC_TX_OVF_INT_CLR (BIT(11))
|
||||
#define SLC_RX_UDF_INT_CLR (BIT(10))
|
||||
#define SLC_TX_START_INT_CLR (BIT(9))
|
||||
#define SLC_RX_START_INT_CLR (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_CLR (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_CLR (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_CLR (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_CLR (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_CLR (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_CLR (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_CLR (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_CLR (BIT(0))
|
||||
|
||||
#define SLC_RX_STATUS (REG_SLC_BASE + 0x14)
|
||||
#define SLC_RX_EMPTY (BIT(1))
|
||||
#define SLC_RX_FULL (BIT(0))
|
||||
|
||||
#define SLC_RX_FIFO_PUSH (REG_SLC_BASE + 0x18)
|
||||
#define SLC_RXFIFO_PUSH (BIT(16))
|
||||
#define SLC_RXFIFO_WDATA 0x000001FF
|
||||
#define SLC_RXFIFO_WDATA_S 0
|
||||
|
||||
#define SLC_TX_STATUS (REG_SLC_BASE + 0x1C)
|
||||
#define SLC_TX_EMPTY (BIT(1))
|
||||
#define SLC_TX_FULL (BIT(0))
|
||||
|
||||
#define SLC_TX_FIFO_POP (REG_SLC_BASE + 0x20)
|
||||
#define SLC_TXFIFO_POP (BIT(16))
|
||||
#define SLC_TXFIFO_RDATA 0x000007FF
|
||||
#define SLC_TXFIFO_RDATA_S 0
|
||||
|
||||
#define SLC_RX_LINK (REG_SLC_BASE + 0x24)
|
||||
#define SLC_RXLINK_PARK (BIT(31))
|
||||
#define SLC_RXLINK_RESTART (BIT(30))
|
||||
#define SLC_RXLINK_START (BIT(29))
|
||||
#define SLC_RXLINK_STOP (BIT(28))
|
||||
#define SLC_RXLINK_DESCADDR_MASK 0x000FFFFF
|
||||
#define SLC_RXLINK_ADDR_S 0
|
||||
|
||||
#define SLC_TX_LINK (REG_SLC_BASE + 0x28)
|
||||
#define SLC_TXLINK_PARK (BIT(31))
|
||||
#define SLC_TXLINK_RESTART (BIT(30))
|
||||
#define SLC_TXLINK_START (BIT(29))
|
||||
#define SLC_TXLINK_STOP (BIT(28))
|
||||
#define SLC_TXLINK_DESCADDR_MASK 0x000FFFFF
|
||||
#define SLC_TXLINK_ADDR_S 0
|
||||
|
||||
#define SLC_INTVEC_TOHOST (REG_SLC_BASE + 0x2C)
|
||||
#define SLC_TOHOST_INTVEC 0x000000FF
|
||||
#define SLC_TOHOST_INTVEC_S 0
|
||||
|
||||
#define SLC_TOKEN0 (REG_SLC_BASE + 0x30)
|
||||
#define SLC_TOKEN0_MASK 0x00000FFF
|
||||
#define SLC_TOKEN0_S 16
|
||||
#define SLC_TOKEN0_LOCAL_INC_MORE (BIT(14))
|
||||
#define SLC_TOKEN0_LOCAL_INC (BIT(13))
|
||||
#define SLC_TOKEN0_LOCAL_WR (BIT(12))
|
||||
#define SLC_TOKEN0_LOCAL_WDATA_MASK 0x00000FFF
|
||||
#define SLC_TOKEN0_LOCAL_WDATA_S 0
|
||||
|
||||
#define SLC_TOKEN1 (REG_SLC_BASE + 0x34)
|
||||
#define SLC_TOKEN1_MASK 0x00000FFF
|
||||
#define SLC_TOKEN1_S 16
|
||||
#define SLC_TOKEN1_LOCAL_INC_MORE (BIT(14))
|
||||
#define SLC_TOKEN1_LOCAL_INC (BIT(13))
|
||||
#define SLC_TOKEN1_LOCAL_WR (BIT(12))
|
||||
#define SLC_TOKEN1_LOCAL_WDATA 0x00000FFF
|
||||
#define SLC_TOKEN1_LOCAL_WDATA_S 0
|
||||
|
||||
#define SLC_CONF1 (REG_SLC_BASE + 0x38)
|
||||
#define SLC_STATE0 (REG_SLC_BASE + 0x3C)
|
||||
#define SLC_STATE1 (REG_SLC_BASE + 0x40)
|
||||
|
||||
#define SLC_BRIDGE_CONF (REG_SLC_BASE + 0x44)
|
||||
#ifndef ESP_MAC_5
|
||||
#define SLC_TX_PUSH_IDLE_NUM 0x0000FFFF
|
||||
#define SLC_TX_PUSH_IDLE_NUM_S 16
|
||||
#define SLC_TX_DUMMY_MODE (BIT(12))
|
||||
#endif
|
||||
#define SLC_FIFO_MAP_ENA 0x0000000F
|
||||
#define SLC_FIFO_MAP_ENA_S 8
|
||||
#define SLC_TXEOF_ENA 0x0000003F
|
||||
#define SLC_TXEOF_ENA_S 0
|
||||
|
||||
#define SLC_RX_EOF_DES_ADDR (REG_SLC_BASE + 0x48)
|
||||
#define SLC_TX_EOF_DES_ADDR (REG_SLC_BASE + 0x4C)
|
||||
#define SLC_FROM_HOST_LAST_DESC SLC_TX_EOF_DES_ADDR
|
||||
#define SLC_TO_HOST_LAST_DESC SLC_RX_EOF_DES_ADDR
|
||||
|
||||
#define SLC_RX_EOF_BFR_DES_ADDR (REG_SLC_BASE + 0x50)
|
||||
#define SLC_AHB_TEST (REG_SLC_BASE + 0x54)
|
||||
#define SLC_AHB_TESTADDR 0x00000003
|
||||
#define SLC_AHB_TESTADDR_S 4
|
||||
#define SLC_AHB_TESTMODE 0x00000007
|
||||
#define SLC_AHB_TESTMODE_S 0
|
||||
|
||||
#define SLC_SDIO_ST (REG_SLC_BASE + 0x58)
|
||||
#define SLC_BUS_ST 0x00000007
|
||||
#define SLC_BUS_ST_S 12
|
||||
#define SLC_SDIO_WAKEUP (BIT(8))
|
||||
#define SLC_FUNC_ST 0x0000000F
|
||||
#define SLC_FUNC_ST_S 4
|
||||
#define SLC_CMD_ST 0x00000007
|
||||
#define SLC_CMD_ST_S 0
|
||||
|
||||
#define SLC_RX_DSCR_CONF (REG_SLC_BASE + 0x5C)
|
||||
#ifdef ESP_MAC_5
|
||||
#define SLC_INFOR_NO_REPLACE (BIT(9))
|
||||
#define SLC_TOKEN_NO_REPLACE (BIT(8))
|
||||
#define SLC_POP_IDLE_CNT 0x000000FF
|
||||
#else
|
||||
#define SLC_RX_FILL_EN (BIT(20))
|
||||
#define SLC_RX_EOF_MODE (BIT(19))
|
||||
#define SLC_RX_FILL_MODE (BIT(18))
|
||||
#define SLC_INFOR_NO_REPLACE (BIT(17))
|
||||
#define SLC_TOKEN_NO_REPLACE (BIT(16))
|
||||
#define SLC_POP_IDLE_CNT 0x0000FFFF
|
||||
#endif
|
||||
#define SLC_POP_IDLE_CNT_S 0
|
||||
|
||||
#define SLC_TXLINK_DSCR (REG_SLC_BASE + 0x60)
|
||||
#define SLC_TXLINK_DSCR_BF0 (REG_SLC_BASE + 0x64)
|
||||
#define SLC_TXLINK_DSCR_BF1 (REG_SLC_BASE + 0x68)
|
||||
#define SLC_RXLINK_DSCR (REG_SLC_BASE + 0x6C)
|
||||
#define SLC_RXLINK_DSCR_BF0 (REG_SLC_BASE + 0x70)
|
||||
#define SLC_RXLINK_DSCR_BF1 (REG_SLC_BASE + 0x74)
|
||||
#define SLC_DATE (REG_SLC_BASE + 0x78)
|
||||
#define SLC_ID (REG_SLC_BASE + 0x7C)
|
||||
|
||||
#define SLC_HOST_CONF_W0 (REG_SLC_BASE + 0x80 + 0x14)
|
||||
#define SLC_HOST_CONF_W1 (REG_SLC_BASE + 0x80 + 0x18)
|
||||
#define SLC_HOST_CONF_W2 (REG_SLC_BASE + 0x80 + 0x20)
|
||||
#define SLC_HOST_CONF_W3 (REG_SLC_BASE + 0x80 + 0x24)
|
||||
#define SLC_HOST_CONF_W4 (REG_SLC_BASE + 0x80 + 0x28)
|
||||
|
||||
#define SLC_HOST_INTR_ST (REG_SLC_BASE + 0x80 + 0x1c)
|
||||
#define SLC_HOST_INTR_CLR (REG_SLC_BASE + 0x80 + 0x30)
|
||||
#define SLC_HOST_INTR_SOF_BIT (BIT(12))
|
||||
|
||||
#define SLC_HOST_INTR_ENA (REG_SLC_BASE + 0x80 + 0x34)
|
||||
#define SLC_RX_NEW_PACKET_INT_ENA (BIT23)
|
||||
#define SLC_HOST_TOHOST_BIT0_INT_ENA (BIT0)
|
||||
#define SLC_HOST_CONF_W5 (REG_SLC_BASE + 0x80 + 0x3C)
|
||||
#define SLC_HOST_INTR_RAW (REG_SLC_BASE + 0x80 + 0x8)
|
||||
#define SLC_HOST_INTR_ENA_BIT (BIT(23))
|
||||
//[15:12]: 0x3ff9xxxx -- 0b01 from_host
|
||||
// 0x3ffaxxxx -- 0b10 general
|
||||
// 0x3ffbxxxx -- 0b11 to_host
|
||||
#define SLC_DATA_ADDR_CLEAR_MASK (~(0xf<<12))
|
||||
#define SLC_FROM_HOST_ADDR_MASK (0x1<<12)
|
||||
#define SLC_TO_HOST_ADDR_MASK (0x3<<12)
|
||||
|
||||
#define SLC_SET_FROM_HOST_ADDR_MASK(v) do { \
|
||||
(v) &= SLC_DATA_ADDR_CLEAR_MASK; \
|
||||
(v) |= SLC_FROM_HOST_ADDR_MASK; \
|
||||
} while(0);
|
||||
|
||||
#define SLC_SET_TO_HOST_ADDR_MASK(v) do { \
|
||||
(v) &= SLC_DATA_ADDR_CLEAR_MASK; \
|
||||
(v) |= SLC_TO_HOST_ADDR_MASK; \
|
||||
} while(0);
|
||||
|
||||
|
||||
#define SLC_TX_DESC_DEBUG_REG 0x3ff0002c //[15:0] set to 0xcccc
|
||||
|
||||
#define SLC_INTEREST_EVENT (SLC_TX_EOF_INT_ENA | SLC_RX_EOF_INT_ENA | SLC_RX_UDF_INT_ENA | SLC_TX_DSCR_ERR_INT_ENA)
|
||||
#define TRIG_TOHOST_INT() SET_PERI_REG_MASK(SLC_INTVEC_TOHOST , BIT0); CLEAR_PERI_REG_MASK(SLC_INTVEC_TOHOST , BIT0)
|
||||
|
||||
|
||||
#endif // SLC_REGISTER_H_INCLUDED
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2015 -2018 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SMARTCONFIG_H__
|
||||
#define __SMARTCONFIG_H__
|
||||
|
||||
typedef enum {
|
||||
SC_STATUS_WAIT = 0,
|
||||
SC_STATUS_FIND_CHANNEL,
|
||||
SC_STATUS_GETTING_SSID_PSWD,
|
||||
SC_STATUS_LINK,
|
||||
SC_STATUS_LINK_OVER,
|
||||
} sc_status;
|
||||
|
||||
typedef enum {
|
||||
SC_TYPE_ESPTOUCH = 0,
|
||||
SC_TYPE_AIRKISS,
|
||||
SC_TYPE_ESPTOUCH_AIRKISS,
|
||||
} sc_type;
|
||||
|
||||
typedef void (*sc_callback_t)(sc_status status, void *pdata);
|
||||
|
||||
const char *smartconfig_get_version(void);
|
||||
bool smartconfig_start(sc_callback_t cb, ...);
|
||||
bool smartconfig_stop(void);
|
||||
bool esptouch_set_timeout(uint8 time_s); //15s~255s, offset:45s
|
||||
bool smartconfig_set_type(sc_type type);
|
||||
|
||||
#endif
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#ifndef __SNTP_H__
|
||||
#define __SNTP_H__
|
||||
|
||||
#include "os_type.h"
|
||||
#ifdef LWIP_OPEN_SRC
|
||||
#include "lwip/ip_addr.h"
|
||||
#else
|
||||
#include "ip_addr.h"
|
||||
#endif
|
||||
/**
|
||||
* get the seconds since Jan 01, 1970, 00:00 (GMT + 8)
|
||||
*/
|
||||
uint32 sntp_get_current_timestamp();
|
||||
/**
|
||||
* get real time (GTM + 8 time zone)
|
||||
*/
|
||||
char* sntp_get_real_time(long t);
|
||||
/**
|
||||
* SNTP get time_zone default GMT + 8
|
||||
*/
|
||||
sint8 sntp_get_timezone(void);
|
||||
/**
|
||||
* SNTP set time_zone (default GMT + 8)
|
||||
*/
|
||||
bool sntp_set_timezone(sint8 timezone);
|
||||
/**
|
||||
* Initialize this module.
|
||||
* Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC).
|
||||
*/
|
||||
void sntp_init(void);
|
||||
/**
|
||||
* Stop this module.
|
||||
*/
|
||||
void sntp_stop(void);
|
||||
/**
|
||||
* Initialize one of the NTP servers by IP address
|
||||
*
|
||||
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS
|
||||
* @param dnsserver IP address of the NTP server to set
|
||||
*/
|
||||
void sntp_setserver(unsigned char idx, ip_addr_t *addr);
|
||||
/**
|
||||
* Obtain one of the currently configured by IP address (or DHCP) NTP servers
|
||||
*
|
||||
* @param numdns the index of the NTP server
|
||||
* @return IP address of the indexed NTP server or "ip_addr_any" if the NTP
|
||||
* server has not been configured by address (or at all).
|
||||
*/
|
||||
ip_addr_t sntp_getserver(unsigned char idx);
|
||||
/**
|
||||
* Initialize one of the NTP servers by name
|
||||
*
|
||||
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3
|
||||
* @param dnsserver DNS name of the NTP server to set, to be resolved at contact time
|
||||
*/
|
||||
void sntp_setservername(unsigned char idx, char *server);
|
||||
/**
|
||||
* Obtain one of the currently configured by name NTP servers.
|
||||
*
|
||||
* @param numdns the index of the NTP server
|
||||
* @return IP address of the indexed NTP server or NULL if the NTP
|
||||
* server has not been configured by name (or at all)
|
||||
*/
|
||||
char *sntp_getservername(unsigned char idx);
|
||||
|
||||
#define sntp_servermode_dhcp(x)
|
||||
|
||||
#endif
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* copyright (c) Espressif System 2010
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SPI_FLASH_H
|
||||
#define SPI_FLASH_H
|
||||
|
||||
#include <c_types.h>
|
||||
|
||||
typedef enum {
|
||||
SPI_FLASH_RESULT_OK,
|
||||
SPI_FLASH_RESULT_ERR,
|
||||
SPI_FLASH_RESULT_TIMEOUT
|
||||
} SpiFlashOpResult;
|
||||
|
||||
typedef struct{
|
||||
uint32 deviceId;
|
||||
uint32 chip_size; // chip size in byte
|
||||
uint32 block_size;
|
||||
uint32 sector_size;
|
||||
uint32 page_size;
|
||||
uint32 status_mask;
|
||||
} SpiFlashChip;
|
||||
|
||||
#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);
|
||||
|
||||
typedef SpiFlashOpResult (* user_spi_flash_read)(
|
||||
SpiFlashChip *spi,
|
||||
uint32 src_addr,
|
||||
uint32 *des_addr,
|
||||
uint32 size);
|
||||
|
||||
void spi_flash_set_read_func(user_spi_flash_read read);
|
||||
|
||||
#endif
|
||||
Executable
+202
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SPI_REGISTER_H_INCLUDED
|
||||
#define SPI_REGISTER_H_INCLUDED
|
||||
|
||||
#define REG_SPI_BASE(i) (0x60000200-i*0x100)
|
||||
#define SPI_CMD(i) (REG_SPI_BASE(i) + 0x0)
|
||||
|
||||
#define SPI_FLASH_READ BIT31
|
||||
#define SPI_FLASH_WREN BIT30
|
||||
#define SPI_FLASH_WRDI BIT29
|
||||
#define SPI_FLASH_RDID BIT28
|
||||
#define SPI_FLASH_RDSR BIT27
|
||||
#define SPI_FLASH_WRSR BIT26
|
||||
#define SPI_FLASH_PP BIT25
|
||||
#define SPI_FLASH_SE BIT24
|
||||
#define SPI_FLASH_BE BIT23
|
||||
#define SPI_FLASH_CE BIT22
|
||||
#define SPI_FLASH_RES BIT20
|
||||
|
||||
#define SPI_USR (BIT(18))
|
||||
|
||||
#define SPI_ADDR(i) (REG_SPI_BASE(i) + 0x4)
|
||||
|
||||
#define SPI_CTRL(i) (REG_SPI_BASE(i) + 0x8)
|
||||
#define SPI_WR_BIT_ORDER (BIT(26))
|
||||
#define SPI_RD_BIT_ORDER (BIT(25))
|
||||
#define SPI_QIO_MODE (BIT(24))
|
||||
#define SPI_DIO_MODE (BIT(23))
|
||||
#define SPI_QOUT_MODE (BIT(20))
|
||||
#define SPI_DOUT_MODE (BIT(14))
|
||||
#define SPI_FASTRD_MODE (BIT(13))
|
||||
|
||||
#define SPI_CTRL1(i) (REG_SPI_BASE(i) + 0xc)
|
||||
#define SPI_CS_HOLD_DELAY 0xf
|
||||
#define SPI_CS_HOLD_DELAY_S 28
|
||||
#define SPI_CS_HOLD_DELAY_RES 0xfff
|
||||
#define SPI_CS_HOLD_DELAY_RES_S 16
|
||||
|
||||
|
||||
#define SPI_RD_STATUS(i) (REG_SPI_BASE(i) + 0x10)
|
||||
|
||||
#define SPI_CTRL2(i) (REG_SPI_BASE(i) + 0x14)
|
||||
|
||||
#define SPI_CS_DELAY_NUM 0x0000000F
|
||||
#define SPI_CS_DELAY_NUM_S 28
|
||||
#define SPI_CS_DELAY_MODE 0x00000003
|
||||
#define SPI_CS_DELAY_MODE_S 26
|
||||
#define SPI_MOSI_DELAY_NUM 0x00000007
|
||||
#define SPI_MOSI_DELAY_NUM_S 23
|
||||
#define SPI_MOSI_DELAY_MODE 0x00000003
|
||||
#define SPI_MOSI_DELAY_MODE_S 21
|
||||
#define SPI_MISO_DELAY_NUM 0x00000007
|
||||
#define SPI_MISO_DELAY_NUM_S 18
|
||||
#define SPI_MISO_DELAY_MODE 0x00000003
|
||||
#define SPI_MISO_DELAY_MODE_S 16
|
||||
#define SPI_CLOCK(i) (REG_SPI_BASE(i) + 0x18)
|
||||
#define SPI_CLK_EQU_SYSCLK (BIT(31))
|
||||
#define SPI_CLKDIV_PRE 0x00001FFF
|
||||
#define SPI_CLKDIV_PRE_S 18
|
||||
#define SPI_CLKCNT_N 0x0000003F
|
||||
#define SPI_CLKCNT_N_S 12
|
||||
#define SPI_CLKCNT_H 0x0000003F
|
||||
#define SPI_CLKCNT_H_S 6
|
||||
#define SPI_CLKCNT_L 0x0000003F
|
||||
#define SPI_CLKCNT_L_S 0
|
||||
|
||||
#define SPI_USER(i) (REG_SPI_BASE(i) + 0x1C)
|
||||
#define SPI_USR_COMMAND (BIT(31))
|
||||
#define SPI_USR_ADDR (BIT(30))
|
||||
#define SPI_USR_DUMMY (BIT(29))
|
||||
#define SPI_USR_MISO (BIT(28))
|
||||
#define SPI_USR_MOSI (BIT(27))
|
||||
|
||||
#define SPI_USR_MOSI_HIGHPART (BIT(25))
|
||||
#define SPI_USR_MISO_HIGHPART (BIT(24))
|
||||
|
||||
|
||||
#define SPI_SIO (BIT(16))
|
||||
#define SPI_FWRITE_QIO (BIT(15))
|
||||
#define SPI_FWRITE_DIO (BIT(14))
|
||||
#define SPI_FWRITE_QUAD (BIT(13))
|
||||
#define SPI_FWRITE_DUAL (BIT(12))
|
||||
#define SPI_WR_BYTE_ORDER (BIT(11))
|
||||
#define SPI_RD_BYTE_ORDER (BIT(10))
|
||||
#define SPI_CK_OUT_EDGE (BIT(7))
|
||||
#define SPI_CK_I_EDGE (BIT(6))
|
||||
#define SPI_CS_SETUP (BIT(5))
|
||||
#define SPI_CS_HOLD (BIT(4))
|
||||
#define SPI_FLASH_MODE (BIT(2))
|
||||
|
||||
#define SPI_USER1(i) (REG_SPI_BASE(i) + 0x20)
|
||||
#define SPI_USR_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_USR_ADDR_BITLEN_S 26
|
||||
#define SPI_USR_MOSI_BITLEN 0x000001FF
|
||||
#define SPI_USR_MOSI_BITLEN_S 17
|
||||
#define SPI_USR_MISO_BITLEN 0x000001FF
|
||||
#define SPI_USR_MISO_BITLEN_S 8
|
||||
|
||||
#define SPI_USR_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_USR_DUMMY_CYCLELEN_S 0
|
||||
|
||||
#define SPI_USER2(i) (REG_SPI_BASE(i) + 0x24)
|
||||
#define SPI_USR_COMMAND_BITLEN 0x0000000F
|
||||
#define SPI_USR_COMMAND_BITLEN_S 28
|
||||
#define SPI_USR_COMMAND_VALUE 0x0000FFFF
|
||||
#define SPI_USR_COMMAND_VALUE_S 0
|
||||
|
||||
#define SPI_WR_STATUS(i) (REG_SPI_BASE(i) + 0x28)
|
||||
#define SPI_PIN(i) (REG_SPI_BASE(i) + 0x2C)
|
||||
#define SPI_CS2_DIS (BIT(2))
|
||||
#define SPI_CS1_DIS (BIT(1))
|
||||
#define SPI_CS0_DIS (BIT(0))
|
||||
|
||||
#define SPI_SLAVE(i) (REG_SPI_BASE(i) + 0x30)
|
||||
#define SPI_SYNC_RESET (BIT(31))
|
||||
#define SPI_SLAVE_MODE (BIT(30))
|
||||
#define SPI_SLV_WR_RD_BUF_EN (BIT(29))
|
||||
#define SPI_SLV_WR_RD_STA_EN (BIT(28))
|
||||
#define SPI_SLV_CMD_DEFINE (BIT(27))
|
||||
#define SPI_TRANS_CNT 0x0000000F
|
||||
#define SPI_TRANS_CNT_S 23
|
||||
#define SPI_TRANS_DONE_EN (BIT(9))
|
||||
#define SPI_SLV_WR_STA_DONE_EN (BIT(8))
|
||||
#define SPI_SLV_RD_STA_DONE_EN (BIT(7))
|
||||
#define SPI_SLV_WR_BUF_DONE_EN (BIT(6))
|
||||
#define SPI_SLV_RD_BUF_DONE_EN (BIT(5))
|
||||
|
||||
|
||||
|
||||
#define SLV_SPI_INT_EN 0x0000001f
|
||||
#define SLV_SPI_INT_EN_S 5
|
||||
|
||||
#define SPI_TRANS_DONE (BIT(4))
|
||||
#define SPI_SLV_WR_STA_DONE (BIT(3))
|
||||
#define SPI_SLV_RD_STA_DONE (BIT(2))
|
||||
#define SPI_SLV_WR_BUF_DONE (BIT(1))
|
||||
#define SPI_SLV_RD_BUF_DONE (BIT(0))
|
||||
|
||||
#define SPI_SLAVE1(i) (REG_SPI_BASE(i) + 0x34)
|
||||
#define SPI_SLV_STATUS_BITLEN 0x0000001F
|
||||
#define SPI_SLV_STATUS_BITLEN_S 27
|
||||
#define SPI_SLV_BUF_BITLEN 0x000001FF
|
||||
#define SPI_SLV_BUF_BITLEN_S 16
|
||||
#define SPI_SLV_RD_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_SLV_RD_ADDR_BITLEN_S 10
|
||||
#define SPI_SLV_WR_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_SLV_WR_ADDR_BITLEN_S 4
|
||||
|
||||
#define SPI_SLV_WRSTA_DUMMY_EN (BIT(3))
|
||||
#define SPI_SLV_RDSTA_DUMMY_EN (BIT(2))
|
||||
#define SPI_SLV_WRBUF_DUMMY_EN (BIT(1))
|
||||
#define SPI_SLV_RDBUF_DUMMY_EN (BIT(0))
|
||||
|
||||
|
||||
|
||||
#define SPI_SLAVE2(i) (REG_SPI_BASE(i) + 0x38)
|
||||
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN 0X000000FF
|
||||
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN_S 24
|
||||
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN 0X000000FF
|
||||
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN_S 16
|
||||
#define SPI_SLV_WRSTR_DUMMY_CYCLELEN 0X000000FF
|
||||
#define SPI_SLV_WRSTR_DUMMY_CYCLELEN_S 8
|
||||
#define SPI_SLV_RDSTR_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_SLV_RDSTR_DUMMY_CYCLELEN_S 0
|
||||
|
||||
#define SPI_SLAVE3(i) (REG_SPI_BASE(i) + 0x3C)
|
||||
#define SPI_SLV_WRSTA_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_WRSTA_CMD_VALUE_S 24
|
||||
#define SPI_SLV_RDSTA_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_RDSTA_CMD_VALUE_S 16
|
||||
#define SPI_SLV_WRBUF_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_WRBUF_CMD_VALUE_S 8
|
||||
#define SPI_SLV_RDBUF_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_RDBUF_CMD_VALUE_S 0
|
||||
|
||||
#define SPI_W0(i) (REG_SPI_BASE(i) +0x40)
|
||||
#define SPI_W1(i) (REG_SPI_BASE(i) +0x44)
|
||||
#define SPI_W2(i) (REG_SPI_BASE(i) +0x48)
|
||||
#define SPI_W3(i) (REG_SPI_BASE(i) +0x4C)
|
||||
#define SPI_W4(i) (REG_SPI_BASE(i) +0x50)
|
||||
#define SPI_W5(i) (REG_SPI_BASE(i) +0x54)
|
||||
#define SPI_W6(i) (REG_SPI_BASE(i) +0x58)
|
||||
#define SPI_W7(i) (REG_SPI_BASE(i) +0x5C)
|
||||
#define SPI_W8(i) (REG_SPI_BASE(i) +0x60)
|
||||
#define SPI_W9(i) (REG_SPI_BASE(i) +0x64)
|
||||
#define SPI_W10(i) (REG_SPI_BASE(i) +0x68)
|
||||
#define SPI_W11(i) (REG_SPI_BASE(i) +0x6C)
|
||||
#define SPI_W12(i) (REG_SPI_BASE(i) +0x70)
|
||||
#define SPI_W13(i) (REG_SPI_BASE(i) +0x74)
|
||||
#define SPI_W14(i) (REG_SPI_BASE(i) +0x78)
|
||||
#define SPI_W15(i) (REG_SPI_BASE(i) +0x7C)
|
||||
|
||||
#define SPI_EXT2(i) (REG_SPI_BASE(i) + 0xF8)
|
||||
|
||||
#define SPI_EXT3(i) (REG_SPI_BASE(i) + 0xFC)
|
||||
#define SPI_INT_HOLD_ENA 0x00000003
|
||||
#define SPI_INT_HOLD_ENA_S 0
|
||||
#endif // SPI_REGISTER_H_INCLUDED
|
||||
Executable
+163
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* File : uart_register.h
|
||||
* Copyright (C) 2013 - 2016, Espressif Systems
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of version 3 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UART_REGISTER_H_
|
||||
#define UART_REGISTER_H_
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
#define UART_FIFO_LEN 128 //define the tx fifo length
|
||||
|
||||
#define REG_UART_BASE(i) (0x60000000 + (i)*0xf00)
|
||||
//version value:32'h062000
|
||||
|
||||
#define UART_FIFO(i) (REG_UART_BASE(i) + 0x0)
|
||||
#define UART_RXFIFO_RD_BYTE 0x000000FF
|
||||
#define UART_RXFIFO_RD_BYTE_S 0
|
||||
|
||||
#define UART_INT_RAW(i) (REG_UART_BASE(i) + 0x4)
|
||||
#define UART_RXFIFO_TOUT_INT_RAW (BIT(8))
|
||||
#define UART_BRK_DET_INT_RAW (BIT(7))
|
||||
#define UART_CTS_CHG_INT_RAW (BIT(6))
|
||||
#define UART_DSR_CHG_INT_RAW (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_RAW (BIT(4))
|
||||
#define UART_FRM_ERR_INT_RAW (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_RAW (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_RAW (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_RAW (BIT(0))
|
||||
|
||||
#define UART_INT_ST(i) (REG_UART_BASE(i) + 0x8)
|
||||
#define UART_RXFIFO_TOUT_INT_ST (BIT(8))
|
||||
#define UART_BRK_DET_INT_ST (BIT(7))
|
||||
#define UART_CTS_CHG_INT_ST (BIT(6))
|
||||
#define UART_DSR_CHG_INT_ST (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_ST (BIT(4))
|
||||
#define UART_FRM_ERR_INT_ST (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_ST (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_ST (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_ST (BIT(0))
|
||||
|
||||
#define UART_INT_ENA(i) (REG_UART_BASE(i) + 0xC)
|
||||
#define UART_RXFIFO_TOUT_INT_ENA (BIT(8))
|
||||
#define UART_BRK_DET_INT_ENA (BIT(7))
|
||||
#define UART_CTS_CHG_INT_ENA (BIT(6))
|
||||
#define UART_DSR_CHG_INT_ENA (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_ENA (BIT(4))
|
||||
#define UART_FRM_ERR_INT_ENA (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_ENA (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_ENA (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_ENA (BIT(0))
|
||||
|
||||
#define UART_INT_CLR(i) (REG_UART_BASE(i) + 0x10)
|
||||
#define UART_RXFIFO_TOUT_INT_CLR (BIT(8))
|
||||
#define UART_BRK_DET_INT_CLR (BIT(7))
|
||||
#define UART_CTS_CHG_INT_CLR (BIT(6))
|
||||
#define UART_DSR_CHG_INT_CLR (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_CLR (BIT(4))
|
||||
#define UART_FRM_ERR_INT_CLR (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_CLR (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_CLR (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_CLR (BIT(0))
|
||||
|
||||
#define UART_CLKDIV(i) (REG_UART_BASE(i) + 0x14)
|
||||
#define UART_CLKDIV_CNT 0x000FFFFF
|
||||
#define UART_CLKDIV_S 0
|
||||
|
||||
#define UART_AUTOBAUD(i) (REG_UART_BASE(i) + 0x18)
|
||||
#define UART_GLITCH_FILT 0x000000FF
|
||||
#define UART_GLITCH_FILT_S 8
|
||||
#define UART_AUTOBAUD_EN (BIT(0))
|
||||
|
||||
#define UART_STATUS(i) (REG_UART_BASE(i) + 0x1C)
|
||||
#define UART_TXD (BIT(31))
|
||||
#define UART_RTSN (BIT(30))
|
||||
#define UART_DTRN (BIT(29))
|
||||
#define UART_TXFIFO_CNT 0x000000FF
|
||||
#define UART_TXFIFO_CNT_S 16
|
||||
#define UART_RXD (BIT(15))
|
||||
#define UART_CTSN (BIT(14))
|
||||
#define UART_DSRN (BIT(13))
|
||||
#define UART_RXFIFO_CNT 0x000000FF
|
||||
#define UART_RXFIFO_CNT_S 0
|
||||
|
||||
#define UART_CONF0(i) (REG_UART_BASE(i) + 0x20)
|
||||
#define UART_DTR_INV (BIT(24))
|
||||
#define UART_RTS_INV (BIT(23))
|
||||
#define UART_TXD_INV (BIT(22))
|
||||
#define UART_DSR_INV (BIT(21))
|
||||
#define UART_CTS_INV (BIT(20))
|
||||
#define UART_RXD_INV (BIT(19))
|
||||
|
||||
#define UART_LINE_INV_MASK UL(0x3f << 19)
|
||||
|
||||
#define UART_TXFIFO_RST (BIT(18))
|
||||
#define UART_RXFIFO_RST (BIT(17))
|
||||
#define UART_IRDA_EN (BIT(16))
|
||||
#define UART_TX_FLOW_EN (BIT(15))
|
||||
#define UART_LOOPBACK (BIT(14))
|
||||
#define UART_IRDA_RX_INV (BIT(13))
|
||||
#define UART_IRDA_TX_INV (BIT(12))
|
||||
#define UART_IRDA_WCTL (BIT(11))
|
||||
#define UART_IRDA_TX_EN (BIT(10))
|
||||
#define UART_IRDA_DPLX (BIT(9))
|
||||
#define UART_TXD_BRK (BIT(8))
|
||||
#define UART_SW_DTR (BIT(7))
|
||||
#define UART_SW_RTS (BIT(6))
|
||||
#define UART_STOP_BIT_NUM 0x00000003
|
||||
#define UART_STOP_BIT_NUM_S 4
|
||||
#define UART_BIT_NUM 0x00000003
|
||||
#define UART_BIT_NUM_S 2
|
||||
#define UART_PARITY_EN (BIT(1))
|
||||
#define UART_PARITY_EN_M 0x00000001
|
||||
#define UART_PARITY_EN_S 1
|
||||
#define UART_PARITY (BIT(0))
|
||||
#define UART_PARITY_M 0x00000001
|
||||
#define UART_PARITY_S 0
|
||||
|
||||
#define UART_CONF1(i) (REG_UART_BASE(i) + 0x24)
|
||||
#define UART_RX_TOUT_EN (BIT(31))
|
||||
#define UART_RX_TOUT_THRHD 0x0000007F
|
||||
#define UART_RX_TOUT_THRHD_S 24
|
||||
#define UART_RX_FLOW_EN (BIT(23))
|
||||
#define UART_RX_FLOW_THRHD 0x0000007F
|
||||
#define UART_RX_FLOW_THRHD_S 16
|
||||
#define UART_TXFIFO_EMPTY_THRHD 0x0000007F
|
||||
#define UART_TXFIFO_EMPTY_THRHD_S 8
|
||||
#define UART_RXFIFO_FULL_THRHD 0x0000007F
|
||||
#define UART_RXFIFO_FULL_THRHD_S 0
|
||||
|
||||
#define UART_LOWPULSE(i) (REG_UART_BASE(i) + 0x28)
|
||||
#define UART_LOWPULSE_MIN_CNT 0x000FFFFF
|
||||
#define UART_LOWPULSE_MIN_CNT_S 0
|
||||
|
||||
#define UART_HIGHPULSE(i) (REG_UART_BASE(i) + 0x2C)
|
||||
#define UART_HIGHPULSE_MIN_CNT 0x000FFFFF
|
||||
#define UART_HIGHPULSE_MIN_CNT_S 0
|
||||
|
||||
#define UART_PULSE_NUM(i) (REG_UART_BASE(i) + 0x30)
|
||||
#define UART_PULSE_NUM_CNT 0x0003FF
|
||||
#define UART_PULSE_NUM_CNT_S 0
|
||||
|
||||
#define UART_DATE(i) (REG_UART_BASE(i) + 0x78)
|
||||
#define UART_ID(i) (REG_UART_BASE(i) + 0x7C)
|
||||
|
||||
#endif // UART_REGISTER_H_INCLUDED
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#ifndef __UPGRADE_H__
|
||||
#define __UPGRADE_H__
|
||||
|
||||
#include <c_types.h>
|
||||
|
||||
#define SPI_FLASH_SEC_SIZE 4096
|
||||
#define LIMIT_ERASE_SIZE 0x10000
|
||||
|
||||
#define USER_BIN1 0x00
|
||||
#define USER_BIN2 0x01
|
||||
|
||||
#define UPGRADE_FLAG_IDLE 0x00
|
||||
#define UPGRADE_FLAG_START 0x01
|
||||
#define UPGRADE_FLAG_FINISH 0x02
|
||||
|
||||
#define UPGRADE_FW_BIN1 0x00
|
||||
#define UPGRADE_FW_BIN2 0x01
|
||||
|
||||
typedef void (*upgrade_states_check_callback)(void * arg);
|
||||
|
||||
//#define UPGRADE_SSL_ENABLE
|
||||
|
||||
struct upgrade_server_info {
|
||||
uint8 ip[4];
|
||||
uint16 port;
|
||||
|
||||
uint8 upgrade_flag;
|
||||
|
||||
uint8 pre_version[16];
|
||||
uint8 upgrade_version[16];
|
||||
|
||||
uint32 check_times;
|
||||
uint8 *url;
|
||||
|
||||
upgrade_states_check_callback check_cb;
|
||||
struct espconn *pespconn;
|
||||
};
|
||||
|
||||
#define UPGRADE_FLAG_IDLE 0x00
|
||||
#define UPGRADE_FLAG_START 0x01
|
||||
#define UPGRADE_FLAG_FINISH 0x02
|
||||
|
||||
void system_upgrade_init();
|
||||
void system_upgrade_deinit();
|
||||
bool system_upgrade(uint8 *data, uint16 len);
|
||||
|
||||
#ifdef UPGRADE_SSL_ENABLE
|
||||
bool system_upgrade_start_ssl(struct upgrade_server_info *server); // not supported now
|
||||
#else
|
||||
bool system_upgrade_start(struct upgrade_server_info *server);
|
||||
#endif
|
||||
#endif
|
||||
Executable
+2029
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user