Umar Naeem / mbed-dev

Fork of mbed-dev by Umar Naeem

Committer:
mbed_official
Date:
Tue Apr 05 18:15:12 2016 +0100
Revision:
107:414e9c822e99
Synchronized with git revision dd3c5f7fa8473776950ec6e15c0e4adedb21cf2f

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

* * Base Commit for SAMG55J19. No errors and no implementations.

* * Added gpio files.

* * Added pinmap files.

* * Base commit for usticker implementation.

* * Added gcc_arm export functionality

* * added files for usticker.
* added template file for samd55j19

* * GPIO IRQ base commit.

* * updated with changes in gpio irq driver.

* * Reverted back unexpected commit in SAM0 gpio driver.

* * updated gpio_irq driver.

* * correction in gpio and gpio_irq drivers.
* added support for some test for gpio.

* * base commit for peripheralpins for usart.
* update in serial apis.

* * updated serial apis.

* * updated serial apis and test.

* * update serial apis for asynch apis.

* * updated peripheral pins for i2c and spi.
* added test support for serial flow control

* * Base commit for low power ticker implementation.

* * base commit for port apis.
* update in lp ticker apis.

* * Added test support for port.

* * base commit for sleep apis.

* * Base commit for spi.

* * updated with corrections in gpio irq.
* usticker file updated with latest source.

* * updated with corrections for unexpected board reset.
* updated gpio irq apis and added test for the same.

* * updated sleep api for deepsleep.

* * updated serial apis.

* Added uc_ticker and SPI api implementations

* Removed unused SPI pin map

* Updated review feedback

* * implemented lpticker with TC module.
* updated files for KnR Coding Statndard.
* updated serial and usticker apis.

* * Base commit for AnalogueIn apis.

* * RTC apis base commit without implementation.

* * Updated with corrections in lpticker implementations.

* * Added implementation for rtc apis.

* * updated with implementations for pwm.
* changed usticker from TC0 to TC1.

* Added I2C support

* * removed setvector usage from usticker and lpticker implementations
* added tests for SAMG55J19

* * Removed unwanted .o and .d files.
* Updated I2C files for KnR Coding Standards.
* Update for reducing compiler warnings in peripheralpins,c
* Updated with PWM free implementation.

* * Removed unwanted headers file inclusion.
* Compiler warning corrections in serial_api.c

* * Updated ADC with 16 bit mode initialization and code refinements.
* Updated PWM with code refinements.

* Updated I2C review feedback and fixed style

* Updated target name for SAMG55

* * Added Test Support for I2C with AT30TSE75X and Added Support for SAMG55J19 in atmelstudio project exporter

* * Added Test Support for I2C with AT30TSE75X and Added Support for SAMG55J19 in atmelstudio project exporter

* Used NVIC_SetVector for interrupt callback

* Removed Target macro define in test

* Updated test cases to have SAMG55 support

* * Updated with corrections in Serial and SPI asynchronous implementations.
* Updated deepsleep api implementation
* Merged LP_Ticker with latest code from mbed 3.0 repository.

* * updated with corrections in I2C Asynch implementation.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 107:414e9c822e99 1 /**
mbed_official 107:414e9c822e99 2 * \file
mbed_official 107:414e9c822e99 3 *
mbed_official 107:414e9c822e99 4 * \brief System clock management
mbed_official 107:414e9c822e99 5 *
mbed_official 107:414e9c822e99 6 * Copyright (c) 2010-2015 Atmel Corporation. All rights reserved.
mbed_official 107:414e9c822e99 7 *
mbed_official 107:414e9c822e99 8 * \asf_license_start
mbed_official 107:414e9c822e99 9 *
mbed_official 107:414e9c822e99 10 * \page License
mbed_official 107:414e9c822e99 11 *
mbed_official 107:414e9c822e99 12 * Redistribution and use in source and binary forms, with or without
mbed_official 107:414e9c822e99 13 * modification, are permitted provided that the following conditions are met:
mbed_official 107:414e9c822e99 14 *
mbed_official 107:414e9c822e99 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 107:414e9c822e99 16 * this list of conditions and the following disclaimer.
mbed_official 107:414e9c822e99 17 *
mbed_official 107:414e9c822e99 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 107:414e9c822e99 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 107:414e9c822e99 20 * and/or other materials provided with the distribution.
mbed_official 107:414e9c822e99 21 *
mbed_official 107:414e9c822e99 22 * 3. The name of Atmel may not be used to endorse or promote products derived
mbed_official 107:414e9c822e99 23 * from this software without specific prior written permission.
mbed_official 107:414e9c822e99 24 *
mbed_official 107:414e9c822e99 25 * 4. This software may only be redistributed and used in connection with an
mbed_official 107:414e9c822e99 26 * Atmel microcontroller product.
mbed_official 107:414e9c822e99 27 *
mbed_official 107:414e9c822e99 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
mbed_official 107:414e9c822e99 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbed_official 107:414e9c822e99 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
mbed_official 107:414e9c822e99 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
mbed_official 107:414e9c822e99 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 107:414e9c822e99 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
mbed_official 107:414e9c822e99 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
mbed_official 107:414e9c822e99 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
mbed_official 107:414e9c822e99 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
mbed_official 107:414e9c822e99 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 107:414e9c822e99 38 * POSSIBILITY OF SUCH DAMAGE.
mbed_official 107:414e9c822e99 39 *
mbed_official 107:414e9c822e99 40 * \asf_license_stop
mbed_official 107:414e9c822e99 41 *
mbed_official 107:414e9c822e99 42 */
mbed_official 107:414e9c822e99 43 /*
mbed_official 107:414e9c822e99 44 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
mbed_official 107:414e9c822e99 45 */
mbed_official 107:414e9c822e99 46 #ifndef SYSCLK_H_INCLUDED
mbed_official 107:414e9c822e99 47 #define SYSCLK_H_INCLUDED
mbed_official 107:414e9c822e99 48
mbed_official 107:414e9c822e99 49 #include "parts.h"
mbed_official 107:414e9c822e99 50 #include "conf_clock.h"
mbed_official 107:414e9c822e99 51
mbed_official 107:414e9c822e99 52 #if SAM3S
mbed_official 107:414e9c822e99 53 # include "sam3s/sysclk.h"
mbed_official 107:414e9c822e99 54 #elif SAM3U
mbed_official 107:414e9c822e99 55 # include "sam3u/sysclk.h"
mbed_official 107:414e9c822e99 56 #elif SAM3N
mbed_official 107:414e9c822e99 57 # include "sam3n/sysclk.h"
mbed_official 107:414e9c822e99 58 #elif SAM3XA
mbed_official 107:414e9c822e99 59 # include "sam3x/sysclk.h"
mbed_official 107:414e9c822e99 60 #elif SAM4S
mbed_official 107:414e9c822e99 61 # include "sam4s/sysclk.h"
mbed_official 107:414e9c822e99 62 #elif SAM4E
mbed_official 107:414e9c822e99 63 # include "sam4e/sysclk.h"
mbed_official 107:414e9c822e99 64 #elif SAM4C
mbed_official 107:414e9c822e99 65 # include "sam4c/sysclk.h"
mbed_official 107:414e9c822e99 66 #elif SAM4CM
mbed_official 107:414e9c822e99 67 # include "sam4cm/sysclk.h"
mbed_official 107:414e9c822e99 68 #elif SAM4CP
mbed_official 107:414e9c822e99 69 # include "sam4cp/sysclk.h"
mbed_official 107:414e9c822e99 70 #elif SAM4L
mbed_official 107:414e9c822e99 71 # include "sam4l/sysclk.h"
mbed_official 107:414e9c822e99 72 #elif SAM4N
mbed_official 107:414e9c822e99 73 # include "sam4n/sysclk.h"
mbed_official 107:414e9c822e99 74 #elif SAMG
mbed_official 107:414e9c822e99 75 # include "samg/sysclk.h"
mbed_official 107:414e9c822e99 76 #elif SAMV71
mbed_official 107:414e9c822e99 77 # include "samv71/sysclk.h"
mbed_official 107:414e9c822e99 78 #elif SAMV70
mbed_official 107:414e9c822e99 79 # include "samv70/sysclk.h"
mbed_official 107:414e9c822e99 80 #elif SAME70
mbed_official 107:414e9c822e99 81 # include "same70/sysclk.h"
mbed_official 107:414e9c822e99 82 #elif SAMS70
mbed_official 107:414e9c822e99 83 # include "sams70/sysclk.h"
mbed_official 107:414e9c822e99 84 #elif (UC3A0 || UC3A1)
mbed_official 107:414e9c822e99 85 # include "uc3a0_a1/sysclk.h"
mbed_official 107:414e9c822e99 86 #elif UC3A3
mbed_official 107:414e9c822e99 87 # include "uc3a3_a4/sysclk.h"
mbed_official 107:414e9c822e99 88 #elif UC3B
mbed_official 107:414e9c822e99 89 # include "uc3b0_b1/sysclk.h"
mbed_official 107:414e9c822e99 90 #elif UC3C
mbed_official 107:414e9c822e99 91 # include "uc3c/sysclk.h"
mbed_official 107:414e9c822e99 92 #elif UC3D
mbed_official 107:414e9c822e99 93 # include "uc3d/sysclk.h"
mbed_official 107:414e9c822e99 94 #elif UC3L
mbed_official 107:414e9c822e99 95 # include "uc3l/sysclk.h"
mbed_official 107:414e9c822e99 96 #elif XMEGA
mbed_official 107:414e9c822e99 97 # include "xmega/sysclk.h"
mbed_official 107:414e9c822e99 98 #elif MEGA
mbed_official 107:414e9c822e99 99 # include "mega/sysclk.h"
mbed_official 107:414e9c822e99 100 #else
mbed_official 107:414e9c822e99 101 # error Unsupported chip type
mbed_official 107:414e9c822e99 102 #endif
mbed_official 107:414e9c822e99 103
mbed_official 107:414e9c822e99 104 /**
mbed_official 107:414e9c822e99 105 * \defgroup clk_group Clock Management
mbed_official 107:414e9c822e99 106 */
mbed_official 107:414e9c822e99 107
mbed_official 107:414e9c822e99 108 /**
mbed_official 107:414e9c822e99 109 * \ingroup clk_group
mbed_official 107:414e9c822e99 110 * \defgroup sysclk_group System Clock Management
mbed_official 107:414e9c822e99 111 *
mbed_official 107:414e9c822e99 112 * See \ref sysclk_quickstart.
mbed_official 107:414e9c822e99 113 *
mbed_official 107:414e9c822e99 114 * The <em>sysclk</em> API covers the <em>system clock</em> and all
mbed_official 107:414e9c822e99 115 * clocks derived from it. The system clock is a chip-internal clock on
mbed_official 107:414e9c822e99 116 * which all <em>synchronous clocks</em>, i.e. CPU and bus/peripheral
mbed_official 107:414e9c822e99 117 * clocks, are based. The system clock is typically generated from one
mbed_official 107:414e9c822e99 118 * of a variety of sources, which may include crystal and RC oscillators
mbed_official 107:414e9c822e99 119 * as well as PLLs. The clocks derived from the system clock are
mbed_official 107:414e9c822e99 120 * sometimes also known as <em>synchronous clocks</em>, since they
mbed_official 107:414e9c822e99 121 * always run synchronously with respect to each other, as opposed to
mbed_official 107:414e9c822e99 122 * <em>generic clocks</em> which may run from different oscillators or
mbed_official 107:414e9c822e99 123 * PLLs.
mbed_official 107:414e9c822e99 124 *
mbed_official 107:414e9c822e99 125 * Most applications should simply call sysclk_init() to initialize
mbed_official 107:414e9c822e99 126 * everything related to the system clock and its source (oscillator,
mbed_official 107:414e9c822e99 127 * PLL or DFLL), and leave it at that. More advanced applications, and
mbed_official 107:414e9c822e99 128 * platform-specific drivers, may require additional services from the
mbed_official 107:414e9c822e99 129 * clock system, some of which may be platform-specific.
mbed_official 107:414e9c822e99 130 *
mbed_official 107:414e9c822e99 131 * \section sysclk_group_platform Platform Dependencies
mbed_official 107:414e9c822e99 132 *
mbed_official 107:414e9c822e99 133 * The sysclk API is partially chip- or platform-specific. While all
mbed_official 107:414e9c822e99 134 * platforms provide mostly the same functionality, there are some
mbed_official 107:414e9c822e99 135 * variations around how different bus types and clock tree structures
mbed_official 107:414e9c822e99 136 * are handled.
mbed_official 107:414e9c822e99 137 *
mbed_official 107:414e9c822e99 138 * The following functions are available on all platforms with the same
mbed_official 107:414e9c822e99 139 * parameters and functionality. These functions may be called freely by
mbed_official 107:414e9c822e99 140 * portable applications, drivers and services:
mbed_official 107:414e9c822e99 141 * - sysclk_init()
mbed_official 107:414e9c822e99 142 * - sysclk_set_source()
mbed_official 107:414e9c822e99 143 * - sysclk_get_main_hz()
mbed_official 107:414e9c822e99 144 * - sysclk_get_cpu_hz()
mbed_official 107:414e9c822e99 145 * - sysclk_get_peripheral_bus_hz()
mbed_official 107:414e9c822e99 146 *
mbed_official 107:414e9c822e99 147 * The following functions are available on all platforms, but there may
mbed_official 107:414e9c822e99 148 * be variations in the function signature (i.e. parameters) and
mbed_official 107:414e9c822e99 149 * behavior. These functions are typically called by platform-specific
mbed_official 107:414e9c822e99 150 * parts of drivers, and applications that aren't intended to be
mbed_official 107:414e9c822e99 151 * portable:
mbed_official 107:414e9c822e99 152 * - sysclk_enable_peripheral_clock()
mbed_official 107:414e9c822e99 153 * - sysclk_disable_peripheral_clock()
mbed_official 107:414e9c822e99 154 * - sysclk_enable_module()
mbed_official 107:414e9c822e99 155 * - sysclk_disable_module()
mbed_official 107:414e9c822e99 156 * - sysclk_module_is_enabled()
mbed_official 107:414e9c822e99 157 * - sysclk_set_prescalers()
mbed_official 107:414e9c822e99 158 *
mbed_official 107:414e9c822e99 159 * All other functions should be considered platform-specific.
mbed_official 107:414e9c822e99 160 * Enabling/disabling clocks to specific peripherals as well as
mbed_official 107:414e9c822e99 161 * determining the speed of these clocks should be done by calling
mbed_official 107:414e9c822e99 162 * functions provided by the driver for that peripheral.
mbed_official 107:414e9c822e99 163 *
mbed_official 107:414e9c822e99 164 * @{
mbed_official 107:414e9c822e99 165 */
mbed_official 107:414e9c822e99 166
mbed_official 107:414e9c822e99 167 //! \name System Clock Initialization
mbed_official 107:414e9c822e99 168 //@{
mbed_official 107:414e9c822e99 169 /**
mbed_official 107:414e9c822e99 170 * \fn void sysclk_init(void)
mbed_official 107:414e9c822e99 171 * \brief Initialize the synchronous clock system.
mbed_official 107:414e9c822e99 172 *
mbed_official 107:414e9c822e99 173 * This function will initialize the system clock and its source. This
mbed_official 107:414e9c822e99 174 * includes:
mbed_official 107:414e9c822e99 175 * - Mask all synchronous clocks except for any clocks which are
mbed_official 107:414e9c822e99 176 * essential for normal operation (for example internal memory
mbed_official 107:414e9c822e99 177 * clocks).
mbed_official 107:414e9c822e99 178 * - Set up the system clock prescalers as specified by the
mbed_official 107:414e9c822e99 179 * application's configuration file.
mbed_official 107:414e9c822e99 180 * - Enable the clock source specified by the application's
mbed_official 107:414e9c822e99 181 * configuration file (oscillator or PLL) and wait for it to become
mbed_official 107:414e9c822e99 182 * stable.
mbed_official 107:414e9c822e99 183 * - Set the main system clock source to the clock specified by the
mbed_official 107:414e9c822e99 184 * application's configuration file.
mbed_official 107:414e9c822e99 185 *
mbed_official 107:414e9c822e99 186 * Since all non-essential peripheral clocks are initially disabled, it
mbed_official 107:414e9c822e99 187 * is the responsibility of the peripheral driver to re-enable any
mbed_official 107:414e9c822e99 188 * clocks that are needed for normal operation.
mbed_official 107:414e9c822e99 189 */
mbed_official 107:414e9c822e99 190 //@}
mbed_official 107:414e9c822e99 191
mbed_official 107:414e9c822e99 192 //! @}
mbed_official 107:414e9c822e99 193
mbed_official 107:414e9c822e99 194 #endif /* SYSCLK_H_INCLUDED */