diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-05-31 13:41:11 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-05-31 13:41:11 +0000 |
commit | d3561d5bd2449c5a625de27c4e14d9e5034c675e (patch) | |
tree | 0b41065c3dafd4d1705b768017b585bde37676ed /nuttx/arch/avr/include | |
parent | 808f3c791f8bc9742a6e42a12a1b235c1c3642c8 (diff) | |
download | px4-nuttx-d3561d5bd2449c5a625de27c4e14d9e5034c675e.tar.gz px4-nuttx-d3561d5bd2449c5a625de27c4e14d9e5034c675e.tar.bz2 px4-nuttx-d3561d5bd2449c5a625de27c4e14d9e5034c675e.zip |
Add directory structure for AVR and ATMEGA
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3651 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/avr/include')
-rwxr-xr-x | nuttx/arch/avr/include/avr/avr.h | 62 | ||||
-rw-r--r-- | nuttx/arch/avr/include/avr/irq.h | 137 | ||||
-rw-r--r-- | nuttx/arch/avr/include/avr/limits.h | 84 | ||||
-rw-r--r-- | nuttx/arch/avr/include/avr/syscall.h | 138 | ||||
-rw-r--r-- | nuttx/arch/avr/include/avr/types.h | 95 | ||||
-rw-r--r-- | nuttx/arch/avr/include/avr32/irq.h | 5 | ||||
-rw-r--r-- | nuttx/arch/avr/include/avr32/limits.h | 84 | ||||
-rw-r--r-- | nuttx/arch/avr/include/avr32/types.h | 95 | ||||
-rw-r--r-- | nuttx/arch/avr/include/limits.h | 40 | ||||
-rw-r--r-- | nuttx/arch/avr/include/types.h | 45 |
10 files changed, 711 insertions, 74 deletions
diff --git a/nuttx/arch/avr/include/avr/avr.h b/nuttx/arch/avr/include/avr/avr.h new file mode 100755 index 000000000..d6b6f428d --- /dev/null +++ b/nuttx/arch/avr/include/avr/avr.h @@ -0,0 +1,62 @@ +/************************************************************************************ + * arch/avr/include/avr/avr.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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_AVR_INCLUDE_AVR_AVR_H +#define __ARCH_AVR_INCLUDE_AVR_AVR_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include <nuttx/config.h> + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_AVR_INCLUDE_AVR_AVR_H */ + diff --git a/nuttx/arch/avr/include/avr/irq.h b/nuttx/arch/avr/include/avr/irq.h new file mode 100644 index 000000000..16966d194 --- /dev/null +++ b/nuttx/arch/avr/include/avr/irq.h @@ -0,0 +1,137 @@ +/**************************************************************************** + * arch/avr/include/avr/irq.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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_AVR_INCLUDE_AVR_IRQ_H +#define __ARCH_AVR_INCLUDE_AVR_IRQ_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/irq.h> +#include <arch/avr/avr.h> + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Register state save array indices */ + +#define REG_Rx 0 /* Just a placeholder */ + +/* Size of the register state save array (in bytes?) */ + +#define XCPTCONTEXT_REGS 1 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* This struct defines the way the registers are stored. */ + +#ifndef __ASSEMBLY__ +struct xcptcontext +{ + /* The following function pointer is non-zero if there are pending signals + * to be processed. + */ + +#ifndef CONFIG_DISABLE_SIGNALS + void *sigdeliver; /* Actual type is sig_deliver_t */ + + /* These are saved copies of PC and SR used during signal processing.*/ + + uint16_t saved_pc; + uint8_t saved_sr; +#endif + + /* Register save area */ + + uint8_t regs[XCPTCONTEXT_REGS]; +}; +#endif + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/* Save the current interrupt enable state & disable all interrupts */ + +static inline irqstate_t irqsave(void) +{ + /* Needs to return the current interrupt state, then disable interrupts */ +#warning "Not implemented" + return 0 +} + +/* Restore saved interrupt state */ + +static inline void irqrestore(irqstate_t flags) +{ + /* Based on the provided interrupt flags, conditionally enable interrupts */ +#warning "Not implemented" +} +#endif /* __ASSEMBLY__ */ + +/**************************************************************************** + * 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_AVR_INCLUDE_AVR_IRQ_H */ + diff --git a/nuttx/arch/avr/include/avr/limits.h b/nuttx/arch/avr/include/avr/limits.h new file mode 100644 index 000000000..d594408ce --- /dev/null +++ b/nuttx/arch/avr/include/avr/limits.h @@ -0,0 +1,84 @@ +/**************************************************************************** + * arch/avr/include/avr/limits.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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_AVR_INCLUDE_AVR_LIMITS_H +#define __ARCH_AVR_INCLUDE_AVR_LIMITS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define CHAR_BIT 8 +#define SCHAR_MIN 0x80 +#define SCHAR_MAX 0x7f +#define UCHAR_MAX 0xff + +/* These could be different on machines where char is unsigned */ + +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +#define SHRT_MIN 0x8000 +#define SHRT_MAX 0x7fff +#define USHRT_MAX 0xffff + +/* Integer is two bytes */ + +#define INT_MIN 0x8000 +#define INT_MAX 0x7fff +#define UINT_MAX 0xffff + +/* These change on 32-bit and 64-bit platforms */ + +#define LONG_MAX 0x80000000 +#define LONG_MIN 0x7fffffff +#define ULONG_MAX 0xffffffff + +#define LLONG_MAX 0x8000000000000000 +#define LLONG_MIN 0x7fffffffffffffff +#define ULLONG_MAX 0xffffffffffffffff + +/* A pointer is two bytes */ + +#define PTR_MIN 0x8000 +#define PTR_MAX 0x7fff +#define UPTR_MAX 0xffff + +#endif /* __ARCH_AVR_INCLUDE_AVR_LIMITS_H */ + diff --git a/nuttx/arch/avr/include/avr/syscall.h b/nuttx/arch/avr/include/avr/syscall.h new file mode 100644 index 000000000..de5c4e317 --- /dev/null +++ b/nuttx/arch/avr/include/avr/syscall.h @@ -0,0 +1,138 @@ +/**************************************************************************** + * arch/avr/include/avr/syscall.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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_AVR_INCLUDE_AVR_SYSCALL_H +#define __ARCH_AVR_INCLUDE_AVR_SYSCALL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <stdint.h> + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +#define SYS_syscall 0x80 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/* SWI with SYS_ call number and six parameters */ +#warning "REVISIT" +EXTERN uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1, + uintptr_t parm2, uintptr_t parm3, + uintptr_t parm4, uintptr_t parm5, + uintptr_t parm6); + +/* SWI with SYS_ call number and no parameters */ + +static inline uintptr_t sys_call0(unsigned int nbr) +{ + return sys_call6(nbr, 0, 0, 0, 0, 0, 0); +} + +/* SWI with SYS_ call number and one parameter */ + +static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1) +{ + return sys_call6(nbr, parm1, 0, 0, 0, 0, 0); +} + +/* SWI with SYS_ call number and two parameters */ + +static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1, + uintptr_t parm2) +{ + return sys_call6(nbr, parm1, parm2, 0, 0, 0, 0); +} + +/* SWI with SYS_ call number and three parameters */ + +static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1, + uintptr_t parm2, uintptr_t parm3) +{ + return sys_call6(nbr, parm1, parm2, parm3, 0, 0, 0); +} + +/* SWI with SYS_ call number and four parameters */ + +static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1, + uintptr_t parm2, uintptr_t parm3, + uintptr_t parm4) +{ + return sys_call6(nbr, parm1, parm2, parm3, parm4, 0, 0); +} + +/* SWI with SYS_ call number and five parameters */ + +static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1, + uintptr_t parm2, uintptr_t parm3, + uintptr_t parm4, uintptr_t parm5) +{ + return sys_call6(nbr, parm1, parm2, parm3, parm4, parm5, 0); +} + +#undef EXTERN +#ifdef __cplusplus +} +#endif +#endif + +#endif /* __ARCH_AVR_INCLUDE_AVR_SYSCALL_H */ + diff --git a/nuttx/arch/avr/include/avr/types.h b/nuttx/arch/avr/include/avr/types.h new file mode 100644 index 000000000..2e30414c4 --- /dev/null +++ b/nuttx/arch/avr/include/avr/types.h @@ -0,0 +1,95 @@ +/**************************************************************************** + * arch/avr/include/avr/types.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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 stdint.h + */ + +#ifndef __ARCH_AVR_INCLUDE_AVR_TYPES_H +#define __ARCH_AVR_INCLUDE_AVR_TYPES_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Type Declarations + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed to the final name without + * the underscore character. This roundabout way of doings things allows + * the stdint.h to be removed from the include/ directory in the event that + * the user prefers to use the definitions provided by their toolchain header + * files + */ + +typedef signed char _int8_t; +typedef unsigned char _uint8_t; + +typedef signed short _int16_t; +typedef unsigned short _uint16_t; + +typedef signed int _int32_t; +typedef unsigned int _uint32_t; + +typedef signed long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED + +/* A pointer is 4 bytes */ + +typedef signed int _intptr_t; +typedef unsigned int _uintptr_t; + +/* This is the size of the interrupt state save returned by irqsave(). */ + +typedef unsigned char irqstate_t; + +#endif /* __ASSEMBLY__ */ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __ARCH_AVR_INCLUDE_AVR_TYPES_H */ + diff --git a/nuttx/arch/avr/include/avr32/irq.h b/nuttx/arch/avr/include/avr32/irq.h index 691bc72d4..5d4ddf6b1 100644 --- a/nuttx/arch/avr/include/avr32/irq.h +++ b/nuttx/arch/avr/include/avr32/irq.h @@ -189,11 +189,6 @@ static inline void irqrestore(irqstate_t flags) } } -static inline void system_call3(unsigned int nbr, uintptr_t parm1, - uintptr_t parm2, uintptr_t parm3) -{ - /* To be provided */ -} #endif /* __ASSEMBLY__ */ /**************************************************************************** diff --git a/nuttx/arch/avr/include/avr32/limits.h b/nuttx/arch/avr/include/avr32/limits.h new file mode 100644 index 000000000..28cc1708c --- /dev/null +++ b/nuttx/arch/avr/include/avr32/limits.h @@ -0,0 +1,84 @@ +/**************************************************************************** + * arch/avr/include/avr32/limits.h + * + * Copyright (C) 2010, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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_AVR_INCLUDE_AVR32_LIMITS_H +#define __ARCH_AVR_INCLUDE_AVR32_LIMITS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define CHAR_BIT 8 +#define SCHAR_MIN 0x80 +#define SCHAR_MAX 0x7f +#define UCHAR_MAX 0xff + +/* These could be different on machines where char is unsigned */ + +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +#define SHRT_MIN 0x8000 +#define SHRT_MAX 0x7fff +#define USHRT_MAX 0xffff + +/* Integer is four bytes */ + +#define INT_MIN 0x80000000 +#define INT_MAX 0x7fffffff +#define UINT_MAX 0xffffffff + +/* These change on 32-bit and 64-bit platforms */ + +#define LONG_MAX 0x80000000 +#define LONG_MIN 0x7fffffff +#define ULONG_MAX 0xffffffff + +#define LLONG_MAX 0x8000000000000000 +#define LLONG_MIN 0x7fffffffffffffff +#define ULLONG_MAX 0xffffffffffffffff + +/* A pointer is four bytes */ + +#define PTR_MIN 0x80000000 +#define PTR_MAX 0x7fffffff +#define UPTR_MAX 0xffffffff + +#endif /* __ARCH_AVR_INCLUDE_AVR32_LIMITS_H */ + diff --git a/nuttx/arch/avr/include/avr32/types.h b/nuttx/arch/avr/include/avr32/types.h new file mode 100644 index 000000000..4b5f20cea --- /dev/null +++ b/nuttx/arch/avr/include/avr32/types.h @@ -0,0 +1,95 @@ +/**************************************************************************** + * arch/avr/include/avr32/types.h + * + * Copyright (C) 2010, 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * 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 stdint.h + */ + +#ifndef __ARCH_AVR_INCLUDE_AVR32_TYPES_H +#define __ARCH_AVR_INCLUDE_AVR32_TYPES_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Type Declarations + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed to the final name without + * the underscore character. This roundabout way of doings things allows + * the stdint.h to be removed from the include/ directory in the event that + * the user prefers to use the definitions provided by their toolchain header + * files + */ + +typedef signed char _int8_t; +typedef unsigned char _uint8_t; + +typedef signed short _int16_t; +typedef unsigned short _uint16_t; + +typedef signed int _int32_t; +typedef unsigned int _uint32_t; + +typedef signed long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED + +/* A pointer is 4 bytes */ + +typedef signed int _intptr_t; +typedef unsigned int _uintptr_t; + +/* This is the size of the interrupt state save returned by irqsave(). */ + +typedef unsigned int irqstate_t; + +#endif /* __ASSEMBLY__ */ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __ARCH_AVR_INCLUDE_AVR32_TYPES_H */ + diff --git a/nuttx/arch/avr/include/limits.h b/nuttx/arch/avr/include/limits.h index 80413e9c9..221383473 100644 --- a/nuttx/arch/avr/include/limits.h +++ b/nuttx/arch/avr/include/limits.h @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/include/limits.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -44,39 +44,13 @@ * Definitions ****************************************************************************/ -#define CHAR_BIT 8 -#define SCHAR_MIN 0x80 -#define SCHAR_MAX 0x7f -#define UCHAR_MAX 0xff +/* Include AVR architecture-specific limits */ -/* These could be different on machines where char is unsigned */ - -#define CHAR_MIN SCHAR_MIN -#define CHAR_MAX SCHAR_MAX - -#define SHRT_MIN 0x8000 -#define SHRT_MAX 0x7fff -#define USHRT_MAX 0xffff - -#define INT_MIN 0x80000000 -#define INT_MAX 0x7fffffff -#define UINT_MAX 0xffffffff - -/* These change on 32-bit and 64-bit platforms */ - -#define LONG_MAX 0x80000000 -#define LONG_MIN 0x7fffffff -#define ULONG_MAX 0xffffffff - -#define LLONG_MAX 0x8000000000000000 -#define LLONG_MIN 0x7fffffffffffffff -#define ULLONG_MAX 0xffffffffffffffff - -/* A pointer is 4 bytes */ - -#define PTR_MIN 0x80000000 -#define PTR_MAX 0x7fffffff -#define UPTR_MAX 0xffffffff +#ifdef CONFIG_ARCH_AVR32 +# include <arch/avr32/limits.h> +#else +# include <arch/avr/limits.h> +#endif #endif /* __ARCH_AVR_INCLUDE_LIMITS_H */ diff --git a/nuttx/arch/avr/include/types.h b/nuttx/arch/avr/include/types.h index c93e70df4..48481039f 100644 --- a/nuttx/arch/avr/include/types.h +++ b/nuttx/arch/avr/include/types.h @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/include/types.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,14 @@ * Included Files ****************************************************************************/ +/* Include AVR architecture-specific types definitions */ + +#ifdef CONFIG_ARCH_AVR32 +# include <arch/avr32/types.h> +#else +# include <arch/avr/types.h> +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -52,41 +60,6 @@ * Type Declarations ****************************************************************************/ -#ifndef __ASSEMBLY__ - -/* These are the sizes of the standard integer types. NOTE that these type - * names have a leading underscore character. This file will be included - * (indirectly) by include/stdint.h and typedef'ed to the final name without - * the underscore character. This roundabout way of doings things allows - * the stdint.h to be removed from the include/ directory in the event that - * the user prefers to use the definitions provided by their toolchain header - * files - */ - -typedef signed char _int8_t; -typedef unsigned char _uint8_t; - -typedef signed short _int16_t; -typedef unsigned short _uint16_t; - -typedef signed int _int32_t; -typedef unsigned int _uint32_t; - -typedef signed long long _int64_t; -typedef unsigned long long _uint64_t; -#define __INT64_DEFINED - -/* A pointer is 4 bytes */ - -typedef signed int _intptr_t; -typedef unsigned int _uintptr_t; - -/* This is the size of the interrupt state save returned by irqsave(). */ - -typedef unsigned int irqstate_t; - -#endif /* __ASSEMBLY__ */ - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ |