1 /* ---------------------------------------------------------------------------- */
2 /*                  Atmel Microcontroller Software Support                      */
3 /*                       SAM Software Package License                           */
4 /* ---------------------------------------------------------------------------- */
5 /* Copyright (c) %copyright_year%, Atmel Corporation                                        */
6 /*                                                                              */
7 /* All rights reserved.                                                         */
8 /*                                                                              */
9 /* Redistribution and use in source and binary forms, with or without           */
10 /* modification, are permitted provided that the following condition is met:    */
11 /*                                                                              */
12 /* - Redistributions of source code must retain the above copyright notice,     */
13 /* this list of conditions and the disclaimer below.                            */
14 /*                                                                              */
15 /* Atmel's name may not be used to endorse or promote products derived from     */
16 /* this software without specific prior written permission.                     */
17 /*                                                                              */
18 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
19 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
21 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
22 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
24 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
25 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
26 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
28 /* ---------------------------------------------------------------------------- */
29 
30 #ifndef _SAM3X8E_
31 #define _SAM3X8E_
32 
33 /** \addtogroup SAM3X8E_definitions SAM3X8E definitions
34   This file defines all structures and symbols for SAM3X8E:
35     - registers and bitfields
36     - peripheral base address
37     - peripheral ID
38     - PIO definitions
39 */
40 /*@{*/
41 
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45 
46 #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 #include <stdint.h>
48 #endif
49 
50 /* ************************************************************************** */
51 /*   CMSIS DEFINITIONS FOR SAM3X8E */
52 /* ************************************************************************** */
53 /** \addtogroup SAM3X8E_cmsis CMSIS Definitions */
54 /*@{*/
55 
56 /**< Interrupt Number Definition */
57 typedef enum IRQn
58 {
59 /******  Cortex-M3 Processor Exceptions Numbers ******************************/
60   NonMaskableInt_IRQn   = -14, /**<  2 Non Maskable Interrupt                */
61   MemoryManagement_IRQn = -12, /**<  4 Cortex-M3 Memory Management Interrupt */
62   BusFault_IRQn         = -11, /**<  5 Cortex-M3 Bus Fault Interrupt         */
63   UsageFault_IRQn       = -10, /**<  6 Cortex-M3 Usage Fault Interrupt       */
64   SVCall_IRQn           = -5,  /**< 11 Cortex-M3 SV Call Interrupt           */
65   DebugMonitor_IRQn     = -4,  /**< 12 Cortex-M3 Debug Monitor Interrupt     */
66   PendSV_IRQn           = -2,  /**< 14 Cortex-M3 Pend SV Interrupt           */
67   SysTick_IRQn          = -1,  /**< 15 Cortex-M3 System Tick Interrupt       */
68 /******  SAM3X8E specific Interrupt Numbers *********************************/
69 
70   SUPC_IRQn            =  0, /**<  0 SAM3X8E Supply Controller (SUPC) */
71   RSTC_IRQn            =  1, /**<  1 SAM3X8E Reset Controller (RSTC) */
72   RTC_IRQn             =  2, /**<  2 SAM3X8E Real Time Clock (RTC) */
73   RTT_IRQn             =  3, /**<  3 SAM3X8E Real Time Timer (RTT) */
74   WDT_IRQn             =  4, /**<  4 SAM3X8E Watchdog Timer (WDT) */
75   PMC_IRQn             =  5, /**<  5 SAM3X8E Power Management Controller (PMC) */
76   EFC0_IRQn            =  6, /**<  6 SAM3X8E Enhanced Flash Controller 0 (EFC0) */
77   EFC1_IRQn            =  7, /**<  7 SAM3X8E Enhanced Flash Controller 1 (EFC1) */
78   UART_IRQn            =  8, /**<  8 SAM3X8E Universal Asynchronous Receiver Transceiver (UART) */
79   SMC_IRQn             =  9, /**<  9 SAM3X8E Static Memory Controller (SMC) */
80   PIOA_IRQn            = 11, /**< 11 SAM3X8E Parallel I/O Controller A, (PIOA) */
81   PIOB_IRQn            = 12, /**< 12 SAM3X8E Parallel I/O Controller B (PIOB) */
82   PIOC_IRQn            = 13, /**< 13 SAM3X8E Parallel I/O Controller C (PIOC) */
83   PIOD_IRQn            = 14, /**< 14 SAM3X8E Parallel I/O Controller D (PIOD) */
84   USART0_IRQn          = 17, /**< 17 SAM3X8E USART 0 (USART0) */
85   USART1_IRQn          = 18, /**< 18 SAM3X8E USART 1 (USART1) */
86   USART2_IRQn          = 19, /**< 19 SAM3X8E USART 2 (USART2) */
87   USART3_IRQn          = 20, /**< 20 SAM3X8E USART 3 (USART3) */
88   HSMCI_IRQn           = 21, /**< 21 SAM3X8E Multimedia Card Interface (HSMCI) */
89   TWI0_IRQn            = 22, /**< 22 SAM3X8E Two-Wire Interface 0 (TWI0) */
90   TWI1_IRQn            = 23, /**< 23 SAM3X8E Two-Wire Interface 1 (TWI1) */
91   SPI0_IRQn            = 24, /**< 24 SAM3X8E Serial Peripheral Interface (SPI0) */
92   SSC_IRQn             = 26, /**< 26 SAM3X8E Synchronous Serial Controller (SSC) */
93   TC0_IRQn             = 27, /**< 27 SAM3X8E Timer Counter 0 (TC0) */
94   TC1_IRQn             = 28, /**< 28 SAM3X8E Timer Counter 1 (TC1) */
95   TC2_IRQn             = 29, /**< 29 SAM3X8E Timer Counter 2 (TC2) */
96   TC3_IRQn             = 30, /**< 30 SAM3X8E Timer Counter 3 (TC3) */
97   TC4_IRQn             = 31, /**< 31 SAM3X8E Timer Counter 4 (TC4) */
98   TC5_IRQn             = 32, /**< 32 SAM3X8E Timer Counter 5 (TC5) */
99   TC6_IRQn             = 33, /**< 33 SAM3X8E Timer Counter 6 (TC6) */
100   TC7_IRQn             = 34, /**< 34 SAM3X8E Timer Counter 7 (TC7) */
101   TC8_IRQn             = 35, /**< 35 SAM3X8E Timer Counter 8 (TC8) */
102   PWM_IRQn             = 36, /**< 36 SAM3X8E Pulse Width Modulation Controller (PWM) */
103   ADC_IRQn             = 37, /**< 37 SAM3X8E ADC Controller (ADC) */
104   DACC_IRQn            = 38, /**< 38 SAM3X8E DAC Controller (DACC) */
105   DMAC_IRQn            = 39, /**< 39 SAM3X8E DMA Controller (DMAC) */
106   UOTGHS_IRQn          = 40, /**< 40 SAM3X8E USB OTG High Speed (UOTGHS) */
107   TRNG_IRQn            = 41, /**< 41 SAM3X8E True Random Number Generator (TRNG) */
108   EMAC_IRQn            = 42, /**< 42 SAM3X8E Ethernet MAC (EMAC) */
109   CAN0_IRQn            = 43, /**< 43 SAM3X8E CAN Controller 0 (CAN0) */
110   CAN1_IRQn            = 44, /**< 44 SAM3X8E CAN Controller 1 (CAN1) */
111 
112   PERIPH_COUNT_IRQn    = 45  /**< Number of peripheral IDs */
113 } IRQn_Type;
114 
115 typedef struct _DeviceVectors
116 {
117   /* Stack pointer */
118   void* pvStack;
119 
120   /* Cortex-M handlers */
121   void* pfnReset_Handler;
122   void* pfnNMI_Handler;
123   void* pfnHardFault_Handler;
124   void* pfnMemManage_Handler;
125   void* pfnBusFault_Handler;
126   void* pfnUsageFault_Handler;
127   void* pfnReserved1_Handler;
128   void* pfnReserved2_Handler;
129   void* pfnReserved3_Handler;
130   void* pfnReserved4_Handler;
131   void* pfnSVC_Handler;
132   void* pfnDebugMon_Handler;
133   void* pfnReserved5_Handler;
134   void* pfnPendSV_Handler;
135   void* pfnSysTick_Handler;
136 
137   /* Peripheral handlers */
138   void* pfnSUPC_Handler;   /*  0 Supply Controller */
139   void* pfnRSTC_Handler;   /*  1 Reset Controller */
140   void* pfnRTC_Handler;    /*  2 Real Time Clock */
141   void* pfnRTT_Handler;    /*  3 Real Time Timer */
142   void* pfnWDT_Handler;    /*  4 Watchdog Timer */
143   void* pfnPMC_Handler;    /*  5 Power Management Controller */
144   void* pfnEFC0_Handler;   /*  6 Enhanced Flash Controller 0 */
145   void* pfnEFC1_Handler;   /*  7 Enhanced Flash Controller 1 */
146   void* pfnUART_Handler;   /*  8 Universal Asynchronous Receiver Transceiver */
147   void* pfnSMC_Handler;    /*  9 Static Memory Controller */
148   void* pvReserved10;
149   void* pfnPIOA_Handler;   /* 11 Parallel I/O Controller A, */
150   void* pfnPIOB_Handler;   /* 12 Parallel I/O Controller B */
151   void* pfnPIOC_Handler;   /* 13 Parallel I/O Controller C */
152   void* pfnPIOD_Handler;   /* 14 Parallel I/O Controller D */
153   void* pvReserved15;
154   void* pvReserved16;
155   void* pfnUSART0_Handler; /* 17 USART 0 */
156   void* pfnUSART1_Handler; /* 18 USART 1 */
157   void* pfnUSART2_Handler; /* 19 USART 2 */
158   void* pfnUSART3_Handler; /* 20 USART 3 */
159   void* pfnHSMCI_Handler;  /* 21 Multimedia Card Interface */
160   void* pfnTWI0_Handler;   /* 22 Two-Wire Interface 0 */
161   void* pfnTWI1_Handler;   /* 23 Two-Wire Interface 1 */
162   void* pfnSPI0_Handler;   /* 24 Serial Peripheral Interface */
163   void* pvReserved25;
164   void* pfnSSC_Handler;    /* 26 Synchronous Serial Controller */
165   void* pfnTC0_Handler;    /* 27 Timer Counter 0 */
166   void* pfnTC1_Handler;    /* 28 Timer Counter 1 */
167   void* pfnTC2_Handler;    /* 29 Timer Counter 2 */
168   void* pfnTC3_Handler;    /* 30 Timer Counter 3 */
169   void* pfnTC4_Handler;    /* 31 Timer Counter 4 */
170   void* pfnTC5_Handler;    /* 32 Timer Counter 5 */
171   void* pfnTC6_Handler;    /* 33 Timer Counter 6 */
172   void* pfnTC7_Handler;    /* 34 Timer Counter 7 */
173   void* pfnTC8_Handler;    /* 35 Timer Counter 8 */
174   void* pfnPWM_Handler;    /* 36 Pulse Width Modulation Controller */
175   void* pfnADC_Handler;    /* 37 ADC Controller */
176   void* pfnDACC_Handler;   /* 38 DAC Controller */
177   void* pfnDMAC_Handler;   /* 39 DMA Controller */
178   void* pfnUOTGHS_Handler; /* 40 USB OTG High Speed */
179   void* pfnTRNG_Handler;   /* 41 True Random Number Generator */
180   void* pfnEMAC_Handler;   /* 42 Ethernet MAC */
181   void* pfnCAN0_Handler;   /* 43 CAN Controller 0 */
182   void* pfnCAN1_Handler;   /* 44 CAN Controller 1 */
183 } DeviceVectors;
184 
185 /* Cortex-M3 core handlers */
186 void Reset_Handler      ( void );
187 void NMI_Handler        ( void );
188 void HardFault_Handler  ( void );
189 void MemManage_Handler  ( void );
190 void BusFault_Handler   ( void );
191 void UsageFault_Handler ( void );
192 void SVC_Handler        ( void );
193 void DebugMon_Handler   ( void );
194 void PendSV_Handler     ( void );
195 void SysTick_Handler    ( void );
196 
197 /* Peripherals handlers */
198 void ADC_Handler        ( void );
199 void CAN0_Handler       ( void );
200 void CAN1_Handler       ( void );
201 void DACC_Handler       ( void );
202 void DMAC_Handler       ( void );
203 void EFC0_Handler       ( void );
204 void EFC1_Handler       ( void );
205 void EMAC_Handler       ( void );
206 void HSMCI_Handler      ( void );
207 void PIOA_Handler       ( void );
208 void PIOB_Handler       ( void );
209 void PIOC_Handler       ( void );
210 void PIOD_Handler       ( void );
211 void PMC_Handler        ( void );
212 void PWM_Handler        ( void );
213 void RSTC_Handler       ( void );
214 void RTC_Handler        ( void );
215 void RTT_Handler        ( void );
216 void SMC_Handler        ( void );
217 void SPI0_Handler       ( void );
218 void SSC_Handler        ( void );
219 void SUPC_Handler       ( void );
220 void TC0_Handler        ( void );
221 void TC1_Handler        ( void );
222 void TC2_Handler        ( void );
223 void TC3_Handler        ( void );
224 void TC4_Handler        ( void );
225 void TC5_Handler        ( void );
226 void TC6_Handler        ( void );
227 void TC7_Handler        ( void );
228 void TC8_Handler        ( void );
229 void TRNG_Handler       ( void );
230 void TWI0_Handler       ( void );
231 void TWI1_Handler       ( void );
232 void UART_Handler       ( void );
233 void UOTGHS_Handler     ( void );
234 void USART0_Handler     ( void );
235 void USART1_Handler     ( void );
236 void USART2_Handler     ( void );
237 void USART3_Handler     ( void );
238 void WDT_Handler        ( void );
239 
240 /**
241  * \brief Configuration of the Cortex-M3 Processor and Core Peripherals
242  */
243 
244 #define __CM3_REV              0x0200 /**< SAM3X8E core revision number ([15:8] revision number, [7:0] patch number) */
245 #define __MPU_PRESENT          1      /**< SAM3X8E does provide a MPU */
246 #define __NVIC_PRIO_BITS       4      /**< SAM3X8E uses 4 Bits for the Priority Levels */
247 #define __Vendor_SysTickConfig 0      /**< Set to 1 if different SysTick Config is used */
248 
249 /*
250  * \brief CMSIS includes
251  */
252 
253 #include <core_cm3.h>
254 #if !defined DONT_USE_CMSIS_INIT
255 #include "system_sam3xa.h"
256 #endif /* DONT_USE_CMSIS_INIT */
257 
258 /*@}*/
259 
260 /* ************************************************************************** */
261 /**  SOFTWARE PERIPHERAL API DEFINITION FOR SAM3X8E */
262 /* ************************************************************************** */
263 /** \addtogroup SAM3X8E_api Peripheral Software API */
264 /*@{*/
265 
266 #include "component/adc.h"
267 #include "component/can.h"
268 #include "component/chipid.h"
269 #include "component/dacc.h"
270 #include "component/dmac.h"
271 #include "component/efc.h"
272 #include "component/emac.h"
273 #include "component/gpbr.h"
274 #include "component/hsmci.h"
275 #include "component/matrix.h"
276 #include "component/pdc.h"
277 #include "component/pio.h"
278 #include "component/pmc.h"
279 #include "component/pwm.h"
280 #include "component/rstc.h"
281 #include "component/rtc.h"
282 #include "component/rtt.h"
283 #include "component/smc.h"
284 #include "component/spi.h"
285 #include "component/ssc.h"
286 #include "component/supc.h"
287 #include "component/tc.h"
288 #include "component/trng.h"
289 #include "component/twi.h"
290 #include "component/uart.h"
291 #include "component/uotghs.h"
292 #include "component/usart.h"
293 #include "component/wdt.h"
294 /*@}*/
295 
296 /* ************************************************************************** */
297 /*   REGISTER ACCESS DEFINITIONS FOR SAM3X8E */
298 /* ************************************************************************** */
299 /** \addtogroup SAM3X8E_reg Registers Access Definitions */
300 /*@{*/
301 
302 #include "instance/hsmci.h"
303 #include "instance/ssc.h"
304 #include "instance/spi0.h"
305 #include "instance/tc0.h"
306 #include "instance/tc1.h"
307 #include "instance/tc2.h"
308 #include "instance/twi0.h"
309 #include "instance/twi1.h"
310 #include "instance/pwm.h"
311 #include "instance/usart0.h"
312 #include "instance/usart1.h"
313 #include "instance/usart2.h"
314 #include "instance/usart3.h"
315 #include "instance/uotghs.h"
316 #include "instance/emac.h"
317 #include "instance/can0.h"
318 #include "instance/can1.h"
319 #include "instance/trng.h"
320 #include "instance/adc.h"
321 #include "instance/dmac.h"
322 #include "instance/dacc.h"
323 #include "instance/smc.h"
324 #include "instance/matrix.h"
325 #include "instance/pmc.h"
326 #include "instance/uart.h"
327 #include "instance/chipid.h"
328 #include "instance/efc0.h"
329 #include "instance/efc1.h"
330 #include "instance/pioa.h"
331 #include "instance/piob.h"
332 #include "instance/pioc.h"
333 #include "instance/piod.h"
334 #include "instance/rstc.h"
335 #include "instance/supc.h"
336 #include "instance/rtt.h"
337 #include "instance/wdt.h"
338 #include "instance/rtc.h"
339 #include "instance/gpbr.h"
340 /*@}*/
341 
342 /* ************************************************************************** */
343 /*   PERIPHERAL ID DEFINITIONS FOR SAM3X8E */
344 /* ************************************************************************** */
345 /** \addtogroup SAM3X8E_id Peripheral Ids Definitions */
346 /*@{*/
347 
348 #define ID_SUPC   ( 0) /**< \brief Supply Controller (SUPC) */
349 #define ID_RSTC   ( 1) /**< \brief Reset Controller (RSTC) */
350 #define ID_RTC    ( 2) /**< \brief Real Time Clock (RTC) */
351 #define ID_RTT    ( 3) /**< \brief Real Time Timer (RTT) */
352 #define ID_WDT    ( 4) /**< \brief Watchdog Timer (WDT) */
353 #define ID_PMC    ( 5) /**< \brief Power Management Controller (PMC) */
354 #define ID_EFC0   ( 6) /**< \brief Enhanced Flash Controller 0 (EFC0) */
355 #define ID_EFC1   ( 7) /**< \brief Enhanced Flash Controller 1 (EFC1) */
356 #define ID_UART   ( 8) /**< \brief Universal Asynchronous Receiver Transceiver (UART) */
357 #define ID_SMC    ( 9) /**< \brief Static Memory Controller (SMC) */
358 #define ID_PIOA   (11) /**< \brief Parallel I/O Controller A, (PIOA) */
359 #define ID_PIOB   (12) /**< \brief Parallel I/O Controller B (PIOB) */
360 #define ID_PIOC   (13) /**< \brief Parallel I/O Controller C (PIOC) */
361 #define ID_PIOD   (14) /**< \brief Parallel I/O Controller D (PIOD) */
362 #define ID_USART0 (17) /**< \brief USART 0 (USART0) */
363 #define ID_USART1 (18) /**< \brief USART 1 (USART1) */
364 #define ID_USART2 (19) /**< \brief USART 2 (USART2) */
365 #define ID_USART3 (20) /**< \brief USART 3 (USART3) */
366 #define ID_HSMCI  (21) /**< \brief Multimedia Card Interface (HSMCI) */
367 #define ID_TWI0   (22) /**< \brief Two-Wire Interface 0 (TWI0) */
368 #define ID_TWI1   (23) /**< \brief Two-Wire Interface 1 (TWI1) */
369 #define ID_SPI0   (24) /**< \brief Serial Peripheral Interface (SPI0) */
370 #define ID_SSC    (26) /**< \brief Synchronous Serial Controller (SSC) */
371 #define ID_TC0    (27) /**< \brief Timer Counter 0 (TC0) */
372 #define ID_TC1    (28) /**< \brief Timer Counter 1 (TC1) */
373 #define ID_TC2    (29) /**< \brief Timer Counter 2 (TC2) */
374 #define ID_TC3    (30) /**< \brief Timer Counter 3 (TC3) */
375 #define ID_TC4    (31) /**< \brief Timer Counter 4 (TC4) */
376 #define ID_TC5    (32) /**< \brief Timer Counter 5 (TC5) */
377 #define ID_TC6    (33) /**< \brief Timer Counter 6 (TC6) */
378 #define ID_TC7    (34) /**< \brief Timer Counter 7 (TC7) */
379 #define ID_TC8    (35) /**< \brief Timer Counter 8 (TC8) */
380 #define ID_PWM    (36) /**< \brief Pulse Width Modulation Controller (PWM) */
381 #define ID_ADC    (37) /**< \brief ADC Controller (ADC) */
382 #define ID_DACC   (38) /**< \brief DAC Controller (DACC) */
383 #define ID_DMAC   (39) /**< \brief DMA Controller (DMAC) */
384 #define ID_UOTGHS (40) /**< \brief USB OTG High Speed (UOTGHS) */
385 #define ID_TRNG   (41) /**< \brief True Random Number Generator (TRNG) */
386 #define ID_EMAC   (42) /**< \brief Ethernet MAC (EMAC) */
387 #define ID_CAN0   (43) /**< \brief CAN Controller 0 (CAN0) */
388 #define ID_CAN1   (44) /**< \brief CAN Controller 1 (CAN1) */
389 
390 #define ID_PERIPH_COUNT (45) /**< \brief Number of peripheral IDs */
391 /*@}*/
392 
393 /* ************************************************************************** */
394 /*   BASE ADDRESS DEFINITIONS FOR SAM3X8E */
395 /* ************************************************************************** */
396 /** \addtogroup SAM3X8E_base Peripheral Base Address Definitions */
397 /*@{*/
398 
399 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
400 #define HSMCI      (0x40000000U) /**< \brief (HSMCI     ) Base Address */
401 #define SSC        (0x40004000U) /**< \brief (SSC       ) Base Address */
402 #define SPI0       (0x40008000U) /**< \brief (SPI0      ) Base Address */
403 #define TC0        (0x40080000U) /**< \brief (TC0       ) Base Address */
404 #define TC1        (0x40084000U) /**< \brief (TC1       ) Base Address */
405 #define TC2        (0x40088000U) /**< \brief (TC2       ) Base Address */
406 #define TWI0       (0x4008C000U) /**< \brief (TWI0      ) Base Address */
407 #define PDC_TWI0   (0x4008C100U) /**< \brief (PDC_TWI0  ) Base Address */
408 #define TWI1       (0x40090000U) /**< \brief (TWI1      ) Base Address */
409 #define PDC_TWI1   (0x40090100U) /**< \brief (PDC_TWI1  ) Base Address */
410 #define PWM        (0x40094000U) /**< \brief (PWM       ) Base Address */
411 #define PDC_PWM    (0x40094100U) /**< \brief (PDC_PWM   ) Base Address */
412 #define USART0     (0x40098000U) /**< \brief (USART0    ) Base Address */
413 #define PDC_USART0 (0x40098100U) /**< \brief (PDC_USART0) Base Address */
414 #define USART1     (0x4009C000U) /**< \brief (USART1    ) Base Address */
415 #define PDC_USART1 (0x4009C100U) /**< \brief (PDC_USART1) Base Address */
416 #define USART2     (0x400A0000U) /**< \brief (USART2    ) Base Address */
417 #define PDC_USART2 (0x400A0100U) /**< \brief (PDC_USART2) Base Address */
418 #define USART3     (0x400A4000U) /**< \brief (USART3    ) Base Address */
419 #define PDC_USART3 (0x400A4100U) /**< \brief (PDC_USART3) Base Address */
420 #define UOTGHS     (0x400AC000U) /**< \brief (UOTGHS    ) Base Address */
421 #define EMAC       (0x400B0000U) /**< \brief (EMAC      ) Base Address */
422 #define CAN0       (0x400B4000U) /**< \brief (CAN0      ) Base Address */
423 #define CAN1       (0x400B8000U) /**< \brief (CAN1      ) Base Address */
424 #define TRNG       (0x400BC000U) /**< \brief (TRNG      ) Base Address */
425 #define ADC        (0x400C0000U) /**< \brief (ADC       ) Base Address */
426 #define PDC_ADC    (0x400C0100U) /**< \brief (PDC_ADC   ) Base Address */
427 #define DMAC       (0x400C4000U) /**< \brief (DMAC      ) Base Address */
428 #define DACC       (0x400C8000U) /**< \brief (DACC      ) Base Address */
429 #define PDC_DACC   (0x400C8100U) /**< \brief (PDC_DACC  ) Base Address */
430 #define SMC        (0x400E0000U) /**< \brief (SMC       ) Base Address */
431 #define MATRIX     (0x400E0400U) /**< \brief (MATRIX    ) Base Address */
432 #define PMC        (0x400E0600U) /**< \brief (PMC       ) Base Address */
433 #define UART       (0x400E0800U) /**< \brief (UART      ) Base Address */
434 #define PDC_UART   (0x400E0900U) /**< \brief (PDC_UART  ) Base Address */
435 #define CHIPID     (0x400E0940U) /**< \brief (CHIPID    ) Base Address */
436 #define EFC0       (0x400E0A00U) /**< \brief (EFC0      ) Base Address */
437 #define EFC1       (0x400E0C00U) /**< \brief (EFC1      ) Base Address */
438 #define PIOA       (0x400E0E00U) /**< \brief (PIOA      ) Base Address */
439 #define PIOB       (0x400E1000U) /**< \brief (PIOB      ) Base Address */
440 #define PIOC       (0x400E1200U) /**< \brief (PIOC      ) Base Address */
441 #define PIOD       (0x400E1400U) /**< \brief (PIOD      ) Base Address */
442 #define RSTC       (0x400E1A00U) /**< \brief (RSTC      ) Base Address */
443 #define SUPC       (0x400E1A10U) /**< \brief (SUPC      ) Base Address */
444 #define RTT        (0x400E1A30U) /**< \brief (RTT       ) Base Address */
445 #define WDT        (0x400E1A50U) /**< \brief (WDT       ) Base Address */
446 #define RTC        (0x400E1A60U) /**< \brief (RTC       ) Base Address */
447 #define GPBR       (0x400E1A90U) /**< \brief (GPBR      ) Base Address */
448 #else
449 #define HSMCI      ((Hsmci  *)0x40000000U) /**< \brief (HSMCI     ) Base Address */
450 #define SSC        ((Ssc    *)0x40004000U) /**< \brief (SSC       ) Base Address */
451 #define SPI0       ((Spi    *)0x40008000U) /**< \brief (SPI0      ) Base Address */
452 #define TC0        ((Tc     *)0x40080000U) /**< \brief (TC0       ) Base Address */
453 #define TC1        ((Tc     *)0x40084000U) /**< \brief (TC1       ) Base Address */
454 #define TC2        ((Tc     *)0x40088000U) /**< \brief (TC2       ) Base Address */
455 #define TWI0       ((Twi    *)0x4008C000U) /**< \brief (TWI0      ) Base Address */
456 #define PDC_TWI0   ((Pdc    *)0x4008C100U) /**< \brief (PDC_TWI0  ) Base Address */
457 #define TWI1       ((Twi    *)0x40090000U) /**< \brief (TWI1      ) Base Address */
458 #define PDC_TWI1   ((Pdc    *)0x40090100U) /**< \brief (PDC_TWI1  ) Base Address */
459 #define PWM        ((Pwm    *)0x40094000U) /**< \brief (PWM       ) Base Address */
460 #define PDC_PWM    ((Pdc    *)0x40094100U) /**< \brief (PDC_PWM   ) Base Address */
461 #define USART0     ((Usart  *)0x40098000U) /**< \brief (USART0    ) Base Address */
462 #define PDC_USART0 ((Pdc    *)0x40098100U) /**< \brief (PDC_USART0) Base Address */
463 #define USART1     ((Usart  *)0x4009C000U) /**< \brief (USART1    ) Base Address */
464 #define PDC_USART1 ((Pdc    *)0x4009C100U) /**< \brief (PDC_USART1) Base Address */
465 #define USART2     ((Usart  *)0x400A0000U) /**< \brief (USART2    ) Base Address */
466 #define PDC_USART2 ((Pdc    *)0x400A0100U) /**< \brief (PDC_USART2) Base Address */
467 #define USART3     ((Usart  *)0x400A4000U) /**< \brief (USART3    ) Base Address */
468 #define PDC_USART3 ((Pdc    *)0x400A4100U) /**< \brief (PDC_USART3) Base Address */
469 #define UOTGHS     ((Uotghs *)0x400AC000U) /**< \brief (UOTGHS    ) Base Address */
470 #define EMAC       ((Emac   *)0x400B0000U) /**< \brief (EMAC      ) Base Address */
471 #define CAN0       ((Can    *)0x400B4000U) /**< \brief (CAN0      ) Base Address */
472 #define CAN1       ((Can    *)0x400B8000U) /**< \brief (CAN1      ) Base Address */
473 #define TRNG       ((Trng   *)0x400BC000U) /**< \brief (TRNG      ) Base Address */
474 #define ADC        ((Adc    *)0x400C0000U) /**< \brief (ADC       ) Base Address */
475 #define PDC_ADC    ((Pdc    *)0x400C0100U) /**< \brief (PDC_ADC   ) Base Address */
476 #define DMAC       ((Dmac   *)0x400C4000U) /**< \brief (DMAC      ) Base Address */
477 #define DACC       ((Dacc   *)0x400C8000U) /**< \brief (DACC      ) Base Address */
478 #define PDC_DACC   ((Pdc    *)0x400C8100U) /**< \brief (PDC_DACC  ) Base Address */
479 #define SMC        ((Smc    *)0x400E0000U) /**< \brief (SMC       ) Base Address */
480 #define MATRIX     ((Matrix *)0x400E0400U) /**< \brief (MATRIX    ) Base Address */
481 #define PMC        ((Pmc    *)0x400E0600U) /**< \brief (PMC       ) Base Address */
482 #define UART       ((Uart   *)0x400E0800U) /**< \brief (UART      ) Base Address */
483 #define PDC_UART   ((Pdc    *)0x400E0900U) /**< \brief (PDC_UART  ) Base Address */
484 #define CHIPID     ((Chipid *)0x400E0940U) /**< \brief (CHIPID    ) Base Address */
485 #define EFC0       ((Efc    *)0x400E0A00U) /**< \brief (EFC0      ) Base Address */
486 #define EFC1       ((Efc    *)0x400E0C00U) /**< \brief (EFC1      ) Base Address */
487 #define PIOA       ((Pio    *)0x400E0E00U) /**< \brief (PIOA      ) Base Address */
488 #define PIOB       ((Pio    *)0x400E1000U) /**< \brief (PIOB      ) Base Address */
489 #define PIOC       ((Pio    *)0x400E1200U) /**< \brief (PIOC      ) Base Address */
490 #define PIOD       ((Pio    *)0x400E1400U) /**< \brief (PIOD      ) Base Address */
491 #define RSTC       ((Rstc   *)0x400E1A00U) /**< \brief (RSTC      ) Base Address */
492 #define SUPC       ((Supc   *)0x400E1A10U) /**< \brief (SUPC      ) Base Address */
493 #define RTT        ((Rtt    *)0x400E1A30U) /**< \brief (RTT       ) Base Address */
494 #define WDT        ((Wdt    *)0x400E1A50U) /**< \brief (WDT       ) Base Address */
495 #define RTC        ((Rtc    *)0x400E1A60U) /**< \brief (RTC       ) Base Address */
496 #define GPBR       ((Gpbr   *)0x400E1A90U) /**< \brief (GPBR      ) Base Address */
497 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
498 /*@}*/
499 
500 /* ************************************************************************** */
501 /*   PIO DEFINITIONS FOR SAM3X8E */
502 /* ************************************************************************** */
503 /** \addtogroup SAM3X8E_pio Peripheral Pio Definitions */
504 /*@{*/
505 
506 #include "pio/sam3x8e.h"
507 /*@}*/
508 
509 /* ************************************************************************** */
510 /*   MEMORY MAPPING DEFINITIONS FOR SAM3X8E */
511 /* ************************************************************************** */
512 
513 #define IFLASH0_SIZE             (0x40000u)
514 #define IFLASH0_PAGE_SIZE        (256u)
515 #define IFLASH0_LOCK_REGION_SIZE (16384u)
516 #define IFLASH0_NB_OF_PAGES      (1024u)
517 #define IFLASH0_NB_OF_LOCK_BITS  (32u)
518 #define IFLASH1_SIZE             (0x40000u)
519 #define IFLASH1_PAGE_SIZE        (256u)
520 #define IFLASH1_LOCK_REGION_SIZE (16384u)
521 #define IFLASH1_NB_OF_PAGES      (1024u)
522 #define IFLASH1_NB_OF_LOCK_BITS  (32u)
523 #define IRAM0_SIZE               (0x10000u)
524 #define IRAM1_SIZE               (0x8000u)
525 #define NFCRAM_SIZE              (0x1000u)
526 #define IFLASH_SIZE              (IFLASH0_SIZE+IFLASH1_SIZE)
527 #define IRAM_SIZE                (IRAM0_SIZE+IRAM1_SIZE)
528 
529 #define IFLASH0_ADDR    (0x00080000u) /**< Internal Flash 0 base address */
530 #if defined IFLASH0_SIZE
531 #define IFLASH1_ADDR    (IFLASH0_ADDR+IFLASH0_SIZE) /**< Internal Flash 1 base address */
532 #endif
533 #define IROM_ADDR       (0x00100000u) /**< Internal ROM base address */
534 #define IRAM0_ADDR      (0x20000000u) /**< Internal RAM 0 base address */
535 #define IRAM1_ADDR      (0x20080000u) /**< Internal RAM 1 base address */
536 #define NFC_RAM_ADDR    (0x20100000u) /**< NAND Flash Controller RAM base address */
537 #define UOTGHS_RAM_ADDR (0x20180000u) /**< USB On-The-Go Interface RAM base address */
538 #define EBI_CS0_ADDR    (0x60000000u) /**< EBI Chip Select 0 base address */
539 #define EBI_CS1_ADDR    (0x61000000u) /**< EBI Chip Select 1 base address */
540 #define EBI_CS2_ADDR    (0x62000000u) /**< EBI Chip Select 2 base address */
541 #define EBI_CS3_ADDR    (0x63000000u) /**< EBI Chip Select 3 base address */
542 #define EBI_CS4_ADDR    (0x64000000u) /**< EBI Chip Select 4 base address */
543 #define EBI_CS5_ADDR    (0x65000000u) /**< EBI Chip Select 5 base address */
544 #define EBI_CS6_ADDR    (0x66000000u) /**< EBI Chip Select 6 base address */
545 #define EBI_CS7_ADDR    (0x67000000u) /**< EBI Chip Select 7 base address */
546 
547 /* ************************************************************************** */
548 /*   MISCELLANEOUS DEFINITIONS FOR SAM3X8E */
549 /* ************************************************************************** */
550 
551 #define CHIP_JTAGID       (0x05B2B03FUL)
552 #define CHIP_CIDR         (0x285E0A30UL)
553 #define CHIP_EXID         (0x0UL)
554 #define NB_CH_ADC         (15UL)
555 #define NB_CH_DAC         (2UL)
556 #define USB_DEVICE_MAX_EP (10UL)
557 #define USB_HOST_MAX_PIPE (10UL)
558 
559 /* ************************************************************************** */
560 /*   ELECTRICAL DEFINITIONS FOR SAM3X8E */
561 /* ************************************************************************** */
562 
563 /* Device characteristics */
564 #define CHIP_FREQ_SLCK_RC_MIN           (20000UL)
565 #define CHIP_FREQ_SLCK_RC               (32000UL)
566 #define CHIP_FREQ_SLCK_RC_MAX           (44000UL)
567 #define CHIP_FREQ_MAINCK_RC_4MHZ        (4000000UL)
568 #define CHIP_FREQ_MAINCK_RC_8MHZ        (8000000UL)
569 #define CHIP_FREQ_MAINCK_RC_12MHZ       (12000000UL)
570 #define CHIP_FREQ_CPU_MAX               (84000000UL)
571 #define CHIP_FREQ_XTAL_32K              (32768UL)
572 #define CHIP_FREQ_XTAL_12M              (12000000UL)
573 #define CHIP_FREQ_UTMIPLL               (480000000UL) /* UTMI PLL frequency */
574 
575 /* Embedded Flash Write Wait State */
576 #define CHIP_FLASH_WRITE_WAIT_STATE     (6U)
577 
578 /* Embedded Flash Read Wait State (VDDCORE set at 1.65V) */
579 #define CHIP_FREQ_FWS_0                 (22500000UL) /**< \brief Maximum operating frequency when FWS is 0 */
580 #define CHIP_FREQ_FWS_1                 (34000000UL) /**< \brief Maximum operating frequency when FWS is 1 */
581 #define CHIP_FREQ_FWS_2                 (53000000UL) /**< \brief Maximum operating frequency when FWS is 2 */
582 #define CHIP_FREQ_FWS_3                 (78000000UL) /**< \brief Maximum operating frequency when FWS is 3 */
583 
584 #ifdef __cplusplus
585 }
586 #endif
587 
588 /*@}*/
589 
590 #endif /* _SAM3X8E_ */
591