blob: 6104c296f6fce5a0dbd2a16505172c5a1cb30923 [file] [log] [blame]
Jerome Forissiere86aa9f2024-10-16 12:04:02 +02001/* 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
Jerome Forissier97083502024-11-07 12:27:57 +010032#define LWIP_PLATFORM_ASSERT(x) do { \
33 printf("Assertion \"%s\" failed at line %d in %s\n", \
34 x, __LINE__, __FILE__); } while (0)
Jerome Forissiere86aa9f2024-10-16 12:04:02 +020035
36#define atoi(str) (int)dectoul(str, NULL)
Heinrich Schuchardtd0d89ad2025-02-03 10:12:02 +010037#define lwip_strnstr(a, b, c) strnstr(a, b, c)
Jerome Forissiere86aa9f2024-10-16 12:04:02 +020038
39#define LWIP_ERR_T int
40#define LWIP_CONST_CAST(target_type, val) ((target_type)((uintptr_t)val))
41
42#if defined(CONFIG_SYS_BIG_ENDIAN)
43#define BYTE_ORDER BIG_ENDIAN
44#endif
45
46#endif /* LWIP_ARCH_CC_H */