mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 10:33: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,64 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/arch.h
|
||||
*
|
||||
* Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
* Author: Yu Qiang <yuq825@gmail.com>
|
||||
*
|
||||
* This file is a part of NuttX:
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
*
|
||||
* 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 __RGMP_ARCH_ARCH_H
|
||||
#define __RGMP_ARCH_ARCH_H
|
||||
|
||||
#include <arch/subarch/arch.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
|
||||
struct up_wait {
|
||||
struct up_wait *next;
|
||||
_TCB *task;
|
||||
};
|
||||
|
||||
extern _TCB *current_task;
|
||||
|
||||
void up_sigentry(void);
|
||||
|
||||
int up_register_bridge(char *name, int size);
|
||||
int up_unregister_bridge(char *name);
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/arm/arch/subarch/arch.h
|
||||
*
|
||||
* Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
* Author: Yu Qiang <yuq825@gmail.com>
|
||||
*
|
||||
* This file is a part of NuttX:
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
*
|
||||
* 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 __RGMP_ARCH_SUBARCH_ARCH_H
|
||||
#define __RGMP_ARCH_SUBARCH_ARCH_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
|
||||
static inline void up_mdelay(uint32_t msec)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline void up_udelay(uint32_t usec)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/irq.h
|
||||
*
|
||||
* Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
* Author: Yu Qiang <yuq825@gmail.com>
|
||||
*
|
||||
* This file is a part of NuttX:
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
*
|
||||
* 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_RGMP_INCLUDE_IRQ_H
|
||||
#define __ARCH_RGMP_INCLUDE_IRQ_H
|
||||
|
||||
#define NR_IRQS 0
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <rgmp/spinlock.h>
|
||||
#include <arch/types.h>
|
||||
#include <rgmp/trap.h>
|
||||
|
||||
struct xcptcontext {
|
||||
struct Trapframe *tf;
|
||||
// for signal using
|
||||
unsigned int save_eip;
|
||||
unsigned int save_eflags;
|
||||
void *sigdeliver;
|
||||
};
|
||||
|
||||
void push_xcptcontext(struct xcptcontext *xcp);
|
||||
void pop_xcptcontext(struct xcptcontext *xcp);
|
||||
|
||||
extern int nest_irq;
|
||||
|
||||
static inline irqstate_t irqsave(void)
|
||||
{
|
||||
return pushcli();
|
||||
}
|
||||
|
||||
static inline void irqrestore(irqstate_t flags)
|
||||
{
|
||||
popcli(flags);
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
/************************************************************
|
||||
* arch/rgmp/include/limits.h
|
||||
*
|
||||
* Copyright (C) 2011-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 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.
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
#ifndef __ARCH_RGMP_INCLUDE_LIMITS_H
|
||||
#define __ARCH_RGMP_INCLUDE_LIMITS_H
|
||||
|
||||
/************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define SCHAR_MIN (-128)
|
||||
#define SCHAR_MAX 127
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
/* These could be different on machines where char is unsigned */
|
||||
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
#define SHRT_MIN (-32768)
|
||||
#define SHRT_MAX 32767
|
||||
#define USHRT_MAX 65535
|
||||
|
||||
#define INT_MIN (-2147483648)
|
||||
#define INT_MAX 2147483647
|
||||
#define UINT_MAX 4294967295
|
||||
|
||||
/* These change on 32-bit and 64-bit platforms */
|
||||
|
||||
#define LONG_MIN (-2147483648L)
|
||||
#define LONG_MAX 2147483647L
|
||||
#define ULONG_MAX 4294967295UL
|
||||
|
||||
#define LLONG_MIN (-9223372036854775808LL)
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
/* A pointer is 4 bytes */
|
||||
|
||||
#define PTR_MIN (-2147483648)
|
||||
#define PTR_MAX 2147483647
|
||||
#define UPTR_MAX 4294967295
|
||||
|
||||
#endif /* __ARCH_RGMP_INCLUDE_LIMITS_H */
|
||||
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/math.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_RGMP_INCLUDE_MATH_H
|
||||
#define __ARCH_RGMP_INCLUDE_MATH_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#include <rgmp/math.h>
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_RGMP_INCLUDE_MATH_H */
|
||||
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/stdbool.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_RGMP_INCLUDE_STDBOOL_H
|
||||
#define __ARCH_RGMP_INCLUDE_STDBOOL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* bool, true, and false must be provided as macros so that they can be
|
||||
* redefined by the application if necessary.
|
||||
*
|
||||
* NOTE: Under C99 'bool' is required to be defined to be the intrinsic type
|
||||
* _Bool. However, in this NuttX context, we need backward compatibility
|
||||
* to pre-C99 standards where _Bool is not an intrinsic type. Hence, we
|
||||
* use _Bool8 as the underlying type.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_ARCH_RGMP
|
||||
#define bool _Bool8
|
||||
#endif
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* A byte is the smallest address memory element (at least in architectures
|
||||
* that do not support bit banding). The requirement is only that type _Bool
|
||||
* be large enough to hold the values 0 and 1. We select uint8_t to minimize
|
||||
* the RAM footprint of the executable.
|
||||
*
|
||||
* NOTE: We can't actually define the type _Bool here. Under C99 _Bool is
|
||||
* an intrinsic type and cannot be the target of a typedef. However, in this
|
||||
* NuttX context, we also need backward compatibility to pre-C99 standards
|
||||
* where _Bool is not an intrinsic type. We work around this by using _Bool8
|
||||
* as the underlying type.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_ARCH_RGMP
|
||||
typedef uint8_t _Bool8;
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_RGMP_INCLUDE_STDBOOL_H */
|
||||
@@ -0,0 +1,277 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/stdint.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_RGMP_INCLUDE_STDINTL_H
|
||||
#define __ARCH_RGMP_INCLUDE_STDINTL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <arch/types.h>
|
||||
#include <limits.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Limits of exact-width integer types */
|
||||
|
||||
#define INT8_MIN 0x80
|
||||
#define INT8_MAX 0x7f
|
||||
#define UINT8_MAX 0xff
|
||||
|
||||
#define INT16_MIN 0x8000
|
||||
#define INT16_MAX 0x7fff
|
||||
#define UINT16_MAX 0xffff
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
# define INT24_MIN 0x800000
|
||||
# define INT24_MAX 0x7fffff
|
||||
# define UINT24_MAX 0xffffff
|
||||
#endif
|
||||
|
||||
#define INT32_MIN 0x80000000
|
||||
#define INT32_MAX 0x7fffffff
|
||||
#define UINT32_MAX 0xffffffff
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
# define INT64_MIN 0x8000000000000000
|
||||
# define INT64_MAX 0x7fffffffffffffff
|
||||
# define UINT64_MAX 0xffffffffffffffff
|
||||
#endif
|
||||
|
||||
/* Limits of minimum-width integer types */
|
||||
|
||||
#define INT8_LEASTN_MIN 0x80
|
||||
#define INT8_LEASTN_MAX 0x7f
|
||||
#define UINT8_LEASTN_MAX 0xff
|
||||
|
||||
#define INT16_LEASTN_MIN 0x8000
|
||||
#define INT16_LEASTN_MAX 0x7fff
|
||||
#define UINT16_LEASTN_MAX 0xffff
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
# define INT24_LEASTN_MIN 0x800000
|
||||
# define INT24_LEASTN_MAX 0x7fffff
|
||||
# define UINT24_LEASTN_MAX 0xffffff
|
||||
#endif
|
||||
|
||||
#define INT32_LEASTN_MIN 0x80000000
|
||||
#define INT32_LEASTN_MAX 0x7fffffff
|
||||
#define UINT32_LEASTN_MAX 0xffffffff
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
# define INT64_LEASTN_MIN 0x8000000000000000
|
||||
# define INT64_LEASTN_MAX 0x7fffffffffffffff
|
||||
# define UINT64_LEASTN_MAX 0xffffffffffffffff
|
||||
#endif
|
||||
|
||||
/* Limits of fastest minimum-width integer types */
|
||||
|
||||
#define INT8_FASTN_MIN 0x80
|
||||
#define INT8_FASTN_MAX 0x7f
|
||||
#define UINT8_FASTN_MAX 0xff
|
||||
|
||||
#define INT16_FASTN_MIN 0x8000
|
||||
#define INT16_FASTN_MAX 0x7fff
|
||||
#define UINT16_FASTN_MAX 0xffff
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
# define INT24_FASTN_MIN 0x800000
|
||||
# define INT24_FASTN_MAX 0x7fffff
|
||||
# define UINT24_FASTN_MAX 0xffffff
|
||||
#endif
|
||||
|
||||
#define INT32_FASTN_MIN 0x80000000
|
||||
#define INT32_FASTN_MAX 0x7fffffff
|
||||
#define UINT32_FASTN_MAX 0xffffffff
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
# define INT64_FASTN_MIN 0x8000000000000000
|
||||
# define INT64_FASTN_MAX 0x7fffffffffffffff
|
||||
# define UINT64_FASTN_MAX 0xffffffffffffffff
|
||||
#endif
|
||||
|
||||
/* Limits of integer types capable of holding object pointers */
|
||||
|
||||
#define INTPTR_MIN PTR_MIN
|
||||
#define INTPTR_MAX PTR_MIN
|
||||
#define UINTPTR_MAX UPTR_MAX
|
||||
|
||||
/* Limits of greatest-width integer types */
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
# define INTMAX_MIN INT64_MIN
|
||||
# define INTMAX_MAX INT64_MAX
|
||||
|
||||
# define UINTMAX_MIN UINT64_MIN
|
||||
# define UINTMAX_MAX UINT64_MAX
|
||||
#else
|
||||
# define INTMAX_MIN INT32_MIN
|
||||
# define INTMAX_MAX INT32_MAX
|
||||
|
||||
# define UINTMAX_MIN UINT32_MIN
|
||||
# define UINTMAX_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
/* Macros for minimum-width integer constant expressions */
|
||||
|
||||
#if 0 /* REVISIT: Depends on architecture specific implementation */
|
||||
#define INT8_C(x) x
|
||||
#define INT16_C(x) x
|
||||
#define INT32_C(x) x ## L
|
||||
#define INT64_C(x) x ## LL
|
||||
|
||||
#define UINT8_C(x) x
|
||||
#define UINT16_C(x) x
|
||||
#define UINT32_C(x) x ## UL
|
||||
#define UINT64_C(x) x ## ULL
|
||||
#endif
|
||||
|
||||
/* Macros for greatest-width integer constant expressions
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
# define INTMAX_C(x) x ## LL
|
||||
# define UINTMAX_C(x) x ## ULL
|
||||
#else
|
||||
# define INTMAX_C(x) x ## L
|
||||
# define UINTMAX_C(x) x ## UL
|
||||
#endif
|
||||
|
||||
/* Limits of Other Integer Types */
|
||||
|
||||
#if 0
|
||||
# define PTRDIFF_MIN
|
||||
# define PTRDIFF_MAX
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMALL_MEMORY
|
||||
# define SIZE_MAX 0xffff
|
||||
#else
|
||||
# define SIZE_MAX 0xffffffff
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
# define WCHAR_MIN
|
||||
# define WCHAR_MAX
|
||||
|
||||
# define WINT_MIN
|
||||
# define WINT_MAX
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* Exact-width integer types. NOTE that these types are defined in
|
||||
* architecture-specific logic with leading underscore character. This file
|
||||
* typedef's these 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.
|
||||
*/
|
||||
|
||||
#include <rgmp/types.h>
|
||||
|
||||
/* Minimum-width integer types */
|
||||
|
||||
typedef _int8_t int_least8_t;
|
||||
typedef _uint8_t uint_least8_t;
|
||||
|
||||
typedef _int16_t int_least16_t;
|
||||
typedef _uint16_t uint_least16_t;
|
||||
|
||||
#ifdef __INT24_DEFINED
|
||||
typedef _int24_t int_least24_t;
|
||||
typedef _uint24_t uint_least24_t;
|
||||
#else
|
||||
typedef _int32_t int_least24_t;
|
||||
typedef _uint32_t uint_least24_t;
|
||||
#endif
|
||||
|
||||
typedef _int32_t int_least32_t;
|
||||
typedef _uint32_t uint_least32_t;
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
typedef _int64_t int_least64_t;
|
||||
typedef _uint64_t uint_least64_t;
|
||||
#endif
|
||||
|
||||
/* Fastest minimum-width integer types */
|
||||
|
||||
typedef _int8_t int_fast8_t;
|
||||
typedef _uint8_t uint_fast8_t;
|
||||
|
||||
typedef int int_fast16_t;
|
||||
typedef unsigned int uint_fast16_t;
|
||||
|
||||
#ifdef __INT24_DEFINED
|
||||
typedef _int24_t int_fast24_t;
|
||||
typedef _uint24_t uint_fast24_t;
|
||||
#else
|
||||
typedef _int32_t int_fast24_t;
|
||||
typedef _uint32_t uint_fast24_t;
|
||||
#endif
|
||||
|
||||
typedef _int32_t int_fast32_t;
|
||||
typedef _uint32_t uint_fast32_t;
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
typedef _int64_t int_fast64_t;
|
||||
typedef _uint64_t uint_fast64_t;
|
||||
#endif
|
||||
|
||||
/* Integer types capable of holding object pointers */
|
||||
|
||||
#ifndef CONFIG_ARCH_RGMP
|
||||
typedef _intptr_t intptr_t;
|
||||
typedef _uintptr_t uintptr_t;
|
||||
#endif
|
||||
|
||||
/* Greatest-width integer types */
|
||||
|
||||
#ifdef __INT64_DEFINED
|
||||
typedef _int64_t intmax_t;
|
||||
typedef _uint64_t uintmax_t;
|
||||
#else
|
||||
typedef _int32_t intmax_t;
|
||||
typedef _uint32_t uintmax_t;
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_RGMP_INCLUDE_STDINTL_H */
|
||||
@@ -0,0 +1,96 @@
|
||||
/************************************************************************
|
||||
* arch/rgmp/include/types.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name 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_RGMP_INCLUDE_TYPES_H
|
||||
#define __ARCH_RGMP_INCLUDE_TYPES_H
|
||||
|
||||
/************************************************************************
|
||||
* Included Files
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Definitions
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Type Declarations
|
||||
************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* These are the sizes of the standard integer types. NOTE that these type
|
||||
* names have a leading underscore character. This file will be included
|
||||
* (indirectly) by include/stdint.h and typedef'ed to the final name without
|
||||
* the underscore character. This roundabout way of doings things allows
|
||||
* the stdint.h to be removed from the include/ directory in the event that
|
||||
* the user prefers to use the definitions provided by their toolchain header
|
||||
* files
|
||||
*/
|
||||
|
||||
typedef char _int8_t;
|
||||
typedef unsigned char _uint8_t;
|
||||
|
||||
typedef short _int16_t;
|
||||
typedef unsigned short _uint16_t;
|
||||
|
||||
typedef int _int32_t;
|
||||
typedef unsigned int _uint32_t;
|
||||
|
||||
typedef long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is 4 bytes */
|
||||
|
||||
typedef unsigned int _intptr_t;
|
||||
typedef unsigned int _uintptr_t;
|
||||
|
||||
/* This is the size of the interrupt state save returned by
|
||||
* irqsave()
|
||||
*/
|
||||
|
||||
typedef unsigned int irqstate_t;
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/************************************************************************
|
||||
* Global Function Prototypes
|
||||
************************************************************************/
|
||||
|
||||
#endif /* __ARCH_RGMP_INCLUDE_TYPES_H */
|
||||
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/com.h
|
||||
*
|
||||
* Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
* Author: Yu Qiang <yuq825@gmail.com>
|
||||
*
|
||||
* This file is a part of NuttX:
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
*
|
||||
* 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_RGMP_INCLUDE_COM_H
|
||||
#define __ARCH_RGMP_INCLUDE_COM_H
|
||||
|
||||
#define COM_SET_BAUD 1
|
||||
#define COM_SET_PARITY 2
|
||||
#define COM_NO_PARITY 0
|
||||
#define COM_ODD_PARITY 1
|
||||
#define COM_EVEN_PARITY 3
|
||||
#define COM_SET_STOPBITS 3
|
||||
#define COM_ONE_STOPBITS 0
|
||||
#define COM_TWO_STOPBITS 1
|
||||
#define COM_SET_BITS 4
|
||||
#define COM_8_BITS 3
|
||||
#define COM_7_BITS 2
|
||||
#define COM_6_BITS 1
|
||||
#define COM_5_BITS 0
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
* arch/rgmp/include/x86/arch/subarch/arch.h
|
||||
*
|
||||
* Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
* Author: Yu Qiang <yuq825@gmail.com>
|
||||
*
|
||||
* This file is a part of NuttX:
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
*
|
||||
* 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 __RGMP_ARCH_SUBARCH_ARCH_H
|
||||
#define __RGMP_ARCH_SUBARCH_ARCH_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <rgmp/arch/hpet.h>
|
||||
|
||||
|
||||
static inline void up_mdelay(uint32_t msec)
|
||||
{
|
||||
hpet_ndelay(msec*1000000);
|
||||
}
|
||||
|
||||
static inline void up_udelay(uint32_t usec)
|
||||
{
|
||||
hpet_udelay(usec*1000);
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user