added prescaler for 16 bit pwm in LPC1347 target

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Sep 02 15:07:44 2016 +0100
Revision:
144:ef7eb2e8f9f7
This updates the lib to the mbed lib v125

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /**
<> 144:ef7eb2e8f9f7 2 ******************************************************************************
<> 144:ef7eb2e8f9f7 3 * @file clock.h
<> 144:ef7eb2e8f9f7 4 * @brief Header of clock hw module functions
<> 144:ef7eb2e8f9f7 5 * @internal
<> 144:ef7eb2e8f9f7 6 * @author ON Semiconductor
<> 144:ef7eb2e8f9f7 7 * $Rev: 3414 $
<> 144:ef7eb2e8f9f7 8 * $Date: 2015-06-05 13:27:04 +0530 (Fri, 05 Jun 2015) $
<> 144:ef7eb2e8f9f7 9 ******************************************************************************
<> 144:ef7eb2e8f9f7 10 * @copyright (c) 2012 ON Semiconductor. All rights reserved.
<> 144:ef7eb2e8f9f7 11 * ON Semiconductor is supplying this software for use with ON Semiconductor
<> 144:ef7eb2e8f9f7 12 * processor based microcontrollers only.
<> 144:ef7eb2e8f9f7 13 *
<> 144:ef7eb2e8f9f7 14 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
<> 144:ef7eb2e8f9f7 15 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
<> 144:ef7eb2e8f9f7 16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
<> 144:ef7eb2e8f9f7 17 * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
<> 144:ef7eb2e8f9f7 18 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
<> 144:ef7eb2e8f9f7 19 * @endinternal
<> 144:ef7eb2e8f9f7 20 *
<> 144:ef7eb2e8f9f7 21 * @ingroup clock
<> 144:ef7eb2e8f9f7 22 */
<> 144:ef7eb2e8f9f7 23
<> 144:ef7eb2e8f9f7 24 #ifndef CLOCK_H_
<> 144:ef7eb2e8f9f7 25 #define CLOCK_H_
<> 144:ef7eb2e8f9f7 26
<> 144:ef7eb2e8f9f7 27 /*************************************************************************************************
<> 144:ef7eb2e8f9f7 28 * *
<> 144:ef7eb2e8f9f7 29 * Header files *
<> 144:ef7eb2e8f9f7 30 * *
<> 144:ef7eb2e8f9f7 31 *************************************************************************************************/
<> 144:ef7eb2e8f9f7 32
<> 144:ef7eb2e8f9f7 33 #include "types.h"
<> 144:ef7eb2e8f9f7 34
<> 144:ef7eb2e8f9f7 35 /*************************************************************************************************
<> 144:ef7eb2e8f9f7 36 * *
<> 144:ef7eb2e8f9f7 37 * Symbolic Constants *
<> 144:ef7eb2e8f9f7 38 * *
<> 144:ef7eb2e8f9f7 39 *************************************************************************************************/
<> 144:ef7eb2e8f9f7 40
<> 144:ef7eb2e8f9f7 41 /** Peripherals clock disable defines /
<> 144:ef7eb2e8f9f7 42 * @details
<> 144:ef7eb2e8f9f7 43 */
<> 144:ef7eb2e8f9f7 44 #define CLOCK_TIMER0 (0x0) /**< <b> Timer 0 clock enable offset </b>*/
<> 144:ef7eb2e8f9f7 45 #define CLOCK_TIMER1 (0x1) /**< <b> Timer 1 clock enable offset </b>: */
<> 144:ef7eb2e8f9f7 46 #define CLOCK_TIMER2 (0x2) /**< <b> Timer 2 clock enable offset </b>: */
<> 144:ef7eb2e8f9f7 47 #define CLOCK_PAD0_0 (0x3) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 48 #define CLOCK_PAD0_1 (0x4) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 49 #define CLOCK_UART1 (0x5) /**< <b> UART 1 clock enable offset </b> */
<> 144:ef7eb2e8f9f7 50 #define CLOCK_SPI (0x6) /**< <b> SPI clock enable offset </b> */
<> 144:ef7eb2e8f9f7 51 #define CLOCK_I2C (0x7) /**< <b> I2C clock enable offset </b> */
<> 144:ef7eb2e8f9f7 52 #define CLOCK_UART2 (0x8) /**< <b> UART 2 clock enable offset </b> */
<> 144:ef7eb2e8f9f7 53 #define CLOCK_SPI2 (0x9) /**< <b> Unused offset </b>: */
<> 144:ef7eb2e8f9f7 54 #define CLOCK_WDOG (0xA) /**< <b> Watchdog clock enable offset </b> */
<> 144:ef7eb2e8f9f7 55 #define CLOCK_PWM (0xB) /**< <b> PWM clock enable offset </b> */
<> 144:ef7eb2e8f9f7 56 #define CLOCK_GPIO (0xC) /**< <b> GPIO clock enable offset </b> */
<> 144:ef7eb2e8f9f7 57 #define CLOCK_I2C2 (0xD) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 58 #define CLOCK_PAD2_1 (0xE) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 59 #define CLOCK_RTC (0xF) /**< <b> RTC clock enable offset </b> */
<> 144:ef7eb2e8f9f7 60 #define CLOCK_CROSSB (0x10) /**< <b> Crossbar clock enable offset </b> */
<> 144:ef7eb2e8f9f7 61 #define CLOCK_RAND (0x11) /**< <b> Randomizer clock enable offset </b> */
<> 144:ef7eb2e8f9f7 62 #define CLOCK_PAD3_0 (0x12) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 63 #define CLOCK_PAD3_1 (0x13) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 64 #define CLOCK_MACHW (0x14) /**< <b> macHw clock enable offset </b> */
<> 144:ef7eb2e8f9f7 65 #define CLOCK_ADC (0x15) /**< <b> ADC clock enable offset </b> */
<> 144:ef7eb2e8f9f7 66 #define CLOCK_AES (0x16) /**< <b> AES clock enable offset </b> */
<> 144:ef7eb2e8f9f7 67 #define CLOCK_FLASH (0x17) /**< <b> Flash controller clock enable offset</b> */
<> 144:ef7eb2e8f9f7 68 #define CLOCK_PAD4_0 (0x18) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 69 #define CLOCK_RFANA (0x19) /**< <b> rfAna clock enable offset </b> */
<> 144:ef7eb2e8f9f7 70 #define CLOCK_IO (0x1A) /**< <b> IO clock enable offset </b> */
<> 144:ef7eb2e8f9f7 71 #define CLOCK_PAD5_0 (0x1B) /**< <b> Unused offset </b> */
<> 144:ef7eb2e8f9f7 72 #define CLOCK_PAD (0x1C) /**< <b> Pad clock enable offset </b> */
<> 144:ef7eb2e8f9f7 73 #define CLOCK_PMU (0x1D) /**< <b> Pmu clock enable offset </b> */
<> 144:ef7eb2e8f9f7 74 #define CLOCK_DMA (0x1E) /**< <b> DMA clock enable offset </b> */
<> 144:ef7eb2e8f9f7 75 #define CLOCK_TEST (0x1F) /**< <b> Test controller clock enable offset </b> */
<> 144:ef7eb2e8f9f7 76
<> 144:ef7eb2e8f9f7 77 #define CLOCK_ENABLE(a) CLOCKREG->PDIS.WORD &= ~(1 << a)
<> 144:ef7eb2e8f9f7 78 #define CLOCK_DISABLE(a) CLOCKREG->PDIS.WORD |= (uint32_t)(1 << a)
<> 144:ef7eb2e8f9f7 79
<> 144:ef7eb2e8f9f7 80 /*************************************************************************************************
<> 144:ef7eb2e8f9f7 81 * *
<> 144:ef7eb2e8f9f7 82 * Functions *
<> 144:ef7eb2e8f9f7 83 * *
<> 144:ef7eb2e8f9f7 84 *************************************************************************************************/
<> 144:ef7eb2e8f9f7 85
<> 144:ef7eb2e8f9f7 86 /** Function to initialize clocks
<> 144:ef7eb2e8f9f7 87 * @details
<> 144:ef7eb2e8f9f7 88 * The function initializes clocks.
<> 144:ef7eb2e8f9f7 89 * This initialization includes:
<> 144:ef7eb2e8f9f7 90 * - Enable of external 32mHz oscillator
<> 144:ef7eb2e8f9f7 91 * - Disable of all peripheral clocks (to be turned on selectively when used later in the application)
<> 144:ef7eb2e8f9f7 92 * - Setting core frequency
<> 144:ef7eb2e8f9f7 93 */
<> 144:ef7eb2e8f9f7 94 void fClockInit(void);
<> 144:ef7eb2e8f9f7 95
<> 144:ef7eb2e8f9f7 96 /** Function to get peripheral clock frequency
<> 144:ef7eb2e8f9f7 97 * @details
<> 144:ef7eb2e8f9f7 98 * The function checks and returns peripheral clock frequency
<> 144:ef7eb2e8f9f7 99 * @return Peripheral clock frequency
<> 144:ef7eb2e8f9f7 100 */
<> 144:ef7eb2e8f9f7 101 uint32_t fClockGetPeriphClockfrequency();
<> 144:ef7eb2e8f9f7 102
<> 144:ef7eb2e8f9f7 103 /** Function to get peripheral clock frequency
<> 144:ef7eb2e8f9f7 104 * @details
<> 144:ef7eb2e8f9f7 105 * The function checks which input clock is sourcing 32kHz clock domain.
<> 144:ef7eb2e8f9f7 106 * This domain can be either sourced by:
<> 144:ef7eb2e8f9f7 107 * - Internal 32kHz oscillator
<> 144:ef7eb2e8f9f7 108 * - External 32.768kHz oscillator
<> 144:ef7eb2e8f9f7 109 * @return 32kHz clock domain frequency
<> 144:ef7eb2e8f9f7 110 */
<> 144:ef7eb2e8f9f7 111 uint16_t fClockGet32kClockfrequency();
<> 144:ef7eb2e8f9f7 112
<> 144:ef7eb2e8f9f7 113 /** Function to enable peripheral clock
<> 144:ef7eb2e8f9f7 114 * @details
<> 144:ef7eb2e8f9f7 115 * The function enables clock of peripheral indicated by parameter
<> 144:ef7eb2e8f9f7 116 * @param deviceId Peripheral ID whose clock must be enabled.
<> 144:ef7eb2e8f9f7 117 */
<> 144:ef7eb2e8f9f7 118 void fClockEnablePeriph(uint8_t deviceId);
<> 144:ef7eb2e8f9f7 119
<> 144:ef7eb2e8f9f7 120 /** Function to disable peripheral clock
<> 144:ef7eb2e8f9f7 121 * @details
<> 144:ef7eb2e8f9f7 122 * The function disables clock of peripheral indicated by parameter
<> 144:ef7eb2e8f9f7 123 * @param deviceId ID Peripheral whose clock must be disabled.
<> 144:ef7eb2e8f9f7 124 */
<> 144:ef7eb2e8f9f7 125 void fClockDisablePeriph(uint8_t deviceId);
<> 144:ef7eb2e8f9f7 126
<> 144:ef7eb2e8f9f7 127 #endif /* CLOCK_H_ */