1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Define lwIP's s32/u32 to int (#8560)

* Define lwIP's s32/u32 to int

s32/u32 were previously defined as long,
but long can be 64 bits in host mode,
so this commit reduces valgrind complaints and increase coherency.

* some lads like to use `unsigned long` for 32 bits IPv4 addresses

* fix lwIP's `sys_now()` return type

* fix C declarations

* merge upstream (lwip2) update on sys_now() definition

* matching lwIP api (2/2)

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
This commit is contained in:
david gauchard
2022-05-15 21:55:56 +02:00
committed by GitHub
parent 2de142b8db
commit 80c0570620
10 changed files with 36 additions and 28 deletions

View File

@ -85,7 +85,21 @@ typedef uint32_t sys_prot_t;
///////////////////////////////
//// MISSING
#define sys_now millis // arduino wire millis() definition returns 32 bits like sys_now() does
// Arduino Core exposes time func with a generic type
#ifdef __cplusplus
extern "C"
{
#endif
unsigned long millis(void);
#ifdef __cplusplus
}
#endif
// b/c we have conflicting typedefs of u32_t and ulong and can't substitute funcs,
// forcibly cast the `millis()` result to lwip's version of u32_t
// (previous version was `#define sys_now millis`)
#define sys_now() ((u32_t)millis())
#define LWIP_RAND r_rand // old lwip uses this useful undocumented function
#define IPSTR "%d.%d.%d.%d"
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \

View File

@ -1,5 +0,0 @@
#ifndef MYSYSARCH_H
#define MYSYSARCH_H
#endif // MYSYSARCH_H

View File

@ -4,8 +4,8 @@ typedef unsigned char u8_t;
typedef signed char s8_t;
typedef unsigned short u16_t;
typedef signed short s16_t;
typedef unsigned long u32_t;
typedef signed long s32_t;
typedef unsigned int u32_t;
typedef signed int s32_t;
typedef unsigned long mem_ptr_t;
#define LWIP_ERR_T s32_t
typedef uint32_t sys_prot_t;

View File

@ -1,5 +1,5 @@
// generated by makefiles/make-lwip2-hash
#ifndef LWIP_HASH_H
#define LWIP_HASH_H
#define LWIP_HASH_STR "STABLE-2_1_3_RELEASE/glue:1.2-58-g450bb63"
#define LWIP_HASH_STR "STABLE-2_1_3_RELEASE/glue:1.2-61-g679577b"
#endif // LWIP_HASH_H

View File

@ -443,7 +443,7 @@ u32_t sys_jiffies(void);
* Not implementing this function means you cannot use some modules (e.g. TCP
* timestamps, internal timeouts for NO_SYS==1).
*/
u32_t sys_now(void);
//u32_t sys_now(void);
/* Critical Region Protection */
/* These functions must be implemented in the sys_arch.c file.