Skip to content

Commit a82668f

Browse files
author
Espressif Systems
committed
1.sync api from non-os version;
2.remove udhcp and use non-os dhcpserver; 3.fix some bugs;
1 parent 7b65085 commit a82668f

31 files changed

+176
-2646
lines changed

include/espressif/esp_misc.h

+15
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,19 @@ void os_delay_us(uint16 us);
2323
void os_install_putc1(void (*p)(char c));
2424
void os_putc(char c);
2525

26+
enum dhcp_status{
27+
DHCP_STOPPED,
28+
DHCP_STARTED
29+
};
30+
31+
struct dhcps_lease {
32+
struct ip_addr start_ip;
33+
struct ip_addr end_ip;
34+
};
35+
36+
enum dhcps_offer_option{
37+
OFFER_START = 0x00,
38+
OFFER_ROUTER = 0x01,
39+
OFFER_END
40+
};
2641
#endif

include/espressif/esp_softap.h

+12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ struct softap_config {
1818
};
1919

2020
bool wifi_softap_get_config(struct softap_config *config);
21+
bool wifi_softap_get_config_default(struct softap_config *config);
2122
bool wifi_softap_set_config(struct softap_config *config);
23+
bool wifi_softap_set_config_current(struct softap_config *config);
24+
25+
uint8 wifi_softap_get_station_num(void);
26+
struct station_info * wifi_softap_get_station_info(void);
27+
void wifi_softap_free_station_info(void);
28+
29+
bool wifi_softap_dhcps_start(void);
30+
bool wifi_softap_dhcps_stop(void);
31+
enum dhcp_status wifi_softap_dhcps_status(void);
32+
bool wifi_softap_set_dhcps_lease(struct dhcps_lease *please);
33+
bool wifi_softap_set_dhcps_offer_option(uint8 level, void* optarg);
2234

2335
#endif

include/espressif/esp_sta.h

+14
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ struct station_config {
1616
};
1717

1818
bool wifi_station_get_config(struct station_config *config);
19+
bool wifi_station_get_config_default(struct station_config *config);
1920
bool wifi_station_set_config(struct station_config *config);
21+
bool wifi_station_set_config_current(struct station_config *config);
2022

2123
bool wifi_station_connect(void);
2224
bool wifi_station_disconnect(void);
@@ -46,6 +48,9 @@ bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb);
4648
uint8 wifi_station_get_auto_connect(void);
4749
bool wifi_station_set_auto_connect(uint8 set);
4850

51+
bool wifi_station_set_reconnect_policy(bool set);
52+
bool wifi_station_get_reconnect_policy(void);
53+
4954
enum {
5055
STATION_IDLE = 0,
5156
STATION_CONNECTING,
@@ -57,4 +62,13 @@ enum {
5762

5863
uint8 wifi_station_get_connect_status(void);
5964

65+
uint8 wifi_station_get_current_ap_id(void);
66+
bool wifi_station_ap_change(uint8 current_ap_id);
67+
bool wifi_station_ap_number_set(uint8 ap_number);
68+
uint8 wifi_station_get_ap_info(struct station_config config[]);
69+
70+
bool wifi_station_dhcpc_start(void);
71+
bool wifi_station_dhcpc_stop(void);
72+
enum dhcp_status wifi_station_dhcpc_status(void);
73+
6074
#endif

include/espressif/esp_system.h

+26-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#include "c_types.h"
1010

1111
enum rst_reason {
12-
DEFAULT_RST_FLAG = 0,
13-
WDT_RST_FLAG,
14-
EXCEPTION_RST_FLAG,
15-
SOFT_WDT_RST_FLAG,
16-
SOFT_RESTART_FLAG,
17-
DEEP_SLEEP_AWAKE_FLAG
12+
REASON_DEFAULT_RST = 0,
13+
REASON_WDT_RST,
14+
REASON_EXCEPTION_RST,
15+
REASON_SOFT_WDT_RST,
16+
REASON_SOFT_RESTART,
17+
REASON_DEEP_SLEEP_AWAKE
1818
};
1919

2020
struct rst_info{
@@ -38,6 +38,22 @@ void system_restart(void);
3838
void system_deep_sleep(uint32 time_in_us);
3939
bool system_deep_sleep_set_option(uint8 option);
4040

41+
#define SYS_BOOT_ENHANCE_MODE 0
42+
#define SYS_BOOT_NORMAL_MODE 1
43+
44+
#define SYS_BOOT_NORMAL_BIN 0
45+
#define SYS_BOOT_TEST_BIN 1
46+
47+
uint8 system_get_boot_version(void);
48+
uint32 system_get_userbin_addr(void);
49+
uint8 system_get_boot_mode(void);
50+
bool system_restart_enhance(uint8 bin_type, uint32 bin_addr);
51+
52+
uint8 system_upgrade_userbin_check(void);
53+
void system_upgrade_reboot(void);
54+
uint8 system_upgrade_flag_check();
55+
void system_upgrade_flag_set(uint8 flag);
56+
4157
uint32 system_get_time(void);
4258

4359
void system_print_meminfo(void);
@@ -72,4 +88,8 @@ enum flash_size_map system_get_flash_size_map(void);
7288
bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
7389
bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len);
7490

91+
void system_phy_set_max_tpw(uint8 max_tpw);
92+
void system_phy_set_tpw_via_vdd33(uint16 vdd33);
93+
void system_phy_set_rfoption(uint8 option);
94+
7595
#endif

include/espressif/esp_timer.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ typedef void os_timer_func_t(void *timer_arg);
1111

1212
typedef struct _os_timer_t {
1313
struct _os_timer_t *timer_next;
14-
void *freerots_handle;
14+
void *timer_handle;
1515
uint32 timer_expire;
1616
uint32 timer_period;
1717
os_timer_func_t *timer_func;
1818
bool timer_repeat_flag;
1919
void *timer_arg;
2020
} os_timer_t;
2121

22+
void os_timer_setfn(os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg);
23+
void os_timer_arm(os_timer_t *ptimer, uint32_t msec, bool repeat_flag);
24+
void os_timer_disarm(os_timer_t *ptimer);
25+
2226
#endif

include/espressif/esp_wifi.h

+3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ typedef enum _auth_mode {
2424
} AUTH_MODE;
2525

2626
uint8 wifi_get_opmode(void);
27+
uint8 wifi_get_opmode_default(void);
2728
bool wifi_set_opmode(uint8 opmode);
29+
bool wifi_set_opmode_current(uint8 opmode);
2830

2931
enum {
3032
STATION_IF = 0,
@@ -48,6 +50,7 @@ uint8 wifi_get_channel(void);
4850
bool wifi_set_channel(uint8 channel);
4951

5052
void wifi_status_led_install(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func);
53+
void wifi_status_led_uninstall(void);
5154

5255
bool wifi_promiscuous_set_mac(const uint8_t *address);
5356

include/lwip/arch/cc.h

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
#define EFAULT 14
4040

41+
#define ERRNO
4142
#define LWIP_PROVIDE_ERRNO
4243

4344
#if (1)

include/lwip/lwip/dhcpserver.h

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#ifndef __DHCPS_H__
2+
#define __DHCPS_H__
3+
4+
#define USE_DNS
5+
6+
typedef struct dhcps_state{
7+
sint16_t state;
8+
} dhcps_state;
9+
10+
// ����dhcpclient�Զ����һ��DHCP msg�ṹ��
11+
typedef struct dhcps_msg {
12+
uint8_t op, htype, hlen, hops;
13+
uint8_t xid[4];
14+
uint16_t secs, flags;
15+
uint8_t ciaddr[4];
16+
uint8_t yiaddr[4];
17+
uint8_t siaddr[4];
18+
uint8_t giaddr[4];
19+
uint8_t chaddr[16];
20+
uint8_t sname[64];
21+
uint8_t file[128];
22+
uint8_t options[312];
23+
}dhcps_msg;
24+
25+
#ifndef LWIP_OPEN_SRC
26+
struct dhcps_lease {
27+
struct ip_addr start_ip;
28+
struct ip_addr end_ip;
29+
};
30+
31+
enum dhcps_offer_option{
32+
OFFER_START = 0x00,
33+
OFFER_ROUTER = 0x01,
34+
OFFER_END
35+
};
36+
#endif
37+
38+
struct dhcps_pool{
39+
struct ip_addr ip;
40+
uint8 mac[6];
41+
uint32 lease_timer;
42+
};
43+
44+
typedef struct _list_node{
45+
void *pnode;
46+
struct _list_node *pnext;
47+
}list_node;
48+
49+
#define DHCPS_LEASE_TIMER 0x05A0
50+
#define DHCPS_MAX_LEASE 0x64
51+
#define BOOTP_BROADCAST 0x8000
52+
53+
#define DHCP_REQUEST 1
54+
#define DHCP_REPLY 2
55+
#define DHCP_HTYPE_ETHERNET 1
56+
#define DHCP_HLEN_ETHERNET 6
57+
#define DHCP_MSG_LEN 236
58+
59+
#define DHCPS_SERVER_PORT 67
60+
#define DHCPS_CLIENT_PORT 68
61+
62+
#define DHCPDISCOVER 1
63+
#define DHCPOFFER 2
64+
#define DHCPREQUEST 3
65+
#define DHCPDECLINE 4
66+
#define DHCPACK 5
67+
#define DHCPNAK 6
68+
#define DHCPRELEASE 7
69+
70+
#define DHCP_OPTION_SUBNET_MASK 1
71+
#define DHCP_OPTION_ROUTER 3
72+
#define DHCP_OPTION_DNS_SERVER 6
73+
#define DHCP_OPTION_REQ_IPADDR 50
74+
#define DHCP_OPTION_LEASE_TIME 51
75+
#define DHCP_OPTION_MSG_TYPE 53
76+
#define DHCP_OPTION_SERVER_ID 54
77+
#define DHCP_OPTION_INTERFACE_MTU 26
78+
#define DHCP_OPTION_PERFORM_ROUTER_DISCOVERY 31
79+
#define DHCP_OPTION_BROADCAST_ADDRESS 28
80+
#define DHCP_OPTION_REQ_LIST 55
81+
#define DHCP_OPTION_END 255
82+
83+
//#define USE_CLASS_B_NET 1
84+
#define DHCPS_DEBUG 0
85+
#define MAX_STATION_NUM 8
86+
87+
#define DHCPS_STATE_OFFER 1
88+
#define DHCPS_STATE_DECLINE 2
89+
#define DHCPS_STATE_ACK 3
90+
#define DHCPS_STATE_NAK 4
91+
#define DHCPS_STATE_IDLE 5
92+
93+
#define dhcps_router_enabled(offer) ((offer & OFFER_ROUTER) != 0)
94+
95+
void dhcps_start(struct ip_info *info);
96+
void dhcps_stop(void);
97+
98+
#endif
99+

include/lwip/lwip/netif.h

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ struct netif {
207207
#if LWIP_DHCP
208208
/** the DHCP client state information for this netif */
209209
struct dhcp *dhcp;
210+
struct udp_pcb *dhcps_pcb; //dhcps
210211
#endif /* LWIP_DHCP */
211212
#if LWIP_AUTOIP
212213
/** the AutoIP client state information for this netif */

lib/libfreertos.a

-272 Bytes
Binary file not shown.

lib/libjson.a

764 Bytes
Binary file not shown.

lib/liblwip.a

21.1 KB
Binary file not shown.

lib/libmain.a

6.71 KB
Binary file not shown.

lib/libnet80211.a

5.93 KB
Binary file not shown.

lib/libphy.a

1.68 KB
Binary file not shown.

lib/libpp.a

5.82 KB
Binary file not shown.

lib/libsmartconfig.a

-1.05 KB
Binary file not shown.

lib/libssl.a

512 Bytes
Binary file not shown.

lib/libudhcp.a

-42.1 KB
Binary file not shown.

lib/libwpa.a

1.37 KB
Binary file not shown.

third_party/udhcp/Makefile

-46
This file was deleted.

0 commit comments

Comments
 (0)