mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Child:
592:a274ee790e56
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 579:53297373a894 1 /**
mbed_official 579:53297373a894 2 * \file
mbed_official 579:53297373a894 3 *
mbed_official 579:53297373a894 4 * \brief SAM R21 Clock configuration
mbed_official 579:53297373a894 5 *
mbed_official 579:53297373a894 6 * Copyright (C) 2014 Atmel Corporation. All rights reserved.
mbed_official 579:53297373a894 7 *
mbed_official 579:53297373a894 8 * \asf_license_start
mbed_official 579:53297373a894 9 *
mbed_official 579:53297373a894 10 * \page License
mbed_official 579:53297373a894 11 *
mbed_official 579:53297373a894 12 * Redistribution and use in source and binary forms, with or without
mbed_official 579:53297373a894 13 * modification, are permitted provided that the following conditions are met:
mbed_official 579:53297373a894 14 *
mbed_official 579:53297373a894 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 579:53297373a894 16 * this list of conditions and the following disclaimer.
mbed_official 579:53297373a894 17 *
mbed_official 579:53297373a894 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 579:53297373a894 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 579:53297373a894 20 * and/or other materials provided with the distribution.
mbed_official 579:53297373a894 21 *
mbed_official 579:53297373a894 22 * 3. The name of Atmel may not be used to endorse or promote products derived
mbed_official 579:53297373a894 23 * from this software without specific prior written permission.
mbed_official 579:53297373a894 24 *
mbed_official 579:53297373a894 25 * 4. This software may only be redistributed and used in connection with an
mbed_official 579:53297373a894 26 * Atmel microcontroller product.
mbed_official 579:53297373a894 27 *
mbed_official 579:53297373a894 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
mbed_official 579:53297373a894 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbed_official 579:53297373a894 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
mbed_official 579:53297373a894 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
mbed_official 579:53297373a894 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 579:53297373a894 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
mbed_official 579:53297373a894 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
mbed_official 579:53297373a894 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
mbed_official 579:53297373a894 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
mbed_official 579:53297373a894 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 579:53297373a894 38 * POSSIBILITY OF SUCH DAMAGE.
mbed_official 579:53297373a894 39 *
mbed_official 579:53297373a894 40 * \asf_license_stop
mbed_official 579:53297373a894 41 *
mbed_official 579:53297373a894 42 */
mbed_official 579:53297373a894 43 /**
mbed_official 579:53297373a894 44 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
mbed_official 579:53297373a894 45 */
mbed_official 579:53297373a894 46 #include <clock.h>
mbed_official 579:53297373a894 47
mbed_official 579:53297373a894 48 #ifndef CONF_CLOCKS_H_INCLUDED
mbed_official 579:53297373a894 49 # define CONF_CLOCKS_H_INCLUDED
mbed_official 579:53297373a894 50
mbed_official 579:53297373a894 51 /* System clock bus configuration */
mbed_official 579:53297373a894 52 # define CONF_CLOCK_CPU_CLOCK_FAILURE_DETECT false
mbed_official 579:53297373a894 53 # define CONF_CLOCK_FLASH_WAIT_STATES 0
mbed_official 579:53297373a894 54 # define CONF_CLOCK_CPU_DIVIDER SYSTEM_MAIN_CLOCK_DIV_1
mbed_official 579:53297373a894 55 # define CONF_CLOCK_APBA_DIVIDER SYSTEM_MAIN_CLOCK_DIV_1
mbed_official 579:53297373a894 56 # define CONF_CLOCK_APBB_DIVIDER SYSTEM_MAIN_CLOCK_DIV_1
mbed_official 579:53297373a894 57
mbed_official 579:53297373a894 58 /* SYSTEM_CLOCK_SOURCE_OSC8M configuration - Internal 8MHz oscillator */
mbed_official 579:53297373a894 59 # define CONF_CLOCK_OSC8M_PRESCALER SYSTEM_OSC8M_DIV_1
mbed_official 579:53297373a894 60 # define CONF_CLOCK_OSC8M_ON_DEMAND true
mbed_official 579:53297373a894 61 # define CONF_CLOCK_OSC8M_RUN_IN_STANDBY false
mbed_official 579:53297373a894 62
mbed_official 579:53297373a894 63 /* SYSTEM_CLOCK_SOURCE_XOSC configuration - External clock/oscillator */
mbed_official 579:53297373a894 64 # define CONF_CLOCK_XOSC_ENABLE false
mbed_official 579:53297373a894 65 # define CONF_CLOCK_XOSC_EXTERNAL_CRYSTAL SYSTEM_CLOCK_EXTERNAL_CRYSTAL
mbed_official 579:53297373a894 66 # define CONF_CLOCK_XOSC_EXTERNAL_FREQUENCY 12000000UL
mbed_official 579:53297373a894 67 # define CONF_CLOCK_XOSC_STARTUP_TIME SYSTEM_XOSC_STARTUP_32768
mbed_official 579:53297373a894 68 # define CONF_CLOCK_XOSC_AUTO_GAIN_CONTROL true
mbed_official 579:53297373a894 69 # define CONF_CLOCK_XOSC_ON_DEMAND true
mbed_official 579:53297373a894 70 # define CONF_CLOCK_XOSC_RUN_IN_STANDBY false
mbed_official 579:53297373a894 71
mbed_official 579:53297373a894 72 /* SYSTEM_CLOCK_SOURCE_XOSC32K configuration - External 32KHz crystal/clock oscillator */
mbed_official 579:53297373a894 73 # define CONF_CLOCK_XOSC32K_ENABLE false
mbed_official 579:53297373a894 74 # define CONF_CLOCK_XOSC32K_EXTERNAL_CRYSTAL SYSTEM_CLOCK_EXTERNAL_CRYSTAL
mbed_official 579:53297373a894 75 # define CONF_CLOCK_XOSC32K_STARTUP_TIME SYSTEM_XOSC32K_STARTUP_65536
mbed_official 579:53297373a894 76 # define CONF_CLOCK_XOSC32K_AUTO_AMPLITUDE_CONTROL false
mbed_official 579:53297373a894 77 # define CONF_CLOCK_XOSC32K_ENABLE_1KHZ_OUPUT false
mbed_official 579:53297373a894 78 # define CONF_CLOCK_XOSC32K_ENABLE_32KHZ_OUTPUT true
mbed_official 579:53297373a894 79 # define CONF_CLOCK_XOSC32K_ON_DEMAND true
mbed_official 579:53297373a894 80 # define CONF_CLOCK_XOSC32K_RUN_IN_STANDBY false
mbed_official 579:53297373a894 81
mbed_official 579:53297373a894 82 /* SYSTEM_CLOCK_SOURCE_OSC32K configuration - Internal 32KHz oscillator */
mbed_official 579:53297373a894 83 # define CONF_CLOCK_OSC32K_ENABLE false
mbed_official 579:53297373a894 84 # define CONF_CLOCK_OSC32K_STARTUP_TIME SYSTEM_OSC32K_STARTUP_130
mbed_official 579:53297373a894 85 # define CONF_CLOCK_OSC32K_ENABLE_1KHZ_OUTPUT true
mbed_official 579:53297373a894 86 # define CONF_CLOCK_OSC32K_ENABLE_32KHZ_OUTPUT true
mbed_official 579:53297373a894 87 # define CONF_CLOCK_OSC32K_ON_DEMAND true
mbed_official 579:53297373a894 88 # define CONF_CLOCK_OSC32K_RUN_IN_STANDBY false
mbed_official 579:53297373a894 89
mbed_official 579:53297373a894 90 /* SYSTEM_CLOCK_SOURCE_DFLL configuration - Digital Frequency Locked Loop */
mbed_official 579:53297373a894 91 # define CONF_CLOCK_DFLL_ENABLE false
mbed_official 579:53297373a894 92 # define CONF_CLOCK_DFLL_LOOP_MODE SYSTEM_CLOCK_DFLL_LOOP_MODE_OPEN
mbed_official 579:53297373a894 93 # define CONF_CLOCK_DFLL_ON_DEMAND false
mbed_official 579:53297373a894 94
mbed_official 579:53297373a894 95 /* DFLL open loop mode configuration */
mbed_official 579:53297373a894 96 # define CONF_CLOCK_DFLL_COARSE_VALUE (0x1f / 4)
mbed_official 579:53297373a894 97 # define CONF_CLOCK_DFLL_FINE_VALUE (0xff / 4)
mbed_official 579:53297373a894 98
mbed_official 579:53297373a894 99 /* DFLL closed loop mode configuration */
mbed_official 579:53297373a894 100 # define CONF_CLOCK_DFLL_SOURCE_GCLK_GENERATOR GCLK_GENERATOR_1
mbed_official 579:53297373a894 101 # define CONF_CLOCK_DFLL_MULTIPLY_FACTOR 6
mbed_official 579:53297373a894 102 # define CONF_CLOCK_DFLL_QUICK_LOCK true
mbed_official 579:53297373a894 103 # define CONF_CLOCK_DFLL_TRACK_AFTER_FINE_LOCK true
mbed_official 579:53297373a894 104 # define CONF_CLOCK_DFLL_KEEP_LOCK_ON_WAKEUP true
mbed_official 579:53297373a894 105 # define CONF_CLOCK_DFLL_ENABLE_CHILL_CYCLE true
mbed_official 579:53297373a894 106 # define CONF_CLOCK_DFLL_MAX_COARSE_STEP_SIZE (0x1f / 4)
mbed_official 579:53297373a894 107 # define CONF_CLOCK_DFLL_MAX_FINE_STEP_SIZE (0xff / 4)
mbed_official 579:53297373a894 108
mbed_official 579:53297373a894 109 /* SYSTEM_CLOCK_SOURCE_DPLL configuration - Digital Phase-Locked Loop */
mbed_official 579:53297373a894 110 # define CONF_CLOCK_DPLL_ENABLE false
mbed_official 579:53297373a894 111 # define CONF_CLOCK_DPLL_ON_DEMAND true
mbed_official 579:53297373a894 112 # define CONF_CLOCK_DPLL_RUN_IN_STANDBY false
mbed_official 579:53297373a894 113 # define CONF_CLOCK_DPLL_LOCK_BYPASS false
mbed_official 579:53297373a894 114 # define CONF_CLOCK_DPLL_WAKE_UP_FAST false
mbed_official 579:53297373a894 115 # define CONF_CLOCK_DPLL_LOW_POWER_ENABLE false
mbed_official 579:53297373a894 116
mbed_official 579:53297373a894 117 # define CONF_CLOCK_DPLL_LOCK_TIME SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_NO_TIMEOUT
mbed_official 579:53297373a894 118 # define CONF_CLOCK_DPLL_REFERENCE_CLOCK SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_REF0
mbed_official 579:53297373a894 119 # define CONF_CLOCK_DPLL_FILTER SYSTEM_CLOCK_SOURCE_DPLL_FILTER_DEFAULT
mbed_official 579:53297373a894 120
mbed_official 579:53297373a894 121 # define CONF_CLOCK_DPLL_REFERENCE_FREQUENCY 32768
mbed_official 579:53297373a894 122 # define CONF_CLOCK_DPLL_REFEREMCE_DIVIDER 1
mbed_official 579:53297373a894 123 # define CONF_CLOCK_DPLL_OUTPUT_FREQUENCY 48000000
mbed_official 579:53297373a894 124
mbed_official 579:53297373a894 125 /* Set this to true to configure the GCLK when running clocks_init. If set to
mbed_official 579:53297373a894 126 * false, none of the GCLK generators will be configured in clocks_init(). */
mbed_official 579:53297373a894 127 # define CONF_CLOCK_CONFIGURE_GCLK true
mbed_official 579:53297373a894 128
mbed_official 579:53297373a894 129 /* Configure GCLK generator 0 (Main Clock) */
mbed_official 579:53297373a894 130 # define CONF_CLOCK_GCLK_0_ENABLE true
mbed_official 579:53297373a894 131 # define CONF_CLOCK_GCLK_0_RUN_IN_STANDBY false
mbed_official 579:53297373a894 132 # define CONF_CLOCK_GCLK_0_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
mbed_official 579:53297373a894 133 # define CONF_CLOCK_GCLK_0_PRESCALER 1
mbed_official 579:53297373a894 134 # define CONF_CLOCK_GCLK_0_OUTPUT_ENABLE false
mbed_official 579:53297373a894 135
mbed_official 579:53297373a894 136 /* Configure GCLK generator 1 */
mbed_official 579:53297373a894 137 # define CONF_CLOCK_GCLK_1_ENABLE false
mbed_official 579:53297373a894 138 # define CONF_CLOCK_GCLK_1_RUN_IN_STANDBY false
mbed_official 579:53297373a894 139 # define CONF_CLOCK_GCLK_1_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
mbed_official 579:53297373a894 140 # define CONF_CLOCK_GCLK_1_PRESCALER 1
mbed_official 579:53297373a894 141 # define CONF_CLOCK_GCLK_1_OUTPUT_ENABLE false
mbed_official 579:53297373a894 142
mbed_official 579:53297373a894 143 /* Configure GCLK generator 2 (RTC) */
mbed_official 579:53297373a894 144 # define CONF_CLOCK_GCLK_2_ENABLE false
mbed_official 579:53297373a894 145 # define CONF_CLOCK_GCLK_2_RUN_IN_STANDBY false
mbed_official 579:53297373a894 146 # define CONF_CLOCK_GCLK_2_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC32K
mbed_official 579:53297373a894 147 # define CONF_CLOCK_GCLK_2_PRESCALER 32
mbed_official 579:53297373a894 148 # define CONF_CLOCK_GCLK_2_OUTPUT_ENABLE false
mbed_official 579:53297373a894 149
mbed_official 579:53297373a894 150 /* Configure GCLK generator 3 */
mbed_official 579:53297373a894 151 # define CONF_CLOCK_GCLK_3_ENABLE false
mbed_official 579:53297373a894 152 # define CONF_CLOCK_GCLK_3_RUN_IN_STANDBY false
mbed_official 579:53297373a894 153 # define CONF_CLOCK_GCLK_3_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
mbed_official 579:53297373a894 154 # define CONF_CLOCK_GCLK_3_PRESCALER 1
mbed_official 579:53297373a894 155 # define CONF_CLOCK_GCLK_3_OUTPUT_ENABLE false
mbed_official 579:53297373a894 156
mbed_official 579:53297373a894 157 /* Configure GCLK generator 4 */
mbed_official 579:53297373a894 158 # define CONF_CLOCK_GCLK_4_ENABLE false
mbed_official 579:53297373a894 159 # define CONF_CLOCK_GCLK_4_RUN_IN_STANDBY false
mbed_official 579:53297373a894 160 # define CONF_CLOCK_GCLK_4_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
mbed_official 579:53297373a894 161 # define CONF_CLOCK_GCLK_4_PRESCALER 1
mbed_official 579:53297373a894 162 # define CONF_CLOCK_GCLK_4_OUTPUT_ENABLE false
mbed_official 579:53297373a894 163
mbed_official 579:53297373a894 164 /* Configure GCLK generator 5 */
mbed_official 579:53297373a894 165 # define CONF_CLOCK_GCLK_5_ENABLE false
mbed_official 579:53297373a894 166 # define CONF_CLOCK_GCLK_5_RUN_IN_STANDBY false
mbed_official 579:53297373a894 167 # define CONF_CLOCK_GCLK_5_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
mbed_official 579:53297373a894 168 # define CONF_CLOCK_GCLK_5_PRESCALER 1
mbed_official 579:53297373a894 169 # define CONF_CLOCK_GCLK_5_OUTPUT_ENABLE false
mbed_official 579:53297373a894 170
mbed_official 579:53297373a894 171 /* Configure GCLK generator 6 */
mbed_official 579:53297373a894 172 # define CONF_CLOCK_GCLK_6_ENABLE false
mbed_official 579:53297373a894 173 # define CONF_CLOCK_GCLK_6_RUN_IN_STANDBY false
mbed_official 579:53297373a894 174 # define CONF_CLOCK_GCLK_6_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
mbed_official 579:53297373a894 175 # define CONF_CLOCK_GCLK_6_PRESCALER 1
mbed_official 579:53297373a894 176 # define CONF_CLOCK_GCLK_6_OUTPUT_ENABLE false
mbed_official 579:53297373a894 177
mbed_official 579:53297373a894 178 /* Configure GCLK generator 7 */
mbed_official 579:53297373a894 179 # define CONF_CLOCK_GCLK_7_ENABLE false
mbed_official 579:53297373a894 180 # define CONF_CLOCK_GCLK_7_RUN_IN_STANDBY false
mbed_official 579:53297373a894 181 # define CONF_CLOCK_GCLK_7_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
mbed_official 579:53297373a894 182 # define CONF_CLOCK_GCLK_7_PRESCALER 1
mbed_official 579:53297373a894 183 # define CONF_CLOCK_GCLK_7_OUTPUT_ENABLE false
mbed_official 579:53297373a894 184
mbed_official 579:53297373a894 185 #endif /* CONF_CLOCKS_H_INCLUDED */
mbed_official 579:53297373a894 186