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 _SAM4SD32C_
31 #define _SAM4SD32C_
32 
33 /** \addtogroup SAM4SD32C_definitions SAM4SD32C definitions
34   This file defines all structures and symbols for SAM4SD32C:
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 SAM4SD32C */
52 /* ************************************************************************** */
53 /** \addtogroup SAM4SD32C_cmsis CMSIS Definitions */
54 /*@{*/
55 
56 /**< Interrupt Number Definition */
57 typedef enum IRQn
58 {
59 /******  Cortex-M4 Processor Exceptions Numbers ******************************/
60   NonMaskableInt_IRQn   = -14, /**<  2 Non Maskable Interrupt                */
61   HardFault_IRQn        = -13, /**<  3 HardFault Interrupt                   */
62   MemoryManagement_IRQn = -12, /**<  4 Cortex-M4 Memory Management Interrupt */
63   BusFault_IRQn         = -11, /**<  5 Cortex-M4 Bus Fault Interrupt         */
64   UsageFault_IRQn       = -10, /**<  6 Cortex-M4 Usage Fault Interrupt       */
65   SVCall_IRQn           = -5,  /**< 11 Cortex-M4 SV Call Interrupt           */
66   DebugMonitor_IRQn     = -4,  /**< 12 Cortex-M4 Debug Monitor Interrupt     */
67   PendSV_IRQn           = -2,  /**< 14 Cortex-M4 Pend SV Interrupt           */
68   SysTick_IRQn          = -1,  /**< 15 Cortex-M4 System Tick Interrupt       */
69 /******  SAM4SD32C specific Interrupt Numbers *********************************/
70 
71   SUPC_IRQn            =  0, /**<  0 SAM4SD32C Supply Controller (SUPC) */
72   RSTC_IRQn            =  1, /**<  1 SAM4SD32C Reset Controller (RSTC) */
73   RTC_IRQn             =  2, /**<  2 SAM4SD32C Real Time Clock (RTC) */
74   RTT_IRQn             =  3, /**<  3 SAM4SD32C Real Time Timer (RTT) */
75   WDT_IRQn             =  4, /**<  4 SAM4SD32C Watchdog Timer (WDT) */
76   PMC_IRQn             =  5, /**<  5 SAM4SD32C Power Management Controller (PMC) */
77   EFC0_IRQn            =  6, /**<  6 SAM4SD32C Enhanced Embedded Flash Controller 0 (EFC0) */
78   EFC1_IRQn            =  7, /**<  7 SAM4SD32C Enhanced Embedded Flash Controller 1 (EFC1) */
79   UART0_IRQn           =  8, /**<  8 SAM4SD32C UART 0 (UART0) */
80   UART1_IRQn           =  9, /**<  9 SAM4SD32C UART 1 (UART1) */
81   PIOA_IRQn            = 11, /**< 11 SAM4SD32C Parallel I/O Controller A (PIOA) */
82   PIOB_IRQn            = 12, /**< 12 SAM4SD32C Parallel I/O Controller B (PIOB) */
83   PIOC_IRQn            = 13, /**< 13 SAM4SD32C Parallel I/O Controller C (PIOC) */
84   USART0_IRQn          = 14, /**< 14 SAM4SD32C USART 0 (USART0) */
85   USART1_IRQn          = 15, /**< 15 SAM4SD32C USART 1 (USART1) */
86   HSMCI_IRQn           = 18, /**< 18 SAM4SD32C Multimedia Card Interface (HSMCI) */
87   TWI0_IRQn            = 19, /**< 19 SAM4SD32C Two Wire Interface 0 (TWI0) */
88   TWI1_IRQn            = 20, /**< 20 SAM4SD32C Two Wire Interface 1 (TWI1) */
89   SPI_IRQn             = 21, /**< 21 SAM4SD32C Serial Peripheral Interface (SPI) */
90   SSC_IRQn             = 22, /**< 22 SAM4SD32C Synchronous Serial Controller (SSC) */
91   TC0_IRQn             = 23, /**< 23 SAM4SD32C Timer/Counter 0 (TC0) */
92   TC1_IRQn             = 24, /**< 24 SAM4SD32C Timer/Counter 1 (TC1) */
93   TC2_IRQn             = 25, /**< 25 SAM4SD32C Timer/Counter 2 (TC2) */
94   TC3_IRQn             = 26, /**< 26 SAM4SD32C Timer/Counter 3 (TC3) */
95   TC4_IRQn             = 27, /**< 27 SAM4SD32C Timer/Counter 4 (TC4) */
96   TC5_IRQn             = 28, /**< 28 SAM4SD32C Timer/Counter 5 (TC5) */
97   ADC_IRQn             = 29, /**< 29 SAM4SD32C Analog To Digital Converter (ADC) */
98   DACC_IRQn            = 30, /**< 30 SAM4SD32C Digital To Analog Converter (DACC) */
99   PWM_IRQn             = 31, /**< 31 SAM4SD32C Pulse Width Modulation (PWM) */
100   CRCCU_IRQn           = 32, /**< 32 SAM4SD32C CRC Calculation Unit (CRCCU) */
101   ACC_IRQn             = 33, /**< 33 SAM4SD32C Analog Comparator (ACC) */
102   UDP_IRQn             = 34, /**< 34 SAM4SD32C USB Device Port (UDP) */
103 
104   PERIPH_COUNT_IRQn    = 35  /**< Number of peripheral IDs */
105 } IRQn_Type;
106 
107 typedef struct _DeviceVectors
108 {
109   /* Stack pointer */
110   void* pvStack;
111 
112   /* Cortex-M handlers */
113   void* pfnReset_Handler;
114   void* pfnNMI_Handler;
115   void* pfnHardFault_Handler;
116   void* pfnMemManage_Handler;
117   void* pfnBusFault_Handler;
118   void* pfnUsageFault_Handler;
119   void* pfnReserved1_Handler;
120   void* pfnReserved2_Handler;
121   void* pfnReserved3_Handler;
122   void* pfnReserved4_Handler;
123   void* pfnSVC_Handler;
124   void* pfnDebugMon_Handler;
125   void* pfnReserved5_Handler;
126   void* pfnPendSV_Handler;
127   void* pfnSysTick_Handler;
128 
129   /* Peripheral handlers */
130   void* pfnSUPC_Handler;   /*  0 Supply Controller */
131   void* pfnRSTC_Handler;   /*  1 Reset Controller */
132   void* pfnRTC_Handler;    /*  2 Real Time Clock */
133   void* pfnRTT_Handler;    /*  3 Real Time Timer */
134   void* pfnWDT_Handler;    /*  4 Watchdog Timer */
135   void* pfnPMC_Handler;    /*  5 Power Management Controller */
136   void* pfnEFC0_Handler;   /*  6 Enhanced Embedded Flash Controller 0 */
137   void* pfnEFC1_Handler;   /*  7 Enhanced Embedded Flash Controller 1 */
138   void* pfnUART0_Handler;  /*  8 UART 0 */
139   void* pfnUART1_Handler;  /*  9 UART 1 */
140   void* pvReserved10;
141   void* pfnPIOA_Handler;   /* 11 Parallel I/O Controller A */
142   void* pfnPIOB_Handler;   /* 12 Parallel I/O Controller B */
143   void* pfnPIOC_Handler;   /* 13 Parallel I/O Controller C */
144   void* pfnUSART0_Handler; /* 14 USART 0 */
145   void* pfnUSART1_Handler; /* 15 USART 1 */
146   void* pvReserved16;
147   void* pvReserved17;
148   void* pfnHSMCI_Handler;  /* 18 Multimedia Card Interface */
149   void* pfnTWI0_Handler;   /* 19 Two Wire Interface 0 */
150   void* pfnTWI1_Handler;   /* 20 Two Wire Interface 1 */
151   void* pfnSPI_Handler;    /* 21 Serial Peripheral Interface */
152   void* pfnSSC_Handler;    /* 22 Synchronous Serial Controller */
153   void* pfnTC0_Handler;    /* 23 Timer/Counter 0 */
154   void* pfnTC1_Handler;    /* 24 Timer/Counter 1 */
155   void* pfnTC2_Handler;    /* 25 Timer/Counter 2 */
156   void* pfnTC3_Handler;    /* 26 Timer/Counter 3 */
157   void* pfnTC4_Handler;    /* 27 Timer/Counter 4 */
158   void* pfnTC5_Handler;    /* 28 Timer/Counter 5 */
159   void* pfnADC_Handler;    /* 29 Analog To Digital Converter */
160   void* pfnDACC_Handler;   /* 30 Digital To Analog Converter */
161   void* pfnPWM_Handler;    /* 31 Pulse Width Modulation */
162   void* pfnCRCCU_Handler;  /* 32 CRC Calculation Unit */
163   void* pfnACC_Handler;    /* 33 Analog Comparator */
164   void* pfnUDP_Handler;    /* 34 USB Device Port */
165 } DeviceVectors;
166 
167 /* Cortex-M4 core handlers */
168 void Reset_Handler      ( void );
169 void NMI_Handler        ( void );
170 void HardFault_Handler  ( void );
171 void MemManage_Handler  ( void );
172 void BusFault_Handler   ( void );
173 void UsageFault_Handler ( void );
174 void SVC_Handler        ( void );
175 void DebugMon_Handler   ( void );
176 void PendSV_Handler     ( void );
177 void SysTick_Handler    ( void );
178 
179 /* Peripherals handlers */
180 void ACC_Handler        ( void );
181 void ADC_Handler        ( void );
182 void CRCCU_Handler      ( void );
183 void DACC_Handler       ( void );
184 void EFC0_Handler       ( void );
185 void EFC1_Handler       ( void );
186 void HSMCI_Handler      ( void );
187 void PIOA_Handler       ( void );
188 void PIOB_Handler       ( void );
189 void PIOC_Handler       ( void );
190 void PMC_Handler        ( void );
191 void PWM_Handler        ( void );
192 void RSTC_Handler       ( void );
193 void RTC_Handler        ( void );
194 void RTT_Handler        ( void );
195 void SPI_Handler        ( void );
196 void SSC_Handler        ( void );
197 void SUPC_Handler       ( void );
198 void TC0_Handler        ( void );
199 void TC1_Handler        ( void );
200 void TC2_Handler        ( void );
201 void TC3_Handler        ( void );
202 void TC4_Handler        ( void );
203 void TC5_Handler        ( void );
204 void TWI0_Handler       ( void );
205 void TWI1_Handler       ( void );
206 void UART0_Handler      ( void );
207 void UART1_Handler      ( void );
208 void UDP_Handler        ( void );
209 void USART0_Handler     ( void );
210 void USART1_Handler     ( void );
211 void WDT_Handler        ( void );
212 
213 /**
214  * \brief Configuration of the Cortex-M4 Processor and Core Peripherals
215  */
216 
217 #define __CM4_REV              0x0001 /**< SAM4SD32C core revision number ([15:8] revision number, [7:0] patch number) */
218 #define __MPU_PRESENT          1      /**< SAM4SD32C does provide a MPU */
219 #define __FPU_PRESENT          0      /**< SAM4SD32C does not provide a FPU */
220 #define __NVIC_PRIO_BITS       4      /**< SAM4SD32C uses 4 Bits for the Priority Levels */
221 #define __Vendor_SysTickConfig 0      /**< Set to 1 if different SysTick Config is used */
222 
223 /*
224  * \brief CMSIS includes
225  */
226 
227 #include <core_cm4.h>
228 #if !defined DONT_USE_CMSIS_INIT
229 #include "system_sam4s.h"
230 #endif /* DONT_USE_CMSIS_INIT */
231 
232 /*@}*/
233 
234 /* ************************************************************************** */
235 /**  SOFTWARE PERIPHERAL API DEFINITION FOR SAM4SD32C */
236 /* ************************************************************************** */
237 /** \addtogroup SAM4SD32C_api Peripheral Software API */
238 /*@{*/
239 
240 #include "component/acc.h"
241 #include "component/adc.h"
242 #include "component/chipid.h"
243 #include "component/cmcc.h"
244 #include "component/crccu.h"
245 #include "component/dacc.h"
246 #include "component/efc.h"
247 #include "component/gpbr.h"
248 #include "component/hsmci.h"
249 #include "component/matrix.h"
250 #include "component/pdc.h"
251 #include "component/pio.h"
252 #include "component/pmc.h"
253 #include "component/pwm.h"
254 #include "component/rstc.h"
255 #include "component/rtc.h"
256 #include "component/rtt.h"
257 #include "component/smc.h"
258 #include "component/spi.h"
259 #include "component/ssc.h"
260 #include "component/supc.h"
261 #include "component/tc.h"
262 #include "component/twi.h"
263 #include "component/uart.h"
264 #include "component/udp.h"
265 #include "component/usart.h"
266 #include "component/wdt.h"
267 /*@}*/
268 
269 /* ************************************************************************** */
270 /*   REGISTER ACCESS DEFINITIONS FOR SAM4SD32C */
271 /* ************************************************************************** */
272 /** \addtogroup SAM4SD32C_reg Registers Access Definitions */
273 /*@{*/
274 
275 #include "instance/hsmci.h"
276 #include "instance/ssc.h"
277 #include "instance/spi.h"
278 #include "instance/tc0.h"
279 #include "instance/tc1.h"
280 #include "instance/twi0.h"
281 #include "instance/twi1.h"
282 #include "instance/pwm.h"
283 #include "instance/usart0.h"
284 #include "instance/usart1.h"
285 #include "instance/udp.h"
286 #include "instance/adc.h"
287 #include "instance/dacc.h"
288 #include "instance/acc.h"
289 #include "instance/crccu.h"
290 #include "instance/cmcc.h"
291 #include "instance/smc.h"
292 #include "instance/matrix.h"
293 #include "instance/pmc.h"
294 #include "instance/uart0.h"
295 #include "instance/chipid.h"
296 #include "instance/uart1.h"
297 #include "instance/efc0.h"
298 #include "instance/efc1.h"
299 #include "instance/pioa.h"
300 #include "instance/piob.h"
301 #include "instance/pioc.h"
302 #include "instance/rstc.h"
303 #include "instance/supc.h"
304 #include "instance/rtt.h"
305 #include "instance/wdt.h"
306 #include "instance/rtc.h"
307 #include "instance/gpbr.h"
308 /*@}*/
309 
310 /* ************************************************************************** */
311 /*   PERIPHERAL ID DEFINITIONS FOR SAM4SD32C */
312 /* ************************************************************************** */
313 /** \addtogroup SAM4SD32C_id Peripheral Ids Definitions */
314 /*@{*/
315 
316 #define ID_SUPC   ( 0) /**< \brief Supply Controller (SUPC) */
317 #define ID_RSTC   ( 1) /**< \brief Reset Controller (RSTC) */
318 #define ID_RTC    ( 2) /**< \brief Real Time Clock (RTC) */
319 #define ID_RTT    ( 3) /**< \brief Real Time Timer (RTT) */
320 #define ID_WDT    ( 4) /**< \brief Watchdog Timer (WDT) */
321 #define ID_PMC    ( 5) /**< \brief Power Management Controller (PMC) */
322 #define ID_EFC0   ( 6) /**< \brief Enhanced Embedded Flash Controller 0 (EFC0) */
323 #define ID_EFC1   ( 7) /**< \brief Enhanced Embedded Flash Controller 1 (EFC1) */
324 #define ID_UART0  ( 8) /**< \brief UART 0 (UART0) */
325 #define ID_UART1  ( 9) /**< \brief UART 1 (UART1) */
326 #define ID_SMC    (10) /**< \brief Static Memory Controller (SMC) */
327 #define ID_PIOA   (11) /**< \brief Parallel I/O Controller A (PIOA) */
328 #define ID_PIOB   (12) /**< \brief Parallel I/O Controller B (PIOB) */
329 #define ID_PIOC   (13) /**< \brief Parallel I/O Controller C (PIOC) */
330 #define ID_USART0 (14) /**< \brief USART 0 (USART0) */
331 #define ID_USART1 (15) /**< \brief USART 1 (USART1) */
332 #define ID_HSMCI  (18) /**< \brief Multimedia Card Interface (HSMCI) */
333 #define ID_TWI0   (19) /**< \brief Two Wire Interface 0 (TWI0) */
334 #define ID_TWI1   (20) /**< \brief Two Wire Interface 1 (TWI1) */
335 #define ID_SPI    (21) /**< \brief Serial Peripheral Interface (SPI) */
336 #define ID_SSC    (22) /**< \brief Synchronous Serial Controller (SSC) */
337 #define ID_TC0    (23) /**< \brief Timer/Counter 0 (TC0) */
338 #define ID_TC1    (24) /**< \brief Timer/Counter 1 (TC1) */
339 #define ID_TC2    (25) /**< \brief Timer/Counter 2 (TC2) */
340 #define ID_TC3    (26) /**< \brief Timer/Counter 3 (TC3) */
341 #define ID_TC4    (27) /**< \brief Timer/Counter 4 (TC4) */
342 #define ID_TC5    (28) /**< \brief Timer/Counter 5 (TC5) */
343 #define ID_ADC    (29) /**< \brief Analog To Digital Converter (ADC) */
344 #define ID_DACC   (30) /**< \brief Digital To Analog Converter (DACC) */
345 #define ID_PWM    (31) /**< \brief Pulse Width Modulation (PWM) */
346 #define ID_CRCCU  (32) /**< \brief CRC Calculation Unit (CRCCU) */
347 #define ID_ACC    (33) /**< \brief Analog Comparator (ACC) */
348 #define ID_UDP    (34) /**< \brief USB Device Port (UDP) */
349 
350 #define ID_PERIPH_COUNT (35) /**< \brief Number of peripheral IDs */
351 /*@}*/
352 
353 /* ************************************************************************** */
354 /*   BASE ADDRESS DEFINITIONS FOR SAM4SD32C */
355 /* ************************************************************************** */
356 /** \addtogroup SAM4SD32C_base Peripheral Base Address Definitions */
357 /*@{*/
358 
359 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
360 #define HSMCI      (0x40000000U) /**< \brief (HSMCI     ) Base Address */
361 #define PDC_HSMCI  (0x40000100U) /**< \brief (PDC_HSMCI ) Base Address */
362 #define SSC        (0x40004000U) /**< \brief (SSC       ) Base Address */
363 #define PDC_SSC    (0x40004100U) /**< \brief (PDC_SSC   ) Base Address */
364 #define SPI        (0x40008000U) /**< \brief (SPI       ) Base Address */
365 #define PDC_SPI    (0x40008100U) /**< \brief (PDC_SPI   ) Base Address */
366 #define TC0        (0x40010000U) /**< \brief (TC0       ) Base Address */
367 #define TC1        (0x40014000U) /**< \brief (TC1       ) Base Address */
368 #define TWI0       (0x40018000U) /**< \brief (TWI0      ) Base Address */
369 #define PDC_TWI0   (0x40018100U) /**< \brief (PDC_TWI0  ) Base Address */
370 #define TWI1       (0x4001C000U) /**< \brief (TWI1      ) Base Address */
371 #define PDC_TWI1   (0x4001C100U) /**< \brief (PDC_TWI1  ) Base Address */
372 #define PWM        (0x40020000U) /**< \brief (PWM       ) Base Address */
373 #define PDC_PWM    (0x40020100U) /**< \brief (PDC_PWM   ) Base Address */
374 #define USART0     (0x40024000U) /**< \brief (USART0    ) Base Address */
375 #define PDC_USART0 (0x40024100U) /**< \brief (PDC_USART0) Base Address */
376 #define USART1     (0x40028000U) /**< \brief (USART1    ) Base Address */
377 #define PDC_USART1 (0x40028100U) /**< \brief (PDC_USART1) Base Address */
378 #define UDP        (0x40034000U) /**< \brief (UDP       ) Base Address */
379 #define ADC        (0x40038000U) /**< \brief (ADC       ) Base Address */
380 #define PDC_ADC    (0x40038100U) /**< \brief (PDC_ADC   ) Base Address */
381 #define DACC       (0x4003C000U) /**< \brief (DACC      ) Base Address */
382 #define PDC_DACC   (0x4003C100U) /**< \brief (PDC_DACC  ) Base Address */
383 #define ACC        (0x40040000U) /**< \brief (ACC       ) Base Address */
384 #define CRCCU      (0x40044000U) /**< \brief (CRCCU     ) Base Address */
385 #define CMCC       (0x4007C000U) /**< \brief (CMCC      ) Base Address */
386 #define SMC        (0x400E0000U) /**< \brief (SMC       ) Base Address */
387 #define MATRIX     (0x400E0200U) /**< \brief (MATRIX    ) Base Address */
388 #define PMC        (0x400E0400U) /**< \brief (PMC       ) Base Address */
389 #define UART0      (0x400E0600U) /**< \brief (UART0     ) Base Address */
390 #define PDC_UART0  (0x400E0700U) /**< \brief (PDC_UART0 ) Base Address */
391 #define CHIPID     (0x400E0740U) /**< \brief (CHIPID    ) Base Address */
392 #define UART1      (0x400E0800U) /**< \brief (UART1     ) Base Address */
393 #define PDC_UART1  (0x400E0900U) /**< \brief (PDC_UART1 ) Base Address */
394 #define EFC0       (0x400E0A00U) /**< \brief (EFC0      ) Base Address */
395 #define EFC1       (0x400E0C00U) /**< \brief (EFC1      ) Base Address */
396 #define PIOA       (0x400E0E00U) /**< \brief (PIOA      ) Base Address */
397 #define PDC_PIOA   (0x400E0F68U) /**< \brief (PDC_PIOA  ) Base Address */
398 #define PIOB       (0x400E1000U) /**< \brief (PIOB      ) Base Address */
399 #define PIOC       (0x400E1200U) /**< \brief (PIOC      ) Base Address */
400 #define RSTC       (0x400E1400U) /**< \brief (RSTC      ) Base Address */
401 #define SUPC       (0x400E1410U) /**< \brief (SUPC      ) Base Address */
402 #define RTT        (0x400E1430U) /**< \brief (RTT       ) Base Address */
403 #define WDT        (0x400E1450U) /**< \brief (WDT       ) Base Address */
404 #define RTC        (0x400E1460U) /**< \brief (RTC       ) Base Address */
405 #define GPBR       (0x400E1490U) /**< \brief (GPBR      ) Base Address */
406 #else
407 #define HSMCI      ((Hsmci  *)0x40000000U) /**< \brief (HSMCI     ) Base Address */
408 #define PDC_HSMCI  ((Pdc    *)0x40000100U) /**< \brief (PDC_HSMCI ) Base Address */
409 #define SSC        ((Ssc    *)0x40004000U) /**< \brief (SSC       ) Base Address */
410 #define PDC_SSC    ((Pdc    *)0x40004100U) /**< \brief (PDC_SSC   ) Base Address */
411 #define SPI        ((Spi    *)0x40008000U) /**< \brief (SPI       ) Base Address */
412 #define PDC_SPI    ((Pdc    *)0x40008100U) /**< \brief (PDC_SPI   ) Base Address */
413 #define TC0        ((Tc     *)0x40010000U) /**< \brief (TC0       ) Base Address */
414 #define TC1        ((Tc     *)0x40014000U) /**< \brief (TC1       ) Base Address */
415 #define TWI0       ((Twi    *)0x40018000U) /**< \brief (TWI0      ) Base Address */
416 #define PDC_TWI0   ((Pdc    *)0x40018100U) /**< \brief (PDC_TWI0  ) Base Address */
417 #define TWI1       ((Twi    *)0x4001C000U) /**< \brief (TWI1      ) Base Address */
418 #define PDC_TWI1   ((Pdc    *)0x4001C100U) /**< \brief (PDC_TWI1  ) Base Address */
419 #define PWM        ((Pwm    *)0x40020000U) /**< \brief (PWM       ) Base Address */
420 #define PDC_PWM    ((Pdc    *)0x40020100U) /**< \brief (PDC_PWM   ) Base Address */
421 #define USART0     ((Usart  *)0x40024000U) /**< \brief (USART0    ) Base Address */
422 #define PDC_USART0 ((Pdc    *)0x40024100U) /**< \brief (PDC_USART0) Base Address */
423 #define USART1     ((Usart  *)0x40028000U) /**< \brief (USART1    ) Base Address */
424 #define PDC_USART1 ((Pdc    *)0x40028100U) /**< \brief (PDC_USART1) Base Address */
425 #define UDP        ((Udp    *)0x40034000U) /**< \brief (UDP       ) Base Address */
426 #define ADC        ((Adc    *)0x40038000U) /**< \brief (ADC       ) Base Address */
427 #define PDC_ADC    ((Pdc    *)0x40038100U) /**< \brief (PDC_ADC   ) Base Address */
428 #define DACC       ((Dacc   *)0x4003C000U) /**< \brief (DACC      ) Base Address */
429 #define PDC_DACC   ((Pdc    *)0x4003C100U) /**< \brief (PDC_DACC  ) Base Address */
430 #define ACC        ((Acc    *)0x40040000U) /**< \brief (ACC       ) Base Address */
431 #define CRCCU      ((Crccu  *)0x40044000U) /**< \brief (CRCCU     ) Base Address */
432 #define CMCC       ((Cmcc   *)0x4007C000U) /**< \brief (CMCC      ) Base Address */
433 #define SMC        ((Smc    *)0x400E0000U) /**< \brief (SMC       ) Base Address */
434 #define MATRIX     ((Matrix *)0x400E0200U) /**< \brief (MATRIX    ) Base Address */
435 #define PMC        ((Pmc    *)0x400E0400U) /**< \brief (PMC       ) Base Address */
436 #define UART0      ((Uart   *)0x400E0600U) /**< \brief (UART0     ) Base Address */
437 #define PDC_UART0  ((Pdc    *)0x400E0700U) /**< \brief (PDC_UART0 ) Base Address */
438 #define CHIPID     ((Chipid *)0x400E0740U) /**< \brief (CHIPID    ) Base Address */
439 #define UART1      ((Uart   *)0x400E0800U) /**< \brief (UART1     ) Base Address */
440 #define PDC_UART1  ((Pdc    *)0x400E0900U) /**< \brief (PDC_UART1 ) Base Address */
441 #define EFC0       ((Efc    *)0x400E0A00U) /**< \brief (EFC0      ) Base Address */
442 #define EFC1       ((Efc    *)0x400E0C00U) /**< \brief (EFC1      ) Base Address */
443 #define PIOA       ((Pio    *)0x400E0E00U) /**< \brief (PIOA      ) Base Address */
444 #define PDC_PIOA   ((Pdc    *)0x400E0F68U) /**< \brief (PDC_PIOA  ) Base Address */
445 #define PIOB       ((Pio    *)0x400E1000U) /**< \brief (PIOB      ) Base Address */
446 #define PIOC       ((Pio    *)0x400E1200U) /**< \brief (PIOC      ) Base Address */
447 #define RSTC       ((Rstc   *)0x400E1400U) /**< \brief (RSTC      ) Base Address */
448 #define SUPC       ((Supc   *)0x400E1410U) /**< \brief (SUPC      ) Base Address */
449 #define RTT        ((Rtt    *)0x400E1430U) /**< \brief (RTT       ) Base Address */
450 #define WDT        ((Wdt    *)0x400E1450U) /**< \brief (WDT       ) Base Address */
451 #define RTC        ((Rtc    *)0x400E1460U) /**< \brief (RTC       ) Base Address */
452 #define GPBR       ((Gpbr   *)0x400E1490U) /**< \brief (GPBR      ) Base Address */
453 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
454 /*@}*/
455 
456 /* ************************************************************************** */
457 /*   PIO DEFINITIONS FOR SAM4SD32C */
458 /* ************************************************************************** */
459 /** \addtogroup SAM4SD32C_pio Peripheral Pio Definitions */
460 /*@{*/
461 
462 #include "pio/sam4sd32c.h"
463 /*@}*/
464 
465 /* ************************************************************************** */
466 /*   MEMORY MAPPING DEFINITIONS FOR SAM4SD32C */
467 /* ************************************************************************** */
468 
469 #define IFLASH0_SIZE             (0x100000u)
470 #define IFLASH0_PAGE_SIZE        (512u)
471 #define IFLASH0_LOCK_REGION_SIZE (8192u)
472 #define IFLASH0_NB_OF_PAGES      (2048u)
473 #define IFLASH0_NB_OF_LOCK_BITS  (128u)
474 #define IFLASH1_SIZE             (0x100000u)
475 #define IFLASH1_PAGE_SIZE        (512u)
476 #define IFLASH1_LOCK_REGION_SIZE (8192u)
477 #define IFLASH1_NB_OF_PAGES      (2048u)
478 #define IFLASH1_NB_OF_LOCK_BITS  (128u)
479 #define IRAM_SIZE                (0x28000u)
480 #define IFLASH_SIZE              (IFLASH0_SIZE+IFLASH1_SIZE)
481 
482 #define IFLASH0_ADDR (0x00400000u) /**< Internal Flash 0 base address */
483 #if defined IFLASH0_SIZE
484 #define IFLASH1_ADDR (IFLASH0_ADDR+IFLASH0_SIZE) /**< Internal Flash 1 base address */
485 #endif
486 #define IROM_ADDR    (0x00800000u) /**< Internal ROM base address */
487 #define IRAM_ADDR    (0x20000000u) /**< Internal RAM base address */
488 #define EBI_CS0_ADDR (0x60000000u) /**< EBI Chip Select 0 base address */
489 #define EBI_CS1_ADDR (0x61000000u) /**< EBI Chip Select 1 base address */
490 #define EBI_CS2_ADDR (0x62000000u) /**< EBI Chip Select 2 base address */
491 #define EBI_CS3_ADDR (0x63000000u) /**< EBI Chip Select 3 base address */
492 
493 /* ************************************************************************** */
494 /*   MISCELLANEOUS DEFINITIONS FOR SAM4SD32C */
495 /* ************************************************************************** */
496 
497 #define CHIP_JTAGID       (0x05B3203FUL)
498 #define CHIP_CIDR         (0x29A70EE0UL)
499 #define NB_CH_ADC         (15UL)
500 #define NB_CH_DAC         (2UL)
501 #define USB_DEVICE_MAX_EP (8UL)
502 
503 /* ************************************************************************** */
504 /*   ELECTRICAL DEFINITIONS FOR SAM4SD32C */
505 /* ************************************************************************** */
506 
507 /* Device characteristics */
508 #define CHIP_FREQ_SLCK_RC_MIN           (20000UL)
509 #define CHIP_FREQ_SLCK_RC               (32000UL)
510 #define CHIP_FREQ_SLCK_RC_MAX           (44000UL)
511 #define CHIP_FREQ_MAINCK_RC_4MHZ        (4000000UL)
512 #define CHIP_FREQ_MAINCK_RC_8MHZ        (8000000UL)
513 #define CHIP_FREQ_MAINCK_RC_12MHZ       (12000000UL)
514 #define CHIP_FREQ_CPU_MAX               (120000000UL)
515 #define CHIP_FREQ_XTAL_32K              (32768UL)
516 
517 /* Embedded Flash Write Wait State */
518 #define CHIP_FLASH_WRITE_WAIT_STATE     (6U)
519 
520 #if defined __SAM4S2A__ || defined __SAM4S2B__ || defined __SAM4S2C__ || \
521     defined __SAM4S4A__ || defined __SAM4S4B__ || defined __SAM4S4C__
522 
523 /* Embedded Flash Read Wait State (VDDCORE set at 1.20V and VDDIO 3.3V) */
524 #define CHIP_FREQ_FWS_0                 (29000000UL)  /**< \brief Maximum operating frequency when FWS is 0 */
525 #define CHIP_FREQ_FWS_1                 (58000000UL)  /**< \brief Maximum operating frequency when FWS is 1 */
526 #define CHIP_FREQ_FWS_2                 (88000000UL)  /**< \brief Maximum operating frequency when FWS is 2 */
527 #define CHIP_FREQ_FWS_3                 (10800000UL)  /**< \brief Maximum operating frequency when FWS is 3 */
528 #define CHIP_FREQ_FWS_4                 (120000000UL) /**< \brief Maximum operating frequency when FWS is 4 */
529 
530 #else  /* SAM4S8/S16/SA16/SD16/SD32 */
531 
532 /* Embedded Flash Read Wait State (VDDCORE set at 1.20V and VDDIO 3.3V) */
533 #define CHIP_FREQ_FWS_0                 (20000000UL)  /**< \brief Maximum operating frequency when FWS is 0 */
534 #define CHIP_FREQ_FWS_1                 (40000000UL)  /**< \brief Maximum operating frequency when FWS is 1 */
535 #define CHIP_FREQ_FWS_2                 (60000000UL)  /**< \brief Maximum operating frequency when FWS is 2 */
536 #define CHIP_FREQ_FWS_3                 (80000000UL)  /**< \brief Maximum operating frequency when FWS is 3 */
537 #define CHIP_FREQ_FWS_4                 (100000000UL) /**< \brief Maximum operating frequency when FWS is 4 */
538 #define CHIP_FREQ_FWS_5                 (123000000UL) /**< \brief Maximum operating frequency when FWS is 5 */
539 
540 #endif
541 
542 /* HYSTeresis levels: please refer to Electrical Characteristics */
543 #define ACC_ACR_HYST_50MV_MAX	          (0x01UL)
544 #define ACC_ACR_HYST_90MV_MAX           (0x11UL)
545 
546 
547 #ifdef __cplusplus
548 }
549 #endif
550 
551 /*@}*/
552 
553 #endif /* _SAM4SD32C_ */
554