Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / lwip / freertos / arch / sys_arch.h
1 /*
2  *    Copyright (c) 2020 Project CHIP Authors
3  *    Copyright (c) 2018-2019 Google LLC.
4  *
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *    Unless required by applicable law or agreed to in writing, software
12  *    distributed under the License is distributed on an "AS IS" BASIS,
13  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *    See the License for the specific language governing permissions and
15  *    limitations under the License.
16  */
17
18 /*
19  *    Description:
20  *      LwIP sys_arch definitions for use with FreeRTOS.
21  *
22  */
23
24 #ifndef CHIP_LWIP_FREERTOS_ARCH_SYS_ARCH_H
25 #define CHIP_LWIP_FREERTOS_ARCH_SYS_ARCH_H
26
27 #include "FreeRTOS.h"
28 #include "queue.h"
29 #include "semphr.h"
30 #include "task.h"
31
32 #define SYS_MBOX_NULL ((xQueueHandle) NULL)
33 #define SYS_SEM_NULL ((xSemaphoreHandle) NULL)
34 #define SYS_DEFAULT_THREAD_STACK_DEPTH configMINIMAL_STACK_SIZE
35 #define SYS_MESG_QUEUE_LENGTH ((UBaseType_t) 6)
36 #define SYS_POST_BLOCK_TIME_MS 10000
37
38 typedef QueueHandle_t sys_mbox_t;
39 typedef xSemaphoreHandle sys_mutex_t;
40 typedef xSemaphoreHandle sys_sem_t;
41 typedef TaskHandle_t sys_thread_t;
42 typedef UBaseType_t sys_prot_t;
43
44 #include "arch/sys_arch.h"
45 #include "lwip/opt.h"
46 #include "lwip/sys.h"
47
48 #define sys_sem_valid(sem) (((sem) != NULL) && (*(sem) != NULL))
49 #define sys_sem_set_invalid(sem)                                                                                                   \
50     do                                                                                                                             \
51     {                                                                                                                              \
52         if ((sem) != NULL)                                                                                                         \
53         {                                                                                                                          \
54             *(sem) = NULL;                                                                                                         \
55         }                                                                                                                          \
56     } while (0)
57
58 #define sys_mutex_valid(mutex) (((mutex) != NULL) && (*(mutex) != NULL))
59 #define sys_mutex_set_invalid(mutex)                                                                                               \
60     do                                                                                                                             \
61     {                                                                                                                              \
62         if ((mutex) != NULL)                                                                                                       \
63         {                                                                                                                          \
64             *(mutex) = NULL;                                                                                                       \
65         }                                                                                                                          \
66     } while (0)
67
68 #define sys_mbox_valid(mbox) (((mbox) != NULL) && (*(mbox) != NULL))
69 #define sys_mbox_set_invalid(mbox)                                                                                                 \
70     do                                                                                                                             \
71     {                                                                                                                              \
72         if ((mbox) != NULL)                                                                                                        \
73         {                                                                                                                          \
74             *(mbox) = NULL;                                                                                                        \
75         }                                                                                                                          \
76     } while (0)
77
78 #define sys_profile_interval_set_pbuf_highwatermark(...)
79
80 #endif /* CHIP_LWIP_FREERTOS_ARCH_SYS_ARCH_H */