[LT] Make headers SDK-independent

This commit is contained in:
Kuba Szczodrzyński
2023-03-14 12:10:54 +01:00
parent 57a7df125b
commit 4ee4d34758
7 changed files with 23 additions and 23 deletions

View File

@@ -34,9 +34,8 @@
#ifndef __CC_H__
#define __CC_H__
#include "typedef.h"
#include "uart_pub.h"
#include <stdint.h>
#include <stdio.h>
/*
* 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"

View File

@@ -32,7 +32,10 @@
#ifndef __SYS_RTXC_H__
#define __SYS_RTXC_H__
#include "sys_rtos.h"
#include <FreeRTOS.h>
#include <queue.h>
#include <semphr.h>
#include <task.h>
#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
{

View File

@@ -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(;;)

View File

@@ -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"));

View File

@@ -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

View File

@@ -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 <sys/time.h> in cc.h */
#ifndef LWIP_TIMEVAL_PRIVATE
#define LWIP_TIMEVAL_PRIVATE 0
#define LWIP_TIMEVAL_PRIVATE 1
#endif
#if LWIP_TIMEVAL_PRIVATE

View File

@@ -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.