Mouse code for the MacroRat
mbed-dev/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/drivers/system/system.h@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * \file |
sahilmgandhi | 18:6a4db94011d3 | 3 | * |
sahilmgandhi | 18:6a4db94011d3 | 4 | * \brief SAM System related functionality |
sahilmgandhi | 18:6a4db94011d3 | 5 | * |
sahilmgandhi | 18:6a4db94011d3 | 6 | * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. |
sahilmgandhi | 18:6a4db94011d3 | 7 | * |
sahilmgandhi | 18:6a4db94011d3 | 8 | * \asf_license_start |
sahilmgandhi | 18:6a4db94011d3 | 9 | * |
sahilmgandhi | 18:6a4db94011d3 | 10 | * \page License |
sahilmgandhi | 18:6a4db94011d3 | 11 | * |
sahilmgandhi | 18:6a4db94011d3 | 12 | * Redistribution and use in source and binary forms, with or without |
sahilmgandhi | 18:6a4db94011d3 | 13 | * modification, are permitted provided that the following conditions are met: |
sahilmgandhi | 18:6a4db94011d3 | 14 | * |
sahilmgandhi | 18:6a4db94011d3 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
sahilmgandhi | 18:6a4db94011d3 | 16 | * this list of conditions and the following disclaimer. |
sahilmgandhi | 18:6a4db94011d3 | 17 | * |
sahilmgandhi | 18:6a4db94011d3 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
sahilmgandhi | 18:6a4db94011d3 | 19 | * this list of conditions and the following disclaimer in the documentation |
sahilmgandhi | 18:6a4db94011d3 | 20 | * and/or other materials provided with the distribution. |
sahilmgandhi | 18:6a4db94011d3 | 21 | * |
sahilmgandhi | 18:6a4db94011d3 | 22 | * 3. The name of Atmel may not be used to endorse or promote products derived |
sahilmgandhi | 18:6a4db94011d3 | 23 | * from this software without specific prior written permission. |
sahilmgandhi | 18:6a4db94011d3 | 24 | * |
sahilmgandhi | 18:6a4db94011d3 | 25 | * 4. This software may only be redistributed and used in connection with an |
sahilmgandhi | 18:6a4db94011d3 | 26 | * Atmel microcontroller product. |
sahilmgandhi | 18:6a4db94011d3 | 27 | * |
sahilmgandhi | 18:6a4db94011d3 | 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED |
sahilmgandhi | 18:6a4db94011d3 | 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
sahilmgandhi | 18:6a4db94011d3 | 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE |
sahilmgandhi | 18:6a4db94011d3 | 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR |
sahilmgandhi | 18:6a4db94011d3 | 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
sahilmgandhi | 18:6a4db94011d3 | 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
sahilmgandhi | 18:6a4db94011d3 | 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
sahilmgandhi | 18:6a4db94011d3 | 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
sahilmgandhi | 18:6a4db94011d3 | 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
sahilmgandhi | 18:6a4db94011d3 | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
sahilmgandhi | 18:6a4db94011d3 | 38 | * POSSIBILITY OF SUCH DAMAGE. |
sahilmgandhi | 18:6a4db94011d3 | 39 | * |
sahilmgandhi | 18:6a4db94011d3 | 40 | * \asf_license_stop |
sahilmgandhi | 18:6a4db94011d3 | 41 | * |
sahilmgandhi | 18:6a4db94011d3 | 42 | */ |
sahilmgandhi | 18:6a4db94011d3 | 43 | /* |
sahilmgandhi | 18:6a4db94011d3 | 44 | * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> |
sahilmgandhi | 18:6a4db94011d3 | 45 | */ |
sahilmgandhi | 18:6a4db94011d3 | 46 | #ifndef SYSTEM_H_INCLUDED |
sahilmgandhi | 18:6a4db94011d3 | 47 | #define SYSTEM_H_INCLUDED |
sahilmgandhi | 18:6a4db94011d3 | 48 | |
sahilmgandhi | 18:6a4db94011d3 | 49 | #include <compiler.h> |
sahilmgandhi | 18:6a4db94011d3 | 50 | #include <clock.h> |
sahilmgandhi | 18:6a4db94011d3 | 51 | #include <gclk.h> |
sahilmgandhi | 18:6a4db94011d3 | 52 | #include <pinmux.h> |
sahilmgandhi | 18:6a4db94011d3 | 53 | #include <power.h> |
sahilmgandhi | 18:6a4db94011d3 | 54 | #include <reset.h> |
sahilmgandhi | 18:6a4db94011d3 | 55 | |
sahilmgandhi | 18:6a4db94011d3 | 56 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 57 | extern "C" { |
sahilmgandhi | 18:6a4db94011d3 | 58 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 59 | |
sahilmgandhi | 18:6a4db94011d3 | 60 | /** |
sahilmgandhi | 18:6a4db94011d3 | 61 | * \defgroup asfdoc_sam0_system_group SAM System (SYSTEM) Driver |
sahilmgandhi | 18:6a4db94011d3 | 62 | * |
sahilmgandhi | 18:6a4db94011d3 | 63 | * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration |
sahilmgandhi | 18:6a4db94011d3 | 64 | * and management of the device's system relation functionality, necessary for |
sahilmgandhi | 18:6a4db94011d3 | 65 | * the basic device operation. This is not limited to a single peripheral, but |
sahilmgandhi | 18:6a4db94011d3 | 66 | * extends across multiple hardware peripherals. |
sahilmgandhi | 18:6a4db94011d3 | 67 | * |
sahilmgandhi | 18:6a4db94011d3 | 68 | * The following peripherals are used by this module: |
sahilmgandhi | 18:6a4db94011d3 | 69 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 70 | * - PM (Power Manager) |
sahilmgandhi | 18:6a4db94011d3 | 71 | * - RSTC(Reset Controller) |
sahilmgandhi | 18:6a4db94011d3 | 72 | * - SUPC(Supply Controller) |
sahilmgandhi | 18:6a4db94011d3 | 73 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 74 | * \if DEVICE_SAMC21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 75 | * - PM (Power Manager) |
sahilmgandhi | 18:6a4db94011d3 | 76 | * - RSTC(Reset Controller) |
sahilmgandhi | 18:6a4db94011d3 | 77 | * - SUPC(Supply Controller) |
sahilmgandhi | 18:6a4db94011d3 | 78 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 79 | * \if DEVICE_SAMD21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 80 | * - SYSCTRL (System Control) |
sahilmgandhi | 18:6a4db94011d3 | 81 | * - PM (Power Manager) |
sahilmgandhi | 18:6a4db94011d3 | 82 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 83 | * |
sahilmgandhi | 18:6a4db94011d3 | 84 | * The following devices can use this module: |
sahilmgandhi | 18:6a4db94011d3 | 85 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 86 | * - Atmel | SMART SAM L21 |
sahilmgandhi | 18:6a4db94011d3 | 87 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 88 | * \if DEVICE_SAMC21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 89 | * - Atmel | SMART SAM C20/C21 |
sahilmgandhi | 18:6a4db94011d3 | 90 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 91 | * \if DEVICE_SAMD21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 92 | * - Atmel | SMART SAM D20/D21 |
sahilmgandhi | 18:6a4db94011d3 | 93 | * - Atmel | SMART SAM R21 |
sahilmgandhi | 18:6a4db94011d3 | 94 | * - Atmel | SMART SAM D10/D11 |
sahilmgandhi | 18:6a4db94011d3 | 95 | * - Atmel | SMART SAM DAx |
sahilmgandhi | 18:6a4db94011d3 | 96 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 97 | * |
sahilmgandhi | 18:6a4db94011d3 | 98 | * The outline of this documentation is as follows: |
sahilmgandhi | 18:6a4db94011d3 | 99 | * - \ref asfdoc_sam0_system_prerequisites |
sahilmgandhi | 18:6a4db94011d3 | 100 | * - \ref asfdoc_sam0_system_module_overview |
sahilmgandhi | 18:6a4db94011d3 | 101 | * - \ref asfdoc_sam0_system_special_considerations |
sahilmgandhi | 18:6a4db94011d3 | 102 | * - \ref asfdoc_sam0_system_extra_info |
sahilmgandhi | 18:6a4db94011d3 | 103 | * - \ref asfdoc_sam0_system_examples |
sahilmgandhi | 18:6a4db94011d3 | 104 | * - \ref asfdoc_sam0_system_api_overview |
sahilmgandhi | 18:6a4db94011d3 | 105 | * |
sahilmgandhi | 18:6a4db94011d3 | 106 | * |
sahilmgandhi | 18:6a4db94011d3 | 107 | * \section asfdoc_sam0_system_prerequisites Prerequisites |
sahilmgandhi | 18:6a4db94011d3 | 108 | * |
sahilmgandhi | 18:6a4db94011d3 | 109 | * There are no prerequisites for this module. |
sahilmgandhi | 18:6a4db94011d3 | 110 | * |
sahilmgandhi | 18:6a4db94011d3 | 111 | * |
sahilmgandhi | 18:6a4db94011d3 | 112 | * \section asfdoc_sam0_system_module_overview Module Overview |
sahilmgandhi | 18:6a4db94011d3 | 113 | * |
sahilmgandhi | 18:6a4db94011d3 | 114 | * The System driver provides a collection of interfaces between the user |
sahilmgandhi | 18:6a4db94011d3 | 115 | * application logic, and the core device functionality (such as clocks, reset |
sahilmgandhi | 18:6a4db94011d3 | 116 | * cause determination, etc.) that is required for all applications. It contains |
sahilmgandhi | 18:6a4db94011d3 | 117 | * a number of sub-modules that control one specific aspect of the device: |
sahilmgandhi | 18:6a4db94011d3 | 118 | * |
sahilmgandhi | 18:6a4db94011d3 | 119 | * - System Core (this module) |
sahilmgandhi | 18:6a4db94011d3 | 120 | * - \ref asfdoc_sam0_system_clock_group "System Clock Control" (sub-module) |
sahilmgandhi | 18:6a4db94011d3 | 121 | * - \ref asfdoc_sam0_system_interrupt_group "System Interrupt Control" (sub-module) |
sahilmgandhi | 18:6a4db94011d3 | 122 | * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Control" (sub-module) |
sahilmgandhi | 18:6a4db94011d3 | 123 | * |
sahilmgandhi | 18:6a4db94011d3 | 124 | * |
sahilmgandhi | 18:6a4db94011d3 | 125 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 126 | * \subsection asfdoc_sam0_system_module_overview_vreg_l21 Voltage Regulator |
sahilmgandhi | 18:6a4db94011d3 | 127 | * The SAM device controls the voltage regulators for the core (VDDCORE) and |
sahilmgandhi | 18:6a4db94011d3 | 128 | * backup (VDDBU) domains. It sets the voltage regulators according to the sleep |
sahilmgandhi | 18:6a4db94011d3 | 129 | * modes, the performance level, or the user configuration. |
sahilmgandhi | 18:6a4db94011d3 | 130 | * |
sahilmgandhi | 18:6a4db94011d3 | 131 | * In active mode, the voltage regulator can be chosen on the fly between a LDO |
sahilmgandhi | 18:6a4db94011d3 | 132 | * or a Buck converter. In standby mode, the low power voltage regulator is used |
sahilmgandhi | 18:6a4db94011d3 | 133 | * to supply VDDCORE. |
sahilmgandhi | 18:6a4db94011d3 | 134 | * |
sahilmgandhi | 18:6a4db94011d3 | 135 | * \subsection asfdoc_sam0_system_module_overview_bbps Battery Backup Power Switch |
sahilmgandhi | 18:6a4db94011d3 | 136 | * The SAM device supports connection of a battery backup to the VBAT power pin. |
sahilmgandhi | 18:6a4db94011d3 | 137 | * It includes functionality that enables automatic power switching between main |
sahilmgandhi | 18:6a4db94011d3 | 138 | * power and battery backup power. This will ensure power to the backup domain, |
sahilmgandhi | 18:6a4db94011d3 | 139 | * when the main battery or power source is unavailable. |
sahilmgandhi | 18:6a4db94011d3 | 140 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 141 | * |
sahilmgandhi | 18:6a4db94011d3 | 142 | * \if DEVICE_SAMC21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 143 | * \subsection asfdoc_sam0_system_module_overview_vreg_c21 Voltage Regulator |
sahilmgandhi | 18:6a4db94011d3 | 144 | * The SAM device controls the voltage regulators for the core (VDDCORE). It sets |
sahilmgandhi | 18:6a4db94011d3 | 145 | * the voltage regulators according to the sleep modes. |
sahilmgandhi | 18:6a4db94011d3 | 146 | * |
sahilmgandhi | 18:6a4db94011d3 | 147 | * There are a selectable reference voltage and voltage dependent on the temperature |
sahilmgandhi | 18:6a4db94011d3 | 148 | * which can be used by analog modules like the ADC. |
sahilmgandhi | 18:6a4db94011d3 | 149 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 150 | * |
sahilmgandhi | 18:6a4db94011d3 | 151 | * \subsection asfdoc_sam0_system_module_overview_vref Voltage References |
sahilmgandhi | 18:6a4db94011d3 | 152 | * The various analog modules within the SAM devices (such as AC, ADC, and |
sahilmgandhi | 18:6a4db94011d3 | 153 | * DAC) require a voltage reference to be configured to act as a reference point |
sahilmgandhi | 18:6a4db94011d3 | 154 | * for comparisons and conversions. |
sahilmgandhi | 18:6a4db94011d3 | 155 | * |
sahilmgandhi | 18:6a4db94011d3 | 156 | * The SAM devices contain multiple references, including an internal |
sahilmgandhi | 18:6a4db94011d3 | 157 | * temperature sensor and a fixed band-gap voltage source. When enabled, the |
sahilmgandhi | 18:6a4db94011d3 | 158 | * associated voltage reference can be selected within the desired peripheral |
sahilmgandhi | 18:6a4db94011d3 | 159 | * where applicable. |
sahilmgandhi | 18:6a4db94011d3 | 160 | * |
sahilmgandhi | 18:6a4db94011d3 | 161 | * \subsection asfdoc_sam0_system_module_overview_reset_cause System Reset Cause |
sahilmgandhi | 18:6a4db94011d3 | 162 | * In some applications there may be a need to execute a different program |
sahilmgandhi | 18:6a4db94011d3 | 163 | * flow based on how the device was reset. For example, if the cause of reset |
sahilmgandhi | 18:6a4db94011d3 | 164 | * was the Watchdog timer (WDT), this might indicate an error in the application, |
sahilmgandhi | 18:6a4db94011d3 | 165 | * and a form of error handling or error logging might be needed. |
sahilmgandhi | 18:6a4db94011d3 | 166 | * |
sahilmgandhi | 18:6a4db94011d3 | 167 | * For this reason, an API is provided to retrieve the cause of the last system |
sahilmgandhi | 18:6a4db94011d3 | 168 | * reset, so that appropriate action can be taken. |
sahilmgandhi | 18:6a4db94011d3 | 169 | * |
sahilmgandhi | 18:6a4db94011d3 | 170 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 171 | * There are three groups of reset sources: |
sahilmgandhi | 18:6a4db94011d3 | 172 | * - Power supply reset: Resets caused by an electrical issue. It covers POR and BOD reset. |
sahilmgandhi | 18:6a4db94011d3 | 173 | * - User reset: Resets caused by the application. It covers external reset, |
sahilmgandhi | 18:6a4db94011d3 | 174 | * system reset, and watchdog reset. |
sahilmgandhi | 18:6a4db94011d3 | 175 | * - Backup reset: Resets caused by a backup mode exit condition. |
sahilmgandhi | 18:6a4db94011d3 | 176 | * |
sahilmgandhi | 18:6a4db94011d3 | 177 | * \subsection asfdoc_sam0_system_module_overview_performance_level Performance Level |
sahilmgandhi | 18:6a4db94011d3 | 178 | * Performance level allows the user to adjust the regulator output voltage to reduce |
sahilmgandhi | 18:6a4db94011d3 | 179 | * power consumption. The user can on the fly select the most suitable performance |
sahilmgandhi | 18:6a4db94011d3 | 180 | * level, depending on the application demands. |
sahilmgandhi | 18:6a4db94011d3 | 181 | * |
sahilmgandhi | 18:6a4db94011d3 | 182 | * The SAM device can operate at two different performance levels (PL0 and PL2). |
sahilmgandhi | 18:6a4db94011d3 | 183 | * When operating at PL0, the voltage applied on the full logic area is reduced |
sahilmgandhi | 18:6a4db94011d3 | 184 | * by voltage scaling. This voltage scaling technique allows to reduce the active |
sahilmgandhi | 18:6a4db94011d3 | 185 | * power consumption while decreasing the maximum frequency of the device. When |
sahilmgandhi | 18:6a4db94011d3 | 186 | * operating at PL2, the voltage regulator supplies the highest voltage, allowing |
sahilmgandhi | 18:6a4db94011d3 | 187 | * the device to run at higher clock speeds. |
sahilmgandhi | 18:6a4db94011d3 | 188 | * |
sahilmgandhi | 18:6a4db94011d3 | 189 | * Performance level transition is possible only when the device is in active |
sahilmgandhi | 18:6a4db94011d3 | 190 | * mode. After a reset, the device starts at the lowest performance level |
sahilmgandhi | 18:6a4db94011d3 | 191 | * (lowest power consumption and lowest max. frequency). The application can then |
sahilmgandhi | 18:6a4db94011d3 | 192 | * switch to another performance level at any time without any stop in the code |
sahilmgandhi | 18:6a4db94011d3 | 193 | * execution. As shown in \ref asfdoc_sam0_system_performance_level_transition_figure. |
sahilmgandhi | 18:6a4db94011d3 | 194 | * |
sahilmgandhi | 18:6a4db94011d3 | 195 | * \note When scaling down the performance level, the bus frequency should first be |
sahilmgandhi | 18:6a4db94011d3 | 196 | * scaled down in order to not exceed the maximum frequency allowed for the |
sahilmgandhi | 18:6a4db94011d3 | 197 | * low performance level. |
sahilmgandhi | 18:6a4db94011d3 | 198 | * When scaling up the performance level (e.g. from PL0 to PL2), check the performance |
sahilmgandhi | 18:6a4db94011d3 | 199 | * level status before increasing the bus frequency. It can be increased only |
sahilmgandhi | 18:6a4db94011d3 | 200 | * when the performance level transition is completed. |
sahilmgandhi | 18:6a4db94011d3 | 201 | * |
sahilmgandhi | 18:6a4db94011d3 | 202 | * \anchor asfdoc_sam0_system_performance_level_transition_figure |
sahilmgandhi | 18:6a4db94011d3 | 203 | * \image html performance_level_transition.svg "Performance Level Transition" |
sahilmgandhi | 18:6a4db94011d3 | 204 | * |
sahilmgandhi | 18:6a4db94011d3 | 205 | * \subsection asfdoc_sam0_system_module_overview_power_domain Power Domain Gating |
sahilmgandhi | 18:6a4db94011d3 | 206 | * Power domain gating allows power saving by reducing the voltage in logic |
sahilmgandhi | 18:6a4db94011d3 | 207 | * areas in the device to a low-power supply. The feature is available in |
sahilmgandhi | 18:6a4db94011d3 | 208 | * Standby sleep mode and will reduce the voltage in domains where all peripherals |
sahilmgandhi | 18:6a4db94011d3 | 209 | * are idle. Internal logic will maintain its content, meaning the corresponding |
sahilmgandhi | 18:6a4db94011d3 | 210 | * peripherals will not need to be reconfigured when normal operating voltage |
sahilmgandhi | 18:6a4db94011d3 | 211 | * is returned. Most power domains can be in the following three states: |
sahilmgandhi | 18:6a4db94011d3 | 212 | * |
sahilmgandhi | 18:6a4db94011d3 | 213 | * - Active state: The power domain is powered on. |
sahilmgandhi | 18:6a4db94011d3 | 214 | * - Retention state: The main voltage supply for the power domain is switched off, |
sahilmgandhi | 18:6a4db94011d3 | 215 | * while maintaining a secondary low-power supply for the sequential cells. The |
sahilmgandhi | 18:6a4db94011d3 | 216 | * logic context is restored when waking up. |
sahilmgandhi | 18:6a4db94011d3 | 217 | * - Off state: The power domain is entirely powered off. The logic context is lost. |
sahilmgandhi | 18:6a4db94011d3 | 218 | * |
sahilmgandhi | 18:6a4db94011d3 | 219 | * The SAM L21 device contains three power domains which can be controlled using |
sahilmgandhi | 18:6a4db94011d3 | 220 | * power domain gating, namely PD0, PD1, and PD2. These power domains can be |
sahilmgandhi | 18:6a4db94011d3 | 221 | * configured to the following cases: |
sahilmgandhi | 18:6a4db94011d3 | 222 | * - Default with no sleepwalking peripherals: A power domain is automatically set |
sahilmgandhi | 18:6a4db94011d3 | 223 | * to retention state in standby sleep mode if no activity require it. The application |
sahilmgandhi | 18:6a4db94011d3 | 224 | * can force all power domains to remain in active state during standby sleep mode |
sahilmgandhi | 18:6a4db94011d3 | 225 | * in order to accelerate wakeup time. |
sahilmgandhi | 18:6a4db94011d3 | 226 | * - Default with sleepwalking peripherals: If one or more peripherals are enabled |
sahilmgandhi | 18:6a4db94011d3 | 227 | * to perform sleepwalking tasks in standby sleep mode, the corresponding power |
sahilmgandhi | 18:6a4db94011d3 | 228 | * domain (PDn) remains in active state as well as all inferior power domains (<PDn). |
sahilmgandhi | 18:6a4db94011d3 | 229 | * - Sleepwalking with dynamic power domain gating: During standby sleep mode, a |
sahilmgandhi | 18:6a4db94011d3 | 230 | * power domain (PDn) in active can wake up a superior power domain (>PDn) in order |
sahilmgandhi | 18:6a4db94011d3 | 231 | * to perform a sleepwalking task. The superior power domain is then automatically |
sahilmgandhi | 18:6a4db94011d3 | 232 | * set to active state. At the end of the sleepwalking task, the device can either |
sahilmgandhi | 18:6a4db94011d3 | 233 | * be woken up or the superior power domain can return to retention state. |
sahilmgandhi | 18:6a4db94011d3 | 234 | * |
sahilmgandhi | 18:6a4db94011d3 | 235 | * Power domains can be linked to each other, it allows a power domain (PDn) to be kept |
sahilmgandhi | 18:6a4db94011d3 | 236 | * in active state if the inferior power domain (PDn-1) is in active state too. |
sahilmgandhi | 18:6a4db94011d3 | 237 | * |
sahilmgandhi | 18:6a4db94011d3 | 238 | * \ref asfdoc_sam0_system_power_domain_overview_table illustrates the |
sahilmgandhi | 18:6a4db94011d3 | 239 | * four cases to consider in standby mode. |
sahilmgandhi | 18:6a4db94011d3 | 240 | * |
sahilmgandhi | 18:6a4db94011d3 | 241 | * \anchor asfdoc_sam0_system_power_domain_overview_table |
sahilmgandhi | 18:6a4db94011d3 | 242 | * <table> |
sahilmgandhi | 18:6a4db94011d3 | 243 | * <caption>Sleep Mode versus Power Domain State Overview</caption> |
sahilmgandhi | 18:6a4db94011d3 | 244 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 245 | * <th>Sleep mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 246 | * <th>PD0</th> |
sahilmgandhi | 18:6a4db94011d3 | 247 | * <th>PD1</th> |
sahilmgandhi | 18:6a4db94011d3 | 248 | * <th>PD2</th> |
sahilmgandhi | 18:6a4db94011d3 | 249 | * <th>PDTOP</th> |
sahilmgandhi | 18:6a4db94011d3 | 250 | * <th>PDBACKUP</th> |
sahilmgandhi | 18:6a4db94011d3 | 251 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 252 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 253 | * <td>Idle</td> |
sahilmgandhi | 18:6a4db94011d3 | 254 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 255 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 256 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 257 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 258 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 259 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 260 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 261 | * <td>Standby - Case 1</td> |
sahilmgandhi | 18:6a4db94011d3 | 262 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 263 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 264 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 265 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 266 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 267 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 268 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 269 | * <td>Standby - Case 2</td> |
sahilmgandhi | 18:6a4db94011d3 | 270 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 271 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 272 | * <td>retention</td> |
sahilmgandhi | 18:6a4db94011d3 | 273 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 274 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 275 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 276 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 277 | * <td>Standby - Case 3</td> |
sahilmgandhi | 18:6a4db94011d3 | 278 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 279 | * <td>retention</td> |
sahilmgandhi | 18:6a4db94011d3 | 280 | * <td>retention</td> |
sahilmgandhi | 18:6a4db94011d3 | 281 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 282 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 283 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 284 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 285 | * <td>Standby - Case 4</td> |
sahilmgandhi | 18:6a4db94011d3 | 286 | * <td>retention</td> |
sahilmgandhi | 18:6a4db94011d3 | 287 | * <td>retention</td> |
sahilmgandhi | 18:6a4db94011d3 | 288 | * <td>retention</td> |
sahilmgandhi | 18:6a4db94011d3 | 289 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 290 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 291 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 292 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 293 | * <td>Backup</td> |
sahilmgandhi | 18:6a4db94011d3 | 294 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 295 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 296 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 297 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 298 | * <td>active</td> |
sahilmgandhi | 18:6a4db94011d3 | 299 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 300 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 301 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 302 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 303 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 304 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 305 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 306 | * <td>off</td> |
sahilmgandhi | 18:6a4db94011d3 | 307 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 308 | * </table> |
sahilmgandhi | 18:6a4db94011d3 | 309 | * |
sahilmgandhi | 18:6a4db94011d3 | 310 | * \subsection asfdoc_sam0_system_module_overview_ram_state RAMs Low Power Mode |
sahilmgandhi | 18:6a4db94011d3 | 311 | * By default, in standby sleep mode, RAM is in low power mode (back biased) |
sahilmgandhi | 18:6a4db94011d3 | 312 | * if its power domain is in retention state. |
sahilmgandhi | 18:6a4db94011d3 | 313 | * \ref asfdoc_sam0_system_power_ram_state_table lists RAMs low power mode. |
sahilmgandhi | 18:6a4db94011d3 | 314 | * |
sahilmgandhi | 18:6a4db94011d3 | 315 | * \anchor asfdoc_sam0_system_power_ram_state_table |
sahilmgandhi | 18:6a4db94011d3 | 316 | * <table> |
sahilmgandhi | 18:6a4db94011d3 | 317 | * <caption>RAM Back-biasing Mode</caption> |
sahilmgandhi | 18:6a4db94011d3 | 318 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 319 | * <th>RAM mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 320 | * <th>Description</th> |
sahilmgandhi | 18:6a4db94011d3 | 321 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 322 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 323 | * <td>Retention Back-biasing mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 324 | * <td>RAM is back-biased if its power domain is in retention mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 325 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 326 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 327 | * <td>Standby Back-biasing mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 328 | * <td>RAM is back-biased if the device is in standby mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 329 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 330 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 331 | * <td>Standby OFF mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 332 | * <td>RAM is OFF if the device is in standby mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 333 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 334 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 335 | * <td>Always OFF mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 336 | * <td>RAM is OFF if the device is in RET mode</td> |
sahilmgandhi | 18:6a4db94011d3 | 337 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 338 | * </table> |
sahilmgandhi | 18:6a4db94011d3 | 339 | * |
sahilmgandhi | 18:6a4db94011d3 | 340 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 341 | * |
sahilmgandhi | 18:6a4db94011d3 | 342 | * \subsection asfdoc_sam0_system_module_overview_sleep_mode Sleep Modes |
sahilmgandhi | 18:6a4db94011d3 | 343 | * The SAM devices have several sleep modes. The sleep mode controls |
sahilmgandhi | 18:6a4db94011d3 | 344 | * which clock systems on the device will remain enabled or disabled when the |
sahilmgandhi | 18:6a4db94011d3 | 345 | * device enters a low power sleep mode. |
sahilmgandhi | 18:6a4db94011d3 | 346 | * \ref asfdoc_sam0_system_module_sleep_mode_table "The table below" lists the |
sahilmgandhi | 18:6a4db94011d3 | 347 | * clock settings of the different sleep modes. |
sahilmgandhi | 18:6a4db94011d3 | 348 | * |
sahilmgandhi | 18:6a4db94011d3 | 349 | * \anchor asfdoc_sam0_system_module_sleep_mode_table |
sahilmgandhi | 18:6a4db94011d3 | 350 | * <table> |
sahilmgandhi | 18:6a4db94011d3 | 351 | * <caption>SAM Device Sleep Modes</caption> |
sahilmgandhi | 18:6a4db94011d3 | 352 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 353 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 354 | * <th>Sleep mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 355 | * <th>System clock</th> |
sahilmgandhi | 18:6a4db94011d3 | 356 | * <th>CPU clock</th> |
sahilmgandhi | 18:6a4db94011d3 | 357 | * <th>AHB/AHB clock</th> |
sahilmgandhi | 18:6a4db94011d3 | 358 | * <th>GCLK clocks</th> |
sahilmgandhi | 18:6a4db94011d3 | 359 | * <th>Oscillators (ONDEMAND = 0)</th> |
sahilmgandhi | 18:6a4db94011d3 | 360 | * <th>Oscillators (ONDEMAND = 1)</th> |
sahilmgandhi | 18:6a4db94011d3 | 361 | * <th>Regulator mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 362 | * <th>RAM mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 363 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 364 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 365 | * <td>Idle</td> |
sahilmgandhi | 18:6a4db94011d3 | 366 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 367 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 368 | * <td>Run if requested</td> |
sahilmgandhi | 18:6a4db94011d3 | 369 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 370 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 371 | * <td>Run if requested</td> |
sahilmgandhi | 18:6a4db94011d3 | 372 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 373 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 374 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 375 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 376 | * <td>Standby</td> |
sahilmgandhi | 18:6a4db94011d3 | 377 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 378 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 379 | * <td>Run if requested</td> |
sahilmgandhi | 18:6a4db94011d3 | 380 | * <td>Run if requested</td> |
sahilmgandhi | 18:6a4db94011d3 | 381 | * <td>Run if requested or RUNSTDBY = 1</td> |
sahilmgandhi | 18:6a4db94011d3 | 382 | * <td>Run if requested</td> |
sahilmgandhi | 18:6a4db94011d3 | 383 | * <td>Low pwer</td> |
sahilmgandhi | 18:6a4db94011d3 | 384 | * <td>Low pwer</td> |
sahilmgandhi | 18:6a4db94011d3 | 385 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 386 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 387 | * <td>Backup</td> |
sahilmgandhi | 18:6a4db94011d3 | 388 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 389 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 390 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 391 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 392 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 393 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 394 | * <td>Backup</td> |
sahilmgandhi | 18:6a4db94011d3 | 395 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 396 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 397 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 398 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 399 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 400 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 401 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 402 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 403 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 404 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 405 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 406 | * <td>Off</td> |
sahilmgandhi | 18:6a4db94011d3 | 407 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 408 | * \else |
sahilmgandhi | 18:6a4db94011d3 | 409 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 410 | * <th>Sleep mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 411 | * <th>CPU clock</th> |
sahilmgandhi | 18:6a4db94011d3 | 412 | * <th>AHB clock</th> |
sahilmgandhi | 18:6a4db94011d3 | 413 | * <th>APB clocks</th> |
sahilmgandhi | 18:6a4db94011d3 | 414 | * <th>Clock sources</th> |
sahilmgandhi | 18:6a4db94011d3 | 415 | * <th>System clock</th> |
sahilmgandhi | 18:6a4db94011d3 | 416 | * <th>32KHz</th> |
sahilmgandhi | 18:6a4db94011d3 | 417 | * <th>Reg mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 418 | * <th>RAM mode</th> |
sahilmgandhi | 18:6a4db94011d3 | 419 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 420 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 421 | * <td>Idle 0</td> |
sahilmgandhi | 18:6a4db94011d3 | 422 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 423 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 424 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 425 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 426 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 427 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 428 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 429 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 430 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 431 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 432 | * <td>Idle 1</td> |
sahilmgandhi | 18:6a4db94011d3 | 433 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 434 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 435 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 436 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 437 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 438 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 439 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 440 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 441 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 442 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 443 | * <td>Idle 2</td> |
sahilmgandhi | 18:6a4db94011d3 | 444 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 445 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 446 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 447 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 448 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 449 | * <td>Run</td> |
sahilmgandhi | 18:6a4db94011d3 | 450 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 451 | * <td>Normal</td> |
sahilmgandhi | 18:6a4db94011d3 | 452 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 453 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 454 | * <td>Standby</td> |
sahilmgandhi | 18:6a4db94011d3 | 455 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 456 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 457 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 458 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 459 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 460 | * <td>Stop</td> |
sahilmgandhi | 18:6a4db94011d3 | 461 | * <td>Low Power</td> |
sahilmgandhi | 18:6a4db94011d3 | 462 | * <td>Source/Drain biasing</td> |
sahilmgandhi | 18:6a4db94011d3 | 463 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 464 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 465 | * </table> |
sahilmgandhi | 18:6a4db94011d3 | 466 | * |
sahilmgandhi | 18:6a4db94011d3 | 467 | * Before entering device sleep, one of the available sleep modes must be set. |
sahilmgandhi | 18:6a4db94011d3 | 468 | * The device will automatically wake up in response to an interrupt being |
sahilmgandhi | 18:6a4db94011d3 | 469 | * generated or upon any other sleep mode exit condition. |
sahilmgandhi | 18:6a4db94011d3 | 470 | * |
sahilmgandhi | 18:6a4db94011d3 | 471 | * Some peripheral clocks will remain enabled during sleep, depending on their |
sahilmgandhi | 18:6a4db94011d3 | 472 | * configuration. If desired, the modules can remain clocked during sleep to allow |
sahilmgandhi | 18:6a4db94011d3 | 473 | * them continue to operate while other parts of the system are powered down |
sahilmgandhi | 18:6a4db94011d3 | 474 | * to save power. |
sahilmgandhi | 18:6a4db94011d3 | 475 | * |
sahilmgandhi | 18:6a4db94011d3 | 476 | * |
sahilmgandhi | 18:6a4db94011d3 | 477 | * \section asfdoc_sam0_system_special_considerations Special Considerations |
sahilmgandhi | 18:6a4db94011d3 | 478 | * |
sahilmgandhi | 18:6a4db94011d3 | 479 | * Most of the functions in this driver have device specific restrictions and |
sahilmgandhi | 18:6a4db94011d3 | 480 | * caveats; refer to your device datasheet. |
sahilmgandhi | 18:6a4db94011d3 | 481 | * |
sahilmgandhi | 18:6a4db94011d3 | 482 | * |
sahilmgandhi | 18:6a4db94011d3 | 483 | * \section asfdoc_sam0_system_extra_info Extra Information |
sahilmgandhi | 18:6a4db94011d3 | 484 | * |
sahilmgandhi | 18:6a4db94011d3 | 485 | * For extra information, see \ref asfdoc_sam0_system_extra. This includes: |
sahilmgandhi | 18:6a4db94011d3 | 486 | * - \ref asfdoc_sam0_system_extra_acronyms |
sahilmgandhi | 18:6a4db94011d3 | 487 | * - \ref asfdoc_sam0_system_extra_dependencies |
sahilmgandhi | 18:6a4db94011d3 | 488 | * - \ref asfdoc_sam0_system_extra_errata |
sahilmgandhi | 18:6a4db94011d3 | 489 | * - \ref asfdoc_sam0_system_extra_history |
sahilmgandhi | 18:6a4db94011d3 | 490 | * |
sahilmgandhi | 18:6a4db94011d3 | 491 | * |
sahilmgandhi | 18:6a4db94011d3 | 492 | * \section asfdoc_sam0_system_examples Examples |
sahilmgandhi | 18:6a4db94011d3 | 493 | * |
sahilmgandhi | 18:6a4db94011d3 | 494 | * For SYSTEM module related examples, refer to the sub-modules listed in |
sahilmgandhi | 18:6a4db94011d3 | 495 | * the \ref asfdoc_sam0_system_module_overview "system module overview". |
sahilmgandhi | 18:6a4db94011d3 | 496 | * |
sahilmgandhi | 18:6a4db94011d3 | 497 | * For a list of examples related to this driver, see |
sahilmgandhi | 18:6a4db94011d3 | 498 | * \ref asfdoc_sam0_drivers_power_exqsg. |
sahilmgandhi | 18:6a4db94011d3 | 499 | * |
sahilmgandhi | 18:6a4db94011d3 | 500 | * |
sahilmgandhi | 18:6a4db94011d3 | 501 | * \section asfdoc_sam0_system_api_overview API Overview |
sahilmgandhi | 18:6a4db94011d3 | 502 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 503 | */ |
sahilmgandhi | 18:6a4db94011d3 | 504 | |
sahilmgandhi | 18:6a4db94011d3 | 505 | /** |
sahilmgandhi | 18:6a4db94011d3 | 506 | * \name System Debugger |
sahilmgandhi | 18:6a4db94011d3 | 507 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 508 | */ |
sahilmgandhi | 18:6a4db94011d3 | 509 | |
sahilmgandhi | 18:6a4db94011d3 | 510 | /** |
sahilmgandhi | 18:6a4db94011d3 | 511 | * \brief Check if debugger is present. |
sahilmgandhi | 18:6a4db94011d3 | 512 | * |
sahilmgandhi | 18:6a4db94011d3 | 513 | * Check if debugger is connected to the onboard debug system (DAP). |
sahilmgandhi | 18:6a4db94011d3 | 514 | * |
sahilmgandhi | 18:6a4db94011d3 | 515 | * \return A bool identifying if a debugger is present. |
sahilmgandhi | 18:6a4db94011d3 | 516 | * |
sahilmgandhi | 18:6a4db94011d3 | 517 | * \retval true Debugger is connected to the system |
sahilmgandhi | 18:6a4db94011d3 | 518 | * \retval false Debugger is not connected to the system |
sahilmgandhi | 18:6a4db94011d3 | 519 | * |
sahilmgandhi | 18:6a4db94011d3 | 520 | */ |
sahilmgandhi | 18:6a4db94011d3 | 521 | static inline bool system_is_debugger_present(void) |
sahilmgandhi | 18:6a4db94011d3 | 522 | { |
sahilmgandhi | 18:6a4db94011d3 | 523 | return DSU->STATUSB.reg & DSU_STATUSB_DBGPRES; |
sahilmgandhi | 18:6a4db94011d3 | 524 | } |
sahilmgandhi | 18:6a4db94011d3 | 525 | |
sahilmgandhi | 18:6a4db94011d3 | 526 | /** |
sahilmgandhi | 18:6a4db94011d3 | 527 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 528 | */ |
sahilmgandhi | 18:6a4db94011d3 | 529 | |
sahilmgandhi | 18:6a4db94011d3 | 530 | /** |
sahilmgandhi | 18:6a4db94011d3 | 531 | * \name System Identification |
sahilmgandhi | 18:6a4db94011d3 | 532 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 533 | */ |
sahilmgandhi | 18:6a4db94011d3 | 534 | |
sahilmgandhi | 18:6a4db94011d3 | 535 | /** |
sahilmgandhi | 18:6a4db94011d3 | 536 | * \brief Retrieve the device identification signature. |
sahilmgandhi | 18:6a4db94011d3 | 537 | * |
sahilmgandhi | 18:6a4db94011d3 | 538 | * Retrieves the signature of the current device. |
sahilmgandhi | 18:6a4db94011d3 | 539 | * |
sahilmgandhi | 18:6a4db94011d3 | 540 | * \return Device ID signature as a 32-bit integer. |
sahilmgandhi | 18:6a4db94011d3 | 541 | */ |
sahilmgandhi | 18:6a4db94011d3 | 542 | static inline uint32_t system_get_device_id(void) |
sahilmgandhi | 18:6a4db94011d3 | 543 | { |
sahilmgandhi | 18:6a4db94011d3 | 544 | return DSU->DID.reg; |
sahilmgandhi | 18:6a4db94011d3 | 545 | } |
sahilmgandhi | 18:6a4db94011d3 | 546 | |
sahilmgandhi | 18:6a4db94011d3 | 547 | /** |
sahilmgandhi | 18:6a4db94011d3 | 548 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 549 | */ |
sahilmgandhi | 18:6a4db94011d3 | 550 | |
sahilmgandhi | 18:6a4db94011d3 | 551 | /** |
sahilmgandhi | 18:6a4db94011d3 | 552 | * \name System Initialization |
sahilmgandhi | 18:6a4db94011d3 | 553 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 554 | */ |
sahilmgandhi | 18:6a4db94011d3 | 555 | |
sahilmgandhi | 18:6a4db94011d3 | 556 | void system_init(void); |
sahilmgandhi | 18:6a4db94011d3 | 557 | |
sahilmgandhi | 18:6a4db94011d3 | 558 | /** |
sahilmgandhi | 18:6a4db94011d3 | 559 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 560 | */ |
sahilmgandhi | 18:6a4db94011d3 | 561 | |
sahilmgandhi | 18:6a4db94011d3 | 562 | |
sahilmgandhi | 18:6a4db94011d3 | 563 | /** |
sahilmgandhi | 18:6a4db94011d3 | 564 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 565 | */ |
sahilmgandhi | 18:6a4db94011d3 | 566 | |
sahilmgandhi | 18:6a4db94011d3 | 567 | /** |
sahilmgandhi | 18:6a4db94011d3 | 568 | |
sahilmgandhi | 18:6a4db94011d3 | 569 | * \page asfdoc_sam0_drivers_power_exqsg Examples for Power Driver |
sahilmgandhi | 18:6a4db94011d3 | 570 | * |
sahilmgandhi | 18:6a4db94011d3 | 571 | * This is a list of the available Quick Start Guides (QSGs) and example |
sahilmgandhi | 18:6a4db94011d3 | 572 | * applications. QSGs are simple examples with step-by-step instructions to |
sahilmgandhi | 18:6a4db94011d3 | 573 | * configure and use this driver in a selection of |
sahilmgandhi | 18:6a4db94011d3 | 574 | * use cases. Note that a QSG can be compiled as a standalone application or be |
sahilmgandhi | 18:6a4db94011d3 | 575 | * added to the user application. |
sahilmgandhi | 18:6a4db94011d3 | 576 | * |
sahilmgandhi | 18:6a4db94011d3 | 577 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 578 | * - \subpage asfdoc_sam0_power_basic_use_case |
sahilmgandhi | 18:6a4db94011d3 | 579 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 580 | * |
sahilmgandhi | 18:6a4db94011d3 | 581 | * \page asfdoc_sam0_system_extra Extra Information for SYSTEM Driver |
sahilmgandhi | 18:6a4db94011d3 | 582 | * |
sahilmgandhi | 18:6a4db94011d3 | 583 | * \section asfdoc_sam0_system_extra_acronyms Acronyms |
sahilmgandhi | 18:6a4db94011d3 | 584 | * Below is a table listing the acronyms used in this module, along with their |
sahilmgandhi | 18:6a4db94011d3 | 585 | * intended meanings. |
sahilmgandhi | 18:6a4db94011d3 | 586 | * |
sahilmgandhi | 18:6a4db94011d3 | 587 | * <table> |
sahilmgandhi | 18:6a4db94011d3 | 588 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 589 | * <th>Acronym</th> |
sahilmgandhi | 18:6a4db94011d3 | 590 | * <th>Definition</th> |
sahilmgandhi | 18:6a4db94011d3 | 591 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 592 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 593 | * <td>PM</td> |
sahilmgandhi | 18:6a4db94011d3 | 594 | * <td>Power Manager</td> |
sahilmgandhi | 18:6a4db94011d3 | 595 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 596 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 597 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 598 | * <td>SUPC</td> |
sahilmgandhi | 18:6a4db94011d3 | 599 | * <td>Supply Controller</td> |
sahilmgandhi | 18:6a4db94011d3 | 600 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 601 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 602 | * <td>RSTC</td> |
sahilmgandhi | 18:6a4db94011d3 | 603 | * <td>Reset Controller</td> |
sahilmgandhi | 18:6a4db94011d3 | 604 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 605 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 606 | * \if DEVICE_SAMC21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 607 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 608 | * <td>SUPC</td> |
sahilmgandhi | 18:6a4db94011d3 | 609 | * <td>Supply Controller</td> |
sahilmgandhi | 18:6a4db94011d3 | 610 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 611 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 612 | * <td>RSTC</td> |
sahilmgandhi | 18:6a4db94011d3 | 613 | * <td>Reset Controller</td> |
sahilmgandhi | 18:6a4db94011d3 | 614 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 615 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 616 | * \if DEVICE_SAMD21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 617 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 618 | * <td>SYSCTRL</td> |
sahilmgandhi | 18:6a4db94011d3 | 619 | * <td>System control interface</td> |
sahilmgandhi | 18:6a4db94011d3 | 620 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 621 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 622 | * </table> |
sahilmgandhi | 18:6a4db94011d3 | 623 | * |
sahilmgandhi | 18:6a4db94011d3 | 624 | * |
sahilmgandhi | 18:6a4db94011d3 | 625 | * \section asfdoc_sam0_system_extra_dependencies Dependencies |
sahilmgandhi | 18:6a4db94011d3 | 626 | * This driver has the following dependencies: |
sahilmgandhi | 18:6a4db94011d3 | 627 | * |
sahilmgandhi | 18:6a4db94011d3 | 628 | * - None |
sahilmgandhi | 18:6a4db94011d3 | 629 | * |
sahilmgandhi | 18:6a4db94011d3 | 630 | * |
sahilmgandhi | 18:6a4db94011d3 | 631 | * \section asfdoc_sam0_system_extra_errata Errata |
sahilmgandhi | 18:6a4db94011d3 | 632 | * There are no errata related to this driver. |
sahilmgandhi | 18:6a4db94011d3 | 633 | * |
sahilmgandhi | 18:6a4db94011d3 | 634 | * |
sahilmgandhi | 18:6a4db94011d3 | 635 | * \section asfdoc_sam0_system_extra_history Module History |
sahilmgandhi | 18:6a4db94011d3 | 636 | * An overview of the module history is presented in the table below, with |
sahilmgandhi | 18:6a4db94011d3 | 637 | * details on the enhancements and fixes made to the module since its first |
sahilmgandhi | 18:6a4db94011d3 | 638 | * release. The current version of this corresponds to the newest version in |
sahilmgandhi | 18:6a4db94011d3 | 639 | * the table. |
sahilmgandhi | 18:6a4db94011d3 | 640 | * |
sahilmgandhi | 18:6a4db94011d3 | 641 | * <table> |
sahilmgandhi | 18:6a4db94011d3 | 642 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 643 | * <th>Changelog</th> |
sahilmgandhi | 18:6a4db94011d3 | 644 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 645 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 646 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 647 | * <td>Initial Release</td> |
sahilmgandhi | 18:6a4db94011d3 | 648 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 649 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 650 | * \if DEVICE_SAMC21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 651 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 652 | * <td>Initial Release</td> |
sahilmgandhi | 18:6a4db94011d3 | 653 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 654 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 655 | * \if DEVICE_SAMD21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 656 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 657 | * <td>Added new \c system_reset() to reset the complete MCU with some exceptions</td> |
sahilmgandhi | 18:6a4db94011d3 | 658 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 659 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 660 | * <td>Added new \c system_get_device_id() function to retrieved the device |
sahilmgandhi | 18:6a4db94011d3 | 661 | * ID.</td> |
sahilmgandhi | 18:6a4db94011d3 | 662 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 663 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 664 | * <td>Initial Release</td> |
sahilmgandhi | 18:6a4db94011d3 | 665 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 666 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 667 | * </table> |
sahilmgandhi | 18:6a4db94011d3 | 668 | * |
sahilmgandhi | 18:6a4db94011d3 | 669 | * \page asfdoc_sam0_system_document_revision_history Document Revision History |
sahilmgandhi | 18:6a4db94011d3 | 670 | * |
sahilmgandhi | 18:6a4db94011d3 | 671 | * <table> |
sahilmgandhi | 18:6a4db94011d3 | 672 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 673 | * <th>Doc. Rev.</td> |
sahilmgandhi | 18:6a4db94011d3 | 674 | * <th>Date</td> |
sahilmgandhi | 18:6a4db94011d3 | 675 | * <th>Comments</td> |
sahilmgandhi | 18:6a4db94011d3 | 676 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 677 | * \if DEVICE_SAML21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 678 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 679 | * <td>42449A</td> |
sahilmgandhi | 18:6a4db94011d3 | 680 | * <td>07/2015</td> |
sahilmgandhi | 18:6a4db94011d3 | 681 | * <td>Initial document release</td> |
sahilmgandhi | 18:6a4db94011d3 | 682 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 683 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 684 | * \if DEVICE_SAMC21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 685 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 686 | * <td>42484A</td> |
sahilmgandhi | 18:6a4db94011d3 | 687 | * <td>08/2015</td> |
sahilmgandhi | 18:6a4db94011d3 | 688 | * <td>Initial document release.</td> |
sahilmgandhi | 18:6a4db94011d3 | 689 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 690 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 691 | * \if DEVICE_SAMD21_SYSTEM_SUPPORT |
sahilmgandhi | 18:6a4db94011d3 | 692 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 693 | * <td>42120E</td> |
sahilmgandhi | 18:6a4db94011d3 | 694 | * <td>04/2015</td> |
sahilmgandhi | 18:6a4db94011d3 | 695 | * <td>Added support for SAMDAx</td> |
sahilmgandhi | 18:6a4db94011d3 | 696 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 697 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 698 | * <td>42120D</td> |
sahilmgandhi | 18:6a4db94011d3 | 699 | * <td>12/2014</td> |
sahilmgandhi | 18:6a4db94011d3 | 700 | * <td>Added support for SAMR21 and SAMD10/D11</td> |
sahilmgandhi | 18:6a4db94011d3 | 701 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 702 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 703 | * <td>42120C</td> |
sahilmgandhi | 18:6a4db94011d3 | 704 | * <td>01/2014</td> |
sahilmgandhi | 18:6a4db94011d3 | 705 | * <td>Added support for SAMD21</td> |
sahilmgandhi | 18:6a4db94011d3 | 706 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 707 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 708 | * <td>42120B</td> |
sahilmgandhi | 18:6a4db94011d3 | 709 | * <td>06/2013</td> |
sahilmgandhi | 18:6a4db94011d3 | 710 | * <td>Corrected documentation typos</td> |
sahilmgandhi | 18:6a4db94011d3 | 711 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 712 | * <tr> |
sahilmgandhi | 18:6a4db94011d3 | 713 | * <td>42120A</td> |
sahilmgandhi | 18:6a4db94011d3 | 714 | * <td>06/2013</td> |
sahilmgandhi | 18:6a4db94011d3 | 715 | * <td>Initial document release</td> |
sahilmgandhi | 18:6a4db94011d3 | 716 | * </tr> |
sahilmgandhi | 18:6a4db94011d3 | 717 | * \endif |
sahilmgandhi | 18:6a4db94011d3 | 718 | * </table> |
sahilmgandhi | 18:6a4db94011d3 | 719 | */ |
sahilmgandhi | 18:6a4db94011d3 | 720 | |
sahilmgandhi | 18:6a4db94011d3 | 721 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 722 | } |
sahilmgandhi | 18:6a4db94011d3 | 723 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 724 | |
sahilmgandhi | 18:6a4db94011d3 | 725 | #endif /* SYSTEM_H_INCLUDED */ |
sahilmgandhi | 18:6a4db94011d3 | 726 |