Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / lwip / efr32 / arch / cc.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2019 Nest Labs, Inc.
5  *
6  *   Licensed under the Apache License, Version 2.0 (the "License");
7  *   you may not use this file except in compliance with the License.
8  *   You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *   Unless required by applicable law or agreed to in writing, software
13  *   distributed under the License is distributed on an "AS IS" BASIS,
14  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *   See the License for the specific language governing permissions and
16  *   limitations under the License.
17  *
18  */
19
20 #ifndef CHIP_LWIP_FREERTOS_ARCH_CC_H
21 #define CHIP_LWIP_FREERTOS_ARCH_CC_H
22
23 #include <assert.h>
24 #include <errno.h>
25 #include <stddef.h>
26 #include <stdint.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <sys/time.h>
30
31 #if CHIP_CONFIG_MEMORY_MGMT_MALLOC
32 #include <malloc.h>
33 #endif
34
35 #if __cplusplus
36 extern "C" {
37 #endif
38
39 #ifndef LWIP_NOASSERT
40 #ifdef DEBUG
41 #define LWIP_PLATFORM_ASSERT(MSG) assert(MSG);
42 #else
43 #define LWIP_PLATFORM_ASSERT(MSG)
44 #endif
45 #else
46 #define LWIP_PLATFORM_ASSERT(message)
47 #endif
48
49 #ifndef BYTE_ORDER
50 #if defined(__LITTLE_ENDIAN__)
51 #define BYTE_ORDER LITTLE_ENDIAN
52 #elif defined(__BIG_ENDIAN__)
53 #define BYTE_ORDER BIG_ENDIAN
54 #elif defined(__BYTE_ORDER__)
55 #define BYTE_ORDER __BYTE_ORDER__
56 #endif
57 #endif // BYTE_ORDER
58
59 #define PACK_STRUCT_STRUCT __attribute__((__packed__))
60 #define PACK_STRUCT_FIELD(x) x
61
62 extern void LwIPLog(const char * fmt, ...);
63 #define LWIP_PLATFORM_DIAG(x)                                                                                                      \
64     do                                                                                                                             \
65     {                                                                                                                              \
66         LwIPLog x;                                                                                                                 \
67     } while (0)
68
69 // Place LwIP pools into their own subsections of .bss to make it easier to see
70 // their sizes in the linker map file.
71 extern uint8_t __attribute__((section(".bss.lwip_ND6_QUEUE"))) memp_memory_ND6_QUEUE_base[];
72 extern uint8_t __attribute__((section(".bss.lwip_IP6_REASSDATA"))) memp_memory_IP6_REASSDATA_base[];
73 extern uint8_t __attribute__((section(".bss.lwip_RAW_PCB"))) memp_memory_RAW_PCB_base[];
74 extern uint8_t __attribute__((section(".bss.lwip_TCP_SEG"))) memp_memory_TCP_SEG_base[];
75 extern uint8_t __attribute__((section(".bss.lwip_PBUF_POOL"))) memp_memory_PBUF_POOL_base[];
76 extern uint8_t __attribute__((section(".bss.lwip_FRAG_PBUF"))) memp_memory_FRAG_PBUF_base[];
77 extern uint8_t __attribute__((section(".bss.lwip_PBUF"))) memp_memory_PBUF_base[];
78 extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB_LISTEN"))) memp_memory_TCP_PCB_LISTEN_base[];
79 extern uint8_t __attribute__((section(".bss.lwip_REASSDATA"))) memp_memory_REASSDATA_base[];
80 extern uint8_t __attribute__((section(".bss.lwip_UDP_PCB"))) memp_memory_UDP_PCB_base[];
81 extern uint8_t __attribute__((section(".bss.lwip_MLD6_GROUP"))) memp_memory_MLD6_GROUP_base[];
82 extern uint8_t __attribute__((section(".bss.lwip_IGMP_GROUP"))) memp_memory_IGMP_GROUP_base[];
83 extern uint8_t __attribute__((section(".bss.lwip_TCP_PCB"))) memp_memory_TCP_PCB_base[];
84 extern uint8_t __attribute__((section(".bss.lwip_SYS_TIMEOUT"))) memp_memory_SYS_TIMEOUT_base[];
85
86 #if __cplusplus
87 }
88 #endif
89
90 #endif /* CHIP_LWIP_FREERTOS_ARCH_CC_H */