1 /**
2  * \file
3  *
4  * \brief Header file for SAMD20G16
5  *
6  * Copyright (c) 2017 Microchip Technology Inc.
7  *
8  * \asf_license_start
9  *
10  * \page License
11  *
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License"); you may
15  * not use this file except in compliance with the License.
16  * You may obtain a copy of the Licence at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  * \asf_license_stop
27  *
28  */
29 
30 #ifndef _SAMD20G16_
31 #define _SAMD20G16_
32 
33 /**
34  * \ingroup SAMD20_definitions
35  * \addtogroup SAMD20G16_definitions SAMD20G16 definitions
36  * This file defines all structures and symbols for SAMD20G16:
37  *   - registers and bitfields
38  *   - peripheral base address
39  *   - peripheral ID
40  *   - PIO definitions
41 */
42 /*@{*/
43 
44 #ifdef __cplusplus
45  extern "C" {
46 #endif
47 
48 #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
49 #include <stdint.h>
50 #ifndef __cplusplus
51 typedef volatile const uint32_t RoReg;   /**< Read only 32-bit register (volatile const unsigned int) */
52 typedef volatile const uint16_t RoReg16; /**< Read only 16-bit register (volatile const unsigned int) */
53 typedef volatile const uint8_t  RoReg8;  /**< Read only  8-bit register (volatile const unsigned int) */
54 #else
55 typedef volatile       uint32_t RoReg;   /**< Read only 32-bit register (volatile const unsigned int) */
56 typedef volatile       uint16_t RoReg16; /**< Read only 16-bit register (volatile const unsigned int) */
57 typedef volatile       uint8_t  RoReg8;  /**< Read only  8-bit register (volatile const unsigned int) */
58 #endif
59 typedef volatile       uint32_t WoReg;   /**< Write only 32-bit register (volatile unsigned int) */
60 typedef volatile       uint16_t WoReg16; /**< Write only 16-bit register (volatile unsigned int) */
61 typedef volatile       uint8_t  WoReg8;  /**< Write only  8-bit register (volatile unsigned int) */
62 typedef volatile       uint32_t RwReg;   /**< Read-Write 32-bit register (volatile unsigned int) */
63 typedef volatile       uint16_t RwReg16; /**< Read-Write 16-bit register (volatile unsigned int) */
64 typedef volatile       uint8_t  RwReg8;  /**< Read-Write  8-bit register (volatile unsigned int) */
65 #endif
66 
67 #if !defined(SKIP_INTEGER_LITERALS)
68 #if defined(_U_) || defined(_L_) || defined(_UL_)
69   #error "Integer Literals macros already defined elsewhere"
70 #endif
71 
72 #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
73 /* Macros that deal with adding suffixes to integer literal constants for C/C++ */
74 #define _U_(x)         x ## U            /**< C code: Unsigned integer literal constant value */
75 #define _L_(x)         x ## L            /**< C code: Long integer literal constant value */
76 #define _UL_(x)        x ## UL           /**< C code: Unsigned Long integer literal constant value */
77 #else /* Assembler */
78 #define _U_(x)         x                 /**< Assembler: Unsigned integer literal constant value */
79 #define _L_(x)         x                 /**< Assembler: Long integer literal constant value */
80 #define _UL_(x)        x                 /**< Assembler: Unsigned Long integer literal constant value */
81 #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
82 #endif /* SKIP_INTEGER_LITERALS */
83 
84 /* ************************************************************************** */
85 /**  CMSIS DEFINITIONS FOR SAMD20G16 */
86 /* ************************************************************************** */
87 /** \defgroup SAMD20G16_cmsis CMSIS Definitions */
88 /*@{*/
89 
90 /** Interrupt Number Definition */
91 typedef enum IRQn
92 {
93   /******  Cortex-M0+ Processor Exceptions Numbers ******************************/
94   NonMaskableInt_IRQn      = -14,/**<  2 Non Maskable Interrupt                 */
95   HardFault_IRQn           = -13,/**<  3 Cortex-M0+ Hard Fault Interrupt        */
96   SVCall_IRQn              = -5, /**< 11 Cortex-M0+ SV Call Interrupt           */
97   PendSV_IRQn              = -2, /**< 14 Cortex-M0+ Pend SV Interrupt           */
98   SysTick_IRQn             = -1, /**< 15 Cortex-M0+ System Tick Interrupt       */
99   /******  SAMD20G16-specific Interrupt Numbers ***********************/
100   PM_IRQn                  =  0, /**<  0 SAMD20G16 Power Manager (PM) */
101   SYSCTRL_IRQn             =  1, /**<  1 SAMD20G16 System Control (SYSCTRL) */
102   WDT_IRQn                 =  2, /**<  2 SAMD20G16 Watchdog Timer (WDT) */
103   RTC_IRQn                 =  3, /**<  3 SAMD20G16 Real-Time Counter (RTC) */
104   EIC_IRQn                 =  4, /**<  4 SAMD20G16 External Interrupt Controller (EIC) */
105   NVMCTRL_IRQn             =  5, /**<  5 SAMD20G16 Non-Volatile Memory Controller (NVMCTRL) */
106   EVSYS_IRQn               =  6, /**<  6 SAMD20G16 Event System Interface (EVSYS) */
107   SERCOM0_IRQn             =  7, /**<  7 SAMD20G16 Serial Communication Interface 0 (SERCOM0) */
108   SERCOM1_IRQn             =  8, /**<  8 SAMD20G16 Serial Communication Interface 1 (SERCOM1) */
109   SERCOM2_IRQn             =  9, /**<  9 SAMD20G16 Serial Communication Interface 2 (SERCOM2) */
110   SERCOM3_IRQn             = 10, /**< 10 SAMD20G16 Serial Communication Interface 3 (SERCOM3) */
111   SERCOM4_IRQn             = 11, /**< 11 SAMD20G16 Serial Communication Interface 4 (SERCOM4) */
112   SERCOM5_IRQn             = 12, /**< 12 SAMD20G16 Serial Communication Interface 5 (SERCOM5) */
113   TC0_IRQn                 = 13, /**< 13 SAMD20G16 Basic Timer Counter 0 (TC0) */
114   TC1_IRQn                 = 14, /**< 14 SAMD20G16 Basic Timer Counter 1 (TC1) */
115   TC2_IRQn                 = 15, /**< 15 SAMD20G16 Basic Timer Counter 2 (TC2) */
116   TC3_IRQn                 = 16, /**< 16 SAMD20G16 Basic Timer Counter 3 (TC3) */
117   TC4_IRQn                 = 17, /**< 17 SAMD20G16 Basic Timer Counter 4 (TC4) */
118   TC5_IRQn                 = 18, /**< 18 SAMD20G16 Basic Timer Counter 5 (TC5) */
119   ADC_IRQn                 = 21, /**< 21 SAMD20G16 Analog Digital Converter (ADC) */
120   AC_IRQn                  = 22, /**< 22 SAMD20G16 Analog Comparators (AC) */
121   DAC_IRQn                 = 23, /**< 23 SAMD20G16 Digital Analog Converter (DAC) */
122   PTC_IRQn                 = 24, /**< 24 SAMD20G16 Peripheral Touch Controller (PTC) */
123 
124   PERIPH_COUNT_IRQn        = 25  /**< Number of peripheral IDs */
125 } IRQn_Type;
126 
127 typedef struct _DeviceVectors
128 {
129   /* Stack pointer */
130   void* pvStack;
131 
132   /* Cortex-M handlers */
133   void* pfnReset_Handler;
134   void* pfnNMI_Handler;
135   void* pfnHardFault_Handler;
136   void* pvReservedM12;
137   void* pvReservedM11;
138   void* pvReservedM10;
139   void* pvReservedM9;
140   void* pvReservedM8;
141   void* pvReservedM7;
142   void* pvReservedM6;
143   void* pfnSVC_Handler;
144   void* pvReservedM4;
145   void* pvReservedM3;
146   void* pfnPendSV_Handler;
147   void* pfnSysTick_Handler;
148 
149   /* Peripheral handlers */
150   void* pfnPM_Handler;                    /*  0 Power Manager */
151   void* pfnSYSCTRL_Handler;               /*  1 System Control */
152   void* pfnWDT_Handler;                   /*  2 Watchdog Timer */
153   void* pfnRTC_Handler;                   /*  3 Real-Time Counter */
154   void* pfnEIC_Handler;                   /*  4 External Interrupt Controller */
155   void* pfnNVMCTRL_Handler;               /*  5 Non-Volatile Memory Controller */
156   void* pfnEVSYS_Handler;                 /*  6 Event System Interface */
157   void* pfnSERCOM0_Handler;               /*  7 Serial Communication Interface 0 */
158   void* pfnSERCOM1_Handler;               /*  8 Serial Communication Interface 1 */
159   void* pfnSERCOM2_Handler;               /*  9 Serial Communication Interface 2 */
160   void* pfnSERCOM3_Handler;               /* 10 Serial Communication Interface 3 */
161   void* pfnSERCOM4_Handler;               /* 11 Serial Communication Interface 4 */
162   void* pfnSERCOM5_Handler;               /* 12 Serial Communication Interface 5 */
163   void* pfnTC0_Handler;                   /* 13 Basic Timer Counter 0 */
164   void* pfnTC1_Handler;                   /* 14 Basic Timer Counter 1 */
165   void* pfnTC2_Handler;                   /* 15 Basic Timer Counter 2 */
166   void* pfnTC3_Handler;                   /* 16 Basic Timer Counter 3 */
167   void* pfnTC4_Handler;                   /* 17 Basic Timer Counter 4 */
168   void* pfnTC5_Handler;                   /* 18 Basic Timer Counter 5 */
169   void* pvReserved19;
170   void* pvReserved20;
171   void* pfnADC_Handler;                   /* 21 Analog Digital Converter */
172   void* pfnAC_Handler;                    /* 22 Analog Comparators */
173   void* pfnDAC_Handler;                   /* 23 Digital Analog Converter */
174   void* pfnPTC_Handler;                   /* 24 Peripheral Touch Controller */
175 } DeviceVectors;
176 
177 /* Cortex-M0+ processor handlers */
178 void Reset_Handler               ( void );
179 void NMI_Handler                 ( void );
180 void HardFault_Handler           ( void );
181 void SVC_Handler                 ( void );
182 void PendSV_Handler              ( void );
183 void SysTick_Handler             ( void );
184 
185 /* Peripherals handlers */
186 void PM_Handler                  ( void );
187 void SYSCTRL_Handler             ( void );
188 void WDT_Handler                 ( void );
189 void RTC_Handler                 ( void );
190 void EIC_Handler                 ( void );
191 void NVMCTRL_Handler             ( void );
192 void EVSYS_Handler               ( void );
193 void SERCOM0_Handler             ( void );
194 void SERCOM1_Handler             ( void );
195 void SERCOM2_Handler             ( void );
196 void SERCOM3_Handler             ( void );
197 void SERCOM4_Handler             ( void );
198 void SERCOM5_Handler             ( void );
199 void TC0_Handler                 ( void );
200 void TC1_Handler                 ( void );
201 void TC2_Handler                 ( void );
202 void TC3_Handler                 ( void );
203 void TC4_Handler                 ( void );
204 void TC5_Handler                 ( void );
205 void ADC_Handler                 ( void );
206 void AC_Handler                  ( void );
207 void DAC_Handler                 ( void );
208 void PTC_Handler                 ( void );
209 
210 /*
211  * \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
212  */
213 
214 #define __CM0PLUS_REV          1         /*!< Core revision r0p1 */
215 #define __MPU_PRESENT          0         /*!< MPU present or not */
216 #define __NVIC_PRIO_BITS       2         /*!< Number of bits used for Priority Levels */
217 #define __VTOR_PRESENT         1         /*!< VTOR present or not */
218 #define __Vendor_SysTickConfig 0         /*!< Set to 1 if different SysTick Config is used */
219 
220 /**
221  * \brief CMSIS includes
222  */
223 
224 #include <core_cm0plus.h>
225 #if !defined DONT_USE_CMSIS_INIT
226 #include "system_samd20.h"
227 #endif /* DONT_USE_CMSIS_INIT */
228 
229 /*@}*/
230 
231 /* ************************************************************************** */
232 /**  SOFTWARE PERIPHERAL API DEFINITION FOR SAMD20G16 */
233 /* ************************************************************************** */
234 /** \defgroup SAMD20G16_api Peripheral Software API */
235 /*@{*/
236 
237 #include "component/ac.h"
238 #include "component/adc.h"
239 #include "component/dac.h"
240 #include "component/dsu.h"
241 #include "component/eic.h"
242 #include "component/evsys.h"
243 #include "component/gclk.h"
244 #include "component/nvmctrl.h"
245 #include "component/pac.h"
246 #include "component/pm.h"
247 #include "component/port.h"
248 #include "component/rtc.h"
249 #include "component/sercom.h"
250 #include "component/sysctrl.h"
251 #include "component/tc.h"
252 #include "component/wdt.h"
253 /*@}*/
254 
255 /* ************************************************************************** */
256 /**  REGISTERS ACCESS DEFINITIONS FOR SAMD20G16 */
257 /* ************************************************************************** */
258 /** \defgroup SAMD20G16_reg Registers Access Definitions */
259 /*@{*/
260 
261 #include "instance/ac.h"
262 #include "instance/adc.h"
263 #include "instance/dac.h"
264 #include "instance/dsu.h"
265 #include "instance/eic.h"
266 #include "instance/evsys.h"
267 #include "instance/gclk.h"
268 #include "instance/nvmctrl.h"
269 #include "instance/pac0.h"
270 #include "instance/pac1.h"
271 #include "instance/pac2.h"
272 #include "instance/pm.h"
273 #include "instance/port.h"
274 #include "instance/rtc.h"
275 #include "instance/sercom0.h"
276 #include "instance/sercom1.h"
277 #include "instance/sercom2.h"
278 #include "instance/sercom3.h"
279 #include "instance/sercom4.h"
280 #include "instance/sercom5.h"
281 #include "instance/sysctrl.h"
282 #include "instance/tc0.h"
283 #include "instance/tc1.h"
284 #include "instance/tc2.h"
285 #include "instance/tc3.h"
286 #include "instance/tc4.h"
287 #include "instance/tc5.h"
288 #include "instance/wdt.h"
289 /*@}*/
290 
291 /* ************************************************************************** */
292 /**  PERIPHERAL ID DEFINITIONS FOR SAMD20G16 */
293 /* ************************************************************************** */
294 /** \defgroup SAMD20G16_id Peripheral Ids Definitions */
295 /*@{*/
296 
297 // Peripheral instances on HPB0 bridge
298 #define ID_PAC0           0 /**< \brief Peripheral Access Controller 0 (PAC0) */
299 #define ID_PM             1 /**< \brief Power Manager (PM) */
300 #define ID_SYSCTRL        2 /**< \brief System Control (SYSCTRL) */
301 #define ID_GCLK           3 /**< \brief Generic Clock Generator (GCLK) */
302 #define ID_WDT            4 /**< \brief Watchdog Timer (WDT) */
303 #define ID_RTC            5 /**< \brief Real-Time Counter (RTC) */
304 #define ID_EIC            6 /**< \brief External Interrupt Controller (EIC) */
305 
306 // Peripheral instances on HPB1 bridge
307 #define ID_PAC1          32 /**< \brief Peripheral Access Controller 1 (PAC1) */
308 #define ID_DSU           33 /**< \brief Device Service Unit (DSU) */
309 #define ID_NVMCTRL       34 /**< \brief Non-Volatile Memory Controller (NVMCTRL) */
310 #define ID_PORT          35 /**< \brief Port Module (PORT) */
311 
312 // Peripheral instances on HPB2 bridge
313 #define ID_PAC2          64 /**< \brief Peripheral Access Controller 2 (PAC2) */
314 #define ID_EVSYS         65 /**< \brief Event System Interface (EVSYS) */
315 #define ID_SERCOM0       66 /**< \brief Serial Communication Interface 0 (SERCOM0) */
316 #define ID_SERCOM1       67 /**< \brief Serial Communication Interface 1 (SERCOM1) */
317 #define ID_SERCOM2       68 /**< \brief Serial Communication Interface 2 (SERCOM2) */
318 #define ID_SERCOM3       69 /**< \brief Serial Communication Interface 3 (SERCOM3) */
319 #define ID_SERCOM4       70 /**< \brief Serial Communication Interface 4 (SERCOM4) */
320 #define ID_SERCOM5       71 /**< \brief Serial Communication Interface 5 (SERCOM5) */
321 #define ID_TC0           72 /**< \brief Basic Timer Counter 0 (TC0) */
322 #define ID_TC1           73 /**< \brief Basic Timer Counter 1 (TC1) */
323 #define ID_TC2           74 /**< \brief Basic Timer Counter 2 (TC2) */
324 #define ID_TC3           75 /**< \brief Basic Timer Counter 3 (TC3) */
325 #define ID_TC4           76 /**< \brief Basic Timer Counter 4 (TC4) */
326 #define ID_TC5           77 /**< \brief Basic Timer Counter 5 (TC5) */
327 #define ID_ADC           80 /**< \brief Analog Digital Converter (ADC) */
328 #define ID_AC            81 /**< \brief Analog Comparators (AC) */
329 #define ID_DAC           82 /**< \brief Digital Analog Converter (DAC) */
330 #define ID_PTC           83 /**< \brief Peripheral Touch Controller (PTC) */
331 
332 #define ID_PERIPH_COUNT  84 /**< \brief Max number of peripheral IDs */
333 /*@}*/
334 
335 /* ************************************************************************** */
336 /**  BASE ADDRESS DEFINITIONS FOR SAMD20G16 */
337 /* ************************************************************************** */
338 /** \defgroup SAMD20G16_base Peripheral Base Address Definitions */
339 /*@{*/
340 
341 #if defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)
342 #define AC                            (0x42004400) /**< \brief (AC) APB Base Address */
343 #define ADC                           (0x42004000) /**< \brief (ADC) APB Base Address */
344 #define DAC                           (0x42004800) /**< \brief (DAC) APB Base Address */
345 #define DSU                           (0x41002000) /**< \brief (DSU) APB Base Address */
346 #define EIC                           (0x40001800) /**< \brief (EIC) APB Base Address */
347 #define EVSYS                         (0x42000400) /**< \brief (EVSYS) APB Base Address */
348 #define GCLK                          (0x40000C00) /**< \brief (GCLK) APB Base Address */
349 #define NVMCTRL                       (0x41004000) /**< \brief (NVMCTRL) APB Base Address */
350 #define NVMCTRL_CAL                   (0x00800000) /**< \brief (NVMCTRL) CAL Base Address */
351 #define NVMCTRL_LOCKBIT               (0x00802000) /**< \brief (NVMCTRL) LOCKBIT Base Address */
352 #define NVMCTRL_OTP1                  (0x00806000) /**< \brief (NVMCTRL) OTP1 Base Address */
353 #define NVMCTRL_OTP2                  (0x00806008) /**< \brief (NVMCTRL) OTP2 Base Address */
354 #define NVMCTRL_OTP4                  (0x00806020) /**< \brief (NVMCTRL) OTP4 Base Address */
355 #define NVMCTRL_TEMP_LOG              (0x00806030) /**< \brief (NVMCTRL) TEMP_LOG Base Address */
356 #define NVMCTRL_USER                  (0x00804000) /**< \brief (NVMCTRL) USER Base Address */
357 #define PAC0                          (0x40000000) /**< \brief (PAC0) APB Base Address */
358 #define PAC1                          (0x41000000) /**< \brief (PAC1) APB Base Address */
359 #define PAC2                          (0x42000000) /**< \brief (PAC2) APB Base Address */
360 #define PM                            (0x40000400) /**< \brief (PM) APB Base Address */
361 #define PORT                          (0x41004400) /**< \brief (PORT) APB Base Address */
362 #define PORT_IOBUS                    (0x60000000) /**< \brief (PORT) IOBUS Base Address */
363 #define PTC                           (0x42004C00) /**< \brief (PTC) APB Base Address */
364 #define RTC                           (0x40001400) /**< \brief (RTC) APB Base Address */
365 #define SERCOM0                       (0x42000800) /**< \brief (SERCOM0) APB Base Address */
366 #define SERCOM1                       (0x42000C00) /**< \brief (SERCOM1) APB Base Address */
367 #define SERCOM2                       (0x42001000) /**< \brief (SERCOM2) APB Base Address */
368 #define SERCOM3                       (0x42001400) /**< \brief (SERCOM3) APB Base Address */
369 #define SERCOM4                       (0x42001800) /**< \brief (SERCOM4) APB Base Address */
370 #define SERCOM5                       (0x42001C00) /**< \brief (SERCOM5) APB Base Address */
371 #define SYSCTRL                       (0x40000800) /**< \brief (SYSCTRL) APB Base Address */
372 #define TC0                           (0x42002000) /**< \brief (TC0) APB Base Address */
373 #define TC1                           (0x42002400) /**< \brief (TC1) APB Base Address */
374 #define TC2                           (0x42002800) /**< \brief (TC2) APB Base Address */
375 #define TC3                           (0x42002C00) /**< \brief (TC3) APB Base Address */
376 #define TC4                           (0x42003000) /**< \brief (TC4) APB Base Address */
377 #define TC5                           (0x42003400) /**< \brief (TC5) APB Base Address */
378 #define WDT                           (0x40001000) /**< \brief (WDT) APB Base Address */
379 #else
380 #define AC                ((Ac       *)0x42004400UL) /**< \brief (AC) APB Base Address */
381 #define AC_INST_NUM       1                          /**< \brief (AC) Number of instances */
382 #define AC_INSTS          { AC }                     /**< \brief (AC) Instances List */
383 
384 #define ADC               ((Adc      *)0x42004000UL) /**< \brief (ADC) APB Base Address */
385 #define ADC_INST_NUM      1                          /**< \brief (ADC) Number of instances */
386 #define ADC_INSTS         { ADC }                    /**< \brief (ADC) Instances List */
387 
388 #define DAC               ((Dac      *)0x42004800UL) /**< \brief (DAC) APB Base Address */
389 #define DAC_INST_NUM      1                          /**< \brief (DAC) Number of instances */
390 #define DAC_INSTS         { DAC }                    /**< \brief (DAC) Instances List */
391 
392 #define DSU               ((Dsu      *)0x41002000UL) /**< \brief (DSU) APB Base Address */
393 #define DSU_INST_NUM      1                          /**< \brief (DSU) Number of instances */
394 #define DSU_INSTS         { DSU }                    /**< \brief (DSU) Instances List */
395 
396 #define EIC               ((Eic      *)0x40001800UL) /**< \brief (EIC) APB Base Address */
397 #define EIC_INST_NUM      1                          /**< \brief (EIC) Number of instances */
398 #define EIC_INSTS         { EIC }                    /**< \brief (EIC) Instances List */
399 
400 #define EVSYS             ((Evsys    *)0x42000400UL) /**< \brief (EVSYS) APB Base Address */
401 #define EVSYS_INST_NUM    1                          /**< \brief (EVSYS) Number of instances */
402 #define EVSYS_INSTS       { EVSYS }                  /**< \brief (EVSYS) Instances List */
403 
404 #define GCLK              ((Gclk     *)0x40000C00UL) /**< \brief (GCLK) APB Base Address */
405 #define GCLK_INST_NUM     1                          /**< \brief (GCLK) Number of instances */
406 #define GCLK_INSTS        { GCLK }                   /**< \brief (GCLK) Instances List */
407 
408 #define NVMCTRL           ((Nvmctrl  *)0x41004000UL) /**< \brief (NVMCTRL) APB Base Address */
409 #define NVMCTRL_CAL                   (0x00800000UL) /**< \brief (NVMCTRL) CAL Base Address */
410 #define NVMCTRL_LOCKBIT               (0x00802000UL) /**< \brief (NVMCTRL) LOCKBIT Base Address */
411 #define NVMCTRL_OTP1                  (0x00806000UL) /**< \brief (NVMCTRL) OTP1 Base Address */
412 #define NVMCTRL_OTP2                  (0x00806008UL) /**< \brief (NVMCTRL) OTP2 Base Address */
413 #define NVMCTRL_OTP4                  (0x00806020UL) /**< \brief (NVMCTRL) OTP4 Base Address */
414 #define NVMCTRL_TEMP_LOG              (0x00806030UL) /**< \brief (NVMCTRL) TEMP_LOG Base Address */
415 #define NVMCTRL_USER                  (0x00804000UL) /**< \brief (NVMCTRL) USER Base Address */
416 #define NVMCTRL_INST_NUM  1                          /**< \brief (NVMCTRL) Number of instances */
417 #define NVMCTRL_INSTS     { NVMCTRL }                /**< \brief (NVMCTRL) Instances List */
418 
419 #define PAC0              ((Pac      *)0x40000000UL) /**< \brief (PAC0) APB Base Address */
420 #define PAC1              ((Pac      *)0x41000000UL) /**< \brief (PAC1) APB Base Address */
421 #define PAC2              ((Pac      *)0x42000000UL) /**< \brief (PAC2) APB Base Address */
422 #define PAC_INST_NUM      3                          /**< \brief (PAC) Number of instances */
423 #define PAC_INSTS         { PAC0, PAC1, PAC2 }       /**< \brief (PAC) Instances List */
424 
425 #define PM                ((Pm       *)0x40000400UL) /**< \brief (PM) APB Base Address */
426 #define PM_INST_NUM       1                          /**< \brief (PM) Number of instances */
427 #define PM_INSTS          { PM }                     /**< \brief (PM) Instances List */
428 
429 #define PORT              ((Port     *)0x41004400UL) /**< \brief (PORT) APB Base Address */
430 #define PORT_IOBUS        ((Port     *)0x60000000UL) /**< \brief (PORT) IOBUS Base Address */
431 #define PORT_INST_NUM     1                          /**< \brief (PORT) Number of instances */
432 #define PORT_INSTS        { PORT }                   /**< \brief (PORT) Instances List */
433 #define PORT_IOBUS_INST_NUM 1                          /**< \brief (PORT) Number of instances */
434 #define PORT_IOBUS_INSTS  { PORT_IOBUS }             /**< \brief (PORT) Instances List */
435 
436 #define PTC               ((void     *)0x42004C00UL) /**< \brief (PTC) APB Base Address */
437 #define PTC_GCLK_ID       27
438 #define PTC_INST_NUM      1                          /**< \brief (PTC) Number of instances */
439 #define PTC_INSTS         { PTC }                    /**< \brief (PTC) Instances List */
440 
441 #define RTC               ((Rtc      *)0x40001400UL) /**< \brief (RTC) APB Base Address */
442 #define RTC_INST_NUM      1                          /**< \brief (RTC) Number of instances */
443 #define RTC_INSTS         { RTC }                    /**< \brief (RTC) Instances List */
444 
445 #define SERCOM0           ((Sercom   *)0x42000800UL) /**< \brief (SERCOM0) APB Base Address */
446 #define SERCOM1           ((Sercom   *)0x42000C00UL) /**< \brief (SERCOM1) APB Base Address */
447 #define SERCOM2           ((Sercom   *)0x42001000UL) /**< \brief (SERCOM2) APB Base Address */
448 #define SERCOM3           ((Sercom   *)0x42001400UL) /**< \brief (SERCOM3) APB Base Address */
449 #define SERCOM4           ((Sercom   *)0x42001800UL) /**< \brief (SERCOM4) APB Base Address */
450 #define SERCOM5           ((Sercom   *)0x42001C00UL) /**< \brief (SERCOM5) APB Base Address */
451 #define SERCOM_INST_NUM   6                          /**< \brief (SERCOM) Number of instances */
452 #define SERCOM_INSTS      { SERCOM0, SERCOM1, SERCOM2, SERCOM3, SERCOM4, SERCOM5 } /**< \brief (SERCOM) Instances List */
453 
454 #define SYSCTRL           ((Sysctrl  *)0x40000800UL) /**< \brief (SYSCTRL) APB Base Address */
455 #define SYSCTRL_INST_NUM  1                          /**< \brief (SYSCTRL) Number of instances */
456 #define SYSCTRL_INSTS     { SYSCTRL }                /**< \brief (SYSCTRL) Instances List */
457 
458 #define TC0               ((Tc       *)0x42002000UL) /**< \brief (TC0) APB Base Address */
459 #define TC1               ((Tc       *)0x42002400UL) /**< \brief (TC1) APB Base Address */
460 #define TC2               ((Tc       *)0x42002800UL) /**< \brief (TC2) APB Base Address */
461 #define TC3               ((Tc       *)0x42002C00UL) /**< \brief (TC3) APB Base Address */
462 #define TC4               ((Tc       *)0x42003000UL) /**< \brief (TC4) APB Base Address */
463 #define TC5               ((Tc       *)0x42003400UL) /**< \brief (TC5) APB Base Address */
464 #define TC_INST_NUM       6                          /**< \brief (TC) Number of instances */
465 #define TC_INSTS          { TC0, TC1, TC2, TC3, TC4, TC5 } /**< \brief (TC) Instances List */
466 
467 #define WDT               ((Wdt      *)0x40001000UL) /**< \brief (WDT) APB Base Address */
468 #define WDT_INST_NUM      1                          /**< \brief (WDT) Number of instances */
469 #define WDT_INSTS         { WDT }                    /**< \brief (WDT) Instances List */
470 
471 #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
472 /*@}*/
473 
474 /* ************************************************************************** */
475 /**  PORT DEFINITIONS FOR SAMD20G16 */
476 /* ************************************************************************** */
477 /** \defgroup SAMD20G16_port PORT Definitions */
478 /*@{*/
479 
480 #include "pio/samd20g16.h"
481 /*@}*/
482 
483 /* ************************************************************************** */
484 /**  MEMORY MAPPING DEFINITIONS FOR SAMD20G16 */
485 /* ************************************************************************** */
486 
487 #define FLASH_SIZE            _UL_(0x00010000) /* 64 kB */
488 #define FLASH_PAGE_SIZE       64
489 #define FLASH_NB_OF_PAGES     1024
490 #define FLASH_USER_PAGE_SIZE  64
491 #define HRAMC0_SIZE           _UL_(0x00002000) /* 8 kB */
492 
493 #define FLASH_ADDR            _UL_(0x00000000) /**< FLASH base address */
494 #define FLASH_USER_PAGE_ADDR  _UL_(0x00800000) /**< FLASH_USER_PAGE base address */
495 #define HRAMC0_ADDR           _UL_(0x20000000) /**< HRAMC0 base address */
496 #define HPB0_ADDR             _UL_(0x40000000) /**< HPB0 base address */
497 #define HPB1_ADDR             _UL_(0x41000000) /**< HPB1 base address */
498 #define HPB2_ADDR             _UL_(0x42000000) /**< HPB2 base address */
499 #define PPB_ADDR              _UL_(0xE0000000) /**< PPB base address */
500 
501 #define DSU_DID_RESETVALUE    _UL_(0x10001407)
502 #define PORT_GROUPS           2
503 
504 /* ************************************************************************** */
505 /**  ELECTRICAL DEFINITIONS FOR SAMD20G16 */
506 /* ************************************************************************** */
507 
508 
509 #ifdef __cplusplus
510 }
511 #endif
512 
513 /*@}*/
514 
515 #endif /* SAMD20G16_H */
516