xref: /kernel/uniproton/src/net/lwip-2.1/include/arch/cc.h (revision 54568cb3)
1/*
2 * Copyright (c) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
3 *
4 * UniProton is licensed under Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *          http://license.coscl.org.cn/MulanPSL2
8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11 * See the Mulan PSL v2 for more details.
12 * Create: 2022-09-21
13 * Description: 网络
14 */
15
16#ifndef LWIP_PORTING_CC_H
17#define LWIP_PORTING_CC_H
18
19#ifdef LITTLE_ENDIAN
20#undef LITTLE_ENDIAN
21#endif
22
23#ifdef BIG_ENDIAN
24#undef BIG_ENDIAN
25#endif
26
27#include <endian.h>
28#include <stdio.h>
29#include <stdlib.h>
30#include "securec.h"
31
32#ifdef htons
33#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
34#endif
35
36#define SOCKLEN_T_DEFINED
37#define SA_FAMILY_T_DEFINED
38#define IN_PORT_T_DEFINED
39
40#define LWIP_TIMEVAL_PRIVATE    0
41#define LWIP_ERRNO_STDINCLUDE
42#define LWIP_SOCKET_STDINCLUDE
43
44#define LWIP_DNS_API_DEFINE_ERRORS    0
45#define LWIP_DNS_API_DEFINE_FLAGS     0
46#define LWIP_DNS_API_DECLARE_STRUCTS  0
47#define LWIP_DNS_API_DECLARE_H_ERRNO  0
48
49#ifndef __SIZEOF_POINTER__
50#define __SIZEOF_POINTER__ 4   // 32 bit system
51#endif
52
53#define OS_TASK_STATUS_DETACHED   0x0100  // reserved
54
55#if defined(__arm__) && defined(__ARMCC_VERSION)
56    /* Keil uVision4 tools */
57    #define PACK_STRUCT_BEGIN __packed
58    #define PACK_STRUCT_STRUCT
59    #define PACK_STRUCT_END
60    #define PACK_STRUCT_FIELD(fld) fld
61    #define ALIGNED(n)  __align(n)
62#elif defined (__IAR_SYSTEMS_ICC__)
63    /* IAR Embedded Workbench tools */
64    #define PACK_STRUCT_BEGIN __packed
65    #define PACK_STRUCT_STRUCT
66    #define PACK_STRUCT_END
67    #define PACK_STRUCT_FIELD(fld) fld
68    // #error NEEDS ALIGNED
69#else
70    /* GCC tools (CodeSourcery) */
71    #define PACK_STRUCT_BEGIN
72    #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
73    #define PACK_STRUCT_END
74    #define PACK_STRUCT_FIELD(fld) fld
75    #define ALIGNED(n)  __attribute__((aligned (n)))
76#endif
77
78#define LWIP_RAND rand
79
80#ifndef LWIP_LOGGER
81#define LWIP_LOGGER(msg)
82#endif
83
84extern void OsLwipLogPrintf(const char *fmt, ...);
85#define LWIP_PLATFORM_DIAG(vars) OsLwipLogPrintf vars
86#define LWIP_PLATFORM_ASSERT(x) do { \
87        LWIP_PLATFORM_DIAG(("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__)); \
88    } while (0)
89
90#define init_waitqueue_head(...)
91#define poll_check_waiters(...)
92
93#ifndef _BSD_SOURCE
94#define _BSD_SOURCE 1
95#endif
96
97#endif /* LWIP_PORTING_CC_H */
98