From 4ee4d347589040bb1202506340e67cfedb24541d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 14 Mar 2023 12:10:54 +0100 Subject: [PATCH] [LT] Make headers SDK-independent --- port/arch/cc.h | 9 ++++----- port/arch/sys_arch.h | 6 +++++- port/sys_arch.c | 9 +++++---- src/core/ipv4/ip4.c | 8 ++++---- src/core/mem.c | 6 +++--- src/include/lwip/sockets.h | 5 ++--- src/include/lwip/sys.h | 3 --- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/port/arch/cc.h b/port/arch/cc.h index 44ad6f97..5c7bb485 100644 --- a/port/arch/cc.h +++ b/port/arch/cc.h @@ -34,9 +34,8 @@ #ifndef __CC_H__ #define __CC_H__ -#include "typedef.h" -#include "uart_pub.h" - +#include +#include /* * Typedefs for the types used by lwip - @@ -80,12 +79,12 @@ typedef int sys_prot_t; #ifndef LWIP_PLATFORM_ASSERT #define LWIP_PLATFORM_ASSERT(x) \ do \ - { fatal_prf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); \ + { printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); \ } while(0) #endif #ifndef LWIP_PLATFORM_DIAG -#define LWIP_PLATFORM_DIAG(x) do {fatal_prf x ;} while(0) +#define LWIP_PLATFORM_DIAG(x) do {printf x ;} while(0) #endif #define U16_F "4d" diff --git a/port/arch/sys_arch.h b/port/arch/sys_arch.h index c938e832..e2895196 100644 --- a/port/arch/sys_arch.h +++ b/port/arch/sys_arch.h @@ -32,7 +32,10 @@ #ifndef __SYS_RTXC_H__ #define __SYS_RTXC_H__ -#include "sys_rtos.h" +#include +#include +#include +#include #define SYS_MBOX_NULL (xQueueHandle)0 #define SYS_SEM_NULL (xSemaphoreHandle)0 @@ -41,6 +44,7 @@ typedef xSemaphoreHandle sys_sem_t; typedef xQueueHandle sys_mbox_t; typedef xTaskHandle sys_thread_t; +typedef void * sys_mutex_t; typedef struct _sys_arch_state_t { diff --git a/port/sys_arch.c b/port/sys_arch.c index 411ba82d..cda5c1db 100644 --- a/port/sys_arch.c +++ b/port/sys_arch.c @@ -30,15 +30,16 @@ * */ +#include "typedef.h" +#include "sys_rtos.h" +#include "rtos_pub.h" /* lwIP includes. */ #include "lwip/debug.h" #include "lwip/def.h" #include "lwip/sys.h" #include "lwip/mem.h" #include "lwip/stats.h" -#include "sys_rtos.h" #include "lwip/timeouts.h" -#include "rtos_pub.h" #include "portmacro.h" #define CFG_ENABLE_LWIP_MUTEX 1 @@ -474,8 +475,8 @@ void sys_assert( const char *msg ) (void) msg; /*FSL:only needed for debugging*/ - os_printf(msg); - os_printf("\n\r"); + printf(msg); + printf("\n\r"); vPortEnterCritical(); for(;;) diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index 49fe5ca4..6cfd7d5a 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -413,10 +413,10 @@ ip4_input_accept(struct netif *netif) * parse ipv4 IP options * return: < 0 if IP options contain invalid option, = 0 Ok. */ -int ip4_parse_opt(u8 *opt, int len) +int ip4_parse_opt(u8_t *opt, int len) { int ret = 0; - u8 type, item_len; + u8_t type, item_len; while (len > 1) { type = *opt; @@ -435,7 +435,7 @@ int ip4_parse_opt(u8 *opt, int len) return ret; case 7: { /* RR Option */ - u8 *pointer = opt; + u8_t *pointer = opt; if (*pointer < 4 || (*pointer % 4)) return -1; @@ -518,7 +518,7 @@ ip4_input(struct pbuf *p, struct netif *inp) #if LWIP_RIPPLE20 /* Parse IP options */ if (iphdr_hlen > 20) { - u8 *opt = (u8*)p->payload; + u8_t *opt = (u8_t*)p->payload; if (ip4_parse_opt(opt + 20, iphdr_hlen - 20)) { pbuf_free(p); LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IP packet dropped due to invalid IP options\n")); diff --git a/src/core/mem.c b/src/core/mem.c index 3db832bf..315fb3c5 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -180,13 +180,13 @@ mem_trim(void *mem, mem_size_t size) * allow these defines to be overridden. */ #ifndef mem_clib_free -#define mem_clib_free os_free +#define mem_clib_free free #endif #ifndef mem_clib_malloc -#define mem_clib_malloc os_malloc +#define mem_clib_malloc malloc #endif #ifndef mem_clib_calloc -#define mem_clib_calloc os_calloc +#define mem_clib_calloc calloc #endif #if LWIP_STATS && MEM_STATS diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h index c070f842..d70d36c4 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -40,7 +40,6 @@ #define LWIP_HDR_SOCKETS_H #include "lwip/opt.h" -#include "mem_pub.h" #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ @@ -477,7 +476,7 @@ typedef struct ipv6_mreq { #define FD_SET(n, p) FDSETSAFESET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] = (u8_t)((p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] | (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))) #define FD_CLR(n, p) FDSETSAFESET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] = (u8_t)((p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] & ~(1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))) #define FD_ISSET(n,p) FDSETSAFEGET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] & (1 << (((n)-LWIP_SOCKET_OFFSET) & 7))) -#define FD_ZERO(p) os_memset((void*)(p), 0, sizeof(*(p))) +#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p))) typedef struct fd_set { @@ -516,7 +515,7 @@ struct pollfd /** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided * by your system, set this to 0 and include in cc.h */ #ifndef LWIP_TIMEVAL_PRIVATE -#define LWIP_TIMEVAL_PRIVATE 0 +#define LWIP_TIMEVAL_PRIVATE 1 #endif #if LWIP_TIMEVAL_PRIVATE diff --git a/src/include/lwip/sys.h b/src/include/lwip/sys.h index 6f9a04d2..168e465b 100644 --- a/src/include/lwip/sys.h +++ b/src/include/lwip/sys.h @@ -38,7 +38,6 @@ #define LWIP_HDR_SYS_H #include "lwip/opt.h" -#include "rtos_pub.h" #ifdef __cplusplus extern "C" { @@ -121,8 +120,6 @@ typedef void (*lwip_thread_fn)(void *arg); #else /* LWIP_COMPAT_MUTEX */ -typedef beken_mutex_t sys_mutex_t; - /** * @ingroup sys_mutex * Create a new mutex.