[core] Move platform/ files to cores/
This commit is contained in:
87
cores/common/base/config/lwipopts.h
Normal file
87
cores/common/base/config/lwipopts.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-08-26. */
|
||||
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#define LWIP_NETIF_HOSTNAME 1 // to support hostname changing
|
||||
#define LWIP_SO_RCVBUF 1 // for ioctl(FIONREAD)
|
||||
|
||||
#define LWIP_MDNS_RESPONDER 1
|
||||
#define MDNS_MAX_SERVICES 10
|
||||
|
||||
#include_next "lwipopts.h"
|
||||
|
||||
// set lwIP debugging options according to LT config
|
||||
#if LT_DEBUG_LWIP
|
||||
#undef LWIP_DEBUG
|
||||
#define LWIP_DEBUG 1
|
||||
// make lwIP use printf() library
|
||||
#include <stdio.h>
|
||||
#undef LWIP_PLATFORM_DIAG
|
||||
// clang-format off
|
||||
#define LWIP_PLATFORM_DIAG(x) do { printf x; } while (0)
|
||||
// clang-format on
|
||||
#endif
|
||||
|
||||
#if LT_DEBUG_LWIP_ASSERT
|
||||
#undef LWIP_NOASSERT
|
||||
#undef LWIP_PLATFORM_ASSERT
|
||||
// clang-format off
|
||||
#define LWIP_PLATFORM_ASSERT(x) do { printf("ASSERT \"%s\" - %s:%d\n", x, __FILE__, __LINE__); while (1) {}; } while (0)
|
||||
// clang-format on
|
||||
#endif
|
||||
|
||||
// remove family-defined debugging options (use lwIP defaults, or user-defined)
|
||||
#undef ETHARP_DEBUG
|
||||
#undef NETIF_DEBUG
|
||||
#undef PBUF_DEBUG
|
||||
#undef API_LIB_DEBUG
|
||||
#undef API_MSG_DEBUG
|
||||
#undef SOCKETS_DEBUG
|
||||
#undef ICMP_DEBUG
|
||||
#undef IGMP_DEBUG
|
||||
#undef INET_DEBUG
|
||||
#undef IP_DEBUG
|
||||
#undef IP_REASS_DEBUG
|
||||
#undef RAW_DEBUG
|
||||
#undef MEM_DEBUG
|
||||
#undef MEMP_DEBUG
|
||||
#undef SYS_DEBUG
|
||||
#undef TIMERS_DEBUG
|
||||
#undef TCP_DEBUG
|
||||
#undef TCP_INPUT_DEBUG
|
||||
#undef TCP_FR_DEBUG
|
||||
#undef TCP_RTO_DEBUG
|
||||
#undef TCP_CWND_DEBUG
|
||||
#undef TCP_WND_DEBUG
|
||||
#undef TCP_OUTPUT_DEBUG
|
||||
#undef TCP_RST_DEBUG
|
||||
#undef TCP_QLEN_DEBUG
|
||||
#undef UDP_DEBUG
|
||||
#undef TCPIP_DEBUG
|
||||
#undef SLIP_DEBUG
|
||||
#undef DHCP_DEBUG
|
||||
#undef AUTOIP_DEBUG
|
||||
#undef DNS_DEBUG
|
||||
#undef IP6_DEBUG
|
||||
#undef MDNS_DEBUG
|
||||
|
||||
|
||||
/** Set this to 1 to support DNS names (or IP address strings) to set sntp servers
|
||||
* One server address/name can be defined as default if SNTP_SERVER_DNS == 1:
|
||||
* \#define SNTP_SERVER_ADDRESS "pool.ntp.org"
|
||||
*/
|
||||
#define SNTP_SERVER_DNS 1
|
||||
|
||||
#define SNTP_SET_SYSTEM_TIME_US(sec, us) \
|
||||
do { \
|
||||
struct timeval tv = { .tv_sec = sec, .tv_usec = us }; \
|
||||
settimeofday(&tv, NULL); \
|
||||
} while (0);
|
||||
|
||||
#define SNTP_GET_SYSTEM_TIME(sec, us) \
|
||||
do { \
|
||||
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; \
|
||||
gettimeofday(&tv, NULL); \
|
||||
(sec) = tv.tv_sec; \
|
||||
(us) = tv.tv_usec; \
|
||||
} while (0);
|
||||
|
||||
22
cores/common/base/inc/fixups/errno.h
Normal file
22
cores/common/base/inc/fixups/errno.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-06-13. */
|
||||
|
||||
#pragma once
|
||||
|
||||
// This is an attempt to bring at least some order to <errno.h>, as
|
||||
// it's generally a source of problems everywhere.
|
||||
// The idea is that all units will try to import this errno.h first,
|
||||
// which means it won't use lwIP's error codes.
|
||||
// The code below was moved from realtek-ambz/fixups during
|
||||
// porting of BK72XX SDK, when the errno stroke again.
|
||||
|
||||
// There are two different errno's:
|
||||
// - first is just an int
|
||||
// - second is a macro that calls __errno()
|
||||
// Here the first option is ensured in the entire project.
|
||||
#include <sys/errno.h> // use system __errno() & error codes
|
||||
#undef errno // undefine __errno() macro
|
||||
extern int errno; // use a global errno variable
|
||||
#define errno errno // for #ifdef errno in lwIP
|
||||
|
||||
// make sure lwIP never defines its own error codes
|
||||
#undef LWIP_PROVIDE_ERRNO
|
||||
5
cores/common/base/inc/fixups/lwip/errno.h
Normal file
5
cores/common/base/inc/fixups/lwip/errno.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-06-13. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../errno.h"
|
||||
5
cores/common/base/inc/proxy/certs.h
Normal file
5
cores/common/base/inc/proxy/certs.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-06-13. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mbedtls/certs.h>
|
||||
5
cores/common/base/inc/proxy/err.h
Normal file
5
cores/common/base/inc/proxy/err.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-05-22. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lwip/err.h>
|
||||
5
cores/common/base/inc/proxy/netdb.h
Normal file
5
cores/common/base/inc/proxy/netdb.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-06-13. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lwip/netdb.h>
|
||||
5
cores/common/base/inc/proxy/netif.h
Normal file
5
cores/common/base/inc/proxy/netif.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-07-20. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lwip/netif.h>
|
||||
5
cores/common/base/inc/proxy/sockets.h
Normal file
5
cores/common/base/inc/proxy/sockets.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-05-23. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lwip/sockets.h>
|
||||
5
cores/common/base/inc/proxy/sys.h
Normal file
5
cores/common/base/inc/proxy/sys.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-05-22. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lwip/sys.h>
|
||||
5
cores/common/base/inc/proxy/tcpip.h
Normal file
5
cores/common/base/inc/proxy/tcpip.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-05-22. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lwip/tcpip.h>
|
||||
10
cores/common/base/inc/proxy/udp.h
Normal file
10
cores/common/base/inc/proxy/udp.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-05-23. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <lwip/udp.h>
|
||||
|
||||
// this is included only by wifi_simple_config.c
|
||||
// which uses lwip_ntohl without parentheses
|
||||
// so the #define from lwip/def.h doesn't work
|
||||
#define lwip_ntohl lwip_htonl
|
||||
Reference in New Issue
Block a user