blob: 3a80e53aba732fef55f47628c7e88e73350e5251 [file] [log] [blame]
/*
*
* Copyright (c) 2012-2013 Nest Labs, Inc.
* All rights reserved.
*
* This document is the property of Nest. It is considered
* confidential and proprietary information.
*
* This document may not be reproduced or transmitted in any form,
* in whole or in part, without the express written permission of
* Nest.
*
* Description:
* This file defines processor-architecture- and toolchain-
* specific constants and types required for building
* LwIP against DARWIN.
*
*/
#ifndef NL_LWIP_DARWIN_ARCH_CC_H
#define NL_LWIP_DARWIN_ARCH_CC_H
#include <errno.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
typedef int8_t s8_t;
typedef uint8_t u8_t;
typedef int16_t s16_t;
typedef uint16_t u16_t;
typedef int32_t s32_t;
typedef uint32_t u32_t;
typedef ptrdiff_t mem_ptr_t;
typedef u32_t sys_prot_t;
#ifndef LWIP_NOASSERT
#define LWIP_PLATFORM_ASSERT(message) do { puts(message); } while (0)
#else
#define LWIP_PLATFORM_ASSERT(message)
#endif
/* Darwin defines BYTE_ORDER to definitions that should be identical
* to those LwIP has defined for LITTLE_ENDIAN and BIG_ENDIAN. Ensure
* that's the case.
*/
#if !defined(BYTE_ORDER)
# if defined(__LITTLE_ENDIAN__)
# define BYTE_ORDER LITTLE_ENDIAN
# elif defined(__BIG_ENDIAN__)
# define BYTE_ORDER BIG_ENDIAN
# endif
#else
# if defined(__LITTLE_ENDIAN__) && (BYTE_ORDER != LITTLE_ENDIAN)
# error "Darwin's BYTE_ORDER is inconsistent with LwIP's LITTLE_ENDIAN."
# elif defined(__BIG_ENDIAN__) && (BYTE_ORDER != BIG_ENDIAN)
# error "Darwin's BYTE_ORDER is inconsistent with LwIP's BIG_ENDIAN."
# endif
#endif
/* LwIP Debug Output Formatting and Function Calls */
#define U16_F "hu"
#define S16_F "hd"
#define X16_F "hx"
#define U32_F "u"
#define S32_F "d"
#define X32_F "x"
#define SZT_F "zu"
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
#define PACK_STRUCT_FIELD(x) x
#define LWIP_PLATFORM_DIAG(x) \
do { \
printf x; \
} while (0)
#endif /* NL_LWIP_DARWIN_ARCH_CC_H */