mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-29 14:06:08 +08:00
Merge branch 'feature/fix_warning_in_lwip' into 'master'
feat(lwip): Fix compile warning in lwip See merge request sdk/ESP8266_RTOS_SDK!119
This commit is contained in:
@ -20,9 +20,6 @@
|
|||||||
#include "lwip/mem.h"
|
#include "lwip/mem.h"
|
||||||
#include "dhcpserver/dhcpserver.h"
|
#include "dhcpserver/dhcpserver.h"
|
||||||
|
|
||||||
#ifndef LWIP_OPEN_SRC
|
|
||||||
#include "net80211/ieee80211_var.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MEMLEAK_DEBUG
|
#ifdef MEMLEAK_DEBUG
|
||||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
|
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
|
||||||
@ -354,10 +351,10 @@ static void send_offer(struct dhcps_msg* m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if DHCPS_DEBUG
|
#if DHCPS_DEBUG
|
||||||
SendOffer_err_t = udp_sendto(pcb_dhcps, p, IP4_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
SendOffer_err_t = udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
||||||
os_printf("dhcps: send_offer>>udp_sendto result %x\n", SendOffer_err_t);
|
os_printf("dhcps: send_offer>>udp_sendto result %x\n", SendOffer_err_t);
|
||||||
#else
|
#else
|
||||||
udp_sendto(pcb_dhcps, p, IP4_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p->ref != 0) {
|
if (p->ref != 0) {
|
||||||
@ -430,10 +427,10 @@ static void send_nak(struct dhcps_msg* m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if DHCPS_DEBUG
|
#if DHCPS_DEBUG
|
||||||
SendNak_err_t = udp_sendto(pcb_dhcps, p, IP4_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
SendNak_err_t = udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
||||||
os_printf("dhcps: send_nak>>udp_sendto result %x\n", SendNak_err_t);
|
os_printf("dhcps: send_nak>>udp_sendto result %x\n", SendNak_err_t);
|
||||||
#else
|
#else
|
||||||
udp_sendto(pcb_dhcps, p, IP4_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p->ref != 0) {
|
if (p->ref != 0) {
|
||||||
@ -507,10 +504,10 @@ static void send_ack(struct dhcps_msg* m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if DHCPS_DEBUG
|
#if DHCPS_DEBUG
|
||||||
SendAck_err_t = udp_sendto(pcb_dhcps, p, IP4_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
SendAck_err_t = udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
||||||
os_printf("dhcps: send_ack>>udp_sendto result %x\n", SendAck_err_t);
|
os_printf("dhcps: send_ack>>udp_sendto result %x\n", SendAck_err_t);
|
||||||
#else
|
#else
|
||||||
udp_sendto(pcb_dhcps, p, IP4_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
udp_sendto(pcb_dhcps, p, IP_ADDR_BROADCAST, DHCPS_CLIENT_PORT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p->ref != 0) {
|
if (p->ref != 0) {
|
||||||
@ -778,7 +775,7 @@ POOL_CHECK:
|
|||||||
|
|
||||||
memset(&client_address, 0x0, sizeof(client_address));
|
memset(&client_address, 0x0, sizeof(client_address));
|
||||||
}
|
}
|
||||||
|
extern bool wifi_softap_set_station_info(uint8_t*,ip4_addr_t*);
|
||||||
if (wifi_softap_set_station_info(m->chaddr, &client_address) == false) {
|
if (wifi_softap_set_station_info(m->chaddr, &client_address) == false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
static s8_t sntp_time_timezone = 8;
|
static s8_t sntp_time_timezone = 8;
|
||||||
static u32_t sntp_time_realtime = 0;
|
static u32_t sntp_time_realtime = 0;
|
||||||
|
|
||||||
static int sntp_time_month;
|
|
||||||
static int sntp_time_year;
|
|
||||||
static char sntp_time_result[100];
|
static char sntp_time_result[100];
|
||||||
static sntp_tm_type sntp_time_rule[2];
|
static sntp_tm_type sntp_time_rule[2];
|
||||||
static sntp_tm sntp_time_result_buf;
|
static sntp_tm sntp_time_result_buf;
|
||||||
@ -33,7 +31,6 @@ static sntp_tm *sntp_mktm_r(const sntp_time_t *tim_p, sntp_tm *res, int is_gmtim
|
|||||||
{
|
{
|
||||||
long days, rem;
|
long days, rem;
|
||||||
sntp_time_t lcltime;
|
sntp_time_t lcltime;
|
||||||
int i;
|
|
||||||
int y;
|
int y;
|
||||||
int yleap;
|
int yleap;
|
||||||
const int *ip;
|
const int *ip;
|
||||||
@ -190,61 +187,6 @@ static sntp_tm *sntp_localtime(const sntp_time_t *tim_p)
|
|||||||
return sntp_localtime_r (tim_p, &sntp_time_result_buf);
|
return sntp_localtime_r (tim_p, &sntp_time_result_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sntp_limitstime(int year)
|
|
||||||
{
|
|
||||||
int days, year_days, years;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
if (year < EPOCH_YEAR)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
sntp_time_year = year;
|
|
||||||
|
|
||||||
years = (year - EPOCH_YEAR);
|
|
||||||
|
|
||||||
year_days = years * 365 +
|
|
||||||
(years - 1 + EPOCH_YEARS_SINCE_LEAP) / 4 - (years - 1 + EPOCH_YEARS_SINCE_CENTURY) / 100 +
|
|
||||||
(years - 1 + EPOCH_YEARS_SINCE_LEAP_CENTURY) / 400;
|
|
||||||
|
|
||||||
for (i = 0; i < 2; ++i)
|
|
||||||
{
|
|
||||||
if (sntp_time_rule[i].ch == 'J')
|
|
||||||
days = year_days + sntp_time_rule[i].d + (isleap(year) && sntp_time_rule[i].d >= 60);
|
|
||||||
else if (sntp_time_rule[i].ch == 'D')
|
|
||||||
days = year_days + sntp_time_rule[i].d;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int yleap = isleap(year);
|
|
||||||
int m_day, m_wday, wday_diff;
|
|
||||||
const int *ip = sntp_time_mon_lengths[yleap];
|
|
||||||
|
|
||||||
days = year_days;
|
|
||||||
|
|
||||||
for (j = 1; j < sntp_time_rule[i].m; ++j)
|
|
||||||
days += ip[j-1];
|
|
||||||
|
|
||||||
m_wday = (EPOCH_WDAY + days) % DAYSPERWEEK;
|
|
||||||
|
|
||||||
wday_diff = sntp_time_rule[i].d - m_wday;
|
|
||||||
if (wday_diff < 0)
|
|
||||||
wday_diff += DAYSPERWEEK;
|
|
||||||
m_day = (sntp_time_rule[i].n - 1) * DAYSPERWEEK + wday_diff;
|
|
||||||
|
|
||||||
while (m_day >= ip[j-1])
|
|
||||||
m_day -= DAYSPERWEEK;
|
|
||||||
|
|
||||||
days += m_day;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* store the change-over time in GMT form by adding offset */
|
|
||||||
sntp_time_rule[i].change = days * SECSPERDAY + sntp_time_rule[i].s + sntp_time_rule[i].offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
sntp_time_month = (sntp_time_rule[0].change < sntp_time_rule[1].change);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *sntp_asctime_r(sntp_tm *tim_p ,char *result)
|
static char *sntp_asctime_r(sntp_tm *tim_p ,char *result)
|
||||||
{
|
{
|
||||||
static const char day_name[7][4] = {
|
static const char day_name[7][4] = {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "c_types.h"
|
#include "c_types.h"
|
||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
|
||||||
#include "lwip/apps/sntp.h"
|
#include "lwip/apps/sntp.h"
|
||||||
#include "lwip/apps/sntp/time.h"
|
#include "lwip/apps/sntp/time.h"
|
||||||
@ -29,6 +30,8 @@ static os_timer_t micros_overflow_timer;
|
|||||||
static uint32 micros_at_last_overflow_tick = 0;
|
static uint32 micros_at_last_overflow_tick = 0;
|
||||||
static uint32 micros_overflow_count = 0;
|
static uint32 micros_overflow_count = 0;
|
||||||
|
|
||||||
|
extern void sntp_set_update_delay(uint32 ms);
|
||||||
|
|
||||||
static void micros_overflow_tick(void * arg)
|
static void micros_overflow_tick(void * arg)
|
||||||
{
|
{
|
||||||
uint32 m = system_get_time();
|
uint32 m = system_get_time();
|
||||||
|
@ -7,4 +7,4 @@ COMPONENT_ADD_INCLUDEDIRS += lwip/src/include lwip/src/include/lwip lwip/src/inc
|
|||||||
COMPONENT_SRCDIRS += lwip/src/api lwip/src/apps/sntp lwip/src/netif lwip/src/core lwip/src/core/ipv4 lwip/src/core/ipv6 \
|
COMPONENT_SRCDIRS += lwip/src/api lwip/src/apps/sntp lwip/src/netif lwip/src/core lwip/src/core/ipv4 lwip/src/core/ipv6 \
|
||||||
port/freertos port/netif apps/dhcpserver apps/sntp apps/multi-threads
|
port/freertos port/netif apps/dhcpserver apps/sntp apps/multi-threads
|
||||||
|
|
||||||
CFLAGS += -D_POSIX_SOURCE -DLWIP_OPEN_SRC -DPBUF_RSV_FOR_WLAN -DEBUF_LWIP
|
CFLAGS += -Wno-address #lots of LWIP source files evaluate macros that check address of stack variables
|
@ -24,20 +24,6 @@ typedef struct dhcps_msg {
|
|||||||
u8_t options[312];
|
u8_t options[312];
|
||||||
} dhcps_msg;
|
} dhcps_msg;
|
||||||
|
|
||||||
#ifndef LWIP_OPEN_SRC
|
|
||||||
struct dhcps_lease {
|
|
||||||
bool enable;
|
|
||||||
struct ip4_addr start_ip;
|
|
||||||
struct ip4_addr end_ip;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum dhcps_offer_option {
|
|
||||||
OFFER_START = 0x00,
|
|
||||||
OFFER_ROUTER = 0x01,
|
|
||||||
OFFER_END
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct dhcps_pool {
|
struct dhcps_pool {
|
||||||
struct ip4_addr ip;
|
struct ip4_addr ip;
|
||||||
u8_t mac[6];
|
u8_t mac[6];
|
||||||
@ -58,7 +44,6 @@ extern u32_t dhcps_lease_time;
|
|||||||
#define DHCP_REPLY 2
|
#define DHCP_REPLY 2
|
||||||
#define DHCP_HTYPE_ETHERNET 1
|
#define DHCP_HTYPE_ETHERNET 1
|
||||||
#define DHCP_HLEN_ETHERNET 6
|
#define DHCP_HLEN_ETHERNET 6
|
||||||
#define DHCP_MSG_LEN 236
|
|
||||||
|
|
||||||
#define DHCPS_SERVER_PORT 67
|
#define DHCPS_SERVER_PORT 67
|
||||||
#define DHCPS_CLIENT_PORT 68
|
#define DHCPS_CLIENT_PORT 68
|
||||||
|
@ -45,6 +45,9 @@
|
|||||||
#define __LWIP_HDR_LWIPOPTS_H__
|
#define __LWIP_HDR_LWIPOPTS_H__
|
||||||
|
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "esp_libc.h"
|
||||||
|
|
||||||
//#define SOCKETS_MT
|
//#define SOCKETS_MT
|
||||||
|
|
||||||
//#define SOCKETS_TCP_TRACE
|
//#define SOCKETS_TCP_TRACE
|
||||||
@ -190,6 +193,10 @@
|
|||||||
/**
|
/**
|
||||||
* Use DRAM instead of IRAM
|
* Use DRAM instead of IRAM
|
||||||
*/
|
*/
|
||||||
|
extern void *pvPortMalloc( size_t xWantedSize, const char * file, unsigned line, unsigned char use_iram);
|
||||||
|
extern void *pvPortZalloc( size_t xWantedSize, const char * file, unsigned line);
|
||||||
|
extern void *pvPortCalloc(size_t count, size_t size, const char * file, unsigned line);
|
||||||
|
extern void vPortFree(void *pv, const char * file, unsigned line);
|
||||||
#define mem_clib_free os_free
|
#define mem_clib_free os_free
|
||||||
#define mem_clib_malloc os_malloc
|
#define mem_clib_malloc os_malloc
|
||||||
#define mem_clib_calloc os_calloc
|
#define mem_clib_calloc os_calloc
|
||||||
@ -703,6 +710,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define SNTP_SERVER_DNS 1
|
#define SNTP_SERVER_DNS 1
|
||||||
|
|
||||||
|
#ifndef sntp_time_t
|
||||||
|
typedef long sntp_time_t;
|
||||||
|
#endif
|
||||||
|
extern void sntp_set_system_time(sntp_time_t GMT_Time);
|
||||||
#define SNTP_SET_SYSTEM_TIME sntp_set_system_time
|
#define SNTP_SET_SYSTEM_TIME sntp_set_system_time
|
||||||
/*
|
/*
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
@ -365,7 +365,7 @@ sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize
|
|||||||
xTaskHandle CreatedTask;
|
xTaskHandle CreatedTask;
|
||||||
portBASE_TYPE result;
|
portBASE_TYPE result;
|
||||||
|
|
||||||
result = xTaskCreate(thread, (signed char *)name, stacksize, arg, prio, &CreatedTask);
|
result = xTaskCreate(thread, (const char *)name, stacksize, arg, prio, &CreatedTask);
|
||||||
|
|
||||||
if (result == pdPASS) {
|
if (result == pdPASS) {
|
||||||
return CreatedTask;
|
return CreatedTask;
|
||||||
|
Reference in New Issue
Block a user