初始化版本
This commit is contained in:
69
lwip/port/arch/cc.h
Normal file
69
lwip/port/arch/cc.h
Normal file
@ -0,0 +1,69 @@
|
||||
#ifndef __ARCH_CC_H__
|
||||
#define __ARCH_CC_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Compiler specific types */
|
||||
typedef uint8_t u8_t;
|
||||
typedef int8_t s8_t;
|
||||
typedef uint16_t u16_t;
|
||||
typedef int16_t s16_t;
|
||||
typedef uint32_t u32_t;
|
||||
typedef int32_t s32_t;
|
||||
typedef uintptr_t mem_ptr_t;
|
||||
|
||||
/* Formatters for printf */
|
||||
#define U16_F "u"
|
||||
#define S16_F "d"
|
||||
#define X16_F "x"
|
||||
#define U32_F "u"
|
||||
#define S32_F "d"
|
||||
#define X32_F "x"
|
||||
#define SZT_F "u"
|
||||
#define X8_F "02x"
|
||||
|
||||
/* Endianness (Usually Little Endian for ARM) */
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
/* Compiler hints for packing structures */
|
||||
#if defined(__GNUC__)
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#elif defined(__CC_ARM)
|
||||
#define PACK_STRUCT_BEGIN __packed
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#elif defined(__IAR_SYSTEMS_ICC__)
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_USE_INCLUDES
|
||||
#else
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#endif
|
||||
|
||||
/* Platform specific diagnostic output */
|
||||
extern void osal_kprintf(const char *fmt, ...);
|
||||
#define LWIP_PLATFORM_DIAG(x) do { osal_kprintf x; } while(0)
|
||||
|
||||
/* Assert */
|
||||
#define LWIP_PLATFORM_ASSERT(x) do { osal_kprintf("Assertion \"%s\" failed at line %d in %s\n", \
|
||||
x, __LINE__, __FILE__); } while(0)
|
||||
|
||||
/* Random number generator */
|
||||
#define LWIP_RAND() ((u32_t)rand())
|
||||
|
||||
#endif /* __ARCH_CC_H__ */
|
||||
Reference in New Issue
Block a user