mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 13:03:33 +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,81 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/arch.h
|
||||
*
|
||||
* Copyright (C) 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/arch.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_HC_INCLUDE_ARCH_H
|
||||
#define __ARCH_HC_INCLUDE_ARCH_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.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_HC_INCLUDE_ARCH_H */
|
||||
@@ -0,0 +1,111 @@
|
||||
/************************************************************************************
|
||||
* arch/hc/include/hc12/irq.h
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather,
|
||||
* only indirectly through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_HC_INCLUDE_HC12_IRQ_H
|
||||
#define __ARCH_HC_INCLUDE_HC12_IRQ_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/* This structure defines the way the registers are stored. */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
struct xcptcontext
|
||||
{
|
||||
int dummy; /* For now */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Save the current interrupt enable state & disable IRQs */
|
||||
|
||||
static inline irqstate_t irqsave(void)
|
||||
{
|
||||
/* To be provided */
|
||||
}
|
||||
|
||||
/* Restore saved IRQ & FIQ state */
|
||||
|
||||
static inline void irqrestore(irqstate_t flags)
|
||||
{
|
||||
/* To be provided */
|
||||
}
|
||||
|
||||
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3)
|
||||
{
|
||||
/* To be provided */
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_HC_INCLUDE_HC12_IRQ_H */
|
||||
@@ -0,0 +1,97 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/hc12/limits.h
|
||||
*
|
||||
* Copyright (C) 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_HC_INCLUDE_HC12_LIMITS_H
|
||||
#define __ARCH_HC_INCLUDE_HC12_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
|
||||
|
||||
/* The size of an integer is controlled with the -mshort or -mnoshort GCC
|
||||
* options. GCC will set the pre-defined symbol __INT__ to indicate the size
|
||||
* of an integer
|
||||
*/
|
||||
|
||||
#if __INT__ == 32
|
||||
# define INT_MIN (-2147483648)
|
||||
# define INT_MAX 2147483647
|
||||
# define UINT_MAX 4294967295
|
||||
#else
|
||||
# define INT_MIN (-32768)
|
||||
# define INT_MAX 32767
|
||||
# define UINT_MAX 65535
|
||||
#endif
|
||||
|
||||
/* Long is 4-bytes and long long is 8 bytes in any case */
|
||||
|
||||
#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 2 bytes */
|
||||
|
||||
#define PTR_MIN (-32768)
|
||||
#define PTR_MAX 32767
|
||||
#define UPTR_MAX 65535
|
||||
|
||||
#endif /* __ARCH_HC_INCLUDE_HC12_LIMITS_H */
|
||||
@@ -0,0 +1,103 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/hc12/types.h
|
||||
*
|
||||
* Copyright (C) 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_HC_INCLUDE_HC12_TYPES_H
|
||||
#define __ARCH_HC_INCLUDE_HC12_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;
|
||||
|
||||
/* Normally, mc68hc1x code is compiled with the -mshort option
|
||||
* which results in a 16-bit integer. If -mnoshort is defined
|
||||
* then an integer is 32-bits. GCC will defined __INT__ accordingly:
|
||||
*/
|
||||
|
||||
# if __INT__ == 16
|
||||
typedef signed long _int32_t;
|
||||
typedef unsigned long _uint32_t;
|
||||
#else
|
||||
typedef signed int _int32_t;
|
||||
typedef unsigned int _uint32_t;
|
||||
#endif
|
||||
|
||||
typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is two bytes */
|
||||
|
||||
typedef signed short _intptr_t;
|
||||
typedef unsigned short _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_HC_INCLUDE_HC12_TYPES_H */
|
||||
@@ -0,0 +1,274 @@
|
||||
/************************************************************************************
|
||||
* arch/hc/include/hcs12/irq.h
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather,
|
||||
* only indirectly through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_HC_INCLUDE_HCS12_IRQ_H
|
||||
#define __ARCH_HC_INCLUDE_HCS12_IRQ_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
/* CCR bit definitions */
|
||||
|
||||
#define HCS12_CCR_C (1 << 0) /* Bit 0: Carry/Borrow status bit */
|
||||
#define HCS12_CCR_V (1 << 1) /* Bit 1: Two’s complement overflow status bit */
|
||||
#define HCS12_CCR_Z (1 << 2) /* Bit 2: Zero status bit */
|
||||
#define HCS12_CCR_N (1 << 3) /* Bit 3: Negative status bit */
|
||||
#define HCS12_CCR_I (1 << 4) /* Bit 4: Maskable interrupt control bit */
|
||||
#define HCS12_CCR_H (1 << 5) /* Bit 5: Half-carry status bit */
|
||||
#define HCS12_CCR_X (1 << 6) /* Bit 6: Non-maskable interrupt control bit */
|
||||
#define HCS12_CCR_S (1 << 7) /* Bit 7: STOP instruction control bit */
|
||||
|
||||
/************************************************************************************
|
||||
* Register state save strucure
|
||||
* Low Address <-- SP after state save
|
||||
* [PPAGE]
|
||||
* [soft regisers]
|
||||
* XYH
|
||||
* XYL
|
||||
* ZH
|
||||
* ZL
|
||||
* TMPH
|
||||
* TMPL
|
||||
* FRAMEH
|
||||
* FRAMEL
|
||||
* SP <-- SP after interrupt
|
||||
* CCR
|
||||
* B
|
||||
* A
|
||||
* XH
|
||||
* XL
|
||||
* YH
|
||||
* YL
|
||||
* PCH
|
||||
* High Address PCL <-- SP before interrupt
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/* Byte offsets */
|
||||
/* PPAGE register (only in banked mode) */
|
||||
|
||||
#ifndef CONFIG_HCS12_NONBANKED
|
||||
# define REG_PPAGE 0
|
||||
# define REG_FIRST_SOFTREG 1
|
||||
#else
|
||||
# define REG_FIRST_SOFTREG 0
|
||||
#endif
|
||||
|
||||
/* Soft registers (as configured) */
|
||||
|
||||
#if CONFIG_HCS12_MSOFTREGS > 2
|
||||
# error "Need to save more registers"
|
||||
#elif CONFIG_HCS12_MSOFTREGS == 2
|
||||
# define REG_SOFTREG1 REG_FIRST_SOFTREG
|
||||
# define REG_SOFTREG2 (REG_FIRST_SOFTREG+2)
|
||||
# define REG_FIRST_HARDREG (REG_FIRST_SOFTREG+4)
|
||||
#elif CONFIG_HCS12_MSOFTREGS == 1
|
||||
# define REG_SOFTREG1 REG_FIRST_SOFTREG
|
||||
# define REG_FIRST_HARDREG (REG_FIRST_SOFTREG+2)
|
||||
#else
|
||||
# define REG_FIRST_HARDREG REG_FIRST_SOFTREG
|
||||
#endif
|
||||
|
||||
#define REG_XY REG_FIRST_HARDREG
|
||||
#define REG_Z (REG_FIRST_HARDREG+2)
|
||||
# define REG_ZH (REG_FIRST_HARDREG+2)
|
||||
# define REG_ZL (REG_FIRST_HARDREG+3)
|
||||
#define REG_TMP (REG_FIRST_HARDREG+4)
|
||||
# define REG_TMPH (REG_FIRST_HARDREG+4)
|
||||
# define REG_TMPL (REG_FIRST_HARDREG+5)
|
||||
#define REG_FRAME (REG_FIRST_HARDREG+6)
|
||||
# define REG_FRAMEH (REG_FIRST_HARDREG+6)
|
||||
# define REG_FRAMEL (REG_FIRST_HARDREG+7)
|
||||
|
||||
/* Stack pointer before the interrupt */
|
||||
|
||||
#define REG_SP (REG_FIRST_HARDREG+8)
|
||||
# define REG_SPH (REG_FIRST_HARDREG+8)
|
||||
# define REG_SPL (REG_FIRST_HARDREG+9)
|
||||
|
||||
/* On entry into an I- or X-interrupt, into an SWI, or into an undefined instruction
|
||||
* interrupt, the stack frame created by hardware looks like:
|
||||
*
|
||||
* Low Address <-- SP after interrupt
|
||||
* CCR
|
||||
* B
|
||||
* A
|
||||
* XH
|
||||
* XL
|
||||
* YH
|
||||
* YL
|
||||
* PCH
|
||||
* High Address PCL <-- SP before interrupt
|
||||
*/
|
||||
|
||||
#define REG_CCR (REG_FIRST_HARDREG+10)
|
||||
#define REG_BA (REG_FIRST_HARDREG+11)
|
||||
# define REG_B (REG_FIRST_HARDREG+11)
|
||||
# define REG_A (REG_FIRST_HARDREG+12)
|
||||
#define REG_X (REG_FIRST_HARDREG+13)
|
||||
# define REG_XH (REG_FIRST_HARDREG+13)
|
||||
# define REG_XL (REG_FIRST_HARDREG+14)
|
||||
#define REG_Y (REG_FIRST_HARDREG+15)
|
||||
# define REG_YH (REG_FIRST_HARDREG+15)
|
||||
# define REG_YL (REG_FIRST_HARDREG+16)
|
||||
#define REG_PC (REG_FIRST_HARDREG+17)
|
||||
# define REG_PCH (REG_FIRST_HARDREG+17)
|
||||
# define REG_PCL (REG_FIRST_HARDREG+18)
|
||||
|
||||
#define TOTALFRAME_SIZE (REG_FIRST_HARDREG+17)
|
||||
#define INTFRAME_SIZE 9
|
||||
#define XCPTCONTEXT_REGS TOTALFRAME_SIZE
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/* This structure defines the way the registers are stored. */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
struct xcptcontext
|
||||
{
|
||||
uint8_t regs[XCPTCONTEXT_REGS];
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Enable/Disable interrupts */
|
||||
|
||||
#define ienable() __asm("cli");
|
||||
#define idisable() __asm("orcc #0x10")
|
||||
#define xenable() __asm("andcc #0xbf")
|
||||
#define xdisable() __asm("orcc #0x40")
|
||||
|
||||
/* Get the current value of the stack pointer */
|
||||
|
||||
static inline uint16_t up_getsp(void)
|
||||
{
|
||||
uint16_t ret;
|
||||
__asm__
|
||||
(
|
||||
"\tsts %0\n"
|
||||
: "=m"(ret) :
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get the current value of the CCR */
|
||||
|
||||
static inline irqstate_t up_getccr(void)
|
||||
{
|
||||
irqstate_t ccr;
|
||||
__asm__
|
||||
(
|
||||
"\ttpa\n"
|
||||
"\tstaa %0\n"
|
||||
: "=m"(ccr) :
|
||||
);
|
||||
return ccr;
|
||||
}
|
||||
|
||||
/* Save the current interrupt enable state & disable IRQs */
|
||||
|
||||
static inline irqstate_t irqsave(void)
|
||||
{
|
||||
irqstate_t ccr;
|
||||
__asm__
|
||||
(
|
||||
"\ttpa\n"
|
||||
"\tstaa %0\n"
|
||||
"\torcc #0x50\n"
|
||||
: "=m"(ccr) :
|
||||
);
|
||||
return ccr;
|
||||
}
|
||||
|
||||
/* Restore saved interrupt state */
|
||||
|
||||
static inline void irqrestore(irqstate_t flags)
|
||||
{
|
||||
/* Should interrupts be enabled? */
|
||||
|
||||
if ((flags & HCS12_CCR_I) == 0)
|
||||
{
|
||||
/* Yes.. unmask I- and Z-interrupts */
|
||||
|
||||
__asm("andcc #0xaf");
|
||||
}
|
||||
}
|
||||
|
||||
/* System call */
|
||||
|
||||
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3)
|
||||
{
|
||||
/* To be provided */
|
||||
/* __asm("swi") */
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_HC_INCLUDE_HCS12_IRQ_H */
|
||||
@@ -0,0 +1,97 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/hcs12/limits.h
|
||||
*
|
||||
* Copyright (C) 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_HC_INCLUDE_HCS12_LIMITS_H
|
||||
#define __ARCH_HC_INCLUDE_HCS12_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
|
||||
|
||||
/* The size of an integer is controlled with the -mshort or -mnoshort GCC
|
||||
* options. GCC will set the pre-defined symbol __INT__ to indicate the size
|
||||
* of an integer
|
||||
*/
|
||||
|
||||
#if __INT__ == 32
|
||||
# define INT_MIN (-2147483648)
|
||||
# define INT_MAX 2147483647
|
||||
# define UINT_MAX 4294967295
|
||||
#else
|
||||
# define INT_MIN (-32768)
|
||||
# define INT_MAX 32767
|
||||
# define UINT_MAX 65535
|
||||
#endif
|
||||
|
||||
/* Long is 4-bytes and long long is 8 bytes in any case */
|
||||
|
||||
#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 2 bytes */
|
||||
|
||||
#define PTR_MIN (-32768)
|
||||
#define PTR_MAX 32767
|
||||
#define UPTR_MAX 65535
|
||||
|
||||
#endif /* __ARCH_HC_INCLUDE_HCS12_LIMITS_H */
|
||||
@@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/hcs12/types.h
|
||||
*
|
||||
* Copyright (C) 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_HC_INCLUDE_HCS12_TYPES_H
|
||||
#define __ARCH_HC_INCLUDE_HCS12_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;
|
||||
|
||||
/* Normally, mc68hc1x code is compiled with the -mshort option
|
||||
* which results in a 16-bit integer. If -mnoshort is defined
|
||||
* then an integer is 32-bits. GCC will defined __INT__ accordingly:
|
||||
*/
|
||||
|
||||
# if __INT__ == 16
|
||||
typedef signed long _int32_t;
|
||||
typedef unsigned long _uint32_t;
|
||||
#else
|
||||
typedef signed int _int32_t;
|
||||
typedef unsigned int _uint32_t;
|
||||
#endif
|
||||
|
||||
typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is two bytes */
|
||||
|
||||
typedef signed short _intptr_t;
|
||||
typedef unsigned short _uintptr_t;
|
||||
|
||||
/* This is the size of the interrupt state save returned by irqsave()*/
|
||||
|
||||
typedef unsigned char irqstate_t;
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/****************************************************************************
|
||||
* Global Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_HC_INCLUDE_HCS12_TYPES_H */
|
||||
@@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/irq.h
|
||||
*
|
||||
* Copyright (C) 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_HC_INCLUDE_IRQ_H
|
||||
#define __ARCH_HC_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
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_HC12)
|
||||
# include <arch/hc12/irq.h>
|
||||
#elif defined(CONFIG_ARCH_HCS12)
|
||||
# include <arch/hcs12/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_HC_INCLUDE_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/limits.h
|
||||
*
|
||||
* Copyright (C) 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_HC_INCLUDE_LIMITS_H
|
||||
#define __ARCH_HC_INCLUDE_LIMITS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include architecture-specific limits definitions */
|
||||
|
||||
#if defined(CONFIG_ARCH_HC12)
|
||||
# include <arch/hc12/limits.h>
|
||||
#elif defined(CONFIG_ARCH_HCS12)
|
||||
# include <arch/hcs12/limits.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_HC_INCLUDE_LIMITS_H */
|
||||
@@ -0,0 +1,190 @@
|
||||
/************************************************************************************
|
||||
* arch/hc/include/m9s12/irq.h
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather,
|
||||
* only indirectly through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_HC_INCLUDE_M9S12_IRQ_H
|
||||
#define __ARCH_HC_INCLUDE_M9S12_IRQ_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* IRQ Numbers */
|
||||
|
||||
#define HCS12_IRQ_VRESET 0 /* fffe: External reset, power on reset orlow voltage reset */
|
||||
#define HCS12_IRQ_VCLKMON 1 /* fffc: Clock monitor fail reset */
|
||||
#define HCS12_IRQ_VCOP 2 /* fffa: COP failure reset*/
|
||||
#define HCS12_IRQ_VTRAP 3 /* fff8: Unimplemented instruction trap */
|
||||
#define HCS12_IRQ_VSWI 4 /* fff6: SWI */
|
||||
#define HCS12_IRQ_VXIRQ 5 /* fff4: XIRQ */
|
||||
#define HCS12_IRQ_VIRQ 6 /* fff2: IRQ */
|
||||
#define HCS12_IRQ_VRTI 7 /* fff0: Real-time interrupt */
|
||||
/* ffe8-ffef: Reserved */
|
||||
#define HCS12_IRQ_VTIMCH4 8 /* ffe6: Standard timer channel 4 */
|
||||
#define HCS12_IRQ_VTIMCH5 9 /* ffe4: Standard timer channel 5 */
|
||||
#define HCS12_IRQ_VTIMCH6 10 /* ffe2: Standard timer channel 6 */
|
||||
#define HCS12_IRQ_VTIMCH7 11 /* ffe0: Standard timer channel 7 */
|
||||
#define HCS12_IRQ_VTIMOVF 12 /* ffde: Standard timer overflow */
|
||||
#define HCS12_IRQ_VTIMPAOVF 13 /* ffdc: Pulse accumulator overflow */
|
||||
#define HCS12_IRQ_VTIMPAIE 14 /* ffda: Pulse accumulator input edge */
|
||||
#define HCS12_IRQ_VSPI 15 /* ffd8: SPI */
|
||||
#define HCS12_IRQ_VSCI0 16 /* ffd6: SCI0 */
|
||||
#define HCS12_IRQ_VSCI1 17 /* ffd4: SCI1 */
|
||||
#define HCS12_IRQ_VATD 18 /* ffd2: ATD */
|
||||
/* ffd0: Reserved */
|
||||
#define HCS12_IRQ_VPORTJ 19 /* ffce: Port J */
|
||||
#define HCS12_IRQ_VPORTH 20 /* ffcc: Port H */
|
||||
#define HCS12_IRQ_VPORTG 21 /* ffca: Port G */
|
||||
/* ffc8: Reserved */
|
||||
#define HCS12_IRQ_VCRGPLLLCK 22 /* ffc6: CRG PLL lock */
|
||||
#define HCS12_IRQ_VCRGSCM 23 /* ffc4: CRG self clock mode */
|
||||
/* ffc2: Reserved */
|
||||
#define HCS12_IRQ_VIIC 24 /* ffc0: IIC bus */
|
||||
/* ffba-ffbf: Reserved */
|
||||
#define HCS12_IRQ_VFLASH 25 /* ffb8: FLASH */
|
||||
#define HCS12_IRQ_VEPHY 26 /* ffb6: EPHY interrupt */
|
||||
#define HCS12_IRQ_VEMACCRXBAC 27 /* ffb4: EMAC receive buffer A complete */
|
||||
#define HCS12_IRQ_VEMACCRXBBC 28 /* ffb2: EMAC receive buffer B complete */
|
||||
#define HCS12_IRQ_VEMACTXC 29 /* ffb0: EMAC frame transmission complete */
|
||||
#define HCS12_IRQ_VEMACRXFC 30 /* ffae: EMAC receive flow control */
|
||||
#define HCS12_IRQ_VEMACMII 31 /* ffac: EMAC MII management transfer complete */
|
||||
#define HCS12_IRQ_VEMACRXERR 32 /* ffaa: EMAC receive error */
|
||||
#define HCS12_IRQ_VEMACRXBAO 33 /* ffa8: EMAC receive buffer A overrun */
|
||||
#define HCS12_IRQ_VEMACRXBBO 34 /* ffa6: EMAC receive buffer B overrun */
|
||||
#define HCS12_IRQ_VEMACBRXERR 35 /* ffa4: EMAC babbling receive error */
|
||||
#define HCS12_IRQ_VEMACLC 36 /* ffa2: EMAC late collision */
|
||||
#define HCS12_IRQ_VEMACEC 37 /* ffa0: EMAC excessive collision */
|
||||
/* ff80-ff9f: Reserved */
|
||||
#define HCS12_IRQ_NVECTORS 38
|
||||
|
||||
/* GPIO interrupts. The m9s12x supports several interrupts on PIM ports G, H,
|
||||
* and J. We go through some special efforts to keep the number of IRQs
|
||||
* to a minimum in this sparse interrupt case.
|
||||
*
|
||||
* Port G: Pins 0-7
|
||||
* Port H: Pins 0-6
|
||||
* Port J: Pins 0-3 and 6-7
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
|
||||
/* To conserve space, interrupts must also be configured, port by port */
|
||||
|
||||
# define HCC12_IRQ_PGFIRST HCS12_IRQ_NVECTORS
|
||||
# ifdef CONFIG_HCS12_PORTG_INTS
|
||||
# define HCS12_IRQ_PGSET 0xff
|
||||
# define HCS12_IRQ_PG0 (HCC12_IRQ_PGFIRST+0)
|
||||
# define HCS12_IRQ_PG1 (HCC12_IRQ_PGFIRST+1)
|
||||
# define HCS12_IRQ_PG2 (HCC12_IRQ_PGFIRST+2)
|
||||
# define HCS12_IRQ_PG3 (HCC12_IRQ_PGFIRST+3)
|
||||
# define HCS12_IRQ_PG4 (HCC12_IRQ_PGFIRST+4)
|
||||
# define HCS12_IRQ_PG5 (HCC12_IRQ_PGFIRST+5)
|
||||
# define HCS12_IRQ_PG6 (HCC12_IRQ_PGFIRST+6)
|
||||
# define HCS12_IRQ_PG7 (HCC12_IRQ_PGFIRST+7)
|
||||
# define HCC12_IRQ_PHFIRST (HCC12_IRQ_PGFIRST+8)
|
||||
# else
|
||||
# define HCC12_IRQ_PHFIRST HCC12_IRQ_PGFIRST
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_HCS12_PORTH_INTS
|
||||
# define HCS12_IRQ_PHSET 0x7f
|
||||
# define HCS12_IRQ_PH0 (HCC12_IRQ_PHFIRST+0)
|
||||
# define HCS12_IRQ_PH1 (HCC12_IRQ_PHFIRST+1)
|
||||
# define HCS12_IRQ_PH2 (HCC12_IRQ_PHFIRST+2)
|
||||
# define HCS12_IRQ_PH3 (HCC12_IRQ_PHFIRST+3)
|
||||
# define HCS12_IRQ_PH4 (HCC12_IRQ_PHFIRST+4)
|
||||
# define HCS12_IRQ_PH5 (HCC12_IRQ_PHFIRST+5)
|
||||
# define HCS12_IRQ_PH6 (HCC12_IRQ_PHFIRST+6)
|
||||
# define HCC12_IRQ_PJFIRST (HCC12_IRQ_PHFIRST+7)
|
||||
# else
|
||||
# define HCC12_IRQ_PJFIRST HCC12_IRQ_PHFIRST
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_HCS12_PORTJ_INTS
|
||||
# define HCS12_IRQ_PJSET 0xcf
|
||||
# define HCS12_IRQ_PJ0 (HCC12_IRQ_PJFIRST+0)
|
||||
# define HCS12_IRQ_PJ1 (HCC12_IRQ_PJFIRST+1)
|
||||
# define HCS12_IRQ_PJ2 (HCC12_IRQ_PJFIRST+2)
|
||||
# define HCS12_IRQ_PJ3 (HCC12_IRQ_PJFIRST+3)
|
||||
# define HCS12_IRQ_PJ6 (HCC12_IRQ_PJFIRST+4)
|
||||
# define HCS12_IRQ_PJ7 (HCC12_IRQ_PJFIRST+5)
|
||||
# define HCS12_IRQ_NIRQS (HCC12_IRQ_PJFIRST+6)
|
||||
# else
|
||||
# define HCS12_IRQ_NIRQS HCC12_IRQ_PJFIRST
|
||||
# endif
|
||||
#else
|
||||
# define HCS12_IRQ_NIRQS HCS12_IRQ_NVECTORS
|
||||
#endif /* CONFIG_GPIO_IRQ */
|
||||
|
||||
#define HCS12_IRQ_VILLEGAL HCS12_IRQ_NIRQS /* Any reserved vector */
|
||||
#define NR_IRQS (HCS12_IRQ_NIRQS+1)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_HC_INCLUDE_M9S12_IRQ_H */
|
||||
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/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_HC_INCLUDE_SYSCALL_H
|
||||
#define _ARCH_HC_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_HC_INCLUDE_SYSCALL_H */
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/include/types.h
|
||||
*
|
||||
* Copyright (C) 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_HC_INCLUDE_TYPES_H
|
||||
#define __ARCH_HC_INCLUDE_TYPES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Include architecture-specific limits definitions */
|
||||
|
||||
#if defined(CONFIG_ARCH_HC12)
|
||||
# include <arch/hc12/types.h>
|
||||
#elif defined(CONFIG_ARCH_HCS12)
|
||||
# include <arch/hcs12/types.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Global Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_HC_INCLUDE_TYPES_H */
|
||||
Reference in New Issue
Block a user