4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2009 Develer S.r.l. (http://www.develer.com/)
33 * \author Luca Ottaviano <lottaviano@develer.com>
35 * \brief Compiler defines for Emulation Layer for lwIP
36 * - Architecture environment, some compiler specific, some
37 * environment specific (probably should move env stuff
45 #include <cfg/compiler.h>
47 #include <lwip/arch.h>
49 #if CPU_BYTE_ORDER == CPU_BIG_ENDIAN
50 #define BYTE_ORDER BIG_ENDIAN
51 #elif CPU_BYTE_ORDER == CPU_LITTLE_ENDIAN
52 #define BYTE_ORDER LITTLE_ENDIAN
56 #include <cfg/debug.h>
59 // Unix error codes required by lwip
61 // memset required by lwip
66 typedef uint16_t u16_t;
67 typedef int16_t s16_t;
68 typedef uint32_t u32_t;
69 typedef int32_t s32_t;
70 typedef int mem_ptr_t;
73 /* Define (sn)printf formatters for these lwIP types */
74 #if CPU_ARM_AT91 || CPU_CM3_SAM3 || (ARCH & ARCH_EMUL)
89 #error This CPU is currently unsupported by lwip
93 * Compiler hints for packing lwip's structures
95 #define PACK_STRUCT_STRUCT PACKED
98 * Platform specific diagnostic output
100 // not fatal, print a message
101 #define LWIP_PLATFORM_DIAG(y) kprintf y
103 // fatal, print message and abandon execution.
104 #define LWIP_PLATFORM_ASSERT(y) \
111 * "lightweight" synchronization mechanisms
113 * SYS_LIGHTWEIGHT_PROT
114 * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
115 * for certain critical regions during buffer allocation, deallocation and memory
116 * allocation and deallocation.
119 // TODO: if lwip is not used within multiple processes or interrupts, it's ok
120 // not to define them
121 /* #define SYS_ARCH_DECL_PROTECT(x) - declare a protection state variable.
122 SYS_ARCH_PROTECT(x) - enter protection mode.
123 SYS_ARCH_UNPROTECT(x) - leave protection mode. */
125 #define SYS_ARCH_DECL_PROTECT(x)
126 #define SYS_ARCH_PROTECT(x) proc_forbid()
127 #define SYS_ARCH_UNPROTECT(x) proc_permit()