Robobo
sam3s8c.h
1 /* ----------------------------------------------------------------------------
2  * SAM Software Package License
3  * ----------------------------------------------------------------------------
4  * Copyright (c) 2012, Atmel Corporation
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following condition is met:
10  *
11  * - Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the disclaimer below.
13  *
14  * Atmel's name may not be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * ----------------------------------------------------------------------------
28  */
29 
30 #ifndef _SAM3S8C_
31 #define _SAM3S8C_
32 
41 
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45 
46 #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
47 #include <stdint.h>
48 #ifndef __cplusplus
49 typedef volatile const uint32_t RoReg;
50 #else
51 typedef volatile uint32_t RoReg;
52 #endif
53 typedef volatile uint32_t WoReg;
54 typedef volatile uint32_t RwReg;
55 #endif
56 
57 /* ************************************************************************** */
58 /* CMSIS DEFINITIONS FOR SAM3S8C */
59 /* ************************************************************************** */
62 
64 typedef enum IRQn
65 {
66 /****** Cortex-M3 Processor Exceptions Numbers ******************************/
69  BusFault_IRQn = -11,
71  SVCall_IRQn = -5,
73  PendSV_IRQn = -2,
74  SysTick_IRQn = -1,
75 /****** SAM3S8C specific Interrupt Numbers *********************************/
76 
77  SUPC_IRQn = 0,
78  RSTC_IRQn = 1,
79  RTC_IRQn = 2,
80  RTT_IRQn = 3,
81  WDT_IRQn = 4,
82  PMC_IRQn = 5,
83  EFC_IRQn = 6,
84  UART0_IRQn = 8,
85  UART1_IRQn = 9,
86  SMC_IRQn = 10,
87  PIOA_IRQn = 11,
88  PIOB_IRQn = 12,
89  PIOC_IRQn = 13,
90  USART0_IRQn = 14,
91  USART1_IRQn = 15,
92  USART2_IRQn = 16,
93  HSMCI_IRQn = 18,
94  TWI0_IRQn = 19,
95  TWI1_IRQn = 20,
96  SPI_IRQn = 21,
97  SSC_IRQn = 22,
98  TC0_IRQn = 23,
99  TC1_IRQn = 24,
100  TC2_IRQn = 25,
101  TC3_IRQn = 26,
102  TC4_IRQn = 27,
103  TC5_IRQn = 28,
104  ADC_IRQn = 29,
105  DACC_IRQn = 30,
106  PWM_IRQn = 31,
107  CRCCU_IRQn = 32,
108  ACC_IRQn = 33,
109  UDP_IRQn = 34,
112 } IRQn_Type;
113 
114 typedef struct _DeviceVectors
115 {
116  /* Stack pointer */
117  void* pvStack;
118 
119  /* Cortex-M handlers */
120  void* pfnReset_Handler;
121  void* pfnNMI_Handler;
122  void* pfnHardFault_Handler;
123  void* pfnMemManage_Handler;
124  void* pfnBusFault_Handler;
125  void* pfnUsageFault_Handler;
126  void* pfnReserved1_Handler;
127  void* pfnReserved2_Handler;
128  void* pfnReserved3_Handler;
129  void* pfnReserved4_Handler;
130  void* pfnSVC_Handler;
131  void* pfnDebugMon_Handler;
132  void* pfnReserved5_Handler;
133  void* pfnPendSV_Handler;
134  void* pfnSysTick_Handler;
135 
136  /* Peripheral handlers */
137  void* pfnSUPC_Handler; /* 0 Supply Controller */
138  void* pfnRSTC_Handler; /* 1 Reset Controller */
139  void* pfnRTC_Handler; /* 2 Real Time Clock */
140  void* pfnRTT_Handler; /* 3 Real Time Timer */
141  void* pfnWDT_Handler; /* 4 Watchdog Timer */
142  void* pfnPMC_Handler; /* 5 Power Management Controller */
143  void* pfnEFC_Handler; /* 6 Enhanced Embedded Flash Controller */
144  void* pvReserved7;
145  void* pfnUART0_Handler; /* 8 UART 0 */
146  void* pfnUART1_Handler; /* 9 UART 1 */
147  void* pfnSMC_Handler; /* 10 Static Memory Controller */
148  void* pfnPIOA_Handler; /* 11 Parallel I/O Controller A */
149  void* pfnPIOB_Handler; /* 12 Parallel I/O Controller B */
150  void* pfnPIOC_Handler; /* 13 Parallel I/O Controller C */
151  void* pfnUSART0_Handler; /* 14 USART 0 */
152  void* pfnUSART1_Handler; /* 15 USART 1 */
153  void* pfnUSART2_Handler; /* 16 USART 2 (SAM3SD8 100 pins only) */
154  void* pvReserved17;
155  void* pfnHSMCI_Handler; /* 18 Multimedia Card Interface */
156  void* pfnTWI0_Handler; /* 19 Two Wire Interface 0 */
157  void* pfnTWI1_Handler; /* 20 Two Wire Interface 1 */
158  void* pfnSPI_Handler; /* 21 Serial Peripheral Interface */
159  void* pfnSSC_Handler; /* 22 Synchronous Serial Controler */
160  void* pfnTC0_Handler; /* 23 Timer/Counter 0 */
161  void* pfnTC1_Handler; /* 24 Timer/Counter 1 */
162  void* pfnTC2_Handler; /* 25 Timer/Counter 2 */
163  void* pfnTC3_Handler; /* 26 Timer/Counter 3 */
164  void* pfnTC4_Handler; /* 27 Timer/Counter 4 */
165  void* pfnTC5_Handler; /* 28 Timer/Counter 5 */
166  void* pfnADC_Handler; /* 29 Analog To Digital Converter */
167  void* pfnDACC_Handler; /* 30 Digital To Analog Converter */
168  void* pfnPWM_Handler; /* 31 Pulse Width Modulation */
169  void* pfnCRCCU_Handler; /* 32 CRC Calculation Unit */
170  void* pfnACC_Handler; /* 33 Analog Comparator */
171  void* pfnUDP_Handler; /* 34 USB Device Port */
172 } DeviceVectors;
173 
174 /* Cortex-M3 core handlers */
175 void Reset_Handler ( void );
176 void NMI_Handler ( void );
177 void HardFault_Handler ( void );
178 void MemManage_Handler ( void );
179 void BusFault_Handler ( void );
180 void UsageFault_Handler ( void );
181 void SVC_Handler ( void );
182 void DebugMon_Handler ( void );
183 void PendSV_Handler ( void );
184 void SysTick_Handler ( void );
185 
186 /* Peripherals handlers */
187 void ACC_Handler ( void );
188 void ADC_Handler ( void );
189 void CRCCU_Handler ( void );
190 void DACC_Handler ( void );
191 void EFC_Handler ( void );
192 void HSMCI_Handler ( void );
193 void PIOA_Handler ( void );
194 void PIOB_Handler ( void );
195 void PIOC_Handler ( void );
196 void PMC_Handler ( void );
197 void PWM_Handler ( void );
198 void RSTC_Handler ( void );
199 void RTC_Handler ( void );
200 void RTT_Handler ( void );
201 void SMC_Handler ( void );
202 void SPI_Handler ( void );
203 void SSC_Handler ( void );
204 void SUPC_Handler ( void );
205 void TC0_Handler ( void );
206 void TC1_Handler ( void );
207 void TC2_Handler ( void );
208 void TC3_Handler ( void );
209 void TC4_Handler ( void );
210 void TC5_Handler ( void );
211 void TWI0_Handler ( void );
212 void TWI1_Handler ( void );
213 void UART0_Handler ( void );
214 void UART1_Handler ( void );
215 void UDP_Handler ( void );
216 void USART0_Handler ( void );
217 void USART1_Handler ( void );
218 void USART2_Handler ( void );
219 void WDT_Handler ( void );
220 
225 #define __CM3_REV 0x0200
226 #define __MPU_PRESENT 1
227 #define __NVIC_PRIO_BITS 4
228 #define __Vendor_SysTickConfig 0
230 /*
231  * \brief CMSIS includes
232  */
233 
234 #include <core_cm3.h>
235 #if !defined DONT_USE_CMSIS_INIT
236 #include "system_sam3sd8.h"
237 #endif /* DONT_USE_CMSIS_INIT */
238 
241 /* ************************************************************************** */
243 /* ************************************************************************** */
246 
247 #include "component/component_acc.h"
248 #include "component/component_adc.h"
249 #include "component/component_chipid.h"
250 #include "component/component_crccu.h"
251 #include "component/component_dacc.h"
252 #include "component/component_efc.h"
253 #include "component/component_gpbr.h"
254 #include "component/component_hsmci.h"
255 #include "component/component_matrix.h"
256 #include "component/component_pdc.h"
257 #include "component/component_pio.h"
258 #include "component/component_pmc.h"
259 #include "component/component_pwm.h"
260 #include "component/component_rstc.h"
261 #include "component/component_rtc.h"
262 #include "component/component_rtt.h"
263 #include "component/component_smc.h"
264 #include "component/component_spi.h"
265 #include "component/component_ssc.h"
266 #include "component/component_supc.h"
267 #include "component/component_tc.h"
268 #include "component/component_twi.h"
269 #include "component/component_uart.h"
270 #include "component/component_udp.h"
271 #include "component/component_usart.h"
272 #include "component/component_wdt.h"
275 /* ************************************************************************** */
276 /* REGISTER ACCESS DEFINITIONS FOR SAM3S8C */
277 /* ************************************************************************** */
280 
281 #include "instance/instance_hsmci.h"
282 #include "instance/instance_ssc.h"
283 #include "instance/instance_spi.h"
284 #include "instance/instance_tc0.h"
285 #include "instance/instance_tc1.h"
286 #include "instance/instance_twi0.h"
287 #include "instance/instance_twi1.h"
288 #include "instance/instance_pwm.h"
289 #include "instance/instance_usart0.h"
290 #include "instance/instance_usart1.h"
291 #include "instance/instance_usart2.h"
292 #include "instance/instance_udp.h"
293 #include "instance/instance_adc.h"
294 #include "instance/instance_dacc.h"
295 #include "instance/instance_acc.h"
296 #include "instance/instance_crccu.h"
297 #include "instance/instance_smc.h"
298 #include "instance/instance_matrix.h"
299 #include "instance/instance_pmc.h"
300 #include "instance/instance_uart0.h"
301 #include "instance/instance_chipid.h"
302 #include "instance/instance_uart1.h"
303 #include "instance/instance_efc.h"
304 #include "instance/instance_pioa.h"
305 #include "instance/instance_piob.h"
306 #include "instance/instance_pioc.h"
307 #include "instance/instance_rstc.h"
308 #include "instance/instance_supc.h"
309 #include "instance/instance_rtt.h"
310 #include "instance/instance_wdt.h"
311 #include "instance/instance_rtc.h"
312 #include "instance/instance_gpbr.h"
315 /* ************************************************************************** */
316 /* PERIPHERAL ID DEFINITIONS FOR SAM3S8C */
317 /* ************************************************************************** */
320 
321 #define ID_SUPC ( 0)
322 #define ID_RSTC ( 1)
323 #define ID_RTC ( 2)
324 #define ID_RTT ( 3)
325 #define ID_WDT ( 4)
326 #define ID_PMC ( 5)
327 #define ID_EFC ( 6)
328 #define ID_UART0 ( 8)
329 #define ID_UART1 ( 9)
330 #define ID_SMC (10)
331 #define ID_PIOA (11)
332 #define ID_PIOB (12)
333 #define ID_PIOC (13)
334 #define ID_USART0 (14)
335 #define ID_USART1 (15)
336 #define ID_USART2 (16)
337 #define ID_HSMCI (18)
338 #define ID_TWI0 (19)
339 #define ID_TWI1 (20)
340 #define ID_SPI (21)
341 #define ID_SSC (22)
342 #define ID_TC0 (23)
343 #define ID_TC1 (24)
344 #define ID_TC2 (25)
345 #define ID_TC3 (26)
346 #define ID_TC4 (27)
347 #define ID_TC5 (28)
348 #define ID_ADC (29)
349 #define ID_DACC (30)
350 #define ID_PWM (31)
351 #define ID_CRCCU (32)
352 #define ID_ACC (33)
353 #define ID_UDP (34)
355 #define ID_PERIPH_COUNT (35)
357 
358 /* ************************************************************************** */
359 /* BASE ADDRESS DEFINITIONS FOR SAM3S8C */
360 /* ************************************************************************** */
363 
364 #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
365 #define HSMCI (0x40000000U)
366 #define PDC_HSMCI (0x40000100U)
367 #define SSC (0x40004000U)
368 #define PDC_SSC (0x40004100U)
369 #define SPI (0x40008000U)
370 #define PDC_SPI (0x40008100U)
371 #define TC0 (0x40010000U)
372 #define TC1 (0x40014000U)
373 #define TWI0 (0x40018000U)
374 #define PDC_TWI0 (0x40018100U)
375 #define TWI1 (0x4001C000U)
376 #define PDC_TWI1 (0x4001C100U)
377 #define PWM (0x40020000U)
378 #define PDC_PWM (0x40020100U)
379 #define USART0 (0x40024000U)
380 #define PDC_USART0 (0x40024100U)
381 #define USART1 (0x40028000U)
382 #define PDC_USART1 (0x40028100U)
383 #define USART2 (0x4002C000U)
384 #define PDC_USART2 (0x4002C100U)
385 #define UDP (0x40034000U)
386 #define ADC (0x40038000U)
387 #define PDC_ADC (0x40038100U)
388 #define DACC (0x4003C000U)
389 #define PDC_DACC (0x4003C100U)
390 #define ACC (0x40040000U)
391 #define CRCCU (0x40044000U)
392 #define SMC (0x400E0000U)
393 #define MATRIX (0x400E0200U)
394 #define PMC (0x400E0400U)
395 #define UART0 (0x400E0600U)
396 #define PDC_UART0 (0x400E0700U)
397 #define CHIPID (0x400E0740U)
398 #define UART1 (0x400E0800U)
399 #define PDC_UART1 (0x400E0900U)
400 #define EFC (0x400E0A00U)
401 #define PIOA (0x400E0E00U)
402 #define PDC_PIOA (0x400E0F68U)
403 #define PIOB (0x400E1000U)
404 #define PIOC (0x400E1200U)
405 #define RSTC (0x400E1400U)
406 #define SUPC (0x400E1410U)
407 #define RTT (0x400E1430U)
408 #define WDT (0x400E1450U)
409 #define RTC (0x400E1460U)
410 #define GPBR (0x400E1490U)
411 #else
412 #define HSMCI ((Hsmci *)0x40000000U)
413 #define PDC_HSMCI ((Pdc *)0x40000100U)
414 #define SSC ((Ssc *)0x40004000U)
415 #define PDC_SSC ((Pdc *)0x40004100U)
416 #define SPI ((Spi *)0x40008000U)
417 #define PDC_SPI ((Pdc *)0x40008100U)
418 #define TC0 ((Tc *)0x40010000U)
419 #define TC1 ((Tc *)0x40014000U)
420 #define TWI0 ((Twi *)0x40018000U)
421 #define PDC_TWI0 ((Pdc *)0x40018100U)
422 #define TWI1 ((Twi *)0x4001C000U)
423 #define PDC_TWI1 ((Pdc *)0x4001C100U)
424 #define PWM ((Pwm *)0x40020000U)
425 #define PDC_PWM ((Pdc *)0x40020100U)
426 #define USART0 ((Usart *)0x40024000U)
427 #define PDC_USART0 ((Pdc *)0x40024100U)
428 #define USART1 ((Usart *)0x40028000U)
429 #define PDC_USART1 ((Pdc *)0x40028100U)
430 #define USART2 ((Usart *)0x4002C000U)
431 #define PDC_USART2 ((Pdc *)0x4002C100U)
432 #define UDP ((Udp *)0x40034000U)
433 #define ADC ((Adc *)0x40038000U)
434 #define PDC_ADC ((Pdc *)0x40038100U)
435 #define DACC ((Dacc *)0x4003C000U)
436 #define PDC_DACC ((Pdc *)0x4003C100U)
437 #define ACC ((Acc *)0x40040000U)
438 #define CRCCU ((Crccu *)0x40044000U)
439 #define SMC ((Smc *)0x400E0000U)
440 #define MATRIX ((Matrix *)0x400E0200U)
441 #define PMC ((Pmc *)0x400E0400U)
442 #define UART0 ((Uart *)0x400E0600U)
443 #define PDC_UART0 ((Pdc *)0x400E0700U)
444 #define CHIPID ((Chipid *)0x400E0740U)
445 #define UART1 ((Uart *)0x400E0800U)
446 #define PDC_UART1 ((Pdc *)0x400E0900U)
447 #define EFC ((Efc *)0x400E0A00U)
448 #define PIOA ((Pio *)0x400E0E00U)
449 #define PDC_PIOA ((Pdc *)0x400E0F68U)
450 #define PIOB ((Pio *)0x400E1000U)
451 #define PIOC ((Pio *)0x400E1200U)
452 #define RSTC ((Rstc *)0x400E1400U)
453 #define SUPC ((Supc *)0x400E1410U)
454 #define RTT ((Rtt *)0x400E1430U)
455 #define WDT ((Wdt *)0x400E1450U)
456 #define RTC ((Rtc *)0x400E1460U)
457 #define GPBR ((Gpbr *)0x400E1490U)
458 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
459 
461 /* ************************************************************************** */
462 /* PIO DEFINITIONS FOR SAM3S8C */
463 /* ************************************************************************** */
466 
467 #include "pio/pio_sam3s8c.h"
470 /* ************************************************************************** */
471 /* MEMORY MAPPING DEFINITIONS FOR SAM3S8C */
472 /* ************************************************************************** */
473 
474 #define IFLASH0_SIZE (0x80000u)
475 #define IFLASH0_PAGE_SIZE (256u)
476 #define IFLASH0_LOCK_REGION_SIZE (16384u)
477 #define IFLASH0_NB_OF_PAGES (2048u)
478 #define IFLASH0_NB_OF_LOCK_BITS (16u)
479 #define IRAM_SIZE (0x10000u)
480 #define IFLASH_SIZE (IFLASH0_SIZE)
481 
482 #define IFLASH_ADDR (0x00400000u)
483 #define IFLASH0_ADDR (0x00400000u)
484 #define IROM_ADDR (0x00800000u)
485 #define IRAM_ADDR (0x20000000u)
486 #define EBI_CS0_ADDR (0x60000000u)
487 #define EBI_CS1_ADDR (0x61000000u)
488 #define EBI_CS2_ADDR (0x62000000u)
489 #define EBI_CS3_ADDR (0x63000000u)
491 /* ************************************************************************** */
492 /* ELECTRICAL DEFINITIONS FOR SAM3S8C */
493 /* ************************************************************************** */
494 
495 /* Device characteristics */
496 #define CHIP_FREQ_SLCK_RC_MIN (20000UL)
497 #define CHIP_FREQ_SLCK_RC (32000UL)
498 #define CHIP_FREQ_SLCK_RC_MAX (44000UL)
499 #define CHIP_FREQ_MAINCK_RC_4MHZ (4000000UL)
500 #define CHIP_FREQ_MAINCK_RC_8MHZ (8000000UL)
501 #define CHIP_FREQ_MAINCK_RC_12MHZ (12000000UL)
502 #define CHIP_FREQ_CPU_MAX (64000000UL)
503 #define CHIP_FREQ_XTAL_32K (32768UL)
504 #define CHIP_FREQ_XTAL_12M (12000000UL)
505 
506 /* Embedded Flash Write Wait State */
507 #define CHIP_FLASH_WRITE_WAIT_STATE (6U)
508 
509 /* Embedded Flash Read Wait State (VDDCORE set at 1.65V) */
510 #define CHIP_FREQ_FWS_0 (21000000UL)
511 #define CHIP_FREQ_FWS_1 (35000000UL)
512 #define CHIP_FREQ_FWS_2 (60000000UL)
513 #define CHIP_FREQ_FWS_3 (64000000UL)
516 #ifdef __cplusplus
517 }
518 #endif
519 
522 #endif /* _SAM3S8C_ */
Definition: sam3s8c.h:71
Definition: sam3s8c.h:92
Definition: sam3s8c.h:83
Definition: sam3s8c.h:72
Definition: sam3s8c.h:105
Definition: sam3n00a.h:102
Definition: sam3s8c.h:98
Definition: sam3s8c.h:88
Definition: sam3s8c.h:95
Definition: sam3s8c.h:77
Definition: sam3s8c.h:87
IRQn
Definition: ARMCM0.h:35
Definition: sam3s8c.h:74
Definition: sam3s8c.h:84
Definition: sam3s8c.h:70
Definition: sam3s8c.h:82
CMSIS Cortex-M3 Core Peripheral Access Layer Header File.
void HardFault_Handler(void)
Definition: FreeRTOS_ARM.c:99
Definition: sam3s8c.h:91
void BusFault_Handler(void)
Definition: FreeRTOS_ARM.c:104
void UsageFault_Handler(void)
Definition: FreeRTOS_ARM.c:109
volatile uint32_t WoReg
Definition: sam3s8c.h:53
Definition: sam3s8c.h:93
Definition: sam3s8c.h:94
Definition: sam3s8c.h:104
void Reset_Handler(void)
This is the code that gets called on processor reset. To initialize the device, and call the main() r...
Definition: startup_sam3n.c:172
enum IRQn IRQn_Type
Definition: sam3s8c.h:89
Definition: sam3s8c.h:69
Definition: sam3s8c.h:100
Definition: sam3s8c.h:99
Definition: sam3s8c.h:108
Definition: sam3s8c.h:85
Definition: sam3s8c.h:79
Definition: sam3s8c.h:78
void SysTick_Handler(void)
SysTick_Handler.
Definition: main.c:78
volatile const uint32_t RoReg
Definition: sam3s8c.h:49
Definition: sam3s8c.h:67
Definition: sam3s8c.h:102
Definition: sam3s8c.h:80
Definition: sam3s8c.h:90
Definition: sam3s8c.h:96
Definition: sam3s8c.h:101
Definition: sam3s8c.h:103
Definition: sam3s8c.h:73
Definition: sam3s8c.h:106
Definition: sam3s8c.h:86
volatile uint32_t RwReg
Definition: sam3s8c.h:54
Definition: sam3s8c.h:97
Definition: sam3s8c.h:68
CMSIS Cortex-M# Device Peripheral Access Layer Header File for SAM3 devices.
Definition: sam3s8c.h:109
Definition: sam3s8c.h:107
Definition: sam3s8c.h:81
Definition: sam3s8c.h:111