summaryrefslogtreecommitdiff
path: root/nuttx/arch/avr/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-07 17:15:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-07 17:15:56 +0000
commitf9878933553405ff96a23bb2929fe8a7b6571021 (patch)
tree865d2f04b7b1bdb46ad5d9e9079cd884485720f4 /nuttx/arch/avr/include
parentbfda95976300d7400b2d492f1a2640afc9576d87 (diff)
downloadpx4-nuttx-f9878933553405ff96a23bb2929fe8a7b6571021.tar.gz
px4-nuttx-f9878933553405ff96a23bb2929fe8a7b6571021.tar.bz2
px4-nuttx-f9878933553405ff96a23bb2929fe8a7b6571021.zip
Add AT90USB support and AVR vector/startup logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3677 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/avr/include')
-rw-r--r--nuttx/arch/avr/include/at90usb/irq.h149
-rw-r--r--nuttx/arch/avr/include/atmega/irq.h146
2 files changed, 295 insertions, 0 deletions
diff --git a/nuttx/arch/avr/include/at90usb/irq.h b/nuttx/arch/avr/include/at90usb/irq.h
new file mode 100644
index 000000000..6d2b9166c
--- /dev/null
+++ b/nuttx/arch/avr/include/at90usb/irq.h
@@ -0,0 +1,149 @@
+/****************************************************************************
+ * arch/avr/include/avr/at90usb/irq.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directed but, rather, only indirectly
+ * through nuttx/irq.h
+ */
+
+#ifndef __ARCH_AVR_INCLUDE_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 PCINT0 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__
+
+/* Save the current interrupt enable state & disable all interrupts */
+
+static inline irqstate_t irqsave(void)
+{
+ /* Needs to return the current interrupt state, then disable interrupts */
+#warning "Not implemented"
+ return 0
+}
+
+/* Restore saved interrupt state */
+
+static inline void irqrestore(irqstate_t flags)
+{
+ /* Based on the provided interrupt flags, conditionally enable interrupts */
+#warning "Not implemented"
+}
+#endif /* __ASSEMBLY__ */
+
+/****************************************************************************
+ * Public Variables
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __ARCH_AVR_INCLUDE_AT90USB_IRQ_H */
+
diff --git a/nuttx/arch/avr/include/atmega/irq.h b/nuttx/arch/avr/include/atmega/irq.h
new file mode 100644
index 000000000..ea5b02060
--- /dev/null
+++ b/nuttx/arch/avr/include/atmega/irq.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+ * arch/avr/include/avr/atmega/irq.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directed but, rather, only indirectly
+ * through nuttx/irq.h
+ */
+
+#ifndef __ARCH_AVR_INCLUDE_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__
+
+/* Save the current interrupt enable state & disable all interrupts */
+
+static inline irqstate_t irqsave(void)
+{
+ /* Needs to return the current interrupt state, then disable interrupts */
+#warning "Not implemented"
+ return 0
+}
+
+/* Restore saved interrupt state */
+
+static inline void irqrestore(irqstate_t flags)
+{
+ /* Based on the provided interrupt flags, conditionally enable interrupts */
+#warning "Not implemented"
+}
+#endif /* __ASSEMBLY__ */
+
+/****************************************************************************
+ * Public Variables
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __ARCH_AVR_INCLUDE_ATMEGA_IRQ_H */
+