mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 04:03:34 +08:00
Resync new repository with old repo r5166
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5153 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/arch.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
/* Include chip-specific definitions */
|
||||
|
||||
# include <arch/chip/arch.h>
|
||||
|
||||
/* Include architecture-specific definitions */
|
||||
|
||||
#ifdef CONFIG_ARCH_I486
|
||||
# include <arch/i486/arch.h>
|
||||
#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 */
|
||||
@@ -0,0 +1,451 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/i486/arch.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* 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+) */
|
||||
|
||||
/* Programmable Interrupt Controller (PIC) */
|
||||
|
||||
/* Operational Control Words
|
||||
*
|
||||
* The first instruction the Operation Control Word 1 (OCW1) to set which
|
||||
* IRQ's to mask and which IRQ's not to.
|
||||
*/
|
||||
|
||||
#define PIC1_OCW1 0x20
|
||||
#define PIC2_OCW1 0xa0
|
||||
|
||||
# define PIC1_OCW1_IRQ0 (1 << 0) /* IRQ0 System Timer */
|
||||
# define PIC1_OCW1_IRQ1 (1 << 1) /* IRQ1 Keyboard */
|
||||
# define PIC1_OCW1_IRQ2 (1 << 2) /* IRQ2 PIC2 */
|
||||
# define PIC1_OCW1_IRQ3 (1 << 3) /* IRQ3 Serial Port */
|
||||
# define PIC1_OCW1_IRQ4 (1 << 4) /* IRQ4 Serial Port */
|
||||
# define PIC1_OCW1_IRQ5 (1 << 5) /* IRQ5 Reserved/Sound Card */
|
||||
# define PIC1_OCW1_IRQ6 (1 << 6) /* IRQ6 Floppy Disk Controller */
|
||||
# define PIC1_OCW1_IRQ7 (1 << 7) /* IRQ7 Parallel Port */
|
||||
# define PIC1_OCW1_ALL
|
||||
|
||||
# define PIC2_OCW1_IRQ8 (1 << 0) /* IRQ8 Real Time Clock */
|
||||
# define PIC2_OCW1_IRQ9 (1 << 1) /* IRQ9 Redirected IRQ2 */
|
||||
# define PIC2_OCW1_IRQ10 (1 << 2) /* IRQ10 Reserved */
|
||||
# define PIC2_OCW1_IRQ11 (1 << 3) /* IRQ11 Reserved */
|
||||
# define PIC2_OCW1_IRQ12 (1 << 4) /* IRQ12 PS/2 Mouse */
|
||||
# define PIC2_OCW1_IRQ13 (1 << 5) /* IRQ13 Maths Co-Processor */
|
||||
# define PIC2_OCW1_IRQ14 (1 << 6) /* IRQ14 Hard Disk Drive */
|
||||
# define PIC2_OCW1_IRQ15 (1 << 7) /* IRQ15 Reserved */
|
||||
# define PIC2_OCW1_ALL
|
||||
|
||||
/* Operation Control Word 2 selects how the End of Interrupt (EOI) procedure
|
||||
* works. The only thing of interest to us in this register is the non-
|
||||
* specific EOI command, which we must send at the end of our ISR's.
|
||||
*/
|
||||
|
||||
#define PIC1_OCW2 0x20
|
||||
#define PIC2_OCW2 0xa0
|
||||
|
||||
# define PIC_OCW2_ACT_SHIFT (0)
|
||||
# define PIC_OCW2_ACT_MASK (7 << PIC_OCW2_ACT_SHIFT)
|
||||
# define PIC1_OCW2_ACT_IRQ0 (0 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 0 */
|
||||
# define PIC1_OCW2_ACT_IRQ1 (1 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 1 */
|
||||
# define PIC1_OCW2_ACT_IRQ2 (2 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 2 */
|
||||
# define PIC1_OCW2_ACT_IRQ3 (3 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 3 */
|
||||
# define PIC1_OCW2_ACT_IRQ4 (4 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 4 */
|
||||
# define PIC1_OCW2_ACT_IRQ5 (5 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 5 */
|
||||
# define PIC1_OCW2_ACT_IRQ6 (6 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 6 */
|
||||
# define PIC1_OCW2_ACT_IRQ7 (7 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 7 */
|
||||
|
||||
# define PIC2_OCW2_ACT_IRQ8 (0 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 8 */
|
||||
# define PIC2_OCW2_ACT_IRQ9 (1 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 9 */
|
||||
# define PIC2_OCW2_ACT_IRQ10 (2 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 10 */
|
||||
# define PIC2_OCW2_ACT_IRQ11 (3 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 11 */
|
||||
# define PIC2_OCW2_ACT_IRQ12 (4 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 12 */
|
||||
# define PIC2_OCW2_ACT_IRQ13 (5 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 13 */
|
||||
# define PIC2_OCW2_ACT_IRQ14 (6 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 14 */
|
||||
# define PIC2_OCW2_ACT_IRQ15 (7 << PIC_OCW2_ACT_SHIFT) /* Act on IRQ 15 */
|
||||
|
||||
# define PIC_OCW2_EOI_SHIFT (5)
|
||||
# define PIC_OCW2_EOI_MASK (7 << PIC_OCW2_EOI_SHIFT)
|
||||
# define PIC_OCW2_EOI_AUTO (0 << PIC_OCW2_EOI_SHIFT) /* Rotate in Auto EOI Mode (Clear) */
|
||||
# define PIC_OCW2_EOI_NONSPEC (1 << PIC_OCW2_EOI_SHIFT) /* Non Specific EOI */
|
||||
# define PIC_OCW2_EOI_SPEC (3 << PIC_OCW2_EOI_SHIFT) /* Specific EOI */
|
||||
# define PIC_OCW2_EOI_RAUTO (4 << PIC_OCW2_EOI_SHIFT) /* Rotate in Auto EOI Mode (Set) */
|
||||
# define PIC_OCW2_EOI_RNSPEC (5 << PIC_OCW2_EOI_SHIFT) /* Rotate on Non-Specific EOI */
|
||||
# define PIC_OCW2_EOI_PRIO (6 << PIC_OCW2_EOI_SHIFT) /* Set Priority Command (Use Bits 2:0) */
|
||||
# define PIC_OCW2_EOI_RSPEC (7 << PIC_OCW2_EOI_SHIFT) /* Rotate on Specific EOI (Use Bits 2:0) */
|
||||
|
||||
/* Operation Control Word 3. Bits 0 and 1 bitsenable us to read the status
|
||||
* of the Interrupt Request Register (IRR) and the In-Service Register (ISR).
|
||||
* This is done by setting the appropriate bits correctly and reading the
|
||||
* register at the Base Address.
|
||||
*
|
||||
* For example if we wanted to read the In-Service Register (ISR), then we
|
||||
* would set both bits 1 and 0 to 1. The next read to the base register,
|
||||
* (0x20 for PIC1 or 0xa0 for PIC2) will return the status of the In-Service
|
||||
* Register.
|
||||
*/
|
||||
|
||||
#define PIC1_OCW3 0x20
|
||||
#define PIC2_OCW3 0xa0
|
||||
|
||||
# define PIC_OCW3_PCMD_SHIFT (0) /* Poll command */
|
||||
# define PIC_OCW3_PCMD_MASK (3 << PIC_OCW3_PCMD_SHIFT)
|
||||
# define PIC_OCW3_PCMD_IRR (2 << PIC_OCW3_PCMD_SHIFT) /* Next Read Returns Interrupt Request Register */
|
||||
# define PIC_OCW3_PCMD_ISR (3 << PIC_OCW3_PCMD_SHIFT) /* Next Read Returns In-Service Register */
|
||||
# define PIC_OCW3_POLLCMD (1 << 2) /* Poll command */
|
||||
# define PIC_OCW3_ONE (1 << 3) /* Must be set to 1 */
|
||||
# define PIC_OCW3_SM_SHIFT (5)
|
||||
# define PIC_OCW3_SM_MASK (3 << PIC_OCW3_SM_SHIFT)
|
||||
# define PIC_OCW3_RSM (2 << PIC_OCW3_SM_SHIFT) /* Reset Special Mask */
|
||||
# define PIC_OCW3_SSM (3 << PIC_OCW3_SM_SHIFT) /* Set Special Mask */
|
||||
|
||||
/* If the PIC has been reset, it must be initialized with 2 to 4 Initialization
|
||||
* Command Words (ICW) before it will accept and process Interrupt Requests. The
|
||||
* following outlines the four possible Initialization Command Words.
|
||||
*/
|
||||
|
||||
#define PIC1_ICW1 0x20
|
||||
#define PIC2_ICW1 0xa0
|
||||
|
||||
# define PIC_ICW1_ICW4 (1 << 0) /* Will be Sending ICW4 (no ICW4) */
|
||||
# define PIC_ICW1_SINGLE (1 << 1) /* Single PIC (vs. Cascaded pics) */
|
||||
# define PIC_ICW1_INTERVAL (1 << 2) /* Call Address Interval of 4 (vs 8) */
|
||||
# define PIC_ICW1_LEVEL (1 << 3) /* Level Triggered Interrupts (vs Edge) */
|
||||
# define PIC_ICW1_ICW1 (1 << 4) /* Must be set to 1 for ICW1 */
|
||||
# define PIC_ICW1_VEC_SHIFT (5) /* Interrupt Vector Addresses for MCS-80/85 Mode */
|
||||
# define PIC_ICW1_VEC_MASK (7 << PIC_ICW1_VEC_SHIFT)
|
||||
|
||||
/* Initialization Command Word 2 (ICW2) selects which vector information is
|
||||
* released onto the bus, during the 2nd INTA Pulse. Using the 8086 mode,
|
||||
* only bits 7:3 need to be used. This will be 00001000 (0x08) for PIC1 and
|
||||
* 01110000 (0x70) for PIC2. If you wish to relocate the IRQ Vector Table,
|
||||
* then you can use this register.
|
||||
*/
|
||||
|
||||
#define PIC1_ICW2 0x21
|
||||
#define PIC2_ICW2 0xa1
|
||||
|
||||
/* There are two different Initialization Command Word 3's. One is used, if
|
||||
* the PIC is a master, while the other is used for slaves.
|
||||
*/
|
||||
|
||||
#define PIC1_ICW3 0x21
|
||||
#define PIC2_ICW3 0xa1
|
||||
|
||||
/* Master ICW3 */
|
||||
|
||||
# define PIC1_ICW3_IRQ0 (1 << 0) /* IRQ0 is connected to a Slave */
|
||||
# define PIC1_ICW3_IRQ1 (1 << 1) /* IRQ1 is connected to a Slave */
|
||||
# define PIC1_ICW3_IRQ2 (1 << 2) /* IRQ2 is connected to a Slave */
|
||||
# define PIC1_ICW3_IRQ3 (1 << 3) /* IRQ3 is connected to a Slave */
|
||||
# define PIC1_ICW3_IRQ4 (1 << 4) /* IRQ4 is connected to a Slave */
|
||||
# define PIC1_ICW3_IRQ5 (1 << 5) /* IRQ5 is connected to a Slave */
|
||||
# define PIC1_ICW3_IRQ6 (1 << 6) /* IRQ6 is connected to a Slave */
|
||||
# define PIC1_ICW3_IRQ7 (1 << 7) /* IRQ7 is connected to a Slave */
|
||||
|
||||
/* And for the slave device, the ICW3 below is used. */
|
||||
|
||||
# define PIC_ICW3_SID_MASK (0) /* Slave ID */
|
||||
# define PIC_ICW3_SID_SHIFT (7 << PIC_ICW3_SID_MASK)
|
||||
# define PIC_ICW3_SID0 (0 << PIC_ICW3_SID_MASK) /* Slave 0 */
|
||||
# define PIC_ICW3_SID1 (1 << PIC_ICW3_SID_MASK) /* Slave 1 */
|
||||
# define PIC_ICW3_SID2 (2 << PIC_ICW3_SID_MASK) /* Slave 2 */
|
||||
# define PIC_ICW3_SID3 (3 << PIC_ICW3_SID_MASK) /* Slave 3 */
|
||||
# define PIC_ICW3_SID4 (4 << PIC_ICW3_SID_MASK) /* Slave 4 */
|
||||
# define PIC_ICW3_SID5 (5 << PIC_ICW3_SID_MASK) /* Slave 5 */
|
||||
# define PIC_ICW3_SID6 (6 << PIC_ICW3_SID_MASK) /* Slave 6 */
|
||||
# define PIC_ICW3_SID7 (7 << PIC_ICW3_SID_MASK) /* Slave 7 */
|
||||
|
||||
#define PIC1_ICW4 0x21
|
||||
#define PIC2_ICW4 0xa1
|
||||
|
||||
# define PIC_ICW4_FNM (1 << 4) /* Special Fully Nested Mode */
|
||||
# define PIC_ICW4_BMODE_SHIFT (2) /* Bufferd mode */
|
||||
# define PIC_ICW4_BMODE_MASK (3 << PIC_ICW4_BMODE_SHIFT)
|
||||
# define PIC_ICW4_BMODE_NON (0 << PIC_ICW4_BMODE_SHIFT) /* Non - Buffered Mode */
|
||||
# define PIC_ICW4_BMODE_SLAVE (2 << PIC_ICW4_BMODE_SHIFT) /* Buffered Mode - Slave */
|
||||
# define PIC_ICW4_BMODE_MSTR (3 << PIC_ICW4_BMODE_SHIFT) /* Buffered Mode - Master */
|
||||
# define PIC_ICW4_AEOI (1 << 1) /* Auto EOI */
|
||||
# define PIC_ICW4_808xMODE (1 << 0) /* 8086/8080 Mode (vs MCS-80/85) */
|
||||
|
||||
/* Interrupt Mask Register */
|
||||
|
||||
#define PIC1_IMR 0x21
|
||||
#define PIC2_IMR 0xa1
|
||||
|
||||
# define PIC1_IMR_IRQ0 (1 << 0) /* IRQ0 System Timer */
|
||||
# define PIC1_IMR_IRQ1 (1 << 1) /* IRQ1 Keyboard */
|
||||
# define PIC1_IMR_IRQ2 (1 << 2) /* IRQ2 PIC2 */
|
||||
# define PIC1_IMR_IRQ3 (1 << 3) /* IRQ3 Serial Port */
|
||||
# define PIC1_IMR_IRQ4 (1 << 4) /* IRQ4 Serial Port */
|
||||
# define PIC1_IMR_IRQ5 (1 << 5) /* IRQ5 Reserved/Sound Card */
|
||||
# define PIC1_IMR_IRQ6 (1 << 6) /* IRQ6 Floppy Disk Controller */
|
||||
# define PIC1_IMR_IRQ7 (1 << 7) /* IRQ7 Parallel Port */
|
||||
# define PIC1_IMR_ALL 0xff
|
||||
|
||||
# define PIC2_IMR_IRQ8 (1 << 0) /* IRQ8 Real Time Clock */
|
||||
# define PIC2_IMR_IRQ9 (1 << 1) /* IRQ9 Redirected IRQ2 */
|
||||
# define PIC2_IMR_IRQ10 (1 << 2) /* IRQ10 Reserved */
|
||||
# define PIC2_IMR_IRQ11 (1 << 3) /* IRQ11 Reserved */
|
||||
# define PIC2_IMR_IRQ12 (1 << 4) /* IRQ12 PS/2 Mouse */
|
||||
# define PIC2_IMR_IRQ13 (1 << 5) /* IRQ13 Maths Co-Processor */
|
||||
# define PIC2_IMR_IRQ14 (1 << 6) /* IRQ14 Hard Disk Drive */
|
||||
# define PIC2_IMR_IRQ15 (1 << 7) /* IRQ15 Reserved */
|
||||
# define PIC2_IMR_ALL 0xff
|
||||
|
||||
/* Programmable Interrupt Timer Definitions */
|
||||
|
||||
#define PIT_REG_COUNTER0 0x40
|
||||
#define PIT_REG_COUNTER1 0x41
|
||||
#define PIT_REG_COUNTER2 0x42
|
||||
#define PIT_REG_COMMAND 0x43
|
||||
|
||||
/* PIT command bit defintions */
|
||||
|
||||
# define PIT_OCW_BINCOUNT_BCD (1 << 0) /* vs binary */
|
||||
# define PIT_OCW_MODE_SHIFT (1)
|
||||
# define PIT_OCW_MODE_MASK (7 << PIT_OCW_MODE_SHIFT)
|
||||
# define PIT_OCW_MODE_TMCNT (0 << PIT_OCW_MODE_SHIFT) /* Terminal count */
|
||||
# define PIT_OCW_MODE_ONESHOT (1 << PIT_OCW_MODE_SHIFT) /* One shot */
|
||||
# define PIT_OCW_MODE_RATEGEN (2 << PIT_OCW_MODE_SHIFT) /* Rate gen */
|
||||
# define PIT_OCW_MODE_SQUARE (3 << PIT_OCW_MODE_SHIFT) /* Square wave generation */
|
||||
# define PIT_OCW_MODE_SWTRIG (4 << PIT_OCW_MODE_SHIFT) /* Software trigger */
|
||||
# define PIT_OCW_MODE_HWTRIG (5 << PIT_OCW_MODE_SHIFT) /* Hardware trigger */
|
||||
# define PIT_OCW_RL_SHIFT (4)
|
||||
# define PIT_OCW_RL_MASK (3 << PIT_OCW_RL_SHIFT)
|
||||
# define PIT_OCW_RL_LATCH (0 << PIT_OCW_RL_SHIFT)
|
||||
# define PIT_OCW_RL_LSBONLY (1 << PIT_OCW_RL_SHIFT)
|
||||
# define PIT_OCW_RL_MSBONLY (2 << PIT_OCW_RL_SHIFT)
|
||||
# define PIT_OCW_RL_DATA (3 << PIT_OCW_RL_SHIFT)
|
||||
# define PIT_OCW_COUNTER_SHIFT (6)
|
||||
# define PIT_OCW_COUNTER_MASK (3 << PIT_OCW_COUNTER_SHIFT)
|
||||
# define PIT_OCW_COUNTER_0 (0 << PIT_OCW_COUNTER_SHIFT)
|
||||
# define PIT_OCW_COUNTER_1 (1 << PIT_OCW_COUNTER_SHIFT)
|
||||
# define PIT_OCW_COUNTER_2 (2 << PIT_OCW_COUNTER_SHIFT)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* GDT data structures ******************************************************
|
||||
*
|
||||
* The Global Descriptor Table or GDT is a data structure used by Intel x86-
|
||||
* family processors starting with the 80286 in order to define the
|
||||
* characteristics of the various memory areas used during program execution,
|
||||
* for example the base address, the size and access privileges like
|
||||
* executability and writability. These memory areas are called segments in
|
||||
* Intel terminology.
|
||||
*/
|
||||
|
||||
/* This structure defines one segment */
|
||||
|
||||
struct gdt_entry_s
|
||||
{
|
||||
uint16_t lowlimit; /* The lower 16 bits of the limit */
|
||||
uint16_t lowbase; /* The lower 16 bits of the base */
|
||||
uint8_t midbase; /* The next 8 bits of the base */
|
||||
uint8_t access; /* Access flags, determine ring segment can be used in */
|
||||
uint8_t granularity;
|
||||
uint8_t hibase; /* The last 8 bits of the base */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* This structure refers to the array of GDT entries, and is in the format
|
||||
* required by the lgdt instruction.
|
||||
*/
|
||||
|
||||
struct gdt_ptr_s
|
||||
{
|
||||
uint16_t limit; /* The upper 16 bits of all selector limits */
|
||||
uint32_t base; /* The address of the first GDT entry */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* IDT data structures ******************************************************
|
||||
*
|
||||
* The Interrupt Descriptor Table (IDT) is a data structure used by the x86
|
||||
* architecture to implement an interrupt vector table. The IDT is used by the
|
||||
* processor to determine the correct response to interrupts and exceptions.
|
||||
*/
|
||||
|
||||
struct idt_entry_s
|
||||
{
|
||||
uint16_t lobase; /* Lower 16-bits of vector address for interrupt */
|
||||
uint16_t sel; /* Kernel segment selector */
|
||||
uint8_t zero; /* This must always be zero */
|
||||
uint8_t flags; /* (See documentation) */
|
||||
uint16_t hibase; /* Upper 16-bits of vector address for interrupt */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* A struct describing a pointer to an array of interrupt handlers. This is
|
||||
* in a format suitable for giving to 'lidt'.
|
||||
*/
|
||||
|
||||
struct idt_ptr_s
|
||||
{
|
||||
uint16_t limit;
|
||||
uint32_t base; /* The address of the first GDT entry */
|
||||
} __attribute__((packed));
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* Return stack pointer */
|
||||
|
||||
static inline uint32_t up_getsp()
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
asm volatile(
|
||||
"\tmovl %%esp, %0\n"
|
||||
: "=rm" (regval)
|
||||
:
|
||||
: "memory");
|
||||
return regval;
|
||||
}
|
||||
|
||||
/* Get segment registers */
|
||||
|
||||
static inline uint32_t up_getds()
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
asm volatile(
|
||||
"\tmov %%ds, %0\n"
|
||||
: "=rm" (regval)
|
||||
:
|
||||
: "memory");
|
||||
return regval;
|
||||
}
|
||||
|
||||
static inline uint32_t up_getcs()
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
asm volatile(
|
||||
"\tmov %%cs, %0\n"
|
||||
: "=rm" (regval)
|
||||
:
|
||||
: "memory");
|
||||
return regval;
|
||||
}
|
||||
|
||||
static inline uint32_t up_getss()
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
asm volatile(
|
||||
"\tmov %%ss, %0\n"
|
||||
: "=rm" (regval)
|
||||
:
|
||||
: "memory");
|
||||
return regval;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN void gdt_flush(uint32_t gdt_addr);
|
||||
EXTERN void idt_flush(uint32_t idt_addr);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_X86_INCLUDE_I486_ARCH_H */
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/i486/io.h
|
||||
* arch/chip/io.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* 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(uint16_t port)
|
||||
{
|
||||
uint32_t regval;
|
||||
asm volatile(
|
||||
"\tinl %1,%0\n"
|
||||
: "=a" (regval)
|
||||
: "dN" (port)
|
||||
);
|
||||
return regval;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* 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_IO_H */
|
||||
@@ -0,0 +1,287 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/i486/irq.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
# include <stdbool.h>
|
||||
# include <arch/arch.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* ISR and IRQ numbers */
|
||||
|
||||
#define ISR0 0 /* Division by zero exception */
|
||||
#define ISR1 1 /* Debug exception */
|
||||
#define ISR2 2 /* Non maskable interrupt */
|
||||
#define ISR3 3 /* Breakpoint exception */
|
||||
#define ISR4 4 /* 'Into detected overflow' */
|
||||
#define ISR5 5 /* Out of bounds exception */
|
||||
#define ISR6 6 /* Invalid opcode exception */
|
||||
#define ISR7 7 /* No coprocessor exception */
|
||||
#define ISR8 8 /* Double fault (pushes an error code) */
|
||||
#define ISR9 9 /* Coprocessor segment overrun */
|
||||
#define ISR10 10 /* Bad TSS (pushes an error code) */
|
||||
#define ISR11 11 /* Segment not present (pushes an error code) */
|
||||
#define ISR12 12 /* Stack fault (pushes an error code) */
|
||||
#define ISR13 13 /* General protection fault (pushes an error code) */
|
||||
#define ISR14 14 /* Page fault (pushes an error code) */
|
||||
#define ISR15 15 /* Unknown interrupt exception */
|
||||
#define ISR16 16 /* Coprocessor fault */
|
||||
#define ISR17 17 /* Alignment check exception */
|
||||
#define ISR18 18 /* Machine check exception */
|
||||
#define ISR19 19 /* Reserved */
|
||||
#define ISR20 20 /* Reserved */
|
||||
#define ISR21 21 /* Reserved */
|
||||
#define ISR22 22 /* Reserved */
|
||||
#define ISR23 23 /* Reserved */
|
||||
#define ISR24 24 /* Reserved */
|
||||
#define ISR25 25 /* Reserved */
|
||||
#define ISR26 26 /* Reserved */
|
||||
#define ISR27 27 /* Reserved */
|
||||
#define ISR28 28 /* Reserved */
|
||||
#define ISR29 29 /* Reserved */
|
||||
#define ISR30 30 /* Reserved */
|
||||
#define ISR31 31 /* Reserved */
|
||||
|
||||
#define IRQ0 32 /* System timer (cannot be changed) */
|
||||
#define IRQ1 33 /* Keyboard controller (cannot be changed) */
|
||||
#define IRQ2 34 /* Cascaded signals from IRQs 8–15 */
|
||||
#define IRQ3 35 /* Serial port controller for COM2/4 */
|
||||
#define IRQ4 36 /* serial port controller for COM1/3 */
|
||||
#define IRQ5 37 /* LPT port 2 or sound card */
|
||||
#define IRQ6 38 /* Floppy disk controller */
|
||||
#define IRQ7 39 /* LPT port 1 or sound card */
|
||||
#define IRQ8 40 /* Real time clock (RTC) */
|
||||
#define IRQ9 41 /* Open interrupt/available or SCSI host adapter */
|
||||
#define IRQ10 42 /* Open interrupt/available or SCSI or NIC */
|
||||
#define IRQ11 43 /* Open interrupt/available or SCSI or NIC */
|
||||
#define IRQ12 44 /* Mouse on PS/2 connector */
|
||||
#define IRQ13 45 /* Math coprocessor */
|
||||
#define IRQ14 46 /* Primary ATA channel */
|
||||
#define IRQ15 47 /* Secondary ATA channel */
|
||||
|
||||
#define NR_IRQS 48
|
||||
|
||||
/* Common register save structgure created by up_saveusercontext() and by
|
||||
* ISR/IRQ interrupt processing.
|
||||
*/
|
||||
|
||||
#define REG_DS (0) /* Data segment selector */
|
||||
#define REG_EDI (1) /* Saved by pusha */
|
||||
#define REG_ESI (2) /* " " "" " " */
|
||||
#define REG_EBP (3) /* " " "" " " */
|
||||
#define REG_ESP (4) /* " " "" " " (NOTE 1)*/
|
||||
#define REG_EBX (5) /* " " "" " " */
|
||||
#define REG_EDX (6) /* " " "" " " */
|
||||
#define REG_ECX (7) /* " " "" " " */
|
||||
#define REG_EAX (8) /* " " "" " " */
|
||||
#define REG_IRQNO (9) /* Interrupt number (NOTE 2) */
|
||||
#define REG_ERRCODE (10) /* Error code (NOTE 2) */
|
||||
#define REG_EIP (11) /* Pushed by process on interrupt processing */
|
||||
#define REG_CS (12) /* " " "" " " "" " " " " */
|
||||
#define REG_EFLAGS (13) /* " " "" " " "" " " " " */
|
||||
#define REG_SP (14) /* " " "" " " "" " " " " */
|
||||
#define REG_SS (15) /* " " "" " " "" " " " " */
|
||||
|
||||
/* NOTE 1: Two versions of the ESP are saved: One from the interrupt
|
||||
* processing and one from pusha. Only the interrupt ESP (REG_SP) is used.
|
||||
* NOTE 2: This is not really state data. Rather, this is just a convenient
|
||||
* way to pass parameters from the interrupt handler to C cod.
|
||||
*/
|
||||
|
||||
#define XCPTCONTEXT_REGS (16)
|
||||
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
|
||||
|
||||
/* Some special landmarks in the stack frame:
|
||||
*
|
||||
* TOP_PUSHA - The offset (in 32-bit words) from the beginning of the
|
||||
* save area on the stack to the value that should be in REG_ESP.
|
||||
* BOTTOM_PUSHA - The offset (in 32-bit words) from the stack position before
|
||||
* the interrupt occurred to the value that should be in REG_ESP.
|
||||
* save area on the stack to the value that should be in REG_ESP.
|
||||
* OFFSET_PRIO - The offset from the value of REG_ESP to the value of the
|
||||
* stack pointer before the interrupt occurred (assuming that a priority
|
||||
* change occurred.
|
||||
* OFFSET_PRIO - The offset from the value of REG_ESP to the value of the
|
||||
* stack pointer before the interrupt occurred (assuming that NO priority
|
||||
* change occurred.
|
||||
*/
|
||||
|
||||
#define TOP_PUSHA REG_IRQNO
|
||||
#define BOTTOM_PRIO (XCPTCONTEXT_REGS-REG_IRQNO)
|
||||
#define BOTTOM_NOPRIO (REG_SP-REG_IRQNO)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* This struct defines the way the registers are stored */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
struct xcptcontext
|
||||
{
|
||||
/* The following function pointer is non-zero if there are pending signals
|
||||
* to be processed.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
||||
|
||||
/* These are saved copies of instruction pointer and EFLAGS used during
|
||||
* signal processing.
|
||||
*/
|
||||
|
||||
uint32_t saved_eip;
|
||||
uint32_t saved_eflags;
|
||||
#endif
|
||||
|
||||
/* Register save area */
|
||||
|
||||
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.
|
||||
* If the X86_FLAGS_IF is cleared by cli, then interrupts are disabled. If
|
||||
* if the X86_FLAGS_IF is set by sti, then interrupts are enable.
|
||||
*/
|
||||
|
||||
static inline bool irqdisabled(irqstate_t flags)
|
||||
{
|
||||
return ((flags & X86_FLAGS_IF) == 0);
|
||||
}
|
||||
|
||||
static inline bool irqenabled(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 (irqenabled(flags))
|
||||
{
|
||||
irqenable();
|
||||
}
|
||||
}
|
||||
|
||||
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3)
|
||||
{
|
||||
/* To be provided */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* 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 */
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/i486/limits.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 (-128)
|
||||
#define SCHAR_MAX 127
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
/* These could be different on machines where char is unsigned */
|
||||
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
#define SHRT_MIN (-32768)
|
||||
#define SHRT_MAX 32767
|
||||
#define USHRT_MAX 65535
|
||||
|
||||
#define INT_MIN (-2147483648)
|
||||
#define INT_MAX 2147483647
|
||||
#define UINT_MAX 4294967295
|
||||
|
||||
/* These change on 32-bit and 64-bit platforms */
|
||||
|
||||
#define LONG_MIN (-2147483648L)
|
||||
#define LONG_MAX 2147483647L
|
||||
#define ULONG_MAX 4294967295UL
|
||||
|
||||
#define LLONG_MIN (-9223372036854775808LL)
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
/* A pointer is 4 bytes */
|
||||
|
||||
#define PTR_MIN (-2147483648)
|
||||
#define PTR_MAX 2147483647
|
||||
#define UPTR_MAX 4294967295
|
||||
|
||||
#endif /* __ARCH_X86_INCLUDE_I486_LIMITS_H */
|
||||
@@ -0,0 +1,138 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/i486/syscall.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 include/syscall.h or include/sys/sycall.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_INCLUDE_I486_SYSCALL_H
|
||||
#define __ARCH_X86_INCLUDE_I486_SYSCALL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define SYS_syscall 0x80
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* SWI with SYS_ call number and six parameters */
|
||||
|
||||
EXTERN uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5,
|
||||
uintptr_t parm6);
|
||||
|
||||
/* SWI with SYS_ call number and no parameters */
|
||||
|
||||
static inline uintptr_t sys_call0(unsigned int nbr)
|
||||
{
|
||||
return sys_call6(nbr, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and one parameter */
|
||||
|
||||
static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
|
||||
{
|
||||
return sys_call6(nbr, parm1, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and two parameters */
|
||||
|
||||
static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and three parameters */
|
||||
|
||||
static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and four parameters */
|
||||
|
||||
static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, parm4, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and five parameters */
|
||||
|
||||
static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, parm4, parm5, 0);
|
||||
}
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_X86_INCLUDE_I486_SYSCALL_H */
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/************************************************************************
|
||||
* arch/x86/include/i486/types.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 signed char _int8_t;
|
||||
typedef unsigned char _uint8_t;
|
||||
|
||||
typedef signed short _int16_t;
|
||||
typedef unsigned short _uint16_t;
|
||||
|
||||
typedef signed int _int32_t;
|
||||
typedef unsigned int _uint32_t;
|
||||
|
||||
typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is 4 bytes */
|
||||
|
||||
typedef signed 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 */
|
||||
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/io.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <arch/i486/io.h>
|
||||
#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 */
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/irq.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/irq.h>
|
||||
|
||||
/* Include chip-specific IRQ definitions (including IRQ numbers) */
|
||||
|
||||
#include <arch/chip/irq.h>
|
||||
|
||||
/* Include architecture-specific IRQ definitions (including register save
|
||||
* structure and irqsave()/irqrestore() macros).
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_I486
|
||||
# include <arch/i486/irq.h>
|
||||
#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 */
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/limits.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <arch/i486/limits.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_X86_INCLUDE_LIMITS_H */
|
||||
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/qemu/arch.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 */
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/qemu/irq.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* 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 */
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/syscall.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 include/syscall.h or include/sys/sycall.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_X86_INCLUDE_SYSCALL_H
|
||||
#define __ARCH_X86_INCLUDE_SYSCALL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include x86 architecture-specific syscall macros */
|
||||
|
||||
#ifdef CONFIG_ARCH_I486
|
||||
# include <arch/i486/syscall.h>
|
||||
#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_SYSCALL_H */
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
* arch/x86/include/types.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <arch/i486/types.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_X86_INCLUDE_TYPES_H */
|
||||
Reference in New Issue
Block a user