X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/eee252603be67c539f9986cde76454f756e55d95..7c9c3d15e0b772a8bf26c9695236b80cb26c71b5:/LUFA/Platform/XMEGA/ClockManagement.h diff --git a/LUFA/Platform/XMEGA/ClockManagement.h b/LUFA/Platform/XMEGA/ClockManagement.h index 8e6e64185..f51c73b49 100644 --- a/LUFA/Platform/XMEGA/ClockManagement.h +++ b/LUFA/Platform/XMEGA/ClockManagement.h @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2012. + Copyright (C) Dean Camera, 2015. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -39,24 +39,24 @@ * \defgroup Group_PlatformDrivers_XMEGAClocks Clock Management Driver - LUFA/Platform/XMEGA/ClockManagement.h * \brief Module Clock Driver for the AVR USB XMEGA microcontrollers. * - * \section Sec_Dependencies Module Source Dependencies + * \section Sec_PlatformDrivers_XMEGAClocks_Dependencies Module Source Dependencies * The following files must be built with any user project that uses this module: * - None * - * \section Sec_ModDescription Module Description + * \section Sec_PlatformDrivers_XMEGAClocks_ModDescription Module Description * Clock management driver for the AVR USB XMEGA microcontrollers. This driver allows for the configuration * of the various clocks within the device to clock the various peripherals. * * Usage Example: * \code * #include - * + * * void main(void) * { * // Start the PLL to multiply the 2MHz RC oscillator to F_CPU and switch the CPU core to run from it * XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU); * XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL); - * + * * // Start the 32MHz internal RC oscillator and start the DFLL to increase it to F_USB using the USB SOF as a reference * XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); * XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB); @@ -123,7 +123,7 @@ * \param[in] Address Address to write to, a memory address protected by the CCP mechanism * \param[in] Value Value to write to the protected location */ - static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_ALWAYS_INLINE; + static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) { __asm__ __volatile__ ( @@ -134,7 +134,7 @@ : /* No output operands */ : /* Input operands: */ "m" (RAMPZ), "e" (Address), "m" (CCP), "r" (CCP_IOREG_gc), "r" (Value) : /* Clobbered registers: */ "r30", "r31" - ); + ); } /** Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until @@ -171,8 +171,8 @@ * * \return Boolean \c true if the internal oscillator was successfully started, \c false if invalid parameters specified. */ - static inline uint8_t XMEGACLK_StartInternalOscillator(const uint8_t Source) ATTR_ALWAYS_INLINE; - static inline uint8_t XMEGACLK_StartInternalOscillator(const uint8_t Source) + static inline bool XMEGACLK_StartInternalOscillator(const uint8_t Source) ATTR_ALWAYS_INLINE; + static inline bool XMEGACLK_StartInternalOscillator(const uint8_t Source) { switch (Source) { @@ -239,7 +239,7 @@ if (SourceFreq > Frequency) return false; - + if (MulFactor > 31) return false; @@ -286,7 +286,7 @@ const uint8_t Reference, const uint32_t Frequency) { - uint16_t DFLLCompare = (Frequency / 1000); + uint16_t DFLLCompare = (Frequency / 1024); switch (Source) {