From 55d4f54ef204271e27703b5e7a89d58c13c2b294 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 4 Mar 2011 22:25:03 +0000 Subject: First cut at x86 build environment git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3336 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/x86/include/README.txt | 31 ++++++ nuttx/arch/x86/include/arch.h | 91 ++++++++++++++++++ nuttx/arch/x86/include/i486/arch.h | 108 +++++++++++++++++++++ nuttx/arch/x86/include/i486/io.h | 153 ++++++++++++++++++++++++++++++ nuttx/arch/x86/include/i486/irq.h | 178 +++++++++++++++++++++++++++++++++++ nuttx/arch/x86/include/i486/limits.h | 81 ++++++++++++++++ nuttx/arch/x86/include/i486/types.h | 97 +++++++++++++++++++ nuttx/arch/x86/include/io.h | 86 +++++++++++++++++ nuttx/arch/x86/include/irq.h | 98 +++++++++++++++++++ nuttx/arch/x86/include/limits.h | 53 +++++++++++ nuttx/arch/x86/include/qemu/arch.h | 80 ++++++++++++++++ nuttx/arch/x86/include/qemu/irq.h | 82 ++++++++++++++++ nuttx/arch/x86/include/types.h | 65 +++++++++++++ 13 files changed, 1203 insertions(+) create mode 100755 nuttx/arch/x86/include/README.txt create mode 100755 nuttx/arch/x86/include/arch.h create mode 100755 nuttx/arch/x86/include/i486/arch.h create mode 100644 nuttx/arch/x86/include/i486/io.h create mode 100755 nuttx/arch/x86/include/i486/irq.h create mode 100755 nuttx/arch/x86/include/i486/limits.h create mode 100755 nuttx/arch/x86/include/i486/types.h create mode 100755 nuttx/arch/x86/include/io.h create mode 100755 nuttx/arch/x86/include/irq.h create mode 100755 nuttx/arch/x86/include/limits.h create mode 100755 nuttx/arch/x86/include/qemu/arch.h create mode 100755 nuttx/arch/x86/include/qemu/irq.h create mode 100755 nuttx/arch/x86/include/types.h (limited to 'nuttx/arch/x86/include') diff --git a/nuttx/arch/x86/include/README.txt b/nuttx/arch/x86/include/README.txt new file mode 100755 index 000000000..1f6cdeb91 --- /dev/null +++ b/nuttx/arch/x86/include/README.txt @@ -0,0 +1,31 @@ +arch/x86/include/README.txt +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This directory holds x86-specific header files. The top-level header files in +arch/x86/include simply include corresponding header files from lower lower- +level chip-specific and architecture-specific directories. + +Architecture-Specific Directories +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Architecture-specific directories hold common header files for specific x86 +architectures. Separating these header file makes it easy to manage such +things as differences in sizeof(long) on 32- and 64-bit x86 architectures. + +i486 + This directory holds definitions appropriate for any instantiation of the + 32-bit i486 architecture. + +Chip-Specific directories +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The same x86 architecture may be realized in different chip implementations. +For SoC chips, in particular, on-chip devices and differing interrupt +structures may require special, chip-specific definitions in these chip- +specific directories. + +qemu + This is the implementation of NuttX on the QEMU x86 simulation. + + + diff --git a/nuttx/arch/x86/include/arch.h b/nuttx/arch/x86/include/arch.h new file mode 100755 index 000000000..966bfbc56 --- /dev/null +++ b/nuttx/arch/x86/include/arch.h @@ -0,0 +1,91 @@ +/**************************************************************************** + * arch/x86/include/arch.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, only indirectly + * through arch/arch.h + */ + +#ifndef __ARCH_X86_INCLUDE_ARCH_H +#define __ARCH_X86_INCLUDE_ARCH_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/* Include chip-specific definitions */ + +# include + +/* Include architecture-specific definitions */ + +#ifdef CONFIG_ARCH_I486 +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __ARCH_X86_INCLUDE_ARCH_H */ diff --git a/nuttx/arch/x86/include/i486/arch.h b/nuttx/arch/x86/include/i486/arch.h new file mode 100755 index 000000000..89901cb0a --- /dev/null +++ b/nuttx/arch/x86/include/i486/arch.h @@ -0,0 +1,108 @@ +/**************************************************************************** + * arch/x86/include/i486/arch.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, + * only indirectly through nuttx/arch.h + */ + +#ifndef __ARCH_X86_INCLUDE_I486_ARCH_H +#define __ARCH_X86_INCLUDE_I486_ARCH_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* FLAGS bits */ + +#define X86_FLAGS_CF (1 << 0) /* Bit 0: Carry Flag */ + /* Bit 1: Reserved */ +#define X86_FLAGS_PF (1 << 2) /* Bit 2: Parity Flag */ + /* Bit 3: Reserved */ +#define X86_FLAGS_AF (1 << 4) /* Bit 4: Auxillary carry Flag */ + /* Bit 5: Reserved */ +#define X86_FLAGS_ZF (1 << 6) /* Bit 6: Zero Flag */ +#define X86_FLAGS_SF (1 << 7) /* Bit 7: Sign Flag */ +#define X86_FLAGS_TF (1 << 8) /* Bit 8: Trap Flag */ +#define X86_FLAGS_IF (1 << 9) /* Bit 9: Interrupt Flag */ +#define X86_FLAGS_DF (1 << 10) /* Bit 10: Direction Flag */ +#define X86_FLAGS_OF (1 << 11) /* Bit 11: Overflow Flag */ +#define X86_FLAGS_IOPL_SHIFT (12) /* Bits 12-13: IOPL mask (286+ only)*/ +#define X86_FLAGS_IOPL_MASK (3 << X86_FLAGS_IOPL_SHIFT) +#define X86_FLAGS_NT (1 << 14) /* Bit 14: Nested Task */ + /* Bit 15: Reserved */ + +/* EFLAGS bits (Extend the basic FLAGS bit definitions) */ + +#define X86_EFLAGS_RF (1 << 16) /* Bit 16: Resume Flag (386+ only) */ +#define X86_EFLAGS_VM (1 << 17) /* Bit 17: Virtual Mode (386+ only) */ +#define X86_EFLAGS_AC (1 << 18) /* Bit 18: Alignment Check (486SX+ only) */ +#define X86_EFLAGS_VIF (1 << 19) /* Bit 19: Virtual Interrupt Flag (Pentium+) */ +#define X86_EFLAGS_VIP (1 << 20) /* Bit 20: Virtual Interrupt Pending (Pentium+) */ +#define X86_EFLAGS_ID (1 << 21) /* Bit 21: CPUID detection flag (Pentium+) */ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __ARCH_X86_INCLUDE_I486_ARCH_H */ + diff --git a/nuttx/arch/x86/include/i486/io.h b/nuttx/arch/x86/include/i486/io.h new file mode 100644 index 000000000..7a56ef626 --- /dev/null +++ b/nuttx/arch/x86/include/i486/io.h @@ -0,0 +1,153 @@ +/**************************************************************************** + * arch/x86/include/i486/io.h + * arch/chip/io.h + * + * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, only indirectly + * through arch/io.h + */ + +#ifndef __ARCH_X86_INCLUDE_I486_IO_H +#define __ARCH_X86_INCLUDE_I486_IO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + + #ifndef __ASSEMBLY__ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/* Standard x86 Port I/O */ + +static inline void outb(uint8_t regval, uint16_t port) +{ + asm volatile( + "\toutb %0,%1\n" + : + : "a" (regval), "dN" (port) + ); +} + +static inline uint8_t inb(uint16_t port) +{ + uint8_t regval; + asm volatile( + "\tinb %1,%0\n" + : "=a" (regval) + : "dN" (port) + ); + return regval; +} + +static inline void outw(uint16_t regval, uint16_t port) +{ + asm volatile( + "\toutw %0,%1\n" + : + : "a" (regval), "dN" (port) + ); +} + +static inline uint16_t inw(uint16_t port) +{ + uint16_t regval; + + asm volatile( + "\tinw %1,%0\n" + : "=a" (regval) + : "dN" (port) + ); + return regval; +} + +static inline void outl(uint32_t regval, uint16_t port) +{ + asm volatile( + "\toutl %0,%1\n" + : + : "a" (regval), "dN" (port) + ); +} + +static inline uint32_t inl(uint32_t port) +{ + uint32_t regval; + asm volatile( + "\tinl %1,%0\n" + : "=a" (regval) + : "dN" (port) + ); + return regval; +} + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +EXTERN void outp(char p, char c); +EXTERN char inp(char p); + +#undef EXTERN +#ifdef __cplusplus +} +#endif +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_X86_INCLUDE_I486_IO_H */ diff --git a/nuttx/arch/x86/include/i486/irq.h b/nuttx/arch/x86/include/i486/irq.h new file mode 100755 index 000000000..d24e335f1 --- /dev/null +++ b/nuttx/arch/x86/include/i486/irq.h @@ -0,0 +1,178 @@ +/**************************************************************************** + * arch/x86/include/i486/irq.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, only indirectly + * through nuttx/irq.h + */ + +#ifndef __ARCH_X86_INCLUDE_I486_IRQ_H +#define __ARCH_X86_INCLUDE_I486_IRQ_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#ifdef __ASSEMBLY__ +# include +# include +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Storage order: %ebx, $esi, %edi, %ebp, sp, and return PC */ + +#ifdef __ASSEMBLY__ +# define REG_EBX (0*4) +# define REG_ESI (1*4) +# define REG_EDI (2*4) +# define REG_EBP (3*4) +# define REG_SP (4*4) +# define REG_PC (5*4) +#else +# define REG_EBX (0) +# define REG_ESI (1) +# define REG_EDI (2) +# define REG_EBP (3) +# define REG_SP (4) +# define REG_PC (5) +#endif /* __ASSEMBLY__ */ + +#define XCPTCONTEXT_REGS (6) +#define XCPTCONTEXT_SIZE (6 * XCPTCONTEXT_REGS) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* This struct defines the way the registers are stored */ + +#ifndef __ASSEMBLY__ +struct xcptcontext +{ + void *sigdeliver; /* Actual type is sig_deliver_t */ + + /* Storage order: %ebx, $esi, %edi, %ebp, sp, and return PC */ + + uint32_t regs[XCPTCONTEXT_REGS]; +}; +#endif + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/* Get the current FLAGS register contents */ + +static inline irqstate_t irqflags() +{ + irqstate_t flags; + + asm volatile( + "\tpushf\n" + "\tpop %0\n" + : "=rm" (flags) + : + : "memory"); + return flags; +} + +/* Get a sample of the FLAGS register, determine if interrupts are disabled */ + +static inline bool irqdisabled(irqstate_t flags) +{ + return ((flags & X86_FLAGS_IF) == 0); +} + +/* Disable interrupts unconditionally */ + +static inline void irqdisable(void) +{ + asm volatile("cli": : :"memory"); +} + +/* Enable interrupts unconditionally */ + +static inline void irqenable(void) +{ + asm volatile("sti": : :"memory"); +} + +/* Disable interrupts, but return previous interrupt state */ + +static inline irqstate_t irqsave(void) +{ + irqstate_t flags = irqflags(); + irqdisable(); + return flags; +} + +/* Conditionally disable interrupts */ + +static inline void irqrestore(irqstate_t flags) +{ + if (irqdisabled(flags)) + { + irqdisable(); + } +} + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_X86_INCLUDE_I486_IRQ_H */ + diff --git a/nuttx/arch/x86/include/i486/limits.h b/nuttx/arch/x86/include/i486/limits.h new file mode 100755 index 000000000..ac0755ef9 --- /dev/null +++ b/nuttx/arch/x86/include/i486/limits.h @@ -0,0 +1,81 @@ +/**************************************************************************** + * arch/x86/include/i486/limits.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_X86_INCLUDE_I486_LIMITS_H +#define __ARCH_X86_INCLUDE_I486_LIMITS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define CHAR_BIT 8 +#define SCHAR_MIN 0x80 +#define SCHAR_MAX 0x7f +#define UCHAR_MAX 0xff + +/* These could be different on machines where char is unsigned */ + +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +#define SHRT_MIN 0x8000 +#define SHRT_MAX 0x7fff +#define USHRT_MAX 0xffff + +#define INT_MIN 0x80000000 +#define INT_MAX 0x7fffffff +#define UINT_MAX 0xffffffff + +/* These change on 32-bit and 64-bit platforms */ + +#define LONG_MAX 0x80000000 +#define LONG_MIN 0x7fffffff +#define ULONG_MAX 0xffffffff + +#define LLONG_MAX 0x8000000000000000 +#define LLONG_MIN 0x7fffffffffffffff +#define ULLONG_MAX 0xffffffffffffffff + +/* A pointer is 4 bytes */ + +#define PTR_MIN 0x80000000 +#define PTR_MAX 0x7fffffff +#define UPTR_MAX 0xffffffff + +#endif /* __ARCH_X86_INCLUDE_I486_LIMITS_H */ diff --git a/nuttx/arch/x86/include/i486/types.h b/nuttx/arch/x86/include/i486/types.h new file mode 100755 index 000000000..88379fd0f --- /dev/null +++ b/nuttx/arch/x86/include/i486/types.h @@ -0,0 +1,97 @@ +/************************************************************************ + * arch/x86/include/i486/types.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************/ + +/* This file should never be included directed but, rather, only + * indirectly through arch/types.h (which is, in turn only accessed + * through sys/types.h or stdint.h). + */ + +#ifndef __ARCH_X86_INCLUDE_I486_TYPES_H +#define __ARCH_X86_INCLUDE_I486_TYPES_H + +/************************************************************************ + * Included Files + ************************************************************************/ + +/************************************************************************ + * Definitions + ************************************************************************/ + +/************************************************************************ + * Type Declarations + ************************************************************************/ + +#ifndef __ASSEMBLY__ + +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed to the final name without + * the underscore character. This roundabout way of doings things allows + * the stdint.h to be removed from the include/ directory in the event that + * the user prefers to use the definitions provided by their toolchain header + * files + */ + +typedef char _int8_t; +typedef unsigned char _uint8_t; + +typedef short _int16_t; +typedef unsigned short _uint16_t; + +typedef int _int32_t; +typedef unsigned int _uint32_t; + +typedef long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED + +/* A pointer is 4 bytes */ + +typedef unsigned int _intptr_t; +typedef unsigned int _uintptr_t; + +/* This is the size of the interrupt state save returned by + * irqsave() + */ + +typedef unsigned int irqstate_t; + +#endif /* __ASSEMBLY__ */ + +/************************************************************************ + * Global Function Prototypes + ************************************************************************/ + +#endif /* __ARCH_X86_INCLUDE_I486_TYPES_H */ diff --git a/nuttx/arch/x86/include/io.h b/nuttx/arch/x86/include/io.h new file mode 100755 index 000000000..4f88932c5 --- /dev/null +++ b/nuttx/arch/x86/include/io.h @@ -0,0 +1,86 @@ +/**************************************************************************** + * arch/x86/include/io.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_X86_INCLUDE_IO_H +#define __ARCH_X86_INCLUDE_IO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/* Include architecture-specific IO definitions (These are probably common + * across all architectures, but this gives a little bit of flexibility). + */ + +#ifdef CONFIG_ARCH_I486 +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif +#endif + +#endif /* __ARCH_X86_INCLUDE_IO_H */ + diff --git a/nuttx/arch/x86/include/irq.h b/nuttx/arch/x86/include/irq.h new file mode 100755 index 000000000..97c8c0f9c --- /dev/null +++ b/nuttx/arch/x86/include/irq.h @@ -0,0 +1,98 @@ +/**************************************************************************** + * arch/x86/include/irq.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, only indirectly + * through nuttx/irq.h + */ + +#ifndef __ARCH_X86_INCLUDE_IRQ_H +#define __ARCH_X86_INCLUDE_IRQ_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/* Include NuttX-specific IRQ definitions */ + +#include + +/* Include chip-specific IRQ definitions (including IRQ numbers) */ + +#include + +/* Include architecture-specific IRQ definitions (including register save + * structure and irqsave()/irqrestore() macros). + */ + +#ifdef CONFIG_ARCH_I486 +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif +#endif + +#endif /* __ARCH_X86_INCLUDE_IRQ_H */ + diff --git a/nuttx/arch/x86/include/limits.h b/nuttx/arch/x86/include/limits.h new file mode 100755 index 000000000..729504edd --- /dev/null +++ b/nuttx/arch/x86/include/limits.h @@ -0,0 +1,53 @@ +/**************************************************************************** + * arch/x86/include/limits.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_X86_INCLUDE_LIMITS_H +#define __ARCH_X86_INCLUDE_LIMITS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/* Include architecture-specific limits */ + +#ifdef CONFIG_ARCH_I486 +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#endif /* __ARCH_X86_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/x86/include/qemu/arch.h b/nuttx/arch/x86/include/qemu/arch.h new file mode 100755 index 000000000..fc2a7278b --- /dev/null +++ b/nuttx/arch/x86/include/qemu/arch.h @@ -0,0 +1,80 @@ +/**************************************************************************** + * arch/x86/include/qemu/arch.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, + * only indirectly through nuttx/arch.h + */ + +#ifndef __ARCH_X86_INCLUDE_QEMU_ARCH_H +#define __ARCH_X86_INCLUDE_QEMU_ARCH_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __ARCH_X86_INCLUDE_QEMU_ARCH_H */ + diff --git a/nuttx/arch/x86/include/qemu/irq.h b/nuttx/arch/x86/include/qemu/irq.h new file mode 100755 index 000000000..a39876bc6 --- /dev/null +++ b/nuttx/arch/x86/include/qemu/irq.h @@ -0,0 +1,82 @@ +/**************************************************************************** + * arch/x86/include/qemu/irq.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, + * only indirectly through nuttx/irq.h + */ + +#ifndef __ARCH_X86_INCLUDE_QEMU_IRQ_H +#define __ARCH_X86_INCLUDE_QEMU_IRQ_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define NR_IRQS 0 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __ARCH_X86_INCLUDE_QEMU_IRQ_H */ + diff --git a/nuttx/arch/x86/include/types.h b/nuttx/arch/x86/include/types.h new file mode 100755 index 000000000..112de8525 --- /dev/null +++ b/nuttx/arch/x86/include/types.h @@ -0,0 +1,65 @@ +/**************************************************************************** + * arch/x86/include/types.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, only indirectly + * through sys/types.h + */ + +#ifndef __ARCH_X86_INCLUDE_TYPES_H +#define __ARCH_X86_INCLUDE_TYPES_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/* Include architecture-specific limits */ + +#ifdef CONFIG_ARCH_I486 +# include +#endif + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Type Declarations + ****************************************************************************/ + +/**************************************************************************** + * Global Function Prototypes + ****************************************************************************/ + +#endif /* __ARCH_X86_INCLUDE_TYPES_H */ -- cgit v1.2.3