mirror of https://github.com/jeelabs/esp-link.git
parent
39eb85dc6b
commit
eda66688d0
@ -0,0 +1,13 @@ |
|||||||
|
#ifndef ESPMISSINGINCLUDES_IP_H |
||||||
|
#define ESPMISSINGINCLUDES_IP_H |
||||||
|
|
||||||
|
//Missing function prototypes in include folders. Gcc will warn on these if we don't define 'em anywhere.
|
||||||
|
//MOST OF THESE ARE GUESSED! but they seem to swork and shut up the compiler.
|
||||||
|
|
||||||
|
struct station_info *wifi_softap_get_station_info(); |
||||||
|
bool wifi_softap_set_station_info(uint8_t *addr, struct ip_addr *adr); |
||||||
|
int igmp_leavegroup(ip_addr_t *host_ip, ip_addr_t *multicast_ip); |
||||||
|
int igmp_joingroup(ip_addr_t *host_ip, ip_addr_t *multicast_ip); |
||||||
|
void system_station_got_ip_set(ip_addr_t * ip_addr, ip_addr_t *sn_mask, ip_addr_t *gw_addr); |
||||||
|
bool wifi_get_ip_info(uint8 if_index, struct ip_info *info); |
||||||
|
#endif |
@ -0,0 +1,2 @@ |
|||||||
|
//Dummy file to keep the file in the SDK from b0rking things up
|
||||||
|
#include "lwip/ip_addr.h" |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,81 @@ |
|||||||
|
#ifndef __MEM_MANAGER_H__ |
||||||
|
#define __MEM_MANAGER_H__ |
||||||
|
|
||||||
|
#include "c_types.h" |
||||||
|
|
||||||
|
/*------------------------±äÁ¿¶¨Òå------------------------*/ |
||||||
|
|
||||||
|
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE |
||||||
|
#ifndef IOT_SIP_MODE |
||||||
|
//#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x3fffc000 - (uint32)&_heap_start ) )//fix 16000 to 24000 on 14.2.26
|
||||||
|
#else |
||||||
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8000 ) ) |
||||||
|
#endif |
||||||
|
#define portBYTE_ALIGNMENT 8 |
||||||
|
#define pdFALSE 0 |
||||||
|
#define pdTRUE 1 |
||||||
|
|
||||||
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE |
||||||
|
#if portBYTE_ALIGNMENT == 8 |
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0007 ) |
||||||
|
#endif |
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 4 |
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0003 ) |
||||||
|
#endif |
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 2 |
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0001 ) |
||||||
|
#endif |
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 1 |
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0000 ) |
||||||
|
#endif |
||||||
|
|
||||||
|
#ifndef portBYTE_ALIGNMENT_MASK |
||||||
|
#error "Invalid portBYTE_ALIGNMENT definition" |
||||||
|
#endif |
||||||
|
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 1 |
||||||
|
#define portPOINTER_SIZE_TYPE unsigned int |
||||||
|
|
||||||
|
#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) ) |
||||||
|
|
||||||
|
//#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
|
||||||
|
|
||||||
|
//static unsigned char ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||||
|
//static unsigned char *ucHeap;
|
||||||
|
|
||||||
|
typedef struct A_BLOCK_LINK |
||||||
|
{ |
||||||
|
struct A_BLOCK_LINK *pxNextFreeBlock; //The next free block in the list.
|
||||||
|
size_t xBlockSize; //The size of the free block.
|
||||||
|
} xBlockLink; |
||||||
|
|
||||||
|
//static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_ALIGNMENT - ( sizeof( xBlockLink ) % portBYTE_ALIGNMENT ) );
|
||||||
|
|
||||||
|
//static const size_t xTotalHeapSize = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );
|
||||||
|
|
||||||
|
//static xBlockLink xStart, *pxEnd = NULL;
|
||||||
|
|
||||||
|
//static size_t xFreeBytesRemaining = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------º¯ÊýÉùÃ÷-----------------------------------*/ |
||||||
|
|
||||||
|
//static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ) ;//ICACHE_FLASH_ATTR;
|
||||||
|
|
||||||
|
//static void prvHeapInit( void ) ;//ICACHE_FLASH_ATTR;
|
||||||
|
|
||||||
|
void vApplicationMallocFailedHook( void ) ;//ICACHE_FLASH_ATTR;
|
||||||
|
|
||||||
|
void *pvPortMalloc( size_t xWantedSize ) ;//ICACHE_FLASH_ATTR;
|
||||||
|
|
||||||
|
void vPortFree( void *pv ) ;//ICACHE_FLASH_ATTR;
|
||||||
|
|
||||||
|
size_t xPortGetFreeHeapSize( void ) ;//ICACHE_FLASH_ATTR;
|
||||||
|
|
||||||
|
void vPortInitialiseBlocks( void ) ;//ICACHE_FLASH_ATTR;
|
||||||
|
/*-----------------------------------------------------------*/ |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,253 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 -2014 Espressif System |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef __USER_INTERFACE_H__ |
||||||
|
#define __USER_INTERFACE_H__ |
||||||
|
|
||||||
|
#include "os_type.h" |
||||||
|
#ifdef LWIP_OPEN_SRC |
||||||
|
#include "lwip/ip_addr.h" |
||||||
|
#else |
||||||
|
#include "ip_addr.h" |
||||||
|
#endif |
||||||
|
|
||||||
|
#include "queue.h" |
||||||
|
#include "user_config.h" |
||||||
|
#include "spi_flash.h" |
||||||
|
|
||||||
|
#ifndef MAC2STR |
||||||
|
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] |
||||||
|
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" |
||||||
|
#endif |
||||||
|
|
||||||
|
enum rst_reason { |
||||||
|
DEFAULT_RST_FLAG = 0, |
||||||
|
WDT_RST_FLAG = 1, |
||||||
|
EXP_RST_FLAG = 2 |
||||||
|
}; |
||||||
|
|
||||||
|
struct rst_info{ |
||||||
|
uint32 flag; |
||||||
|
uint32 exccause; |
||||||
|
uint32 epc1; |
||||||
|
uint32 epc2; |
||||||
|
uint32 epc3; |
||||||
|
uint32 excvaddr; |
||||||
|
uint32 depc; |
||||||
|
}; |
||||||
|
|
||||||
|
#define UPGRADE_FW_BIN1 0x00 |
||||||
|
#define UPGRADE_FW_BIN2 0x01 |
||||||
|
|
||||||
|
typedef void (*upgrade_states_check_callback)(void * arg); |
||||||
|
|
||||||
|
struct upgrade_server_info { |
||||||
|
uint8 ip[4]; |
||||||
|
uint16 port; |
||||||
|
|
||||||
|
uint8 upgrade_flag; |
||||||
|
|
||||||
|
uint8 pre_version[8]; |
||||||
|
uint8 upgrade_version[8]; |
||||||
|
|
||||||
|
uint32 check_times; |
||||||
|
uint8 *url; |
||||||
|
|
||||||
|
upgrade_states_check_callback check_cb; |
||||||
|
struct espconn *pespconn; |
||||||
|
}; |
||||||
|
|
||||||
|
bool system_upgrade_start(struct upgrade_server_info *server); |
||||||
|
bool system_upgrade_start_ssl(struct upgrade_server_info *server); |
||||||
|
uint8 system_upgrade_userbin_check(void); |
||||||
|
void system_upgrade_reboot(void); |
||||||
|
|
||||||
|
void system_restore(void); |
||||||
|
void system_restart(void); |
||||||
|
void system_deep_sleep(uint32 time_in_us); |
||||||
|
|
||||||
|
void system_timer_reinit(void); |
||||||
|
uint32 system_get_time(void); |
||||||
|
|
||||||
|
/* user task's prio must be 0/1/2 !!!*/ |
||||||
|
enum { |
||||||
|
USER_TASK_PRIO_0 = 0, |
||||||
|
USER_TASK_PRIO_1, |
||||||
|
USER_TASK_PRIO_2, |
||||||
|
USER_TASK_PRIO_MAX |
||||||
|
}; |
||||||
|
|
||||||
|
void system_os_task(os_task_t task, uint8 prio, os_event_t *queue, uint8 qlen); |
||||||
|
void system_os_post(uint8 prio, os_signal_t sig, os_param_t par); |
||||||
|
|
||||||
|
void system_print_meminfo(void); |
||||||
|
uint32 system_get_free_heap_size(void); |
||||||
|
|
||||||
|
void system_set_os_print(uint8 onoff); |
||||||
|
|
||||||
|
uint64 system_mktime(uint32 year, uint32 mon, uint32 day, uint32 hour, uint32 min, uint32 sec); |
||||||
|
|
||||||
|
uint32 system_get_chip_id(void); |
||||||
|
|
||||||
|
typedef void (* init_done_cb_t)(void); |
||||||
|
|
||||||
|
void system_init_done_cb(init_done_cb_t cb); |
||||||
|
|
||||||
|
uint32 system_rtc_clock_cali_proc(void); |
||||||
|
uint32 system_get_rtc_time(void); |
||||||
|
|
||||||
|
bool system_rtc_mem_read(uint8 src_addr, void *des_addr, uint16 load_size); |
||||||
|
bool system_rtc_mem_write(uint8 des_addr, const void *src_addr, uint16 save_size); |
||||||
|
|
||||||
|
void system_uart_swap(void); |
||||||
|
|
||||||
|
uint16 system_adc_read(void); |
||||||
|
|
||||||
|
#define NULL_MODE 0x00 |
||||||
|
#define STATION_MODE 0x01 |
||||||
|
#define SOFTAP_MODE 0x02 |
||||||
|
#define STATIONAP_MODE 0x03 |
||||||
|
|
||||||
|
uint8 wifi_get_opmode(void); |
||||||
|
bool wifi_set_opmode(uint8 opmode); |
||||||
|
|
||||||
|
struct bss_info { |
||||||
|
STAILQ_ENTRY(bss_info) next; |
||||||
|
|
||||||
|
uint8 bssid[6]; |
||||||
|
uint8 ssid[32]; |
||||||
|
uint8 channel; |
||||||
|
sint8 rssi; |
||||||
|
uint8 authmode; |
||||||
|
uint8 is_hidden; |
||||||
|
}; |
||||||
|
|
||||||
|
typedef struct _scaninfo { |
||||||
|
STAILQ_HEAD(, bss_info) *pbss; |
||||||
|
struct espconn *pespconn; |
||||||
|
uint8 totalpage; |
||||||
|
uint8 pagenum; |
||||||
|
uint8 page_sn; |
||||||
|
uint8 data_cnt; |
||||||
|
} scaninfo; |
||||||
|
|
||||||
|
typedef void (* scan_done_cb_t)(void *arg, STATUS status); |
||||||
|
|
||||||
|
struct station_config { |
||||||
|
uint8 ssid[32]; |
||||||
|
uint8 password[64]; |
||||||
|
uint8 bssid_set; |
||||||
|
uint8 bssid[6]; |
||||||
|
}; |
||||||
|
|
||||||
|
bool wifi_station_get_config(struct station_config *config); |
||||||
|
bool wifi_station_set_config(struct station_config *config); |
||||||
|
|
||||||
|
bool wifi_station_connect(void); |
||||||
|
bool wifi_station_disconnect(void); |
||||||
|
|
||||||
|
struct scan_config { |
||||||
|
uint8 *ssid; |
||||||
|
uint8 *bssid; |
||||||
|
uint8 channel; |
||||||
|
uint8 show_hidden; |
||||||
|
}; |
||||||
|
|
||||||
|
bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb); |
||||||
|
|
||||||
|
uint8 wifi_station_get_auto_connect(void); |
||||||
|
bool wifi_station_set_auto_connect(uint8 set); |
||||||
|
|
||||||
|
enum { |
||||||
|
STATION_IDLE = 0, |
||||||
|
STATION_CONNECTING, |
||||||
|
STATION_WRONG_PASSWORD, |
||||||
|
STATION_NO_AP_FOUND, |
||||||
|
STATION_CONNECT_FAIL, |
||||||
|
STATION_GOT_IP |
||||||
|
}; |
||||||
|
|
||||||
|
uint8 wifi_station_get_connect_status(void); |
||||||
|
|
||||||
|
uint8 wifi_station_get_current_ap_id(void); |
||||||
|
bool wifi_station_ap_change(uint8 current_ap_id); |
||||||
|
bool wifi_station_ap_number_set(uint8 ap_number); |
||||||
|
|
||||||
|
bool wifi_station_dhcpc_start(void); |
||||||
|
bool wifi_station_dhcpc_stop(void); |
||||||
|
|
||||||
|
typedef enum _auth_mode { |
||||||
|
AUTH_OPEN = 0, |
||||||
|
AUTH_WEP, |
||||||
|
AUTH_WPA_PSK, |
||||||
|
AUTH_WPA2_PSK, |
||||||
|
AUTH_WPA_WPA2_PSK |
||||||
|
} AUTH_MODE; |
||||||
|
|
||||||
|
struct softap_config { |
||||||
|
uint8 ssid[32]; |
||||||
|
uint8 password[64]; |
||||||
|
uint8 ssid_len; |
||||||
|
uint8 channel; |
||||||
|
uint8 authmode; |
||||||
|
uint8 ssid_hidden; |
||||||
|
uint8 max_connection; |
||||||
|
}; |
||||||
|
|
||||||
|
bool wifi_softap_get_config(struct softap_config *config); |
||||||
|
bool wifi_softap_set_config(struct softap_config *config); |
||||||
|
|
||||||
|
struct station_info { |
||||||
|
STAILQ_ENTRY(station_info) next; |
||||||
|
|
||||||
|
uint8 bssid[6]; |
||||||
|
struct ip_addr ip; |
||||||
|
}; |
||||||
|
|
||||||
|
struct dhcps_lease { |
||||||
|
uint32 start_ip; |
||||||
|
uint32 end_ip; |
||||||
|
}; |
||||||
|
|
||||||
|
struct station_info * wifi_softap_get_station_info(void); |
||||||
|
void wifi_softap_free_station_info(void); |
||||||
|
|
||||||
|
bool wifi_softap_dhcps_start(void); |
||||||
|
bool wifi_softap_dhcps_stop(void); |
||||||
|
bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please); |
||||||
|
|
||||||
|
#define STATION_IF 0x00 |
||||||
|
#define SOFTAP_IF 0x01 |
||||||
|
|
||||||
|
bool wifi_get_ip_info(uint8 if_index, struct ip_info *info); |
||||||
|
bool wifi_set_ip_info(uint8 if_index, struct ip_info *info); |
||||||
|
bool wifi_get_macaddr(uint8 if_index, uint8 *macaddr); |
||||||
|
bool wifi_set_macaddr(uint8 if_index, uint8 *macaddr); |
||||||
|
|
||||||
|
uint8 wifi_get_channel(void); |
||||||
|
bool wifi_set_channel(uint8 channel); |
||||||
|
|
||||||
|
void wifi_status_led_install(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func); |
||||||
|
|
||||||
|
/** Get the absolute difference between 2 u32_t values (correcting overflows)
|
||||||
|
* 'a' is expected to be 'higher' (without overflow) than 'b'. */ |
||||||
|
#define ESP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1))) |
||||||
|
|
||||||
|
void wifi_promiscuous_enable(uint8 promiscuous); |
||||||
|
|
||||||
|
typedef void (* wifi_promiscuous_cb_t)(uint8 *buf, uint16 len); |
||||||
|
|
||||||
|
void wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); |
||||||
|
|
||||||
|
enum phy_mode { |
||||||
|
PHY_MODE_11B = 1, |
||||||
|
PHY_MODE_11G = 2, |
||||||
|
PHY_MODE_11N = 3 |
||||||
|
}; |
||||||
|
|
||||||
|
enum phy_mode wifi_get_phy_mode(void); |
||||||
|
bool wifi_set_phy_mode(enum phy_mode mode); |
||||||
|
|
||||||
|
#endif |
Loading…
Reference in new issue