sam3n: fix confusion between interrupt numbers and peripheral ids.
[bertos.git] / bertos / cpu / cortex-m3 / io / sam3.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \author Stefano Fedrigo <aleph@develer.com>
34  */
35
36 #ifndef SAM3_H
37 #define SAM3_H
38
39 #include <cpu/detect.h>
40 #include <cfg/compiler.h>
41
42 /*
43  * Peripherals IDs.
44  */
45 /*\{*/
46 #if CPU_CM3_AT91SAM3N
47         #define SUPC_ID      0   ///< Supply Controller (SUPC)
48         #define RSTC_ID      1   ///< Reset Controller (RSTC)
49         #define RTC_ID       2   ///< Real Time Clock (RTC)
50         #define RTT_ID       3   ///< Real Time Timer (RTT)
51         #define WDT_ID       4   ///< Watchdog Timer (WDT)
52         #define PMC_ID       5   ///< Power Management Controller (PMC)
53         #define EFC_ID       6   ///< Enhanced Flash Controller (EFC)
54         #define UART0_ID     8   ///< UART 0 (UART0)
55         #define UART1_ID     9   ///< UART 1 (UART1)
56         #define PIOA_ID     11   ///< Parallel I/O Controller A (PIOA)
57         #define PIOB_ID     12   ///< Parallel I/O Controller B (PIOB)
58         #define PIOC_ID     13   ///< Parallel I/O Controller C (PIOC)
59         #define US0_ID      14   ///< USART 0 (USART0)
60         #define US1_ID      15   ///< USART 1 (USART1)
61         #define TWI0_ID     19   ///< Two Wire Interface 0 (TWI0)
62         #define TWI1_ID     20   ///< Two Wire Interface 1 (TWI1)
63         #define SPI0_ID     21   ///< Serial Peripheral Interface (SPI)
64         #define TC0_ID      23   ///< Timer/Counter 0 (TC0)
65         #define TC1_ID      24   ///< Timer/Counter 1 (TC1)
66         #define TC2_ID      25   ///< Timer/Counter 2 (TC2)
67         #define TC3_ID      26   ///< Timer/Counter 3 (TC3)
68         #define TC4_ID      27   ///< Timer/Counter 4 (TC4)
69         #define TC5_ID      28   ///< Timer/Counter 5 (TC5)
70         #define ADC_ID      29   ///< Analog To Digital Converter (ADC)
71         #define DACC_ID     30   ///< Digital To Analog Converter (DACC)
72         #define PWM_ID      31   ///< Pulse Width Modulation (PWM)
73 #else
74         #error Peripheral IDs undefined
75 #endif
76 /*\}*/
77
78 /*
79  * Hardware features for drivers.
80  */
81 #define USART_HAS_PDC  1
82
83
84 #include "sam3_sysctl.h"
85 #include "sam3_pmc.h"
86 #include "sam3_ints.h"
87 #include "sam3_pio.h"
88 #include "sam3_nvic.h"
89 #include "sam3_uart.h"
90 #include "sam3_usart.h"
91 #include "sam3_spi.h"
92 #include "sam3_flash.h"
93 #include "sam3_wdt.h"
94
95 /**
96  * UART I/O pins
97  */
98 /*\{*/
99 #if CPU_CM3_AT91SAM3U
100         #define RXD0   11
101         #define TXD0   12
102 #else
103         #define RXD0    9
104         #define TXD0   10
105         #define RXD1    2
106         #define TXD1    3
107 #endif
108 /*\}*/
109
110 /**
111  * PIO I/O pins
112  */
113 /*\{*/
114 #if CPU_CM3_AT91SAM3U
115         #define SPI0_SPCK   15
116         #define SPI0_MOSI   14
117         #define SPI0_MISO   13
118 #else
119         #define SPI0_SPCK   14
120         #define SPI0_MOSI   13
121         #define SPI0_MISO   12
122 #endif
123 /*\}*/
124 #endif /* SAM3_H */