sam3: add PDC register offsets
[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 #define SPI_HAS_PDC    1
83
84 /* PDC registers */
85 #define PERIPH_RPR_OFF  0x100  // Receive Pointer Register.
86 #define PERIPH_RCR_OFF  0x104  // Receive Counter Register.
87 #define PERIPH_TPR_OFF  0x108  // Transmit Pointer Register.
88 #define PERIPH_TCR_OFF  0x10C  // Transmit Counter Register.
89 #define PERIPH_RNPR_OFF 0x110  // Receive Next Pointer Register.
90 #define PERIPH_RNCR_OFF 0x114  // Receive Next Counter Register.
91 #define PERIPH_TNPR_OFF 0x118  // Transmit Next Pointer Register.
92 #define PERIPH_TNCR_OFF 0x11C  // Transmit Next Counter Register.
93 #define PERIPH_PTCR_OFF 0x120  // PDC Transfer Control Register.
94 #define PERIPH_PTSR_OFF 0x124  // PDC Transfer Status Register.
95
96 #define PDC_RXTEN  0
97 #define PDC_RXTDIS 1
98 #define PDC_TXTEN  8
99 #define PDC_TXTDIS 9
100
101
102 #include "sam3_sysctl.h"
103 #include "sam3_pmc.h"
104 #include "sam3_ints.h"
105 #include "sam3_pio.h"
106 #include "sam3_nvic.h"
107 #include "sam3_uart.h"
108 #include "sam3_usart.h"
109 #include "sam3_spi.h"
110 #include "sam3_flash.h"
111 #include "sam3_wdt.h"
112
113 /**
114  * UART I/O pins
115  */
116 /*\{*/
117 #if CPU_CM3_AT91SAM3U
118         #define RXD0   11
119         #define TXD0   12
120 #else
121         #define RXD0    9
122         #define TXD0   10
123         #define RXD1    2
124         #define TXD1    3
125 #endif
126 /*\}*/
127
128 /**
129  * PIO I/O pins
130  */
131 /*\{*/
132 #if CPU_CM3_AT91SAM3U
133         #define SPI0_SPCK   15
134         #define SPI0_MOSI   14
135         #define SPI0_MISO   13
136 #else
137         #define SPI0_SPCK   14
138         #define SPI0_MOSI   13
139         #define SPI0_MISO   12
140 #endif
141 /*\}*/
142 #endif /* SAM3_H */