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:
patacongo
2012-09-17 18:18:44 +00:00
commit 57623d42eb
5691 changed files with 1361853 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
/****************************************************************************
* arch/arch.h
*
* Copyright (C) 2007, 2008 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_ARCH_H
#define __ARCH_ARCH_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <arch/chip/arch.h>
/****************************************************************************
* 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_ARCH_H */
+77
View File
@@ -0,0 +1,77 @@
/****************************************************************************
* arch/ez80/arch.h
* arch/chip/arch.h
*
* Copyright (C) 2008 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 (via arch/arch.h)
*/
#ifndef __ARCH_EZ80_ARCH_H
#define __ARCH_EZ80_ARCH_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* 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_EZ80_ARCH_H */
+87
View File
@@ -0,0 +1,87 @@
/****************************************************************************
* arch/z80/include/ez80/io.h
* arch/chip/io.h
*
* Copyright (C) 2008-2009 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_EZ80_IO_H
#define __ARCH_EZ80_IO_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* 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
EXTERN void outp(uint16_t p, uint8_t c);
EXTERN uint8_t inp(uint16_t p);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
#endif /* __ARCH_EZ80_IO_H */
+262
View File
@@ -0,0 +1,262 @@
/****************************************************************************
* arch/ez80/include/ez80/irq.h
* arch/chip/irq.h
*
* Copyright (C) 2008-2009 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 (via arch/irq.h)
*/
#ifndef __ARCH_Z80_INCLUDE_EZ80_IRQ_H
#define __ARCH_Z80_INCLUDE_EZ80_IRQ_H
#ifndef _EZ80F91
# error "Only the EZ80F91 is currently supported"
#endif
/****************************************************************************
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
/* ez80 Interrupt Numbers ***************************************************/
#define EZ80_EMACRX_IRQ (0) /* Vector 0x40 */
#define EZ80_EMACTX_IRQ (1) /* Vector 0x44 */
#define EZ80_EMACSYS_IRQ (2) /* Vector 0x48 */
#define EZ80_PLL_IRQ (3) /* Vector 0x4c */
#define EZ80_FLASH_IRQ (4) /* Vector 0x50 */
#define EZ80_TIMER0_IRQ (5) /* Vector 0x54 */
#define EZ80_TIMER1_IRQ (6) /* Vector 0x58 */
#define EZ80_TIMER2_IRQ (7) /* Vector 0x5c */
#define EZ80_TIMER3_IRQ (8) /* Vector 0x60 */
#define EZ80_RTC_IRQ (9) /* Vector 0x6C */
#define EZ80_UART0_IRQ (10) /* Vector 0x70 */
#define EZ80_UART1_IRQ (11) /* Vector 0x74 */
#define EZ80_I2C_IRQ (12) /* Vector 0x78 */
#define EZ80_SPI_IRQ (13) /* Vector 0x7c */
#define EZ80_PORTA0_IRQ (14) /* Vector 0x80 */
#define EZ80_PORTA1_IRQ (15) /* Vector 0x84 */
#define EZ80_PORTA2_IRQ (16) /* Vector 0x88 */
#define EZ80_PORTA3_IRQ (17) /* Vector 0x8c */
#define EZ80_PORTA4_IRQ (18) /* Vector 0x90 */
#define EZ80_PORTA5_IRQ (19) /* Vector 0x94 */
#define EZ80_PORTA6_IRQ (20) /* Vector 0x98 */
#define EZ80_PORTA7_IRQ (21) /* Vector 0x9c */
#define EZ80_PORTB0_IRQ (22) /* Vector 0xa0 */
#define EZ80_PORTB1_IRQ (23) /* Vector 0xa4 */
#define EZ80_PORTB2_IRQ (24) /* Vector 0xa8 */
#define EZ80_PORTB3_IRQ (25) /* Vector 0xac */
#define EZ80_PORTB4_IRQ (26) /* Vector 0xb0 */
#define EZ80_PORTB5_IRQ (27) /* Vector 0xb4 */
#define EZ80_PORTB6_IRQ (28) /* Vector 0xb8 */
#define EZ80_PORTB7_IRQ (29) /* Vector 0xbc */
#define EZ80_PORTC0_IRQ (30) /* Vector 0xc0 */
#define EZ80_PORTC1_IRQ (31) /* Vector 0xc4 */
#define EZ80_PORTC2_IRQ (32) /* Vector 0xc8 */
#define EZ80_PORTC3_IRQ (33) /* Vector 0xcc */
#define EZ80_PORTC4_IRQ (34) /* Vector 0xd0 */
#define EZ80_PORTC5_IRQ (35) /* Vector 0xd4 */
#define EZ80_PORTC6_IRQ (36) /* Vector 0xd8 */
#define EZ80_PORTC7_IRQ (37) /* Vector 0xdc */
#define EZ80_PORTD0_IRQ (38) /* Vector 0xe0 */
#define EZ80_PORTD1_IRQ (39) /* Vector 0xe4 */
#define EZ80_PORTD2_IRQ (40) /* Vector 0xe8 */
#define EZ80_PORTD3_IRQ (41) /* Vector 0xec */
#define EZ80_PORTD4_IRQ (42) /* Vector 0xf0 */
#define EZ80_PORTD5_IRQ (43) /* Vector 0xf4 */
#define EZ80_PORTD6_IRQ (44) /* Vector 0xf8 */
#define EZ80_PORTD7_IRQ (45) /* Vector 0xfc */
#define NR_IRQS (46)
#define EZ80_IRQ_SYSTIMER EZ80_TIMER0_IRQ
/* IRQ Management Macros ****************************************************/
/* IRQ State Save Format ****************************************************
*
* These indices describe how the ez8 context is save in the state save array
*
* Byte offsets:
*/
/* IRQ Stack Frame Format
*
* This stack frame is created on each interrupt. These registers are stored
* in the TCB to many context switches.
*/
/* chipreg_t indices */
#define XCPT_I (0) /* Index 0: 16-bit interrupt vector register */
#define XCPT_BC (1) /* Index 1: Saved 16-bit BC register */
#define XCPT_DE (2) /* Index 2: Saved 16-bit DE register */
#define XCPT_IX (3) /* Index 3: Saved 16-bit IX register */
#define XCPT_IY (4) /* Index 4: Saved 16-bit IY register */
#define XCPT_SP (5) /* Index 5: Saved 16-bit SP at time of interrupt */
#define XCPT_HL (6) /* Index 6: Saved 16-bit HL register */
#define XCPT_AF (7) /* Index 7: Saved 16-bit AF register */
#define XCPT_PC (8) /* Index 8: Offset to 16-bit PC at time of interrupt */
#define XCPTCONTEXT_REGS (9)
#ifdef CONFIG_EZ80_Z80MODE
/* Byte offsets */
# define XCPT_I_OFFSET (2*XCPT_I) /* Offset 0: 16-bit interrupt vector register */
# define XCPT_IF_OFFSET (2*XCPT_I+0) /* Offset 1: Saved flags. P set if interrupts enabled */
# define XCPT_IA_OFFSET (2*XCPT_I+1) /* Offset 2: Saved lower 8-bits of interrupt vector register */
# define XCPT_BC_OFFSET (2*XCPT_BC) /* Offset 2: Saved 16-bit BC register */
# define XCPT_C_OFFSET (2*XCPT_BC+0) /* Offset 2: Saved 8-bit C register */
# define XCPT_B_OFFSET (2*XCPT_BC+1) /* Offset 3: Saved 8-bit D register */
# define XCPT_DE_OFFSET (2*XCPT_DE) /* Offset 4: Saved 16-bit DE register */
# define XCPT_E_OFFSET (2*XCPT_DE+0) /* Offset 4: Saved 8-bit E register */
# define XCPT_D_OFFSET (2*XCPT_DE+1) /* Offset 5: Saved 8-bit D register */
# define XCPT_IX_OFFSET (2*XCPT_IX) /* Offset 6: Saved 16-bit IX register */
# define XCPT_IY_OFFSET (2*XCPT_IY) /* Offset 8: Saved 16-bit IY register */
# define XCPT_SP_OFFSET (2*XCPT_SP) /* Offset 10: Saved 16-bit SP at time of interrupt */
# define XCPT_HL_OFFSET (2*XCPT_HL) /* Offset 12: Saved 16-bit HL register */
# define XCPT_L_OFFSET (2*XCPT_HL+0) /* Offset 12: Saved 8-bit L register */
# define XCPT_H_OFFSET (2*XCPT_HL+1) /* Offset 13: Saved 8-bit H register */
# define XCPT_AF_OFFSET (2*XCPT_AF) /* Offset 14: Saved 16-bit AF register */
# define XCPT_F_OFFSET (2*XCPT_AF+0) /* Offset 14: Saved flags */
# define XCPT_A_OFFSET (2*XCPT_AF+1) /* Offset 15: Saved 8-bit A register */
# define XCPT_PC_OFFSET (2*XCPT_PC) /* Offset 16: Offset to 16-bit PC at time of interrupt */
# define XCPTCONTEXT_SIZE (2*XCPTCONTEXT_REGS)
#else
/* Byte offsets */
# define XCPT_I_OFFSET (3*XCPT_I) /* Offset 0: Saved 24-bit interrupt vector register */
# define XCPT_IF_OFFSET (2*XCPT_I+1) /* Offset 1: Saved flags. P set if interrupts enabled */
# define XCPT_IA_OFFSET (2*XCPT_I+2) /* Offset 2: Saved lower 8-bits of interrupt vector register */
# define XCPT_BC_OFFSET (3*XCPT_BC) /* Offset 3: Saved 24-bit BC register */
# define XCPT_C_OFFSET (3*XCPT_BC+1) /* Offset 4: Saved 8-bit C register */
# define XCPT_B_OFFSET (3*XCPT_BC+2) /* Offset 5: Saved 8-bit D register */
# define XCPT_DE_OFFSET (3*XCPT_DE) /* Offset 6: Saved 24-bit DE register */
# define XCPT_E_OFFSET (3*XCPT_DE+1) /* Offset 7: Saved 8-bit E register */
# define XCPT_D_OFFSET (3*XCPT_DE+2) /* Offset 8: Saved 8-bit D register */
# define XCPT_IX_OFFSET (3*XCPT_IX) /* Offset 9: Saved 24-bit IX register */
# define XCPT_IY_OFFSET (3*XCPT_IY) /* Offset 12: Saved 24-bit IY register */
# define XCPT_SP_OFFSET (3*XCPT_SP) /* Offset 15: Saved 24-bit SP at time of interrupt */
# define XCPT_HL_OFFSET (3*XCPT_HL) /* Offset 18: Saved 24-bit HL register */
# define XCPT_L_OFFSET (3*XCPT_HL+1) /* Offset 19: Saved 8-bit L register */
# define XCPT_H_OFFSET (3*XCPT_HL+2) /* Offset 20: Saved 8-bit H register */
# define XCPT_AF_OFFSET (3*XCPT_AF) /* Offset 21: Saved AF register */
# define XCPT_F_OFFSET (3*XCPT_AF+1) /* Offset 22: Saved AF register */
# define XCPT_A_OFFSET (3*XCPT_AF+2) /* Offset 23: Saved 8-bit A register */
# define XCPT_PC_OFFSET (3*XCPT_PC) /* Offset 24: Offset to 24-bit PC at time of interrupt */
# define XCPTCONTEXT_SIZE (3*XCPTCONTEXT_REGS)
#endif
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/* This is the type of the register save array */
#ifdef CONFIG_EZ80_Z80MODE
typedef uint16_t chipreg_t;
#else
typedef uint24_t chipreg_t;
#endif
/* This struct defines the way the registers are stored. */
struct xcptcontext
{
/* Register save area */
chipreg_t regs[XCPTCONTEXT_REGS];
/* The following function pointer is non-zero if there
* are pending signals to be processed.
*/
#ifndef CONFIG_DISABLE_SIGNALS
CODE void *sigdeliver; /* Actual type is sig_deliver_t */
/* The following retains that state during signal execution */
chipreg_t saved_pc; /* Saved return address */
chipreg_t saved_i; /* Saved interrupt state */
#endif
};
#endif
/****************************************************************************
* Inline functions
****************************************************************************/
/****************************************************************************
* Public Variables
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
EXTERN irqstate_t irqsave(void);
EXTERN void irqrestore(irqstate_t flags);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
#endif /* __ARCH_Z80_INCLUDE_EZ80_IRQ_H */
+93
View File
@@ -0,0 +1,93 @@
/****************************************************************************
* arch/z80/include/ez80/limits.h
*
* Copyright (C) 2007-2009, 2012 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_Z80_INCLUDE_EZ80_LIMITS_H
#define __ARCH_Z80_INCLUDE_EZ80_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 (-32768)
#define INT_MAX 32767
#define UINT_MAX 65535
/* These change on 32-bit and 64-bit platforms */
#define LONG_MIN (-2147483648L)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
/* A pointer is 2 or 3 bytes, depending upon if the ez80 is in z80
* compatibility mode or not
*
* Z80 mode - 16 bits
* ADL mode - 24 bits
*/
#ifdef CONFIG_EZ80_Z80MODE
#define PTR_MIN (-32768)
#define PTR_MAX 32767
#define UPTR_MAX 65535
#else
#define PTR_MIN (-8388608)
#define PTR_MAX 8388607
#define UPTR_MAX 16777215
#endif
#endif /* __ARCH_Z80_INCLUDE_EZ80_LIMITS_H */
+115
View File
@@ -0,0 +1,115 @@
/****************************************************************************
* arch/z80/include/ez80/types.h
* include/arch/chip/types.h
*
* Copyright (C) 2008-2009 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_Z80_INCLUDE_EZ80_TYPES_H
#define __ARCH_Z80_INCLUDE_EZ80_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
*
* These are the sizes of the types supported by the ZiLOG compiler:
*
* int - 24-bits
* short - 16-bits
* long - 32-bits
* char - 8-bits
* float - 32-bits
*/
typedef signed char _int8_t;
typedef unsigned char _uint8_t;
typedef signed short _int16_t;
typedef unsigned short _uint16_t;
typedef signed int _int24_t;
typedef unsigned int _uint24_t;
#define __INT24_DEFINED
typedef signed long _int32_t;
typedef unsigned long _uint32_t;
/* A pointer is 2 or 3 bytes, depending upon if the ez80 is in z80
* compatibility mode or not
*
* Z80 mode - 16 bits
* ADL mode - 24 bits
*/
#ifdef CONFIG_EZ80_Z80MODE
typedef signed short _intptr_t;
typedef unsigned short _uintptr_t;
#else
typedef signed int _intptr_t;
typedef unsigned int _uintptr_t;
#endif
/* This is the size of the interrupt state save returned by irqsave().
* It holds the AF regiser pair + a zero pad byte
*/
typedef _uint24_t irqstate_t;
#endif /* __ASSEMBLY__ */
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
#endif /* __ARCH_Z80_INCLUDE_EZ80_TYPES_H */
+76
View File
@@ -0,0 +1,76 @@
/****************************************************************************
* arch/z80/include/io.h
* arch/chip/io.h
*
* Copyright (C) 2008 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_IO_H
#define __ARCH_IO_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <arch/chip/io.h>
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* 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_IO_H */
+81
View File
@@ -0,0 +1,81 @@
/****************************************************************************
* arch/z80/include/irq.h
*
* Copyright (C) 2007-2009 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_Z80_INCLUDE_IRQ_H
#define __ARCH_Z80_INCLUDE_IRQ_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/irq.h>
#include <arch/chip/irq.h>
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* 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_Z80_INCLUDE_IRQ_H */
+49
View File
@@ -0,0 +1,49 @@
/****************************************************************************
* arch/z80/include/limits.h
*
* Copyright (C) 2007-2009 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_LIMITS_H
#define __ARCH_LIMITS_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <arch/chip/limits.h>
/****************************************************************************
* Definitions
****************************************************************************/
#endif /* __ARCH_LIMITS_H */
+57
View File
@@ -0,0 +1,57 @@
/****************************************************************************
* arch/z80/include/serial.h
*
* Copyright (C) 2007-2009, 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_Z80_INCLUDE_SERIAL_TYPES_H
#define __ARCH_Z80_INCLUDE_SERIAL_TYPES_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/fs/ioctl.h>
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* __ARCH_Z80_INCLUDE_SERIAL_TYPES_H */
+82
View File
@@ -0,0 +1,82 @@
/****************************************************************************
* arch/z80/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_Z80_INCLUDE_SYSCALL_H
#define __ARCH_Z80_INCLUDE_SYSCALL_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* 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_Z80_INCLUDE_SYSCALL_H */
+61
View File
@@ -0,0 +1,61 @@
/****************************************************************************
* arch/z80/include/types.h
*
* Copyright (C) 2007-2009 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 Gregory Nutt 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_TYPES_H
#define __ARCH_TYPES_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <arch/chip/types.h>
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* Type Declarations
****************************************************************************/
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
#endif /* __ARCH_TYPES_H */
+77
View File
@@ -0,0 +1,77 @@
/****************************************************************************
* arch/z8/arch.h
* arch/chip/arch.h
*
* Copyright (C) 2008 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 (via arch/arch.h)
*/
#ifndef __ARCH_Z8_ARCH_H
#define __ARCH_Z8_ARCH_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* 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_Z8_ARCH_H */
+368
View File
@@ -0,0 +1,368 @@
/****************************************************************************
* arch/z8/include/z8/irq.h
* arch/chip/irq.h
*
* Copyright (C) 2008-2009 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 (via arch/irq.h)
*/
#ifndef __ARCH_Z8_IRQ_H
#define __ARCH_Z8_IRQ_H
/****************************************************************************
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
/* This is similar configuration information that is contained in ez8.h.
* However, this file must be include-able by assembly language files and,
* hence, cannot include ez8.h. The logic is fragmentary at present.
*/
#ifndef ENCORE_VECTORS
# if defined(_Z8ENCORE_F642X) || defined(_Z8ENCORE_64K_SERIES)
# define ENCORE_VECTORS 1
# endif
# if defined(_Z8ENCORE_F640X) || defined(_Z8ENCORE_640_FAMILY)
# define ENCORE_VECTORS 1
# endif
# if defined(_Z8ENCORE_F08X) || defined(_Z8ENCORE_8K_SERIES)
# define ENCORE_VECTORS 1
# endif
# if defined(_Z8ENCORE_4K_SERIES)
# define ENCORE_VECTORS 1
# endif
#endif
/* ez8 Interrupt Numbers ****************************************************/
#if defined(ENCORE_VECTORS)
# define Z8_WDT_IRQ 0
# define Z8_TRAP_IRQ 1
# define Z8_TIMER2_IRQ 2 /* Only if EZ8_TIMER3 defined */
# define Z8_TIMER1_IRQ 3
# define Z8_TIMER0_IRQ 4
# define Z8_UART0_RX_IRQ 5 /* Only if EZ8_UART0 defined */
# define Z8_UART0_TX_IRQ 6 /* Only if EZ8_UART0 defined */
# define Z8_I2C_IRQ 7 /* Only if EZ8_I2C defined */
# define Z8_SPI_IRQ 8 /* Only if EZ8_SPI defined */
# define Z8_ADC_IRQ 9 /* Only if EZ8_ADC defined */
# define Z8_P7AD_IRQ 10
# define Z8_P6AD_IRQ 11
# define Z8_P5AD_IRQ 12
# define Z8_P4AD_IRQ 13
# define Z8_P3AD_IRQ 14
# define Z8_P2AD_IRQ 15
# define Z8_P1AD_IRQ 16
# define Z8_P0AD_IRQ 17
# define Z8_TIMER3_IRQ 18 /* Only if EZ8_TIMER4 defined */
# define Z8_UART1_RX_IRQ 19 /* Only if EZ8_UART1 defined */
# define Z8_UART1_TX_IRQ 20 /* Only if EZ8_UART1 defined */
# define Z8_DMA_IRQ 21 /* Only if EZ8_DMA defined */
# define Z8_C3_IRQ 22 /* Only if EZ8_PORT1 defined */
# define Z8_C2_IRQ 23 /* Only if EZ8_PORT1 defined */
# define Z8_C1_IRQ 24 /* Only if EZ8_PORT1 defined */
# define Z8_C0_IRQ 25 /* Only if EZ8_PORT1 defined */
# define NR_IRQS (26)
#elif defined(ENCORE_XP_VECTORS)
# define Z8_WDT_IRQ 0
# define Z8_TRAP_IRQ 1
# define Z8_TIMER2_IRQ 2 /* Only if EZ8_TIMER3 defined */
# define Z8_TIMER1_IRQ 3
# define Z8_TIMER0_IRQ 4
# define Z8_UART0_RX_IRQ 5 /* Only if EZ8_UART0 defined */
# define Z8_UART0_TX_IRQ 6 /* Only if EZ8_UART0 defined */
# define Z8_I2C_IRQ 7 /* Only if EZ8_I2C defined */
# define Z8_SPI_IRQ 8 /* Only if EZ8_SPI defined */
# define Z8_ADC_IRQ 9 /* Only if EZ8_ADC or EZ8_ADC_NEW defined */
# define Z8_P7AD_IRQ 10
# define Z8_P6AD_IRQ 11
# define Z8_P5AD_IRQ 12
# define Z8_P4AD_IRQ 13
# define Z8_P3AD_IRQ 14
# define Z8_P2AD_IRQ 15
# define Z8_P1AD_IRQ 16
# define Z8_P0AD_IRQ 17
# define Z8_TIMER3_IRQ 18 /* Only if EZ8_TIMER4 defined */
# define Z8_UART1_RX_IRQ 19 /* Only if EZ8_UART1 defined */
# define Z8_UART1_TX_IRQ 20 /* Only if EZ8_UART1 defined */
# define Z8_DMA_IRQ 21 /* Only if EZ8_DMA defined */
# define Z8_C3_IRQ 22 /* Only if EZ8_PORT1 defined */
# define Z8_C2_IRQ 23 /* Only if EZ8_PORT1 defined */
# define Z8_C1_IRQ 24 /* Only if EZ8_PORT1 defined */
# define Z8_C0_IRQ 25 /* Only if EZ8_PORT1 defined */
# define Z8_POTRAP_IRQ 27
# define Z8_WOTRAP_IRQ 28
# define NR_IRQS (29)
#elif defined(ENCORE_XP16K_VECTORS)
# define Z8_WDT_IRQ 0
# define Z8_TRAP_IRQ 1
# define Z8_TIMER2_IRQ 2 /* Only if EZ8_TIMER3 defined */
# define Z8_TIMER1_IRQ 3
# define Z8_TIMER0_IRQ 4
# define Z8_UART0_RX_IRQ 5 /* Only if EZ8_UART0 defined */
# define Z8_UART0_TX_IRQ 6 /* Only if EZ8_UART0 defined */
# define Z8_I2C_IRQ 7 /* Only if EZ8_I2C defined */
# define Z8_SPI_IRQ 8 /* Only if EZ8_ESPI defined */
# define Z8_ADC_IRQ 9 /* Only if EZ8_ADC_NEW defined */
# define Z8_P7AD_IRQ 10
# define Z8_P6AD_IRQ 11
# define Z8_P5AD_IRQ 12
# define Z8_P4AD_IRQ 13
# define Z8_P3AD_IRQ 14
# define Z8_P2AD_IRQ 15
# define Z8_P1AD_IRQ 16
# define Z8_P0AD_IRQ 17
# define Z8_MCT_IRQ 19 /* Only if EZ8_MCT defined */
# define Z8_UART1_RX_IRQ 20 /* Only if EZ8_UART1 defined */
# define Z8_UART1_TX_IRQ 21 /* Only if EZ8_UART1 defined */
# define Z8_C3_IRQ 22
# define Z8_C2_IRQ 23
# define Z8_C1_IRQ 24
# define Z8_C0_IRQ 25
# define Z8_POTRAP_IRQ 27
# define Z8_WOTRAP_IRQ 28
# define NR_IRQS (29)
#elif defined(ENCORE_MC_VECTORS)
# define Z8_WDT_IRQ 0
# define Z8_TRAP_IRQ 1
# define Z8_PWMTIMER_IRQ 2
# define Z8_PWMFAULT_IRQ 3
# define Z8_ADC_IRQ 4 /* Only if EZ8_ADC_NEW defined */
# define Z8_CMP_IRQ 5
# define Z8_TIMER0_IRQ 6
# define Z8_UART0_RX_IRQ 7 /* Only if EZ8_UART0 defined */
# define Z8_UART0_TX_IRQ 8 /* Only if EZ8_UART0 defined */
# define Z8_SPI_IRQ 9 /* Only if EZ8_SPI defined */
# define Z8_I2C_IRQ 10 /* Only if EZ8_I2C defined */
# define Z8_C0_IRQ 12
# define Z8_PB_IRQ 13
# define Z8_P7AP3A_IRQ 14
# define Z8_P6AP2A_IRQ 15
# define Z8_P5AP1A_IRQ 16
# define Z8_P4AP0A_IRQ 17
# define Z8_POTRAP_IRQ 27
# define Z8_WOTRAP_IRQ 28
# define NR_IRQS (29)
#endif
#define Z8_IRQ_SYSTIMER Z8_TIMER0_IRQ
/* IRQ Management Macros ****************************************************/
/* These macros map IRQ numbers to IRQ registers and bits.
* WARNING: These have only been verified for the Z8F640X family!
*/
#ifdef ENCORE_VECTORS
# define Z8_IRQ0_MIN Z8_TIMER2_IRQ
# define Z8_IRQ0_BIT(irq) (1 << (Z8_ADC_IRQ - (irq)))
# define Z8_IRQ0_MAX Z8_ADC_IRQ
# define Z8_IRQ1_MIN Z8_P7AD_IRQ
# define Z8_IRQ1_BIT(irq) (1 << (Z8_P0AD_IRQ - (irq)))
# define Z8_IRQ1_MAX Z8_P0AD_IRQ
# define Z8_IRQ2_MIN Z8_TIMER3_IRQ
# define Z8_IRQ2_BIT(irq) (1 << (Z8_C0_IRQ - (irq)))
# define Z8_IRQ2_MAX Z8_C0_IRQ
#else
# error "Add IRQ support for Z8F family"
#endif
/* IRQ State Save Format ****************************************************
*
* These indices describe how the ez8 context is save in the state save array
*
* Byte offsets:
*/
#define XCPT8_R0 (0) /* Offset 0-15: R0-R15 */
#define XCPT8_R1 (1)
#define XCPT8_R2 (2)
#define XCPT8_R3 (3)
#define XCPT8_R4 (4)
#define XCPT8_R5 (5)
#define XCPT8_R6 (6)
#define XCPT8_R7 (7)
#define XCPT8_R8 (8)
#define XCPT8_R9 (9)
#define XCPT8_R10 (10)
#define XCPT8_R11 (11)
#define XCPT8_R12 (12)
#define XCPT8_R13 (13)
#define XCPT8_R14 (14)
#define XCPT8_R15 (15)
#define XCPT8_SPH (16) /* Offset 16: SP[8:15] */
#define XCPT8_SPL (17) /* Offset 17: SP[0:7] */
#define XCPT8_RP (18) /* Offset 18: Register pointer */
#define XCPT8_FLAGS (19) /* Offset 19: FLAGS */
#define XCPT8_PCH (20) /* Offset 20: PC[8:15] */
#define XCPT8_PCL (21) /* Offset 21: PC[0:7] */
/* 16-bit "word" offsets */
#define XCPT_RR0 (0) /* Indices 0-7: RR0-RR14 */
#define XCPT_RR2 (1)
#define XCPT_RR4 (2)
#define XCPT_RR6 (3)
#define XCPT_RR8 (4)
#define XCPT_RR10 (5)
#define XCPT_RR12 (6)
#define XCPT_RR14 (7)
#define XCPT_IRQCTL (8) /* Index 8: IRQCTL register */
#define XCPT_SP (9) /* Index 9: SP[8:15] */
#define XCPT_RPFLAGS (10) /* Index 10: RP (MS) and FLAGS (LS) */
#define XCPT_PC (11) /* Index 11: PC[8:15] */
#define XCPTCONTEXT_REGS (12)
/* Byte offsets: */
#define XCPT_R0_OFFS (2*XCPT_RR0) /* Offset 0-15: R0-R15 */
#define XCPT_R1_OFFS (2*XCPT_RR0+1)
#define XCPT_R2_OFFS (2*XCPT_RR2)
#define XCPT_R3_OFFS (2*XCPT_RR2+1)
#define XCPT_R4_OFFS (2*XCPT_RR4)
#define XCPT_R5_OFFS (2*XCPT_RR4+1)
#define XCPT_R6_OFFS (2*XCPT_RR6)
#define XCPT_R7_OFFS (2*XCPT_RR6+1)
#define XCPT_R8_OFFS (2*XCPT_RR8)
#define XCPT_R9_OFFS (2*XCPT_RR8+1)
#define XCPT_R10_OFFS (2*XCPT_RR10)
#define XCPT_R11_OFFS (2*XCPT_RR10+1)
#define XCPT_R12_OFFS (2*XCPT_RR12)
#define XCPT_R13_OFFS (2*XCPT_RR12+1)
#define XCPT_R14_OFFS (2*XCPT_RR14)
#define XCPT_R15_OFFS (2*XCPT_RR14+1)
#define XCPT_UNUSED_OFFS (2*XCPT_IRQCTL) /* Offset 16: Unused (zero) */
#define XCPT_IRQCTL_OFFS (2*XCPT_IRQCTL+1) /* offset 17: IRQCTL register */
#define XCPT_SPH_OFFS (2*XCPT_SP) /* Offset 18: SP[8:15] */
#define XCPT_SPL_OFFS (2*XCPT_SP+1) /* Offset 19: SP[0:7] */
#define XCPT_RP_OFFS (2*XCPT_RPFLAGS) /* Offset 20: Register pointer */
#define XCPT_FLAGS_OFFS (2*XCPT_RPFLAGS+1) /* Offset 21: FLAGS */
#define XCPT_PCH_OFFS (2*XCPT_PC) /* Offset 22: PC[8:15] */
#define XCPT_PCL_OFFS (2*XCPT_PC+1) /* Offset 23: PC[0:7] */
#define XCPTCONTEXT_SIZE (2*XCPTCONTEXT_REGS)
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/* This is the type of the register save array */
typedef uint16_t chipreg_t;
/* This struct defines the way the registers are stored. */
struct xcptcontext
{
/* Register save area */
chipreg_t regs[XCPTCONTEXT_REGS];
/* The following function pointer is non-zero if there
* are pending signals to be processed.
*/
#ifndef CONFIG_DISABLE_SIGNALS
CODE void *sigdeliver; /* Actual type is sig_deliver_t */
/* The following retains that state during signal execution */
uint16_t saved_pc; /* Saved return address */
uint16_t saved_irqctl; /* Saved interrupt state */
#endif
};
#endif
/****************************************************************************
* Inline functions
****************************************************************************/
/****************************************************************************
* Public Variables
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
EXTERN irqstate_t irqsave(void);
EXTERN void irqrestore(irqstate_t flags);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
#endif /* __ARCH_Z8_IRQ_H */
+82
View File
@@ -0,0 +1,82 @@
/****************************************************************************
* arch/z80/include/z8/limits.h
*
* Copyright (C) 2007-2009, 2012 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_Z80_INCLUDE_Z8_LIMITS_H
#define __ARCH_Z80_INCLUDE_Z8_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 (-32768)
#define INT_MAX 32767
#define UINT_MAX 65535
/* These change on 32-bit and 64-bit platforms */
#define LONG_MIN (-2147483648L)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
/* A pointer is 2 bytes */
#define PTR_MIN (-32768)
#define PTR_MAX 32767
#define UPTR_MAX 65535
#endif /* __ARCH_Z80_INCLUDE_Z8_LIMITS_H */
+106
View File
@@ -0,0 +1,106 @@
/****************************************************************************
* arch/z80/include/z8/types.h
* include/arch/chip/types.h
*
* Copyright (C) 2008-2009 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_Z80_INCLUDE_Z8_IRQ_H
#define __ARCH_Z80_INCLUDE_Z8_IRQ_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
*
* These are the sizes of the types supported by the ZiLOG Z8Encore! compiler:
*
* int - 16-bits
* short - 16-bits
* long - 32-bits
* char - 8-bits
* float - 32-bits
* double - 32-bits
*
* Pointers:
*
* near pointer - 8-bits
* far pointer - 16-bits
* rom pointer - 16-bits
*/
typedef signed char _int8_t;
typedef unsigned char _uint8_t;
typedef signed int _int16_t;
typedef unsigned int _uint16_t;
typedef signed long _int32_t;
typedef unsigned long _uint32_t;
/* A pointer is 2 bytes */
typedef signed int _intptr_t;
typedef unsigned int _uintptr_t;
/* This is the size of the interrupt state save returned by irqsave() */
typedef _uint8_t irqstate_t;
#endif /* __ASSEMBLY__ */
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
#endif /* __ARCH_Z80_INCLUDE_Z8_IRQ_H */
+77
View File
@@ -0,0 +1,77 @@
/****************************************************************************
* arch/z80/arch.h
* arch/chip/arch.h
*
* Copyright (C) 2007, 2008 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 (via arch/arch.h)
*/
#ifndef __ARCH_Z80_ARCH_H
#define __ARCH_Z80_ARCH_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* 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_Z80_ARCH_H */
+85
View File
@@ -0,0 +1,85 @@
/****************************************************************************
* arch/z80/include/z80/io.h
* arch/chip/io.h
*
* Copyright (C) 2008-2009 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_Z80_IO_H
#define __ARCH_Z80_IO_H
/****************************************************************************
* Included Files
****************************************************************************/
/****************************************************************************
* 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
EXTERN void outp(char p, char c);
EXTERN char inp(char p);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
#endif /* __ARCH_Z80_IO_H */
+152
View File
@@ -0,0 +1,152 @@
/****************************************************************************
* arch/z80/include/z80/irq.h
* arch/chip/irq.h
*
* Copyright (C) 2007-2009 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 (via arch/irq.h)
*/
#ifndef __ARCH_Z80_INCLUDE_Z80_IRQ_H
#define __ARCH_Z80_INCLUDE_Z80_IRQ_H
/****************************************************************************
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
/* Z80 Interrupts */
#define Z80_RST0 (0)
#define Z80_RST1 (1)
#define Z80_RST2 (2)
#define Z80_RST3 (3)
#define Z80_RST4 (4)
#define Z80_RST5 (5)
#define Z80_RST6 (6)
#define Z80_RST7 (7)
#define Z80_IRQ_SYSTIMER Z80_RST7
#define NR_IRQS (8)
/* IRQ Stack Frame Format
*
* This stack frame is created on each interrupt. These registers are stored
* in the TCB to many context switches.
*/
#define XCPT_I (0) /* Offset 0: Saved I w/interrupt state in carry */
#define XCPT_BC (1) /* Offset 1: Saved BC register */
#define XCPT_DE (2) /* Offset 2: Saved DE register */
#define XCPT_IX (3) /* Offset 3: Saved IX register */
#define XCPT_IY (4) /* Offset 4: Saved IY register */
#define XCPT_SP (5) /* Offset 5: Offset to SP at time of interrupt */
#define XCPT_HL (6) /* Offset 6: Saved HL register */
#define XCPT_AF (7) /* Offset 7: Saved AF register */
#define XCPT_PC (8) /* Offset 8: Offset to PC at time of interrupt */
#define XCPTCONTEXT_REGS (9)
#define XCPTCONTEXT_SIZE (2 * XCPTCONTEXT_REGS)
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/* This is the type of the register save array */
typedef uint16_t chipreg_t;
/* This struct defines the way the registers are stored. */
struct xcptcontext
{
/* Register save area */
chipreg_t regs[XCPTCONTEXT_REGS];
/* The following function pointer is non-zero if there
* are pending signals to be processed.
*/
#ifndef CONFIG_DISABLE_SIGNALS
CODE void *sigdeliver; /* Actual type is sig_deliver_t */
/* The following retains that state during signal execution */
uint16_t saved_pc; /* Saved return address */
uint16_t saved_i; /* Saved interrupt state */
#endif
};
#endif
/****************************************************************************
* Inline functions
****************************************************************************/
/****************************************************************************
* Public Variables
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
EXTERN irqstate_t irqsave(void) __naked;
EXTERN void irqrestore(irqstate_t flags) __naked;
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
#endif /* __ARCH_Z80_INCLUDE_Z80_IRQ_H */
+82
View File
@@ -0,0 +1,82 @@
/****************************************************************************
* arch/z80/include/z80/limits.h
*
* Copyright (C) 2007-2009, 2012 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_Z80_INCLUDE_Z80_LIMITS_H
#define __ARCH_Z80_INCLUDE_Z80_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 (-32768)
#define INT_MAX 32767
#define UINT_MAX 65535
/* These change on 32-bit and 64-bit platforms */
#define LONG_MIN (-2147483648L)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
/* A pointer is 2 bytes */
#define PTR_MIN (-32768)
#define PTR_MAX 32767
#define UPTR_MAX 65535
#endif /* __ARCH_Z80_INCLUDE_Z80_LIMITS_H */
+99
View File
@@ -0,0 +1,99 @@
/****************************************************************************
* arch/z80/include/z80/types.h
* include/arch/chip/types.h
*
* Copyright (C) 2007-2009 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 __ARC_Z80_INCLUDE_Z80_TYPES_H
#define __ARC_Z80_INCLUDE_Z80_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
*
* These are the sizes of the standard SDCC types
*
* For SDCC, sizeof(int) is 16 and sizeof(long) is 32. long long and double
* are not supported.
*
* Generic pointers are 3 bytes in length with the first byte holding data
* space information.
*/
typedef signed char _int8_t;
typedef unsigned char _uint8_t;
typedef signed int _int16_t;
typedef unsigned int _uint16_t;
typedef signed long _int32_t;
typedef unsigned long _uint32_t;
/* A pointer is 2 bytes */
typedef signed int _intptr_t;
typedef unsigned int _uintptr_t;
/* This is the size of the interrupt state save returned by irqsave() */
typedef _uint16_t irqstate_t;
#endif /* __ASSEMBLY__ */
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
#endif /* __ARC_Z80_INCLUDE_Z80_TYPES_H */