Loading...
Searching...
No Matches
cc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef ARCH_CC_H
21#define ARCH_CC_H
22
23#include <inttypes.h>
24#include <stdio.h>
25#include <stdlib.h>
26
27#include "irq.h"
28#include "byteorder.h"
29#include "mutex.h"
30
31#ifdef MODULE_LOG
32#define LOG_LEVEL LOG_INFO
33#include "log.h"
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#ifndef BYTE_ORDER
41#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
42# define BYTE_ORDER (LITTLE_ENDIAN)
43#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
44# define BYTE_ORDER (BIG_ENDIAN)
45#else
46# error "Byte order is neither little nor big!"
47#endif
48#endif
49
54#define X8_F "02" PRIx8
55#define U16_F PRIu16
56#define S16_F PRId16
57#define X16_F PRIx16
58#define U32_F PRIu32
59#define S32_F PRId32
60#define X32_F PRIx32
61
62#define SZT_F PRIuPTR
69#define PACK_STRUCT_FIELD(x) x
70#define PACK_STRUCT_STRUCT __attribute__((packed))
71#define PACK_STRUCT_BEGIN
72#define PACK_STRUCT_END
79#ifdef MODULE_LOG
80# define LWIP_PLATFORM_DIAG(x) LOG_INFO x
81# ifdef NDEBUG
82# define LWIP_PLATFORM_ASSERT(x)
83# else
84# define LWIP_PLATFORM_ASSERT(x) \
85 do { \
86 LOG_ERROR("Assertion \"%s\" failed at %s:%d\n", x, __FILE__, __LINE__); \
87 fflush(NULL); \
88 abort(); \
89 } while (0)
90# endif
91#else
92# define LWIP_PLATFORM_DIAG(x) printf x
93# ifdef NDEBUG
94# define LWIP_PLATFORM_ASSERT(x)
95# else
96# define LWIP_PLATFORM_ASSERT(x) \
97 do { \
98 printf("Assertion \"%s\" failed at %s:%d\n", x, __FILE__, __LINE__); \
99 fflush(NULL); \
100 abort(); \
101 } while (0)
102# endif
103#endif
106#ifdef __cplusplus
107}
108#endif
109
110#endif /* ARCH_CC_H */
Functions to work with different byte orders.
Adds include for missing inttype definitions.
IRQ driver interface.
Mutex for thread synchronization.
stdio wrapper to extend the C libs stdio