Jerome Forissier | e86aa9f | 2024-10-16 12:04:02 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright (C) 2023 Linaro Ltd. <maxim.uvarov@linaro.org> */ |
| 3 | |
| 4 | #ifndef LWIP_ARCH_CC_H |
| 5 | #define LWIP_ARCH_CC_H |
| 6 | |
| 7 | #include <linux/types.h> |
| 8 | #include <linux/kernel.h> |
| 9 | #include <vsprintf.h> |
| 10 | #include <rand.h> |
| 11 | |
| 12 | #define LWIP_ERRNO_INCLUDE <errno.h> |
| 13 | |
| 14 | #define LWIP_ERRNO_STDINCLUDE 1 |
| 15 | #define LWIP_NO_UNISTD_H 1 |
| 16 | #define LWIP_TIMEVAL_PRIVATE 1 |
| 17 | |
| 18 | #ifdef CONFIG_LIB_RAND |
| 19 | #define LWIP_RAND() ((u32_t)rand()) |
| 20 | #else |
| 21 | #define LWIP_DNS_SECURE 0 |
| 22 | #endif |
| 23 | |
| 24 | /* different handling for unit test, normally not needed */ |
| 25 | #ifdef LWIP_NOASSERT_ON_ERROR |
| 26 | #define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ |
| 27 | handler; }} while (0) |
| 28 | #endif |
| 29 | |
| 30 | #define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS |
| 31 | |
| 32 | #define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \ |
| 33 | x, __LINE__, __FILE__); } while (0) |
| 34 | |
| 35 | #define atoi(str) (int)dectoul(str, NULL) |
| 36 | #define lwip_strnstr(a, b, c) strstr(a, b) |
| 37 | |
| 38 | #define LWIP_ERR_T int |
| 39 | #define LWIP_CONST_CAST(target_type, val) ((target_type)((uintptr_t)val)) |
| 40 | |
| 41 | #if defined(CONFIG_SYS_BIG_ENDIAN) |
| 42 | #define BYTE_ORDER BIG_ENDIAN |
| 43 | #endif |
| 44 | |
| 45 | #endif /* LWIP_ARCH_CC_H */ |