mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 14:53:34 +08:00
Resync new repository with old repo r5166
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5153 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/arch.h
|
||||
*
|
||||
* Copyright (C) 2010 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_AVR_INCLUDE_ARCH_H
|
||||
#define __ARCH_AVR_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_AVR_INCLUDE_ARCH_H */
|
||||
|
||||
@@ -0,0 +1,635 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/at32uc3/irq.h
|
||||
*
|
||||
* Copyright (C) 2010 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_AVR_INCLUDE_AT32UC3_IRQ_H
|
||||
#define __ARCH_AVR_INCLUDE_AT32UC3_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
/* Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the overall
|
||||
* GPIO IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or
|
||||
* CONFIG_AVR32_GPIOIRQSETB must be enabled to select GPIOs to support
|
||||
* interrupts on.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_AVR32_GPIOIRQ
|
||||
# undef CONFIG_AVR32_GPIOIRQSETA
|
||||
# undef CONFIG_AVR32_GPIOIRQSETB
|
||||
#endif
|
||||
|
||||
/* IRQ numbers **************************************************************/
|
||||
/* Events. These exclude:
|
||||
*
|
||||
* - The Reset event which vectors directly either to 0x8000:0000 (uc3a) or
|
||||
* to 0xa000:0000 (uc3b).
|
||||
* - The OCD stop from the OSD system
|
||||
* - Autovectored interrupt requests
|
||||
*
|
||||
* Others vector relative to the contents of the EVBA register.
|
||||
*/
|
||||
|
||||
#define AVR32_IRQ_UNREC 0 /* EVBA+0x00 Unrecoverable exception */
|
||||
#define AVR32_IRQ_TLBMULT 1 /* EVBA+0x04 TLB multiple hit */
|
||||
#define AVR32_IRQ_BUSDATA 2 /* EVBA+0x08 Bus error data fetch */
|
||||
#define AVR32_IRQ_BUSINST 3 /* EVBA+0x0c Bus error instruction fetch */
|
||||
#define AVR32_IRQ_NMI 4 /* EVBA+0x10 NMI */
|
||||
#define AVR32_IRQ_INSTADDR 5 /* EVBA+0x14 Instruction Address */
|
||||
#define AVR32_IRQ_ITLBPROT 6 /* EVBA+0x18 ITLB Protection */
|
||||
#define AVR32_IRQ_BP 7 /* EVBA+0x1c Breakpoint */
|
||||
#define AVR32_IRQ_INVINST 8 /* EVBA+0x20 Illegal Opcode */
|
||||
#define AVR32_IRQ_UNIMPINST 9 /* EVBA+0x24 Unimplemented instruction */
|
||||
#define AVR32_IRQ_PRIV 10 /* EVBA+0x28 Privilege violation */
|
||||
#define AVR32_IRQ_FP 11 /* EVBA+0x2c Floating-point */
|
||||
#define AVR32_IRQ_COP 12 /* EVBA+0x30 Coprocessor absent */
|
||||
#define AVR32_IRQ_RDDATA 13 /* EVBA+0x34 Data Address (Read) */
|
||||
#define AVR32_IRQ_WRDATA 14 /* EVBA+0x38 Data Address (Write) */
|
||||
#define AVR32_IRQ_RDDTLBPROT 15 /* EVBA+0x3c DTLB Protection (Read) */
|
||||
#define AVR32_IRQ_WRDTLBPROT 16 /* EVBA+0x40 DTLB Protection (Write) */
|
||||
#define AVR32_IRQ_DLTBMOD 17 /* EVBA+0x44 DTLB Modified */
|
||||
#define AVR32_IRQ_ITLBMISS 18 /* EVBA+0x50 ITLB Miss */
|
||||
#define AVR32_IRQ_RDDTLB 19 /* EVBA+0x60 DTLB Miss (Read) */
|
||||
#define AVR32_IRQ_WRDTLB 20 /* EVBA+0x70 DTLB Miss (Write) */
|
||||
#define AVR32_IRQ_SUPER 21 /* EVBA+0x100 Supervisor call */
|
||||
#define AVR32_IRQ_NEVENTS 22
|
||||
|
||||
/* "The INTC collects interrupt requests from the peripherals, prioritizes
|
||||
* them, and delivers an interrupt request and an autovector to the CPU. The
|
||||
* AVR32 architecture supports 4 priority levels for regular, maskable
|
||||
* interrupts, and a Non-Maskable Interrupt (NMI)."
|
||||
*
|
||||
* "The INTC supports up to 64 groups of interrupts. Each group can have up
|
||||
* to 32 interrupt request lines, these lines are connected to the peripherals.
|
||||
* Each group has an Interrupt Priority Register (IPR) and an Interrupt Request
|
||||
* Register (IRR). The IPRs are used to assign a priority level and an autovector
|
||||
* to each group, and the IRRs are used to identify the active interrupt request
|
||||
* within each group. If a group has only one interrupt request line, an active
|
||||
* interrupt group uniquely identifies the active interrupt request line, and
|
||||
* the corresponding IRR is not needed. The INTC also provides one Interrupt
|
||||
* Cause Register (ICR) per priority level. These registers identify the group
|
||||
* that has a pending interrupt of the corresponding priority level. If several
|
||||
* groups have a pending interrupt of the same level, the group with the lowest
|
||||
* number takes priority."
|
||||
*/
|
||||
|
||||
/* Only 19 groups (0-18) are used with the AT32UC3A/B: */
|
||||
|
||||
#define AVR32_IRQ_INTPRIOS 4 /* 4 interrupt priorities */
|
||||
#define AVR32_IRQ_MAXGROUPS 64 /* Architecture supports up to 64 groups */
|
||||
#define AVR32_IRQ_NGROUPS 19 /* UC3 A/B support only 19 */
|
||||
|
||||
/* Group 0 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP0 22
|
||||
#define AVR32_IRQ_NREQGRP0 1
|
||||
|
||||
#define AVR32_IRQ_UC 22 /* 0 AVR32 UC CPU */
|
||||
|
||||
/* Group 1 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP1 23
|
||||
#define AVR32_IRQ_NREQGRP1 10
|
||||
|
||||
#define AVR32_IRQ_EIC0 23 /* 0 External Interrupt Controller 0 */
|
||||
#define AVR32_IRQ_EIC1 24 /* 1 External Interrupt Controller 1 */
|
||||
#define AVR32_IRQ_EIC2 25 /* 2 External Interrupt Controller 2 */
|
||||
#define AVR32_IRQ_EIC3 26 /* 3 External Interrupt Controller 3 */
|
||||
#define AVR32_IRQ_EIC4 27 /* 4 External Interrupt Controller 4 */
|
||||
#define AVR32_IRQ_EIC5 28 /* 5 External Interrupt Controller 5 */
|
||||
#define AVR32_IRQ_EIC6 29 /* 6 External Interrupt Controller 6 */
|
||||
#define AVR32_IRQ_EIC7 30 /* 7 External Interrupt Controller 7 */
|
||||
#define AVR32_IRQ_RTC 31 /* 8 Real Time Counter RTC */
|
||||
#define AVR32_IRQ_PM 32 /* 9 Power Manager PM */
|
||||
|
||||
/* Group 2 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP2 33
|
||||
#define AVR32_IRQ_NREQGRP2 6
|
||||
|
||||
#define AVR32_IRQ_GPIO0 33 /* 0 General Purpose Input/Output Controller 0 */
|
||||
#define AVR32_IRQ_GPIO1 34 /* 1 General Purpose Input/Output Controller 1 */
|
||||
#define AVR32_IRQ_GPIO2 35 /* 2 General Purpose Input/Output Controller 2 */
|
||||
#define AVR32_IRQ_GPIO3 36 /* 3 General Purpose Input/Output Controller 3 */
|
||||
#define AVR32_IRQ_GPIO4 37 /* 4 General Purpose Input/Output Controller 4 */
|
||||
#define AVR32_IRQ_GPIO5 38 /* 5 General Purpose Input/Output Controller 5 */
|
||||
|
||||
/* Group 3 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP3 39
|
||||
#define AVR32_IRQ_NREQGRP3 7
|
||||
|
||||
#define AVR32_IRQ_PDCA0 39 /* 0 Peripheral DMA Controller 0 */
|
||||
#define AVR32_IRQ_PDCA1 40 /* 1 Peripheral DMA Controller 1 */
|
||||
#define AVR32_IRQ_PDCA2 41 /* 2 Peripheral DMA Controller 2 */
|
||||
#define AVR32_IRQ_PDCA3 42 /* 3 Peripheral DMA Controller 3 */
|
||||
#define AVR32_IRQ_PDCA4 43 /* 4 Peripheral DMA Controller 4 */
|
||||
#define AVR32_IRQ_PDCA5 44 /* 5 Peripheral DMA Controller 5 */
|
||||
#define AVR32_IRQ_PDCA6 45 /* 6 Peripheral DMA Controller 6 */
|
||||
|
||||
/* Group 4 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP4 46
|
||||
#define AVR32_IRQ_NREQGRP4 1
|
||||
|
||||
#define AVR32_IRQ_FLASHC 46 /* 0 Flash Controller */
|
||||
|
||||
/* Group 5 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP5 47
|
||||
#define AVR32_IRQ_NREQGRP5 1
|
||||
|
||||
#define AVR32_IRQ_USART0 47 /* 0 Universal Synchronous/Asynchronous
|
||||
* Receiver/Transmitter 0 */
|
||||
/* Group 6 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP6 48
|
||||
#define AVR32_IRQ_NREQGRP6 1
|
||||
|
||||
#define AVR32_IRQ_USART1 48 /* 0 Universal Synchronous/Asynchronous
|
||||
* Receiver/Transmitter 1 */
|
||||
/* Group 7 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP7 49
|
||||
#define AVR32_IRQ_NREQGRP7 1
|
||||
|
||||
#define AVR32_IRQ_USART2 49 /* 0 Universal Synchronous/Asynchronous
|
||||
* Receiver/Transmitter 2 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP8 50
|
||||
#define AVR32_IRQ_NREQGRP8 0
|
||||
|
||||
/* Group 9 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP9 50
|
||||
#define AVR32_IRQ_NREQGRP9 1
|
||||
|
||||
#define AVR32_IRQ_SPI 50 /* 0 Serial Peripheral Interface */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP10 51
|
||||
#define AVR32_IRQ_NREQGRP10 0
|
||||
|
||||
/* Group 11 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP11 51
|
||||
#define AVR32_IRQ_NREQGRP11 1
|
||||
|
||||
#define AVR32_IRQ_TWI 51 /* 0 Two-wire Interface TWI */
|
||||
|
||||
/* Group 12 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP12 52
|
||||
#define AVR32_IRQ_NREQGRP12 1
|
||||
|
||||
#define AVR32_IRQ_PWM 52 /* 0 Pulse Width Modulation Controller */
|
||||
|
||||
/* Group 13 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP13 53
|
||||
#define AVR32_IRQ_NREQGRP13 1
|
||||
|
||||
#define AVR32_IRQ_SSC 53 /* 0 Synchronous Serial Controller */
|
||||
|
||||
/* Group 14 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP14 54
|
||||
#define AVR32_IRQ_NREQGRP14 3
|
||||
|
||||
#define AVR32_IRQ_TC0 54 /* 0 Timer/Counter 0 */
|
||||
#define AVR32_IRQ_TC1 55 /* 1 Timer/Counter 1 */
|
||||
#define AVR32_IRQ_TC2 56 /* 2 Timer/Counter 2 */
|
||||
|
||||
/* Group 15 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP15 57
|
||||
#define AVR32_IRQ_NREQGRP15 1
|
||||
|
||||
#define AVR32_IRQ_ADC 57 /* 0 Analog to Digital Converter */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP16 58
|
||||
#define AVR32_IRQ_NREQGRP16 0
|
||||
|
||||
/* Group 17 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP17 58
|
||||
#define AVR32_IRQ_NREQGRP17 1
|
||||
|
||||
#define AVR32_IRQ_USBB 58 /* 0 USB 2.0 Interface USBB */
|
||||
|
||||
/* Group 18 */
|
||||
|
||||
#define AVR32_IRQ_BASEIRQGRP18 59
|
||||
#define AVR32_IRQ_NREQGRP18 1
|
||||
|
||||
#define AVR32_IRQ_ABDAC 59 /* 0 Audio Bitstream DAC */
|
||||
|
||||
/* Total number of IRQ numbers */
|
||||
|
||||
#define AVR32_IRQ_BADVECTOR 60 /* Not a real IRQ number */
|
||||
#define NR_IRQS 60
|
||||
|
||||
/* GPIO IRQ Numbers *********************************************************/
|
||||
/* These numbers correspond to GPIO port numbers that have interrupts
|
||||
* enabled. These are all decoded by the AVR32_IRQ_GPIO interrupt handler.
|
||||
* A lot of effort was made here to keep the number of IRQs to a minimum
|
||||
* since it will correspond to various, internal table sizes.
|
||||
*/
|
||||
|
||||
/* Up to 32 GPIO interrupts in PORTA0-31 */
|
||||
|
||||
#define __IRQ_GPPIO_PA0 0
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000001) != 0
|
||||
# define AVR32_IRQ_GPIO_PA0 __IRQ_GPPIO_PA0
|
||||
# define __IRQ_GPIO_PA1 (__IRQ_GPPIO_PA0+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA1 __IRQ_GPPIO_PA0
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000002) != 0
|
||||
# define AVR32_IRQ_GPIO_PA1 __IRQ_GPIO_PA1
|
||||
# define __IRQ_GPIO_PA2 (__IRQ_GPIO_PA1+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA2 __IRQ_GPIO_PA1
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000004) != 0
|
||||
# define AVR32_IRQ_GPIO_PA2 __IRQ_GPIO_PA2
|
||||
# define __IRQ_GPIO_PA3 (__IRQ_GPIO_PA2+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA3 __IRQ_GPIO_PA2
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000008) != 0
|
||||
# define AVR32_IRQ_GPIO_PA3 __IRQ_GPIO_PA3
|
||||
# define __IRQ_GPIO_PA4 (__IRQ_GPIO_PA3+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA4 __IRQ_GPIO_PA3
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000010) != 0
|
||||
# define AVR32_IRQ_GPIO_PA4 __IRQ_GPIO_PA4
|
||||
# define __IRQ_GPIO_PA5 (__IRQ_GPIO_PA4+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA5 __IRQ_GPIO_PA4
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000020) != 0
|
||||
# define AVR32_IRQ_GPIO_PA5 __IRQ_GPIO_PA5
|
||||
# define __IRQ_GPIO_PA6 (__IRQ_GPIO_PA5+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA6 __IRQ_GPIO_PA5
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000040) != 0
|
||||
# define AVR32_IRQ_GPIO_PA6 __IRQ_GPIO_PA6
|
||||
# define __IRQ_GPIO_PA7 (__IRQ_GPIO_PA6+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA7 __IRQ_GPIO_PA6
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000080) != 0
|
||||
# define AVR32_IRQ_GPIO_PA7 __IRQ_GPIO_PA7
|
||||
# define __IRQ_GPIO_PA8 (__IRQ_GPIO_PA7+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA8 __IRQ_GPIO_PA7
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000100) != 0
|
||||
# define AVR32_IRQ_GPIO_PA8 __IRQ_GPIO_PA8
|
||||
# define __IRQ_GPIO_PA9 (__IRQ_GPIO_PA8+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA9 __IRQ_GPIO_PA8
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000200) != 0
|
||||
# define AVR32_IRQ_GPIO_PA9 __IRQ_GPIO_PA9
|
||||
# define __IRQ_GPIO_PA10 (__IRQ_GPIO_PA9+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA10 __IRQ_GPIO_PA9
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000400) != 0
|
||||
# define AVR32_IRQ_GPIO_PA10 __IRQ_GPIO_PA10
|
||||
# define __IRQ_GPIO_PA11 (__IRQ_GPIO_PA10+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA11 __IRQ_GPIO_PA10
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00000800) != 0
|
||||
# define AVR32_IRQ_GPIO_PA11 __IRQ_GPIO_PA11
|
||||
# define __IRQ_GPIO_PA12 (__IRQ_GPIO_PA11+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA12 __IRQ_GPIO_PA11
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00001000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA12 __IRQ_GPIO_PA12
|
||||
# define __IRQ_GPIO_PA13 (__IRQ_GPIO_PA12+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA13 __IRQ_GPIO_PA12
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00002000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA13 __IRQ_GPIO_PA13
|
||||
# define __IRQ_GPIO_PA14 (__IRQ_GPIO_PA13+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA14 __IRQ_GPIO_PA13
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00004000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA14 __IRQ_GPIO_PA14
|
||||
# define __IRQ_GPIO_PA15 (__IRQ_GPIO_PA14+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA15 __IRQ_GPIO_PA14
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00008000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA15 __IRQ_GPIO_PA15
|
||||
# define __IRQ_GPIO_PA16 (__IRQ_GPIO_PA15+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA16 __IRQ_GPIO_PA15
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00010000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA16 __IRQ_GPIO_PA16
|
||||
# define __IRQ_GPIO_PA17 (__IRQ_GPIO_PA16+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA17 __IRQ_GPIO_PA16
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00020000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA17 __IRQ_GPIO_PA17
|
||||
# define __IRQ_GPIO_PA18 (__IRQ_GPIO_PA17+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA18 __IRQ_GPIO_PA17
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00040000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA18 __IRQ_GPIO_PA18
|
||||
# define __IRQ_GPIO_PA19 (__IRQ_GPIO_PA18+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA19 __IRQ_GPIO_PA18
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00080000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA19 __IRQ_GPIO_PA19
|
||||
# define __IRQ_GPIO_PA20 (__IRQ_GPIO_PA19+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA20 __IRQ_GPIO_PA19
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00100000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA20 __IRQ_GPIO_PA20
|
||||
# define __IRQ_GPIO_PA21 (__IRQ_GPIO_PA20+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA21 __IRQ_GPIO_PA20
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00200000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA21 __IRQ_GPIO_PA21
|
||||
# define __IRQ_GPIO_PA22 (__IRQ_GPIO_PA21+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA22 __IRQ_GPIO_PA21
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00400000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA22 __IRQ_GPIO_PA22
|
||||
# define __IRQ_GPIO_PA23 (__IRQ_GPIO_PA22+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA23 __IRQ_GPIO_PA22
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x00800000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA23 __IRQ_GPIO_PA23
|
||||
# define __IRQ_GPIO_PA24 (__IRQ_GPIO_PA23+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA24 __IRQ_GPIO_PA23
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x01000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA24 __IRQ_GPIO_PA24
|
||||
# define __IRQ_GPIO_PA25 (__IRQ_GPIO_PA24+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA25 __IRQ_GPIO_PA24
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x02000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA25 __IRQ_GPIO_PA25
|
||||
# define __IRQ_GPIO_PA26 (__IRQ_GPIO_PA25+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA26 __IRQ_GPIO_PA25
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x04000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA26 __IRQ_GPIO_PA26
|
||||
# define __IRQ_GPIO_PA27 (__IRQ_GPIO_PA26+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA27 __IRQ_GPIO_PA26
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x08000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA27 __IRQ_GPIO_PA27
|
||||
# define __IRQ_GPIO_PA28 (__IRQ_GPIO_PA27+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA28 __IRQ_GPIO_PA27
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x10000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA28 __IRQ_GPIO_PA28
|
||||
# define __IRQ_GPIO_PA29 (__IRQ_GPIO_PA28+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA29 __IRQ_GPIO_PA28
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x20000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA29 __IRQ_GPIO_PA29
|
||||
# define __IRQ_GPIO_PA30 (__IRQ_GPIO_PA29+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA30 __IRQ_GPIO_PA29
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x40000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA30 __IRQ_GPIO_PA30
|
||||
# define __IRQ_GPIO_PA31 (__IRQ_GPIO_PA30+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PA31 __IRQ_GPIO_PA30
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETA & 0x80000000) != 0
|
||||
# define AVR32_IRQ_GPIO_PA31 __IRQ_GPIO_PA31
|
||||
# define __IRQ_GPIO_PB0 (__IRQ_GPIO_PA31+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB0 __IRQ_GPIO_PA31
|
||||
#endif
|
||||
|
||||
|
||||
/* Up to 12 GPIO interrupts in PORTB0-11 */
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000001) != 0
|
||||
# define AVR32_IRQ_GPIO_PB0 __IRQ_GPIO_pb0
|
||||
# define __IRQ_GPIO_PB1 (__IRQ_GPIO_PB0+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB1 __IRQ_GPIO_PB0
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000002) != 0
|
||||
# define AVR32_IRQ_GPIO_PB1 __IRQ_GPIO_PB1
|
||||
# define __IRQ_GPIO_PB2 (__IRQ_GPIO_PB1+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB2 __IRQ_GPIO_PB1
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000004) != 0
|
||||
# define AVR32_IRQ_GPIO_PB2 __IRQ_GPIO_PB2
|
||||
# define __IRQ_GPIO_PB3 (__IRQ_GPIO_PB2+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB3 __IRQ_GPIO_PB2
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000008) != 0
|
||||
# define AVR32_IRQ_GPIO_PB3 __IRQ_GPIO_PB3
|
||||
# define __IRQ_GPIO_PB4 (__IRQ_GPIO_PB3+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB4 __IRQ_GPIO_PB3
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000010) != 0
|
||||
# define AVR32_IRQ_GPIO_PB4 __IRQ_GPIO_PB4
|
||||
# define __IRQ_GPIO_PB5 (__IRQ_GPIO_PB4+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB5 __IRQ_GPIO_PB4
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000020) != 0
|
||||
# define AVR32_IRQ_GPIO_PB5 __IRQ_GPIO_PB5
|
||||
# define __IRQ_GPIO_PB6 (__IRQ_GPIO_PB5+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB6 __IRQ_GPIO_PB5
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000040) != 0
|
||||
# define AVR32_IRQ_GPIO_PB6 __IRQ_GPIO_PB6
|
||||
# define __IRQ_GPIO_PB7 (__IRQ_GPIO_PB6+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB7 __IRQ_GPIO_PB6
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000080) != 0
|
||||
# define AVR32_IRQ_GPIO_PB7 __IRQ_GPIO_PB7
|
||||
# define __IRQ_GPIO_PB8 (__IRQ_GPIO_PB7+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB8 __IRQ_GPIO_PB7
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000100) != 0
|
||||
# define AVR32_IRQ_GPIO_PB8 __IRQ_GPIO_PB8
|
||||
# define __IRQ_GPIO_PB9 (__IRQ_GPIO_PB8+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB9 __IRQ_GPIO_PB8
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000200) != 0
|
||||
# define AVR32_IRQ_GPIO_PB9 __IRQ_GPIO_PB9
|
||||
# define __IRQ_GPIO_PB10 (__IRQ_GPIO_PB9+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB10 __IRQ_GPIO_PB9
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000400) != 0
|
||||
# define AVR32_IRQ_GPIO_PB10 __IRQ_GPIO_PB10
|
||||
# define __IRQ_GPIO_PB11 (__IRQ_GPIO_PB10+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB11 __IRQ_GPIO_PB10
|
||||
#endif
|
||||
|
||||
#if (CONFIG_AVR32_GPIOIRQSETB & 0x00000800) != 0
|
||||
# define AVR32_IRQ_GPIO_PB11 __IRQ_GPIO_PB11
|
||||
# define __IRQ_GPIO_PB12 (__IRQ_GPIO_PB11+1)
|
||||
#else
|
||||
# define __IRQ_GPIO_PB12 __IRQ_GPIO_PB11
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AVR32_GPIOIRQ
|
||||
# define NR_GPIO_IRQS __IRQ_GPIO_PB12
|
||||
#else
|
||||
# define NR_GPIO_IRQS 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* 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_AVR_INCLUDE_AT32UC3_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr/at90usb/irq.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_AVR_INCLUDE_AT90USB_IRQ_H
|
||||
#define __ARCH_AVR_INCLUDE_AT90USB_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/avr/avr.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The AT90USB has 38 interrupt vectors including vector 0, the reset
|
||||
* vector. The remaining 37 are assigned IRQ numbers here:
|
||||
*/
|
||||
|
||||
#define AT90USB_IRQ_INT0 0 /* 0x0002 External Interrupt Request 0 */
|
||||
#define AT90USB_IRQ_INT1 1 /* 0x0004 External Interrupt Request 1 */
|
||||
#define AT90USB_IRQ_INT2 2 /* 0x0006 External Interrupt Request 2 */
|
||||
#define AT90USB_IRQ_INT3 3 /* 0x0008 External Interrupt Request 3 */
|
||||
#define AT90USB_IRQ_INT4 4 /* 0x000a External Interrupt Request 4 */
|
||||
#define AT90USB_IRQ_INT5 5 /* 0x000c External Interrupt Request 5 */
|
||||
#define AT90USB_IRQ_INT6 6 /* 0x000e External Interrupt Request 6 */
|
||||
#define AT90USB_IRQ_INT7 7 /* 0x0010 External Interrupt Request 7 */
|
||||
#define AT90USB_IRQ_PCINT0 8 /* 0x0012 Pin Change Interrupt Request 0 */
|
||||
#define AT90USB_IRQ_USBGEN 9 /* 0x0014 USB General USB General Interrupt request */
|
||||
#define AT90USB_IRQ_USBEP 10 /* 0x0016 USB Endpoint/Pipe USB ENdpoint/Pipe Interrupt request */
|
||||
#define AT90USB_IRQ_WDT 11 /* 0x0018 Watchdog Time-out Interrupt */
|
||||
#define AT90USB_IRQ_T2COMPA 12 /* 0x001a TIMER2 COMPA Timer/Counter2 Compare Match A */
|
||||
#define AT90USB_IRQ_T2COMPB 13 /* 0x001c TIMER2 COMPB Timer/Counter2 Compare Match B */
|
||||
#define AT90USB_IRQ_T2OVF 14 /* 0x001e TIMER2 OVF Timer/Counter2 Overflow */
|
||||
#define AT90USB_IRQ_T1CAPT 15 /* 0x0020 TIMER1 CAPT Timer/Counter1 Capture Event */
|
||||
#define AT90USB_IRQ_T1COMPA 16 /* 0x0022 TIMER1 COMPA Timer/Counter1 Compare Match A */
|
||||
#define AT90USB_IRQ_T1COMPB 17 /* 0x0024 TIMER1 COMPB Timer/Counter1 Compare Match B */
|
||||
#define AT90USB_IRQ_T1COMPC 18 /* 0x0026 TIMER1 COMPC Timer/Counter1 Compare Match c */
|
||||
#define AT90USB_IRQ_T1OVF 19 /* 0x0028 TIMER1 OVF Timer/Counter1 Overflow */
|
||||
#define AT90USB_IRQ_T0COMPA 20 /* 0x002a TIMER0 COMPA Timer/Counter0 Compare Match A */
|
||||
#define AT90USB_IRQ_T0COMPB 21 /* 0x002c TIMER0 COMPB Timer/Counter0 Compare Match B */
|
||||
#define AT90USB_IRQ_T0OVF 22 /* 0x002e TIMER0 OVF Timer/Counter0 Overflow */
|
||||
#define AT90USB_IRQ_SPI 23 /* 0x0030 STC SPI Serial Transfer Complete */
|
||||
#define AT90USB_IRQ_U1RX 24 /* 0x0032 USART1 Rx Complete */
|
||||
#define AT90USB_IRQ_U1DRE 25 /* 0x0034 USART1 Data Register Empty */
|
||||
#define AT90USB_IRQ_U1TX 26 /* 0x0036 USART1 Tx Complete */
|
||||
#define AT90USB_IRQ_ANACOMP 27 /* 0x0038 ANALOG COMP Analog Comparator */
|
||||
#define AT90USB_IRQ_ADC 28 /* 0x003a ADC Conversion Complete */
|
||||
#define AT90USB_IRQ_EE 29 /* 0x003c EEPROM Ready */
|
||||
#define AT90USB_IRQ_T3CAPT 30 /* 0x003e TIMER3 CAPT Timer/Counter3 Capture Event */
|
||||
#define AT90USB_IRQ_T3COMPA 31 /* 0x0034 TIMER3 COMPA Timer/Counter3 Compare Match A */
|
||||
#define AT90USB_IRQ_T3COMPB 32 /* 0x0042 TIMER3 COMPB Timer/Counter3 Compare Match B */
|
||||
#define AT90USB_IRQ_T3COMPC 33 /* 0x0044 TIMER3 COMPC Timer/Counter3 Compare Match C */
|
||||
#define AT90USB_IRQ_T3OVF 34 /* 0x0046 TIMER3 OVF Timer/Counter3 Overflow */
|
||||
#define AT90USB_IRQ_TWI 35 /* 0x0048 TWI Two-wire Serial Interface */
|
||||
#define AT90USB_IRQ_SPMRDY 36 /* 0x004a Store Program Memory Ready */
|
||||
|
||||
#define NR_IRQS 37
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#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_AT90USB_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr/atmega/irq.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_AVR_INCLUDE_ATMEGA_IRQ_H
|
||||
#define __ARCH_AVR_INCLUDE_ATMEGA_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/avr/avr.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The ATmega128 has 35 interrupt vectors including vector 0, the reset
|
||||
* vector. The remaining 34 are assigned IRQ numbers here:
|
||||
*/
|
||||
|
||||
#define ATMEGA_IRQ_INT0 0 /* 0x0002 External Interrupt Request 0 */
|
||||
#define ATMEGA_IRQ_INT1 1 /* 0x0004 External Interrupt Request 1 */
|
||||
#define ATMEGA_IRQ_INT2 2 /* 0x0006 External Interrupt Request 2 */
|
||||
#define ATMEGA_IRQ_INT3 3 /* 0x0008 External Interrupt Request 3 */
|
||||
#define ATMEGA_IRQ_INT4 4 /* 0x000a External Interrupt Request 4 */
|
||||
#define ATMEGA_IRQ_INT5 5 /* 0x000c External Interrupt Request 5 */
|
||||
#define ATMEGA_IRQ_INT6 6 /* 0x000e External Interrupt Request 6 */
|
||||
#define ATMEGA_IRQ_INT7 7 /* 0x0010 External Interrupt Request 7 */
|
||||
#define ATMEGA_IRQ_T2COMP 8 /* 0x0012 TIMER2 COMP Timer/Counter2 Compare Match */
|
||||
#define ATMEGA_IRQ_T2OVF 9 /* 0x0014 TIMER2 OVF Timer/Counter2 Overflow */
|
||||
#define ATMEGA_IRQ_T1CAPT 10 /* 0x0016 TIMER1 CAPT Timer/Counter1 Capture Event */
|
||||
#define ATMEGA_IRQ_T1COMPA 11 /* 0x0018 TIMER1 COMPA Timer/Counter1 Compare Match A */
|
||||
#define ATMEGA_IRQ_T1COMPB 12 /* 0x001a TIMER1 COMPB Timer/Counter1 Compare Match B */
|
||||
#define ATMEGA_IRQ_T1OVF 13 /* 0x001c TIMER1 OVF Timer/Counter1 Overflow */
|
||||
#define ATMEGA_IRQ_T0COMP 14 /* 0x001e TIMER0 COMP Timer/Counter0 Compare Match */
|
||||
#define ATMEGA_IRQ_T0OVF 15 /* 0x0020 TIMER0 OVF Timer/Counter0 Overflow */
|
||||
#define ATMEGA_IRQ_SPI 16 /* 0x0022 STC SPI Serial Transfer Complete */
|
||||
#define ATMEGA_IRQ_U0RX 17 /* 0x0024 USART0 Rx Complete */
|
||||
#define ATMEGA_IRQ_U0DRE 18 /* 0x0026 USART0 Data Register Empty */
|
||||
#define ATMEGA_IRQ_U0TX 19 /* 0x0028 USART0 Tx Complete */
|
||||
#define ATMEGA_IRQ_ADC 20 /* 0x002a ADC Conversion Complete */
|
||||
#define ATMEGA_IRQ_EE 21 /* 0x002c EEPROM Ready */
|
||||
#define ATMEGA_IRQ_ANACOMP 22 /* 0x002e ANALOG COMP Analog Comparator */
|
||||
#define ATMEGA_IRQ_T1COMPC 23 /* 0x0030 TIMER1 COMPC Timer/Countre1 Compare Match C */
|
||||
#define ATMEGA_IRQ_T3CAPT 24 /* 0x0032 TIMER3 CAPT Timer/Counter3 Capture Event */
|
||||
#define ATMEGA_IRQ_T3COMPA 25 /* 0x0034 TIMER3 COMPA Timer/Counter3 Compare Match A */
|
||||
#define ATMEGA_IRQ_T3COMPB 26 /* 0x0036 TIMER3 COMPB Timer/Counter3 Compare Match B */
|
||||
#define ATMEGA_IRQ_T3COMPC 27 /* 0x0038 TIMER3 COMPC Timer/Counter3 Compare Match C */
|
||||
#define ATMEGA_IRQ_T3OVF 28 /* 0x003a TIMER3 OVF Timer/Counter3 Overflow */
|
||||
#define ATMEGA_IRQ_U1RX 29 /* 0x003c USART1 Rx Complete */
|
||||
#define ATMEGA_IRQ_U1DRE 30 /* 0x003e USART1 Data Register Empty */
|
||||
#define ATMEGA_IRQ_U1TX 31 /* 0x0040 USART1 Tx Complete */
|
||||
#define ATMEGA_IRQ_TWI 32 /* 0x0042 TWI Two-wire Serial Interface */
|
||||
#define ATMEGA_IRQ_SPMRDY 33 /* 0x0044 Store Program Memory Ready */
|
||||
|
||||
#define NR_IRQS 34
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#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_ATMEGA_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/************************************************************************************
|
||||
* arch/avr/include/avr/avr.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_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 */
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr/irq.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_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_SPH 0 /* Stack pointer on exception entry */
|
||||
#define REG_SPL 1
|
||||
#define REG_R27 2 /* r26-r27 */
|
||||
#define REG_R26 3
|
||||
#define REG_R31 4 /* r18-r31 */
|
||||
#define REG_R30 5
|
||||
#define REG_R29 6
|
||||
#define REG_R28 7
|
||||
#define REG_R23 8 /* r2-r23 */
|
||||
#define REG_R22 9
|
||||
#define REG_R21 10
|
||||
#define REG_R20 11
|
||||
#define REG_R19 12
|
||||
#define REG_R18 13
|
||||
#define REG_R17 14
|
||||
#define REG_R16 15
|
||||
#define REG_R15 16
|
||||
#define REG_R14 17
|
||||
#define REG_R13 18
|
||||
#define REG_R12 19
|
||||
#define REG_R11 20
|
||||
#define REG_R10 21
|
||||
#define REG_R9 22
|
||||
#define REG_R8 23
|
||||
#define REG_R7 24
|
||||
#define REG_R6 25
|
||||
#define REG_R5 26
|
||||
#define REG_R4 27
|
||||
#define REG_R3 28
|
||||
#define REG_R2 29
|
||||
#define REG_R1 30 /* r1 - the "zero" register */
|
||||
#define REG_R0 31 /* r0 */
|
||||
#define REG_SREG 32 /* Status register */
|
||||
#define REG_R25 33 /* r24-r25 */
|
||||
#define REG_R24 34
|
||||
|
||||
/* The program counter is automatically pushed when the interrupt occurs */
|
||||
|
||||
#define REG_PCH 35 /* PC */
|
||||
#define REG_PCL 36
|
||||
|
||||
/* Size of the register state save array (in bytes) */
|
||||
|
||||
#define XCPTCONTEXT_REGS 37
|
||||
|
||||
/****************************************************************************
|
||||
* 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.*/
|
||||
|
||||
uint8_t saved_pcl;
|
||||
uint8_t saved_pch;
|
||||
uint8_t saved_sreg;
|
||||
#endif
|
||||
|
||||
/* Register save area */
|
||||
|
||||
uint8_t regs[XCPTCONTEXT_REGS];
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* Read/write the SREG */
|
||||
|
||||
static inline irqstate_t getsreg(void)
|
||||
{
|
||||
irqstate_t sreg;
|
||||
asm volatile ("in %0, __SREG__" : "=r" (sreg) :: );
|
||||
return sreg;
|
||||
}
|
||||
|
||||
static inline void putsreg(irqstate_t sreg)
|
||||
{
|
||||
asm volatile ("out __SREG__, %s" : : "r" (sreg) : );
|
||||
}
|
||||
|
||||
/* Interrupt enable/disable */
|
||||
|
||||
static inline void irqenable()
|
||||
{
|
||||
asm volatile ("sei" ::);
|
||||
}
|
||||
|
||||
static inline void irqdisable()
|
||||
{
|
||||
asm volatile ("cli" ::);
|
||||
}
|
||||
|
||||
/* Save the current interrupt enable state & disable all interrupts */
|
||||
|
||||
static inline irqstate_t irqsave(void)
|
||||
{
|
||||
irqstate_t sreg;
|
||||
asm volatile
|
||||
(
|
||||
"\tin %0, __SREG__\n"
|
||||
"\tcli\n"
|
||||
: "=&r" (sreg) ::
|
||||
);
|
||||
return sreg;
|
||||
}
|
||||
|
||||
/* Restore saved interrupt state */
|
||||
|
||||
static inline void irqrestore(irqstate_t flags)
|
||||
{
|
||||
asm volatile ("out __SREG__, %0" : : "r" (flags) : );
|
||||
}
|
||||
#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 */
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr/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 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 (-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
|
||||
|
||||
/* Integer is two bytes */
|
||||
|
||||
#define INT_MIN (-32768)
|
||||
#define INT_MAX 32767
|
||||
#define UINT_MAX 65535
|
||||
|
||||
/* These change on 32-bit and 64-bit platforms */
|
||||
|
||||
#define LONG_MIN (-2147483648L)
|
||||
#define LONG_MAX 2147483647L
|
||||
#define ULONG_MAX 4294967295UL
|
||||
|
||||
#define LLONG_MIN (-9223372036854775808LL)
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
/* A pointer is two bytes */
|
||||
|
||||
#define PTR_MIN (-32768)
|
||||
#define PTR_MAX 32767
|
||||
#define UPTR_MAX 65535
|
||||
|
||||
#endif /* __ARCH_AVR_INCLUDE_AVR_LIMITS_H */
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr/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_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 */
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr/types.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directed but, rather, only indirectly
|
||||
* through 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; /* char is 8-bits */
|
||||
typedef unsigned char _uint8_t;
|
||||
|
||||
typedef signed int _int16_t; /* int is 16-bits */
|
||||
typedef unsigned int _uint16_t;
|
||||
|
||||
typedef signed long _int32_t; /* long is 32-bits */
|
||||
typedef unsigned long _uint32_t;
|
||||
|
||||
typedef signed long long _int64_t; /* long long is 64-bits */
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A (near) pointer is 2 bytes */
|
||||
|
||||
typedef signed int _intptr_t;
|
||||
typedef unsigned int _uintptr_t;
|
||||
|
||||
/* A FAR pointer is 4 bytes */
|
||||
|
||||
typedef signed long _int_farptr_t;
|
||||
typedef unsigned long _uint_farptr_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 */
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
/************************************************************************************
|
||||
* arch/avr/include/avr32/avr32.h
|
||||
*
|
||||
* Copyright (C) 2010 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_AVR_INCLUDE_AVR32_AVR32_H
|
||||
#define __ARCH_AVR_INCLUDE_AVR32_AVR32_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* AVR32 System Registers */
|
||||
|
||||
#define AVR32_SR 0x000 /* Status Register */
|
||||
#define AVR32_EVBA 0x004 /* Exception Vector Base Address */
|
||||
#define AVR32_ACBA 0x008 /* Application Call Base Address */
|
||||
#define AVR32_CPUCR 0x00c /* CPU Control Register */
|
||||
#define AVR32_ECR 0x010 /* Exception Cause Register */
|
||||
#define AVR32_RSR_SUP 0x014 /* Return Status Register for Supervisor context */
|
||||
#define AVR32_RSR_INT0 0x018 /* Return Status Register for INT 0 context */
|
||||
#define AVR32_RSR_INT1 0x01c /* Return Status Register for INT 1 context */
|
||||
#define AVR32_RSR_INT2 0x020 /* Return Status Register for INT 2 context */
|
||||
#define AVR32_RSR_INT3 0x024 /* Return Status Register for INT 3 context */
|
||||
#define AVR32_RSR_EX 0x028 /* Return Status Register for Exception context */
|
||||
#define AVR32_RSR_NMI 0x02c /* Return Status Register for NMI context */
|
||||
#define AVR32_RSR_DBG 0x030 /* Return Status Register for Debug Mode */
|
||||
#define AVR32_RAR_SUP 0x034 /* Return Address Register for Supervisor context */
|
||||
#define AVR32_RAR_INT0 0x038 /* Return Address Register for INT 0 context */
|
||||
#define AVR32_RAR_INT1 0x03c /* Return Address Register for INT 1 context */
|
||||
#define AVR32_RAR_INT2 0x040 /* Return Address Register for INT 2 context */
|
||||
#define AVR32_RAR_INT3 0x044 /* Return Address Register for INT 3 context */
|
||||
#define AVR32_RAR_EX 0x048 /* Return Address Register for Exception context */
|
||||
#define AVR32_RAR_NMI 0x04c /* Return Status Register for NMI context */
|
||||
#define AVR32_RAR_DBG 0x050 /* Return Status Register for Debug Mode */
|
||||
#define AVR32_JECR 0x054 /* Java Exception Cause Register */
|
||||
#define AVR32_JOSP 0x058 /* Java Operand Stack Pointer */
|
||||
#define AVR32_JAVA_LV0 0x05c /* Java Local Variable 0 */
|
||||
#define AVR32_JAVA_LV1 0x060 /* Java Local Variable 1 */
|
||||
#define AVR32_JAVA_LV2 0x064 /* Java Local Variable 2 */
|
||||
#define AVR32_JAVA_LV3 0x068 /* Java Local Variable 3 */
|
||||
#define AVR32_JAVA_LV4 0x06c /* Java Local Variable 4 */
|
||||
#define AVR32_JAVA_LV5 0x070 /* Java Local Variable 5 */
|
||||
#define AVR32_JAVA_LV6 0x074 /* Java Local Variable 6 */
|
||||
#define AVR32_JAVA_LV7 0x078 /* Java Local Variable 7 */
|
||||
#define AVR32_JTBA 0x07c /* Java Trap Base Address */
|
||||
#define AVR32_JBCR 0x080 /* Java Trap Base Address */
|
||||
/* 0x084-0x0fc: Reserved for future use */
|
||||
#define AVR32_CONFIG0 0x100 /* Configuration Register 0 */
|
||||
#define AVR32_CONFIG1 0x104 /* Configuration Register 1 */
|
||||
#define AVR32_COUNT 0x108 /* Cycle Counter Register */
|
||||
#define AVR32_COMPARE 0x10c /* Compare register */
|
||||
#define AVR32_TLBEHI 0x110 /* MMU TLB Entry High */
|
||||
#define AVR32_TLBELO 0x114 /* MMU TLB Entry Low */
|
||||
#define AVR32_PTBR 0x118 /* MMU Page Table Base Register */
|
||||
#define AVR32_TLBEAR 0x11c /* MMU TLB Exception Address Register */
|
||||
#define AVR32_MMUCR 0x120 /* MMU Control Register */
|
||||
#define AVR32_TLBARLO 0x124 /* MMU TLB Accessed Register Low */
|
||||
#define AVR32_TLBARHI 0x128 /* MMU TLB Accessed Register High */
|
||||
#define AVR32_PCCNT 0x12c /* Performance Clock Counter */
|
||||
#define AVR32_PCNT0 0x130 /* Performance Counter 0 */
|
||||
#define AVR32_PCNT1 0x134 /* Performance Counter 1 */
|
||||
#define AVR32_PCCR 0x138 /* Performance Counter Control Register */
|
||||
#define AVR32_BEAR 0x13c /* Bus Error Address */
|
||||
#define AVR32_MPUARI0 0x140 /* MPU Address Register Instruction region 0 */
|
||||
#define AVR32_MPUARI1 0x144 /* MPU Address Register Instruction region 1 */
|
||||
#define AVR32_MPUARI2 0x148 /* MPU Address Register Instruction region 2 */
|
||||
#define AVR32_MPUARI3 0x14c /* MPU Address Register Instruction region 3 */
|
||||
#define AVR32_MPUARI4 0x150 /* MPU Address Register Instruction region 4 */
|
||||
#define AVR32_MPUARI5 0x154 /* MPU Address Register Instruction region 5 */
|
||||
#define AVR32_MPUARI6 0x158 /* MPU Address Register Instruction region 6 */
|
||||
#define AVR32_MPUARI7 0x15c /* MPU Address Register Instruction region 7 */
|
||||
#define AVR32_MPUARD0 0x160 /* MPU Address Register Data region 0 */
|
||||
#define AVR32_MPUARD1 0x164 /* MPU Address Register Data region 1 */
|
||||
#define AVR32_MPUARD2 0x168 /* MPU Address Register Data region 2 */
|
||||
#define AVR32_MPUARD3 0x16c /* MPU Address Register Data region 3 */
|
||||
#define AVR32_MPUARD4 0x170 /* MPU Address Register Data region 4 */
|
||||
#define AVR32_MPUARD5 0x174 /* MPU Address Register Data region 5 */
|
||||
#define AVR32_MPUARD6 0x178 /* MPU Address Register Data region 6 */
|
||||
#define AVR32_MPUARD7 0x17c /* MPU Address Register Data region 7 */
|
||||
#define AVR32_MPUCRI 0x180 /* MPU Cacheable Register Instruction regions */
|
||||
#define AVR32_MPUCRD 0x184 /* MPU Cacheable Register Data regions */
|
||||
#define AVR32_MPUBRD 0x188 /* MPU Bufferable Register Data regions */
|
||||
#define AVR32_MPUAPRI 0x18c /* MPU Access Permission Register Instruction regions */
|
||||
#define AVR32_MPUAPRD 0x190 /* MPU Access Permission Register Data regions */
|
||||
#define AVR32_MPUCR 0x194 /* MPU Control Register */
|
||||
/* 0x198-0x2fc: Reserved for future use */
|
||||
#define AVR32_IMPL 0x300 /* 0x300-0x3fc: Implementation defined */
|
||||
|
||||
/* Status register bit definitions */
|
||||
|
||||
#define AVR32_SR_C_SHIFT 0
|
||||
#define AVR32_SR_C_MASK (1 << AVR32_SR_C_SHIFT)
|
||||
|
||||
#define AVR32_SR_Z_SHIFT 1
|
||||
#define AVR32_SR_Z_MASK (1 << AVR32_SR_Z_SHIFT)
|
||||
|
||||
#define AVR32_SR_N_SHIFT 2
|
||||
#define AVR32_SR_N_MASK (1 << AVR32_SR_N_SHIFT)
|
||||
|
||||
#define AVR32_SR_V_SHIFT 3
|
||||
#define AVR32_SR_V_MASK (1 << AVR32_SR_V_SHIFT)
|
||||
|
||||
#define AVR32_SR_Q_SHIFT 4
|
||||
#define AVR32_SR_Q_MASK (1 << AVR32_SR_Q_SHIFT)
|
||||
|
||||
#define AVR32_SR_L_SHIFT 5
|
||||
#define AVR32_SR_L_MASK (1 << AVR32_SR_L_SHIFT)
|
||||
|
||||
#define AVR32_SR_T_SHIFT 14
|
||||
#define AVR32_SR_T_MASK (1 << AVR32_SR_T_SHIFT)
|
||||
|
||||
#define AVR32_SR_R_SHIFT 15
|
||||
#define AVR32_SR_R_MASK (1 << AVR32_SR_R_SHIFT)
|
||||
|
||||
#define AVR32_SR_GM_SHIFT 16
|
||||
#define AVR32_SR_GM_MASK (1 << AVR32_SR_GM_SHIFT)
|
||||
|
||||
#define AVR32_SR_I0M_SHIFT 17
|
||||
#define AVR32_SR_I0M_MASK (1 << AVR32_SR_I0M_SHIFT)
|
||||
|
||||
#define AVR32_SR_I1M_SHIFT 18
|
||||
#define AVR32_SR_I1M_MASK (1 << AVR32_SR_I1M_SHIFT)
|
||||
|
||||
#define AVR32_SR_I2M_SHIFT 19
|
||||
#define AVR32_SR_I2M_MASK (1 << AVR32_SR_I2M_SHIFT)
|
||||
|
||||
#define AVR32_SR_I3M_SHIFT 20
|
||||
#define AVR32_SR_I3M_MASK (1 << AVR32_SR_I3M_SHIFT)
|
||||
|
||||
#define AVR32_SR_EM_SHIFT 21
|
||||
#define AVR32_SR_EM_MASK (1 << AVR32_SR_EM_SHIFT)
|
||||
|
||||
#define AVR32_SR_M_SHIFT 22
|
||||
#define AVR32_SR_M_MASK (7 << AVR32_SR_M_SHIFT)
|
||||
# define AVR32_SR_M_APP (0 << AVR32_SR_M_SHIFT) /* Application */
|
||||
# define AVR32_SR_M_SUPER (1 << AVR32_SR_M_SHIFT) /* Supervisor */
|
||||
# define AVR32_SR_M_INT0 (2 << AVR32_SR_M_SHIFT) /* Interrupt level 0 */
|
||||
# define AVR32_SR_M_INT1 (3 << AVR32_SR_M_SHIFT) /* Interrupt level 1 */
|
||||
# define AVR32_SR_M_INT2 (4 << AVR32_SR_M_SHIFT) /* Interrupt level 2 */
|
||||
# define AVR32_SR_M_INT3 (5 << AVR32_SR_M_SHIFT) /* Interrupt level 3 */
|
||||
# define AVR32_SR_M_EX (6 << AVR32_SR_M_SHIFT) /* Exception */
|
||||
# define AVR32_SR_M_NMI (7 << AVR32_SR_M_SHIFT) /* Non Maskable Interrupt */
|
||||
|
||||
#define AVR32_SR_D_SHIFT 26
|
||||
#define AVR32_SR_D_MASK (1 << AVR32_SR_D_SHIFT)
|
||||
|
||||
#define AVR32_SR_DM_SHIFT 27
|
||||
#define AVR32_SR_DM_MASK (1 << AVR32_SR_DM_SHIFT)
|
||||
|
||||
#define AVR32_SR_J_SHIFT 28
|
||||
#define AVR32_SR_J_MASK (1 << AVR32_SR_J_SHIFT)
|
||||
|
||||
#define AVR32_SR_H_SHIFT 29
|
||||
#define AVR32_SR_H_MASK (1 << AVR32_SR_H_SHIFT)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#endif /* __ARCH_AVR_INCLUDE_AVR32_AVR32_H */
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr32/irq.h
|
||||
*
|
||||
* Copyright (C) 2010 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_AVR_INCLUDE_AVR32_IRQ_H
|
||||
#define __ARCH_AVR_INCLUDE_AVR32_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/avr32/avr32.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* General notes about the AVR32 ABI:
|
||||
*
|
||||
* Scratch/Volatile Registers: r8-r12
|
||||
* Preserved/Static Registers: r0-r7
|
||||
* Parameter Passing: r12-R8 (in that order)
|
||||
*/
|
||||
|
||||
/* Register state save array indices.
|
||||
*
|
||||
* The following registers are saved by the AVR32 hardware (for the case of
|
||||
* interrupts only). Note the registers are order in the opposite order the
|
||||
* they appear in memory (i.e., in the order of increasing address) because
|
||||
* this makes it easier to following the ordering of pushing on a push-down
|
||||
* stack.
|
||||
*/
|
||||
|
||||
#define REG_R8 16
|
||||
#define REG_R9 15
|
||||
#define REG_R10 14
|
||||
#define REG_R11 13
|
||||
#define REG_R12 12
|
||||
#define REG_R14 11
|
||||
#define REG_R15 10
|
||||
#define REG_SR 9
|
||||
|
||||
#define REG_LR REG_R14
|
||||
#define REG_PC REG_R15
|
||||
|
||||
/* Additional registers saved in order have the full CPU context */
|
||||
|
||||
#define REG_R13 8
|
||||
#define REG_SP REG_R13
|
||||
|
||||
#define REG_R0 7
|
||||
#define REG_R1 6
|
||||
#define REG_R2 5
|
||||
#define REG_R3 4
|
||||
#define REG_R4 3
|
||||
#define REG_R5 2
|
||||
#define REG_R6 1
|
||||
#define REG_R7 0
|
||||
|
||||
/* Size of the register state save array (in 32-bit words) */
|
||||
|
||||
#define INTCONTEXT_REGS 8 /* r8-r12, lr, pc, sr */
|
||||
#define XCPTCONTEXT_REGS 17 /* Plus r0-r7, sp */
|
||||
|
||||
/****************************************************************************
|
||||
* 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.*/
|
||||
|
||||
uint32_t saved_pc;
|
||||
uint32_t saved_sr;
|
||||
#endif
|
||||
|
||||
/* Register save area */
|
||||
|
||||
uint32_t regs[XCPTCONTEXT_REGS];
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* Read the AVR32 status register */
|
||||
|
||||
static inline uint32_t avr32_sr(void)
|
||||
{
|
||||
uint32_t sr;
|
||||
__asm__ __volatile__ (
|
||||
"mfsr\t%0,%1\n\t"
|
||||
: "=r" (sr)
|
||||
: "i" (AVR32_SR)
|
||||
);
|
||||
return sr;
|
||||
}
|
||||
|
||||
/* Read the interrupt vector base address */
|
||||
|
||||
static inline uint32_t avr32_evba(void)
|
||||
{
|
||||
uint32_t evba;
|
||||
__asm__ __volatile__ (
|
||||
"mfsr\t%0,%1\n\t"
|
||||
: "=r" (evba)
|
||||
: "i" (AVR32_EVBA)
|
||||
);
|
||||
return evba;
|
||||
}
|
||||
|
||||
/* Save the current interrupt enable state & disable all interrupts */
|
||||
|
||||
static inline irqstate_t irqsave(void)
|
||||
{
|
||||
irqstate_t sr = (irqstate_t)avr32_sr();
|
||||
__asm__ __volatile__ (
|
||||
"ssrf\t%0\n\t"
|
||||
"nop\n\t"
|
||||
"nop"
|
||||
:
|
||||
: "i" (AVR32_SR_GM_SHIFT)
|
||||
);
|
||||
return sr;
|
||||
}
|
||||
|
||||
/* Restore saved interrupt state */
|
||||
|
||||
static inline void irqrestore(irqstate_t flags)
|
||||
{
|
||||
if ((flags & AVR32_SR_GM_MASK) == 0)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"csrf\t%0\n\t"
|
||||
"nop\n\t"
|
||||
"nop"
|
||||
:
|
||||
: "i" (AVR32_SR_GM_SHIFT)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#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_AVR32_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr32/limits.h
|
||||
*
|
||||
* Copyright (C) 2010, 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 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 (-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
|
||||
|
||||
/* Integer is four bytes */
|
||||
|
||||
#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 four bytes */
|
||||
|
||||
#define PTR_MIN (-2147483648)
|
||||
#define PTR_MAX 2147483647
|
||||
#define UPTR_MAX 4294967295
|
||||
|
||||
#endif /* __ARCH_AVR_INCLUDE_AVR32_LIMITS_H */
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr32/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_AVR_INCLUDE_AVR32_SYSCALL_H
|
||||
#define __ARCH_AVR_INCLUDE_AVR32_SYSCALL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define SYS_syscall 0x80
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* SWI with SYS_ call number and six parameters */
|
||||
|
||||
EXTERN uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5,
|
||||
uintptr_t parm6);
|
||||
|
||||
/* SWI with SYS_ call number and no parameters */
|
||||
|
||||
static inline uintptr_t sys_call0(unsigned int nbr)
|
||||
{
|
||||
return sys_call6(nbr, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and one parameter */
|
||||
|
||||
static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
|
||||
{
|
||||
return sys_call6(nbr, parm1, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and two parameters */
|
||||
|
||||
static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and three parameters */
|
||||
|
||||
static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and four parameters */
|
||||
|
||||
static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, parm4, 0, 0);
|
||||
}
|
||||
|
||||
/* SWI with SYS_ call number and five parameters */
|
||||
|
||||
static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5)
|
||||
{
|
||||
return sys_call6(nbr, parm1, parm2, parm3, parm4, parm5, 0);
|
||||
}
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_AVR_INCLUDE_AVR32_SYSCALL_H */
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/avr32/types.h
|
||||
*
|
||||
* Copyright (C) 2010, 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 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 */
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/irq.h
|
||||
*
|
||||
* Copyright (C) 2010 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_AVR_INCLUDE_IRQ_H
|
||||
#define __ARCH_AVR_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 AVR architecture-specific IRQ definitions (including register
|
||||
* save structure and irqsave()/irqrestore() macros
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_AVR32
|
||||
# include <arch/avr32/irq.h>
|
||||
#else
|
||||
# include <arch/avr/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_AVR_INCLUDE_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/limits.h
|
||||
*
|
||||
* Copyright (C) 2010, 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_AVR_INCLUDE_LIMITS_H
|
||||
#define __ARCH_AVR_INCLUDE_LIMITS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Include AVR architecture-specific limits */
|
||||
|
||||
#ifdef CONFIG_ARCH_AVR32
|
||||
# include <arch/avr32/limits.h>
|
||||
#else
|
||||
# include <arch/avr/limits.h>
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_AVR_INCLUDE_LIMITS_H */
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/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_AVR_INCLUDE_SYSCALL_H
|
||||
#define __ARCH_AVR_INCLUDE_SYSCALL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Include AVR architecture-specific syscall macros */
|
||||
|
||||
#ifdef CONFIG_ARCH_AVR32
|
||||
# include <arch/avr32/syscall.h>
|
||||
#else
|
||||
# include <arch/avr/syscall.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_AVR_INCLUDE_SYSCALL_H */
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/include/types.h
|
||||
*
|
||||
* Copyright (C) 2010, 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 stdint.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_AVR_INCLUDE_TYPES_H
|
||||
#define __ARCH_AVR_INCLUDE_TYPES_H
|
||||
|
||||
/****************************************************************************
|
||||
* 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
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_AVR_INCLUDE_TYPES_H */
|
||||
|
||||
Reference in New Issue
Block a user