Loading...
Searching...
No Matches
cc.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
19
20#include <inttypes.h>
21#include <stdio.h>
22#include <stdlib.h>
23
24#include "irq.h"
25#include "byteorder.h"
26#include "mutex.h"
27
28#ifdef MODULE_LOG
29#define LOG_LEVEL LOG_INFO
30#include "log.h"
31#endif
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#ifndef BYTE_ORDER
38#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
39# define BYTE_ORDER (LITTLE_ENDIAN)
40#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
41# define BYTE_ORDER (BIG_ENDIAN)
42#else
43# error "Byte order is neither little nor big!"
44#endif
45#endif
46
51#define X8_F "02" PRIx8
52#define U16_F PRIu16
53#define S16_F PRId16
54#define X16_F PRIx16
55#define U32_F PRIu32
56#define S32_F PRId32
57#define X32_F PRIx32
58
59#define SZT_F PRIuPTR
61
66#define PACK_STRUCT_FIELD(x) x
67#define PACK_STRUCT_STRUCT __attribute__((packed))
68#define PACK_STRUCT_BEGIN
69#define PACK_STRUCT_END
71
76#ifdef MODULE_LOG
77# define LWIP_PLATFORM_DIAG(x) LOG_INFO x
78# ifdef NDEBUG
79# define LWIP_PLATFORM_ASSERT(x)
80# else
81# define LWIP_PLATFORM_ASSERT(x) \
82 do { \
83 LOG_ERROR("Assertion \"%s\" failed at %s:%d\n", x, __FILE__, __LINE__); \
84 fflush(NULL); \
85 abort(); \
86 } while (0)
87# endif
88#else
89# define LWIP_PLATFORM_DIAG(x) printf x
90# ifdef NDEBUG
91# define LWIP_PLATFORM_ASSERT(x)
92# else
93# define LWIP_PLATFORM_ASSERT(x) \
94 do { \
95 printf("Assertion \"%s\" failed at %s:%d\n", x, __FILE__, __LINE__); \
96 fflush(NULL); \
97 abort(); \
98 } while (0)
99# endif
100#endif
102
103#ifdef __cplusplus
104}
105#endif
106
Functions to work with different byte orders.
Adds include for missing inttype definitions.
IRQ driver interface.
Mutex for thread synchronization.