1 /**
2  * \file
3  *
4  * \brief Header file for SAMD20J18
5  *
6  * Copyright (c) 2015 Atmel Corporation. All rights reserved.
7  *
8  * \asf_license_start
9  *
10  * \page License
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright notice,
16  *    this list of conditions and the following disclaimer.
17  *
18  * 2. Redistributions in binary form must reproduce the above copyright notice,
19  *    this list of conditions and the following disclaimer in the documentation
20  *    and/or other materials provided with the distribution.
21  *
22  * 3. The name of Atmel may not be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  * 4. This software may only be redistributed and used in connection with an
26  *    Atmel microcontroller product.
27  *
28  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  *
40  * \asf_license_stop
41  *
42  */
43 /*
44  * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
45  */
46 
47 #ifndef _SAMD20J18_
48 #define _SAMD20J18_
49 
50 /**
51  * \ingroup SAMD20_definitions
52  * \addtogroup SAMD20J18_definitions SAMD20J18 definitions
53  * This file defines all structures and symbols for SAMD20J18:
54  *   - registers and bitfields
55  *   - peripheral base address
56  *   - peripheral ID
57  *   - PIO definitions
58 */
59 /*@{*/
60 
61 #ifdef __cplusplus
62  extern "C" {
63 #endif
64 
65 #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
66 #include <stdint.h>
67 #ifndef __cplusplus
68 typedef volatile const uint32_t RoReg;   /**< Read only 32-bit register (volatile const unsigned int) */
69 typedef volatile const uint16_t RoReg16; /**< Read only 16-bit register (volatile const unsigned int) */
70 typedef volatile const uint8_t  RoReg8;  /**< Read only  8-bit register (volatile const unsigned int) */
71 #else
72 typedef volatile       uint32_t RoReg;   /**< Read only 32-bit register (volatile const unsigned int) */
73 typedef volatile       uint16_t RoReg16; /**< Read only 16-bit register (volatile const unsigned int) */
74 typedef volatile       uint8_t  RoReg8;  /**< Read only  8-bit register (volatile const unsigned int) */
75 #endif
76 typedef volatile       uint32_t WoReg;   /**< Write only 32-bit register (volatile unsigned int) */
77 typedef volatile       uint16_t WoReg16; /**< Write only 16-bit register (volatile unsigned int) */
78 typedef volatile       uint32_t WoReg8;  /**< Write only  8-bit register (volatile unsigned int) */
79 typedef volatile       uint32_t RwReg;   /**< Read-Write 32-bit register (volatile unsigned int) */
80 typedef volatile       uint16_t RwReg16; /**< Read-Write 16-bit register (volatile unsigned int) */
81 typedef volatile       uint8_t  RwReg8;  /**< Read-Write  8-bit register (volatile unsigned int) */
82 #define CAST(type, value) ((type *)(value))
83 #define REG_ACCESS(type, address) (*(type*)(address)) /**< C code: Register value */
84 #else
85 #define CAST(type, value) (value)
86 #define REG_ACCESS(type, address) (address) /**< Assembly code: Register address */
87 #endif
88 
89 /* ************************************************************************** */
90 /**  CMSIS DEFINITIONS FOR SAMD20J18 */
91 /* ************************************************************************** */
92 /** \defgroup SAMD20J18_cmsis CMSIS Definitions */
93 /*@{*/
94 
95 /** Interrupt Number Definition */
96 typedef enum IRQn
97 {
98   /******  Cortex-M0+ Processor Exceptions Numbers ******************************/
99   NonMaskableInt_IRQn      = -14,/**<  2 Non Maskable Interrupt                 */
100   HardFault_IRQn           = -13,/**<  3 Cortex-M0+ Hard Fault Interrupt        */
101   SVCall_IRQn              = -5, /**< 11 Cortex-M0+ SV Call Interrupt           */
102   PendSV_IRQn              = -2, /**< 14 Cortex-M0+ Pend SV Interrupt           */
103   SysTick_IRQn             = -1, /**< 15 Cortex-M0+ System Tick Interrupt       */
104   /******  SAMD20J18-specific Interrupt Numbers ***********************/
105   PM_IRQn                  =  0, /**<  0 SAMD20J18 Power Manager (PM) */
106   SYSCTRL_IRQn             =  1, /**<  1 SAMD20J18 System Control (SYSCTRL) */
107   WDT_IRQn                 =  2, /**<  2 SAMD20J18 Watchdog Timer (WDT) */
108   RTC_IRQn                 =  3, /**<  3 SAMD20J18 Real-Time Counter (RTC) */
109   EIC_IRQn                 =  4, /**<  4 SAMD20J18 External Interrupt Controller (EIC) */
110   NVMCTRL_IRQn             =  5, /**<  5 SAMD20J18 Non-Volatile Memory Controller (NVMCTRL) */
111   EVSYS_IRQn               =  6, /**<  6 SAMD20J18 Event System Interface (EVSYS) */
112   SERCOM0_IRQn             =  7, /**<  7 SAMD20J18 Serial Communication Interface 0 (SERCOM0) */
113   SERCOM1_IRQn             =  8, /**<  8 SAMD20J18 Serial Communication Interface 1 (SERCOM1) */
114   SERCOM2_IRQn             =  9, /**<  9 SAMD20J18 Serial Communication Interface 2 (SERCOM2) */
115   SERCOM3_IRQn             = 10, /**< 10 SAMD20J18 Serial Communication Interface 3 (SERCOM3) */
116   SERCOM4_IRQn             = 11, /**< 11 SAMD20J18 Serial Communication Interface 4 (SERCOM4) */
117   SERCOM5_IRQn             = 12, /**< 12 SAMD20J18 Serial Communication Interface 5 (SERCOM5) */
118   TC0_IRQn                 = 13, /**< 13 SAMD20J18 Basic Timer Counter 0 (TC0) */
119   TC1_IRQn                 = 14, /**< 14 SAMD20J18 Basic Timer Counter 1 (TC1) */
120   TC2_IRQn                 = 15, /**< 15 SAMD20J18 Basic Timer Counter 2 (TC2) */
121   TC3_IRQn                 = 16, /**< 16 SAMD20J18 Basic Timer Counter 3 (TC3) */
122   TC4_IRQn                 = 17, /**< 17 SAMD20J18 Basic Timer Counter 4 (TC4) */
123   TC5_IRQn                 = 18, /**< 18 SAMD20J18 Basic Timer Counter 5 (TC5) */
124   TC6_IRQn                 = 19, /**< 19 SAMD20J18 Basic Timer Counter 6 (TC6) */
125   TC7_IRQn                 = 20, /**< 20 SAMD20J18 Basic Timer Counter 7 (TC7) */
126   ADC_IRQn                 = 21, /**< 21 SAMD20J18 Analog Digital Converter (ADC) */
127   AC_IRQn                  = 22, /**< 22 SAMD20J18 Analog Comparators (AC) */
128   DAC_IRQn                 = 23, /**< 23 SAMD20J18 Digital Analog Converter (DAC) */
129   PTC_IRQn                 = 24, /**< 24 SAMD20J18 Peripheral Touch Controller (PTC) */
130 
131   PERIPH_COUNT_IRQn        = 25  /**< Number of peripheral IDs */
132 } IRQn_Type;
133 
134 typedef struct _DeviceVectors
135 {
136   /* Stack pointer */
137   void* pvStack;
138 
139   /* Cortex-M handlers */
140   void* pfnReset_Handler;
141   void* pfnNMI_Handler;
142   void* pfnHardFault_Handler;
143   void* pfnReservedM12;
144   void* pfnReservedM11;
145   void* pfnReservedM10;
146   void* pfnReservedM9;
147   void* pfnReservedM8;
148   void* pfnReservedM7;
149   void* pfnReservedM6;
150   void* pfnSVC_Handler;
151   void* pfnReservedM4;
152   void* pfnReservedM3;
153   void* pfnPendSV_Handler;
154   void* pfnSysTick_Handler;
155 
156   /* Peripheral handlers */
157   void* pfnPM_Handler;                    /*  0 Power Manager */
158   void* pfnSYSCTRL_Handler;               /*  1 System Control */
159   void* pfnWDT_Handler;                   /*  2 Watchdog Timer */
160   void* pfnRTC_Handler;                   /*  3 Real-Time Counter */
161   void* pfnEIC_Handler;                   /*  4 External Interrupt Controller */
162   void* pfnNVMCTRL_Handler;               /*  5 Non-Volatile Memory Controller */
163   void* pfnEVSYS_Handler;                 /*  6 Event System Interface */
164   void* pfnSERCOM0_Handler;               /*  7 Serial Communication Interface 0 */
165   void* pfnSERCOM1_Handler;               /*  8 Serial Communication Interface 1 */
166   void* pfnSERCOM2_Handler;               /*  9 Serial Communication Interface 2 */
167   void* pfnSERCOM3_Handler;               /* 10 Serial Communication Interface 3 */
168   void* pfnSERCOM4_Handler;               /* 11 Serial Communication Interface 4 */
169   void* pfnSERCOM5_Handler;               /* 12 Serial Communication Interface 5 */
170   void* pfnTC0_Handler;                   /* 13 Basic Timer Counter 0 */
171   void* pfnTC1_Handler;                   /* 14 Basic Timer Counter 1 */
172   void* pfnTC2_Handler;                   /* 15 Basic Timer Counter 2 */
173   void* pfnTC3_Handler;                   /* 16 Basic Timer Counter 3 */
174   void* pfnTC4_Handler;                   /* 17 Basic Timer Counter 4 */
175   void* pfnTC5_Handler;                   /* 18 Basic Timer Counter 5 */
176   void* pfnTC6_Handler;                   /* 19 Basic Timer Counter 6 */
177   void* pfnTC7_Handler;                   /* 20 Basic Timer Counter 7 */
178   void* pfnADC_Handler;                   /* 21 Analog Digital Converter */
179   void* pfnAC_Handler;                    /* 22 Analog Comparators */
180   void* pfnDAC_Handler;                   /* 23 Digital Analog Converter */
181   void* pfnPTC_Handler;                   /* 24 Peripheral Touch Controller */
182 } DeviceVectors;
183 
184 /* Cortex-M0+ processor handlers */
185 void Reset_Handler               ( void );
186 void NMI_Handler                 ( void );
187 void HardFault_Handler           ( void );
188 void SVC_Handler                 ( void );
189 void PendSV_Handler              ( void );
190 void SysTick_Handler             ( void );
191 
192 /* Peripherals handlers */
193 void PM_Handler                  ( void );
194 void SYSCTRL_Handler             ( void );
195 void WDT_Handler                 ( void );
196 void RTC_Handler                 ( void );
197 void EIC_Handler                 ( void );
198 void NVMCTRL_Handler             ( void );
199 void EVSYS_Handler               ( void );
200 void SERCOM0_Handler             ( void );
201 void SERCOM1_Handler             ( void );
202 void SERCOM2_Handler             ( void );
203 void SERCOM3_Handler             ( void );
204 void SERCOM4_Handler             ( void );
205 void SERCOM5_Handler             ( void );
206 void TC0_Handler                 ( void );
207 void TC1_Handler                 ( void );
208 void TC2_Handler                 ( void );
209 void TC3_Handler                 ( void );
210 void TC4_Handler                 ( void );
211 void TC5_Handler                 ( void );
212 void TC6_Handler                 ( void );
213 void TC7_Handler                 ( void );
214 void ADC_Handler                 ( void );
215 void AC_Handler                  ( void );
216 void DAC_Handler                 ( void );
217 void PTC_Handler                 ( void );
218 
219 /*
220  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
221  */
222 
223 #define LITTLE_ENDIAN          1
224 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
225 #define __MPU_PRESENT          0         /*!< MPU present or not */
226 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
227 #define __VTOR_PRESENT         1         /*!< VTOR present or not */
228 #define __Vendor_SysTickConfig 0         /*!< Set to 1 if different SysTick Config is used */
229 
230 /**
231  * \brief CMSIS includes
232  */
233 
234 #include <core_cm0plus.h>
235 #if !defined DONT_USE_CMSIS_INIT
236 #include "system_samd20.h"
237 #endif /* DONT_USE_CMSIS_INIT */
238 
239 /*@}*/
240 
241 /* ************************************************************************** */
242 /**  SOFTWARE PERIPHERAL API DEFINITION FOR SAMD20J18 */
243 /* ************************************************************************** */
244 /** \defgroup SAMD20J18_api Peripheral Software API */
245 /*@{*/
246 
247 #include "component/ac.h"
248 #include "component/adc.h"
249 #include "component/dac.h"
250 #include "component/dsu.h"
251 #include "component/eic.h"
252 #include "component/evsys.h"
253 #include "component/gclk.h"
254 #include "component/nvmctrl.h"
255 #include "component/pac.h"
256 #include "component/pm.h"
257 #include "component/port.h"
258 #include "component/rtc.h"
259 #include "component/sercom.h"
260 #include "component/sysctrl.h"
261 #include "component/tc.h"
262 #include "component/wdt.h"
263 /*@}*/
264 
265 /* ************************************************************************** */
266 /**  REGISTERS ACCESS DEFINITIONS FOR SAMD20J18 */
267 /* ************************************************************************** */
268 /** \defgroup SAMD20J18_reg Registers Access Definitions */
269 /*@{*/
270 
271 #include "instance/ac.h"
272 #include "instance/adc.h"
273 #include "instance/dac.h"
274 #include "instance/dsu.h"
275 #include "instance/eic.h"
276 #include "instance/evsys.h"
277 #include "instance/gclk.h"
278 #include "instance/nvmctrl.h"
279 #include "instance/pac0.h"
280 #include "instance/pac1.h"
281 #include "instance/pac2.h"
282 #include "instance/pm.h"
283 #include "instance/port.h"
284 #include "instance/rtc.h"
285 #include "instance/sercom0.h"
286 #include "instance/sercom1.h"
287 #include "instance/sercom2.h"
288 #include "instance/sercom3.h"
289 #include "instance/sercom4.h"
290 #include "instance/sercom5.h"
291 #include "instance/sysctrl.h"
292 #include "instance/tc0.h"
293 #include "instance/tc1.h"
294 #include "instance/tc2.h"
295 #include "instance/tc3.h"
296 #include "instance/tc4.h"
297 #include "instance/tc5.h"
298 #include "instance/tc6.h"
299 #include "instance/tc7.h"
300 #include "instance/wdt.h"
301 /*@}*/
302 
303 /* ************************************************************************** */
304 /**  PERIPHERAL ID DEFINITIONS FOR SAMD20J18 */
305 /* ************************************************************************** */
306 /** \defgroup SAMD20J18_id Peripheral Ids Definitions */
307 /*@{*/
308 
309 // Peripheral instances on HPB0 bridge
310 #define ID_PAC0           0 /**< \brief Peripheral Access Controller 0 (PAC0) */
311 #define ID_PM             1 /**< \brief Power Manager (PM) */
312 #define ID_SYSCTRL        2 /**< \brief System Control (SYSCTRL) */
313 #define ID_GCLK           3 /**< \brief Generic Clock Generator (GCLK) */
314 #define ID_WDT            4 /**< \brief Watchdog Timer (WDT) */
315 #define ID_RTC            5 /**< \brief Real-Time Counter (RTC) */
316 #define ID_EIC            6 /**< \brief External Interrupt Controller (EIC) */
317 
318 // Peripheral instances on HPB1 bridge
319 #define ID_PAC1          32 /**< \brief Peripheral Access Controller 1 (PAC1) */
320 #define ID_DSU           33 /**< \brief Device Service Unit (DSU) */
321 #define ID_NVMCTRL       34 /**< \brief Non-Volatile Memory Controller (NVMCTRL) */
322 #define ID_PORT          35 /**< \brief Port Module (PORT) */
323 
324 // Peripheral instances on HPB2 bridge
325 #define ID_PAC2          64 /**< \brief Peripheral Access Controller 2 (PAC2) */
326 #define ID_EVSYS         65 /**< \brief Event System Interface (EVSYS) */
327 #define ID_SERCOM0       66 /**< \brief Serial Communication Interface 0 (SERCOM0) */
328 #define ID_SERCOM1       67 /**< \brief Serial Communication Interface 1 (SERCOM1) */
329 #define ID_SERCOM2       68 /**< \brief Serial Communication Interface 2 (SERCOM2) */
330 #define ID_SERCOM3       69 /**< \brief Serial Communication Interface 3 (SERCOM3) */
331 #define ID_SERCOM4       70 /**< \brief Serial Communication Interface 4 (SERCOM4) */
332 #define ID_SERCOM5       71 /**< \brief Serial Communication Interface 5 (SERCOM5) */
333 #define ID_TC0           72 /**< \brief Basic Timer Counter 0 (TC0) */
334 #define ID_TC1           73 /**< \brief Basic Timer Counter 1 (TC1) */
335 #define ID_TC2           74 /**< \brief Basic Timer Counter 2 (TC2) */
336 #define ID_TC3           75 /**< \brief Basic Timer Counter 3 (TC3) */
337 #define ID_TC4           76 /**< \brief Basic Timer Counter 4 (TC4) */
338 #define ID_TC5           77 /**< \brief Basic Timer Counter 5 (TC5) */
339 #define ID_TC6           78 /**< \brief Basic Timer Counter 6 (TC6) */
340 #define ID_TC7           79 /**< \brief Basic Timer Counter 7 (TC7) */
341 #define ID_ADC           80 /**< \brief Analog Digital Converter (ADC) */
342 #define ID_AC            81 /**< \brief Analog Comparators (AC) */
343 #define ID_DAC           82 /**< \brief Digital Analog Converter (DAC) */
344 #define ID_PTC           83 /**< \brief Peripheral Touch Controller (PTC) */
345 
346 #define ID_PERIPH_COUNT  84 /**< \brief Number of peripheral IDs */
347 /*@}*/
348 
349 /* ************************************************************************** */
350 /**  BASE ADDRESS DEFINITIONS FOR SAMD20J18 */
351 /* ************************************************************************** */
352 /** \defgroup SAMD20J18_base Peripheral Base Address Definitions */
353 /*@{*/
354 
355 #if defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)
356 #define AC                            (0x42004400UL) /**< \brief (AC) APB Base Address */
357 #define ADC                           (0x42004000UL) /**< \brief (ADC) APB Base Address */
358 #define DAC                           (0x42004800UL) /**< \brief (DAC) APB Base Address */
359 #define DSU                           (0x41002000UL) /**< \brief (DSU) APB Base Address */
360 #define EIC                           (0x40001800UL) /**< \brief (EIC) APB Base Address */
361 #define EVSYS                         (0x42000400UL) /**< \brief (EVSYS) APB Base Address */
362 #define GCLK                          (0x40000C00UL) /**< \brief (GCLK) APB Base Address */
363 #define NVMCTRL                       (0x41004000UL) /**< \brief (NVMCTRL) APB Base Address */
364 #define NVMCTRL_CAL                   (0x00800000UL) /**< \brief (NVMCTRL) CAL Base Address */
365 #define NVMCTRL_LOCKBIT               (0x00802000UL) /**< \brief (NVMCTRL) LOCKBIT Base Address */
366 #define NVMCTRL_OTP1                  (0x00806000UL) /**< \brief (NVMCTRL) OTP1 Base Address */
367 #define NVMCTRL_OTP2                  (0x00806008UL) /**< \brief (NVMCTRL) OTP2 Base Address */
368 #define NVMCTRL_OTP4                  (0x00806020UL) /**< \brief (NVMCTRL) OTP4 Base Address */
369 #define NVMCTRL_TEMP_LOG              (0x00806030UL) /**< \brief (NVMCTRL) TEMP_LOG Base Address */
370 #define NVMCTRL_USER                  (0x00804000UL) /**< \brief (NVMCTRL) USER Base Address */
371 #define PAC0                          (0x40000000UL) /**< \brief (PAC0) APB Base Address */
372 #define PAC1                          (0x41000000UL) /**< \brief (PAC1) APB Base Address */
373 #define PAC2                          (0x42000000UL) /**< \brief (PAC2) APB Base Address */
374 #define PM                            (0x40000400UL) /**< \brief (PM) APB Base Address */
375 #define PORT                          (0x41004400UL) /**< \brief (PORT) APB Base Address */
376 #define PORT_IOBUS                    (0x60000000UL) /**< \brief (PORT) IOBUS Base Address */
377 #define RTC                           (0x40001400UL) /**< \brief (RTC) APB Base Address */
378 #define SERCOM0                       (0x42000800UL) /**< \brief (SERCOM0) APB Base Address */
379 #define SERCOM1                       (0x42000C00UL) /**< \brief (SERCOM1) APB Base Address */
380 #define SERCOM2                       (0x42001000UL) /**< \brief (SERCOM2) APB Base Address */
381 #define SERCOM3                       (0x42001400UL) /**< \brief (SERCOM3) APB Base Address */
382 #define SERCOM4                       (0x42001800UL) /**< \brief (SERCOM4) APB Base Address */
383 #define SERCOM5                       (0x42001C00UL) /**< \brief (SERCOM5) APB Base Address */
384 #define SYSCTRL                       (0x40000800UL) /**< \brief (SYSCTRL) APB Base Address */
385 #define TC0                           (0x42002000UL) /**< \brief (TC0) APB Base Address */
386 #define TC1                           (0x42002400UL) /**< \brief (TC1) APB Base Address */
387 #define TC2                           (0x42002800UL) /**< \brief (TC2) APB Base Address */
388 #define TC3                           (0x42002C00UL) /**< \brief (TC3) APB Base Address */
389 #define TC4                           (0x42003000UL) /**< \brief (TC4) APB Base Address */
390 #define TC5                           (0x42003400UL) /**< \brief (TC5) APB Base Address */
391 #define TC6                           (0x42003800UL) /**< \brief (TC6) APB Base Address */
392 #define TC7                           (0x42003C00UL) /**< \brief (TC7) APB Base Address */
393 #define WDT                           (0x40001000UL) /**< \brief (WDT) APB Base Address */
394 #else
395 #define AC                ((Ac       *)0x42004400UL) /**< \brief (AC) APB Base Address */
396 #define AC_INST_NUM       1                          /**< \brief (AC) Number of instances */
397 #define AC_INSTS          { AC }                     /**< \brief (AC) Instances List */
398 
399 #define ADC               ((Adc      *)0x42004000UL) /**< \brief (ADC) APB Base Address */
400 #define ADC_INST_NUM      1                          /**< \brief (ADC) Number of instances */
401 #define ADC_INSTS         { ADC }                    /**< \brief (ADC) Instances List */
402 
403 #define DAC               ((Dac      *)0x42004800UL) /**< \brief (DAC) APB Base Address */
404 #define DAC_INST_NUM      1                          /**< \brief (DAC) Number of instances */
405 #define DAC_INSTS         { DAC }                    /**< \brief (DAC) Instances List */
406 
407 #define DSU               ((Dsu      *)0x41002000UL) /**< \brief (DSU) APB Base Address */
408 #define DSU_INST_NUM      1                          /**< \brief (DSU) Number of instances */
409 #define DSU_INSTS         { DSU }                    /**< \brief (DSU) Instances List */
410 
411 #define EIC               ((Eic      *)0x40001800UL) /**< \brief (EIC) APB Base Address */
412 #define EIC_INST_NUM      1                          /**< \brief (EIC) Number of instances */
413 #define EIC_INSTS         { EIC }                    /**< \brief (EIC) Instances List */
414 
415 #define EVSYS             ((Evsys    *)0x42000400UL) /**< \brief (EVSYS) APB Base Address */
416 #define EVSYS_INST_NUM    1                          /**< \brief (EVSYS) Number of instances */
417 #define EVSYS_INSTS       { EVSYS }                  /**< \brief (EVSYS) Instances List */
418 
419 #define GCLK              ((Gclk     *)0x40000C00UL) /**< \brief (GCLK) APB Base Address */
420 #define GCLK_INST_NUM     1                          /**< \brief (GCLK) Number of instances */
421 #define GCLK_INSTS        { GCLK }                   /**< \brief (GCLK) Instances List */
422 
423 #define NVMCTRL           ((Nvmctrl  *)0x41004000UL) /**< \brief (NVMCTRL) APB Base Address */
424 #define NVMCTRL_CAL                   (0x00800000UL) /**< \brief (NVMCTRL) CAL Base Address */
425 #define NVMCTRL_LOCKBIT               (0x00802000UL) /**< \brief (NVMCTRL) LOCKBIT Base Address */
426 #define NVMCTRL_OTP1                  (0x00806000UL) /**< \brief (NVMCTRL) OTP1 Base Address */
427 #define NVMCTRL_OTP2                  (0x00806008UL) /**< \brief (NVMCTRL) OTP2 Base Address */
428 #define NVMCTRL_OTP4                  (0x00806020UL) /**< \brief (NVMCTRL) OTP4 Base Address */
429 #define NVMCTRL_TEMP_LOG              (0x00806030UL) /**< \brief (NVMCTRL) TEMP_LOG Base Address */
430 #define NVMCTRL_USER                  (0x00804000UL) /**< \brief (NVMCTRL) USER Base Address */
431 #define NVMCTRL_INST_NUM  1                          /**< \brief (NVMCTRL) Number of instances */
432 #define NVMCTRL_INSTS     { NVMCTRL }                /**< \brief (NVMCTRL) Instances List */
433 
434 #define PAC0              ((Pac      *)0x40000000UL) /**< \brief (PAC0) APB Base Address */
435 #define PAC1              ((Pac      *)0x41000000UL) /**< \brief (PAC1) APB Base Address */
436 #define PAC2              ((Pac      *)0x42000000UL) /**< \brief (PAC2) APB Base Address */
437 #define PAC_INST_NUM      3                          /**< \brief (PAC) Number of instances */
438 #define PAC_INSTS         { PAC0, PAC1, PAC2 }       /**< \brief (PAC) Instances List */
439 
440 #define PM                ((Pm       *)0x40000400UL) /**< \brief (PM) APB Base Address */
441 #define PM_INST_NUM       1                          /**< \brief (PM) Number of instances */
442 #define PM_INSTS          { PM }                     /**< \brief (PM) Instances List */
443 
444 #define PORT              ((Port     *)0x41004400UL) /**< \brief (PORT) APB Base Address */
445 #define PORT_IOBUS        ((Port     *)0x60000000UL) /**< \brief (PORT) IOBUS Base Address */
446 #define PORT_INST_NUM     1                          /**< \brief (PORT) Number of instances */
447 #define PORT_INSTS        { PORT }                   /**< \brief (PORT) Instances List */
448 
449 #define PTC_GCLK_ID       27
450 #define PTC_INST_NUM      1                          /**< \brief (PTC) Number of instances */
451 #define PTC_INSTS         { PTC }                    /**< \brief (PTC) Instances List */
452 
453 #define RTC               ((Rtc      *)0x40001400UL) /**< \brief (RTC) APB Base Address */
454 #define RTC_INST_NUM      1                          /**< \brief (RTC) Number of instances */
455 #define RTC_INSTS         { RTC }                    /**< \brief (RTC) Instances List */
456 
457 #define SERCOM0           ((Sercom   *)0x42000800UL) /**< \brief (SERCOM0) APB Base Address */
458 #define SERCOM1           ((Sercom   *)0x42000C00UL) /**< \brief (SERCOM1) APB Base Address */
459 #define SERCOM2           ((Sercom   *)0x42001000UL) /**< \brief (SERCOM2) APB Base Address */
460 #define SERCOM3           ((Sercom   *)0x42001400UL) /**< \brief (SERCOM3) APB Base Address */
461 #define SERCOM4           ((Sercom   *)0x42001800UL) /**< \brief (SERCOM4) APB Base Address */
462 #define SERCOM5           ((Sercom   *)0x42001C00UL) /**< \brief (SERCOM5) APB Base Address */
463 #define SERCOM_INST_NUM   6                          /**< \brief (SERCOM) Number of instances */
464 #define SERCOM_INSTS      { SERCOM0, SERCOM1, SERCOM2, SERCOM3, SERCOM4, SERCOM5 } /**< \brief (SERCOM) Instances List */
465 
466 #define SYSCTRL           ((Sysctrl  *)0x40000800UL) /**< \brief (SYSCTRL) APB Base Address */
467 #define SYSCTRL_INST_NUM  1                          /**< \brief (SYSCTRL) Number of instances */
468 #define SYSCTRL_INSTS     { SYSCTRL }                /**< \brief (SYSCTRL) Instances List */
469 
470 #define TC0               ((Tc       *)0x42002000UL) /**< \brief (TC0) APB Base Address */
471 #define TC1               ((Tc       *)0x42002400UL) /**< \brief (TC1) APB Base Address */
472 #define TC2               ((Tc       *)0x42002800UL) /**< \brief (TC2) APB Base Address */
473 #define TC3               ((Tc       *)0x42002C00UL) /**< \brief (TC3) APB Base Address */
474 #define TC4               ((Tc       *)0x42003000UL) /**< \brief (TC4) APB Base Address */
475 #define TC5               ((Tc       *)0x42003400UL) /**< \brief (TC5) APB Base Address */
476 #define TC6               ((Tc       *)0x42003800UL) /**< \brief (TC6) APB Base Address */
477 #define TC7               ((Tc       *)0x42003C00UL) /**< \brief (TC7) APB Base Address */
478 #define TC_INST_NUM       8                          /**< \brief (TC) Number of instances */
479 #define TC_INSTS          { TC0, TC1, TC2, TC3, TC4, TC5, TC6, TC7 } /**< \brief (TC) Instances List */
480 
481 #define WDT               ((Wdt      *)0x40001000UL) /**< \brief (WDT) APB Base Address */
482 #define WDT_INST_NUM      1                          /**< \brief (WDT) Number of instances */
483 #define WDT_INSTS         { WDT }                    /**< \brief (WDT) Instances List */
484 
485 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
486 /*@}*/
487 
488 /* ************************************************************************** */
489 /**  PORT DEFINITIONS FOR SAMD20J18 */
490 /* ************************************************************************** */
491 /** \defgroup SAMD20J18_port PORT Definitions */
492 /*@{*/
493 
494 #include "pio/samd20j18.h"
495 /*@}*/
496 
497 /* ************************************************************************** */
498 /**  MEMORY MAPPING DEFINITIONS FOR SAMD20J18 */
499 /* ************************************************************************** */
500 
501 #define FLASH_SIZE            0x40000UL /* 256 kB */
502 #define FLASH_PAGE_SIZE       64
503 #define FLASH_NB_OF_PAGES     4096
504 #define FLASH_USER_PAGE_SIZE  64
505 #define HRAMC0_SIZE           0x8000UL /* 32 kB */
506 #define FLASH_ADDR            (0x00000000UL) /**< FLASH base address */
507 #define FLASH_USER_PAGE_ADDR  (0x00800000UL) /**< FLASH_USER_PAGE base address */
508 #define HRAMC0_ADDR           (0x20000000UL) /**< HRAMC0 base address */
509 
510 #define DSU_DID_RESETVALUE    0x10001300UL
511 #define PORT_GROUPS           2
512 
513 /* ************************************************************************** */
514 /**  ELECTRICAL DEFINITIONS FOR SAMD20J18 */
515 /* ************************************************************************** */
516 
517 
518 #ifdef __cplusplus
519 }
520 #endif
521 
522 /*@}*/
523 
524 #endif /* SAMD20J18_H */
525