diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-01-21 11:20:52 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-01-21 11:20:52 +0000 |
commit | 0464a12749f9b868bd681cbd93c3b3227e23ea8a (patch) | |
tree | 21a66419dd63914f00f0ea5eaab8c4a168657be1 /extras/mini-os/include/arch | |
parent | afb13d4890c7b505865b8264247c2049fd0c2227 (diff) | |
download | xen-0464a12749f9b868bd681cbd93c3b3227e23ea8a.tar.gz xen-0464a12749f9b868bd681cbd93c3b3227e23ea8a.tar.bz2 xen-0464a12749f9b868bd681cbd93c3b3227e23ea8a.zip |
minios: add lwIP 1.3.0 support
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/include/arch')
-rw-r--r-- | extras/mini-os/include/arch/cc.h | 83 | ||||
-rw-r--r-- | extras/mini-os/include/arch/perf.h | 15 | ||||
-rw-r--r-- | extras/mini-os/include/arch/sys_arch.h | 35 |
3 files changed, 133 insertions, 0 deletions
diff --git a/extras/mini-os/include/arch/cc.h b/extras/mini-os/include/arch/cc.h new file mode 100644 index 0000000000..70191f0b30 --- /dev/null +++ b/extras/mini-os/include/arch/cc.h @@ -0,0 +1,83 @@ +/* + * lwip/arch/cc.h + * + * Compiler-specific types and macros for lwIP running on mini-os + * + * Tim Deegan <Tim.Deegan@eu.citrix.net>, July 2007 + */ + +#ifndef __LWIP_ARCH_CC_H__ +#define __LWIP_ARCH_CC_H__ + +/* Typedefs for the types used by lwip - */ +#include <os.h> +#include <types.h> +#include <time.h> +typedef u8 u8_t; +typedef s8 s8_t; +typedef u16 u16_t; +typedef s16 s16_t; +typedef u32 u32_t; +typedef s32 s32_t; +typedef u64 u64_t; +typedef s64 s64_t; +typedef uintptr_t mem_ptr_t; + +typedef u16 u_short; + +/* Compiler hints for packing lwip's structures - */ +#define PACK_STRUCT_FIELD(_x) _x +#define PACK_STRUCT_STRUCT __attribute__ ((packed)) +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_END + +/* Platform specific diagnostic output - */ + +extern void lwip_printk(char *fmt, ...); +#define LWIP_PLATFORM_DIAG(_x) do { lwip_printk _x ; } while (0) + +extern void lwip_die(char *fmt, ...); +#define LWIP_PLATFORM_ASSERT(_x) do { lwip_die(_x); } while(0) + +/* "lightweight" synchronization mechanisms - */ +/* SYS_ARCH_DECL_PROTECT(x) - declare a protection state variable. */ +/* SYS_ARCH_PROTECT(x) - enter protection mode. */ +/* SYS_ARCH_UNPROTECT(x) - leave protection mode. */ + +/* If the compiler does not provide memset() this file must include a */ +/* definition of it, or include a file which defines it. */ +#include <lib.h> + +/* This file must either include a system-local <errno.h> which defines */ +/* the standard *nix error codes, or it should #define LWIP_PROVIDE_ERRNO */ +/* to make lwip/arch.h define the codes which are used throughout. */ +#include <errno.h> + +/* Not required by the docs, but needed for network-order calculations */ +#include <endian.h> + +#include <inttypes.h> +#define S16_F PRIi16 +#define U16_F PRIu16 +#define X16_F PRIx16 +#define S32_F PRIi32 +#define U32_F PRIu32 +#define X32_F PRIx32 + +#if 0 +#ifndef DBG_ON +#define DBG_ON LWIP_DBG_ON +#endif +#define LWIP_DEBUG DBG_ON +//#define IP_DEBUG DBG_ON +#define TCP_DEBUG DBG_ON +#define TCP_INPUT_DEBUG DBG_ON +#define TCP_QLEN_DEBUG DBG_ON +#define TCPIP_DEBUG DBG_ON +#define DBG_TYPES_ON DBG_ON +#endif + +/* TODO: checksum doesn't work fine?! */ +#define CHECKSUM_CHECK_TCP 0 + +#endif /* __LWIP_ARCH_CC_H__ */ diff --git a/extras/mini-os/include/arch/perf.h b/extras/mini-os/include/arch/perf.h new file mode 100644 index 0000000000..dda87f2790 --- /dev/null +++ b/extras/mini-os/include/arch/perf.h @@ -0,0 +1,15 @@ +/* + * lwip/arch/perf.h + * + * Arch-specific performance measurement for lwIP running on mini-os + * + * Tim Deegan <Tim.Deegan@eu.citrix.net>, July 2007 + */ + +#ifndef __LWIP_ARCH_PERF_H__ +#define __LWIP_ARCH_PERF_H__ + +#define PERF_START do { } while(0) +#define PERF_STOP(_x) do { (void)(_x); } while (0) + +#endif /* __LWIP_ARCH_PERF_H__ */ diff --git a/extras/mini-os/include/arch/sys_arch.h b/extras/mini-os/include/arch/sys_arch.h new file mode 100644 index 0000000000..4e911549c9 --- /dev/null +++ b/extras/mini-os/include/arch/sys_arch.h @@ -0,0 +1,35 @@ +/* + * lwip/arch/sys_arch.h + * + * Arch-specific semaphores and mailboxes for lwIP running on mini-os + * + * Tim Deegan <Tim.Deegan@eu.citrix.net>, July 2007 + */ + +#ifndef __LWIP_ARCH_SYS_ARCH_H__ +#define __LWIP_ARCH_SYS_ARCH_H__ + +#include <os.h> +#include <xmalloc.h> +#include <semaphore.h> + +typedef struct semaphore *sys_sem_t; +#define SYS_SEM_NULL ((sys_sem_t) NULL) + +struct mbox { + int count; + void **messages; + struct semaphore read_sem; + struct semaphore write_sem; + int writer; + int reader; +}; + +typedef struct mbox *sys_mbox_t; +#define SYS_MBOX_NULL ((sys_mbox_t) 0) + +typedef struct thread *sys_thread_t; + +typedef unsigned long sys_prot_t; + +#endif /*__LWIP_ARCH_SYS_ARCH_H__ */ |