meh
Fork of mbed by
TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/clock/src/fsl_clock_manager_private.h@82:6473597d706e, 2014-04-07 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Apr 07 18:28:36 2014 +0100
- Revision:
- 82:6473597d706e
Release 82 of the mbed library
Main changes:
- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 82:6473597d706e | 1 | /* |
bogdanm | 82:6473597d706e | 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. |
bogdanm | 82:6473597d706e | 3 | * All rights reserved. |
bogdanm | 82:6473597d706e | 4 | * |
bogdanm | 82:6473597d706e | 5 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 82:6473597d706e | 6 | * are permitted provided that the following conditions are met: |
bogdanm | 82:6473597d706e | 7 | * |
bogdanm | 82:6473597d706e | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
bogdanm | 82:6473597d706e | 9 | * of conditions and the following disclaimer. |
bogdanm | 82:6473597d706e | 10 | * |
bogdanm | 82:6473597d706e | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
bogdanm | 82:6473597d706e | 12 | * list of conditions and the following disclaimer in the documentation and/or |
bogdanm | 82:6473597d706e | 13 | * other materials provided with the distribution. |
bogdanm | 82:6473597d706e | 14 | * |
bogdanm | 82:6473597d706e | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
bogdanm | 82:6473597d706e | 16 | * contributors may be used to endorse or promote products derived from this |
bogdanm | 82:6473597d706e | 17 | * software without specific prior written permission. |
bogdanm | 82:6473597d706e | 18 | * |
bogdanm | 82:6473597d706e | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
bogdanm | 82:6473597d706e | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
bogdanm | 82:6473597d706e | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 82:6473597d706e | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
bogdanm | 82:6473597d706e | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
bogdanm | 82:6473597d706e | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
bogdanm | 82:6473597d706e | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
bogdanm | 82:6473597d706e | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
bogdanm | 82:6473597d706e | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
bogdanm | 82:6473597d706e | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 82:6473597d706e | 29 | */ |
bogdanm | 82:6473597d706e | 30 | #if !defined(__FSL_CLOCK_MANAGER_PRIVATE_H__) |
bogdanm | 82:6473597d706e | 31 | #define __FSL_CLOCK_MANAGER_PRIVATE_H__ |
bogdanm | 82:6473597d706e | 32 | |
bogdanm | 82:6473597d706e | 33 | #include <stdint.h> |
bogdanm | 82:6473597d706e | 34 | #include <stdbool.h> |
bogdanm | 82:6473597d706e | 35 | #include <assert.h> |
bogdanm | 82:6473597d706e | 36 | |
bogdanm | 82:6473597d706e | 37 | /*! @addtogroup clock_manager*/ |
bogdanm | 82:6473597d706e | 38 | /*! @{*/ |
bogdanm | 82:6473597d706e | 39 | |
bogdanm | 82:6473597d706e | 40 | /*! @file*/ |
bogdanm | 82:6473597d706e | 41 | |
bogdanm | 82:6473597d706e | 42 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 43 | * Definitions |
bogdanm | 82:6473597d706e | 44 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 45 | |
bogdanm | 82:6473597d706e | 46 | /*! @brief Clock manager clock names mapping into the SIM clock name*/ |
bogdanm | 82:6473597d706e | 47 | sim_clock_names_t kClockNameSimMap[kClockNameCount] = { |
bogdanm | 82:6473597d706e | 48 | /* default clocks*/ |
bogdanm | 82:6473597d706e | 49 | kSimCoreClock, /**/ |
bogdanm | 82:6473597d706e | 50 | kSimSystemClock, /**/ |
bogdanm | 82:6473597d706e | 51 | kSimPlatformClock, /**/ |
bogdanm | 82:6473597d706e | 52 | kSimBusClock, /**/ |
bogdanm | 82:6473597d706e | 53 | kSimFlexBusClock, /**/ |
bogdanm | 82:6473597d706e | 54 | kSimFlashClock, /**/ |
bogdanm | 82:6473597d706e | 55 | |
bogdanm | 82:6473597d706e | 56 | /* other internal clocks used by peripherals*/ |
bogdanm | 82:6473597d706e | 57 | /* osc clock*/ |
bogdanm | 82:6473597d706e | 58 | kSimOsc32kClock, |
bogdanm | 82:6473597d706e | 59 | kSimOsc0ErClock, |
bogdanm | 82:6473597d706e | 60 | kSimOsc1ErClock, |
bogdanm | 82:6473597d706e | 61 | |
bogdanm | 82:6473597d706e | 62 | /* irc 48Mhz clock */ |
bogdanm | 82:6473597d706e | 63 | kSimIrc48mClock, |
bogdanm | 82:6473597d706e | 64 | |
bogdanm | 82:6473597d706e | 65 | /* rtc clock*/ |
bogdanm | 82:6473597d706e | 66 | kSimRtc32kClock, |
bogdanm | 82:6473597d706e | 67 | kSimRtc1hzClock, |
bogdanm | 82:6473597d706e | 68 | |
bogdanm | 82:6473597d706e | 69 | /* lpo clcok*/ |
bogdanm | 82:6473597d706e | 70 | kSimLpoClock, |
bogdanm | 82:6473597d706e | 71 | |
bogdanm | 82:6473597d706e | 72 | /* mcg clocks*/ |
bogdanm | 82:6473597d706e | 73 | kSimMcgFllClock, |
bogdanm | 82:6473597d706e | 74 | kSimMcgPll0Clock, |
bogdanm | 82:6473597d706e | 75 | kSimMcgPll1Clock, |
bogdanm | 82:6473597d706e | 76 | kSimMcgOutClock, |
bogdanm | 82:6473597d706e | 77 | kSimMcgIrClock, |
bogdanm | 82:6473597d706e | 78 | |
bogdanm | 82:6473597d706e | 79 | /* constant clocks (provided in other header files?)*/ |
bogdanm | 82:6473597d706e | 80 | kSimSDHC0_CLKIN, |
bogdanm | 82:6473597d706e | 81 | kSimENET_1588_CLKIN, |
bogdanm | 82:6473597d706e | 82 | kSimEXTAL_Clock, |
bogdanm | 82:6473597d706e | 83 | kSimEXTAL1_Clock, |
bogdanm | 82:6473597d706e | 84 | kSimUSB_CLKIN, |
bogdanm | 82:6473597d706e | 85 | |
bogdanm | 82:6473597d706e | 86 | /* reserved value*/ |
bogdanm | 82:6473597d706e | 87 | kSimReserved |
bogdanm | 82:6473597d706e | 88 | }; |
bogdanm | 82:6473597d706e | 89 | |
bogdanm | 82:6473597d706e | 90 | /*! @brief Clock manager clock source names mapping into the SIM clock source name*/ |
bogdanm | 82:6473597d706e | 91 | sim_clock_source_names_t kClockSourceNameSimMap[kClockSourceMax] = { |
bogdanm | 82:6473597d706e | 92 | kSimClockNfcSrc, /* NFCSRC*/ |
bogdanm | 82:6473597d706e | 93 | kSimClockEsdhcSrc, /* ESDHCSRC K70*/ |
bogdanm | 82:6473597d706e | 94 | kSimClockSdhcSrc, /* SDHCSRC K64*/ |
bogdanm | 82:6473597d706e | 95 | kSimClockLcdcSrc, /* LCDCSRC*/ |
bogdanm | 82:6473597d706e | 96 | kSimClockTimeSrc, /* TIMESRC*/ |
bogdanm | 82:6473597d706e | 97 | kSimClockRmiiSrc, /* RMIISRC*/ |
bogdanm | 82:6473597d706e | 98 | kSimClockUsbfSrc, /* USBFSRC K70*/ |
bogdanm | 82:6473597d706e | 99 | kSimClockUsbSrc, /* USBSRC K64, KL25, KV31, and K22*/ |
bogdanm | 82:6473597d706e | 100 | kSimClockUsbhSrc, /* USBHSRC*/ |
bogdanm | 82:6473597d706e | 101 | kSimClockUart0Src, /* UART0SRC*/ |
bogdanm | 82:6473597d706e | 102 | kSimClockTpmSrc, /* TPMSRC*/ |
bogdanm | 82:6473597d706e | 103 | kSimClockOsc32kSel, /* OSC32KSEL*/ |
bogdanm | 82:6473597d706e | 104 | kSimClockUsbfSel, /* USBF_CLKSEL*/ |
bogdanm | 82:6473597d706e | 105 | kSimClockPllfllSel, /* PLLFLLSEL*/ |
bogdanm | 82:6473597d706e | 106 | kSimClockNfcSel, /* NFC_CLKSEL*/ |
bogdanm | 82:6473597d706e | 107 | kSimClockLcdcSel, /* LCDC_CLKSEL*/ |
bogdanm | 82:6473597d706e | 108 | kSimClockTraceSel, /* TRACE_CLKSEL*/ |
bogdanm | 82:6473597d706e | 109 | kSimClockClkoutSel, /* CLKOUTSEL*/ |
bogdanm | 82:6473597d706e | 110 | kSimClockRtcClkoutSel /* RTCCLKOUTSEL */ |
bogdanm | 82:6473597d706e | 111 | }; |
bogdanm | 82:6473597d706e | 112 | |
bogdanm | 82:6473597d706e | 113 | /*! @brief Clock manager clock module names mapping into the SIM clock module name*/ |
bogdanm | 82:6473597d706e | 114 | sim_clock_gate_module_names_t kClockModuleNameSimMap[kClockModuleMax] = { |
bogdanm | 82:6473597d706e | 115 | /* System modules*/ |
bogdanm | 82:6473597d706e | 116 | kSimClockModuleDMA, /**/ |
bogdanm | 82:6473597d706e | 117 | kSimClockModuleDMAMUX, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 118 | kSimClockModulePORT, /* instance 0 - 5 (A - F)*/ |
bogdanm | 82:6473597d706e | 119 | kSimClockModuleMPU, /**/ |
bogdanm | 82:6473597d706e | 120 | kSimClockModuleLLWU, /**/ |
bogdanm | 82:6473597d706e | 121 | kSimClockModuleEWM, /**/ |
bogdanm | 82:6473597d706e | 122 | |
bogdanm | 82:6473597d706e | 123 | /* Clocks*/ |
bogdanm | 82:6473597d706e | 124 | kSimClockModuleOSC1, /**/ |
bogdanm | 82:6473597d706e | 125 | |
bogdanm | 82:6473597d706e | 126 | /* Memory and memory interfaces*/ |
bogdanm | 82:6473597d706e | 127 | kSimClockModuleFTF, /* Flash memory control clock*/ |
bogdanm | 82:6473597d706e | 128 | kSimClockModuleNFC, /* NAND flash control clock*/ |
bogdanm | 82:6473597d706e | 129 | kSimClockModuleFLEXBUS, /**/ |
bogdanm | 82:6473597d706e | 130 | kSimClockModuleDDR, /**/ |
bogdanm | 82:6473597d706e | 131 | |
bogdanm | 82:6473597d706e | 132 | /* Security*/ |
bogdanm | 82:6473597d706e | 133 | kSimClockModuleCRC, /**/ |
bogdanm | 82:6473597d706e | 134 | kSimClockModuleRNGA, /**/ |
bogdanm | 82:6473597d706e | 135 | kSimClockModuleREGFILE, /**/ |
bogdanm | 82:6473597d706e | 136 | kSimClockModuleDRYICESECREG, /**/ |
bogdanm | 82:6473597d706e | 137 | kSimClockModuleDRYICE, /**/ |
bogdanm | 82:6473597d706e | 138 | |
bogdanm | 82:6473597d706e | 139 | /* Analog*/ |
bogdanm | 82:6473597d706e | 140 | kSimClockModuleADC, /* instance 0 - 3*/ |
bogdanm | 82:6473597d706e | 141 | kSimClockModuleCMP, /* */ |
bogdanm | 82:6473597d706e | 142 | kSimClockModuleDAC, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 143 | kSimClockModuleVREF, /* */ |
bogdanm | 82:6473597d706e | 144 | kSimClockModuleSAI, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 145 | |
bogdanm | 82:6473597d706e | 146 | /* Timers*/ |
bogdanm | 82:6473597d706e | 147 | kSimClockModuleTPM, /* TPM timers 0 - 2*/ |
bogdanm | 82:6473597d706e | 148 | kSimClockModulePDB, /* */ |
bogdanm | 82:6473597d706e | 149 | kSimClockModuleFTM, /* instance 0 - 3*/ |
bogdanm | 82:6473597d706e | 150 | kSimClockModulePIT, /**/ |
bogdanm | 82:6473597d706e | 151 | kSimClockModuleLPTIMER, /**/ |
bogdanm | 82:6473597d706e | 152 | kSimClockModuleCMT, /**/ |
bogdanm | 82:6473597d706e | 153 | kSimClockModuleRTC, /**/ |
bogdanm | 82:6473597d706e | 154 | |
bogdanm | 82:6473597d706e | 155 | /* Communication Interfaces*/ |
bogdanm | 82:6473597d706e | 156 | kSimClockModuleENET, /**/ |
bogdanm | 82:6473597d706e | 157 | kSimClockModuleUSBHS, /**/ |
bogdanm | 82:6473597d706e | 158 | kSimClockModuleUSBFS, /**/ |
bogdanm | 82:6473597d706e | 159 | kSimClockModuleUSBDCD, /**/ |
bogdanm | 82:6473597d706e | 160 | kSimClockModuleFLEXCAN, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 161 | kSimClockModuleSPI, /* instance 0 - 2*/ |
bogdanm | 82:6473597d706e | 162 | kSimClockModuleI2C, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 163 | kSimClockModuleUART, /* instance 0 - 5*/ |
bogdanm | 82:6473597d706e | 164 | kSimClockModuleESDHC, /**/ |
bogdanm | 82:6473597d706e | 165 | kSimClockModuleLPUART, /**/ |
bogdanm | 82:6473597d706e | 166 | |
bogdanm | 82:6473597d706e | 167 | /* Human-machine Interfaces*/ |
bogdanm | 82:6473597d706e | 168 | kSimClockModuleTSI, /**/ |
bogdanm | 82:6473597d706e | 169 | kSimClockModuleLCDC /**/ |
bogdanm | 82:6473597d706e | 170 | }; |
bogdanm | 82:6473597d706e | 171 | |
bogdanm | 82:6473597d706e | 172 | extern const sim_clock_source_value_t *kSimClockSourceValueTable[]; |
bogdanm | 82:6473597d706e | 173 | |
bogdanm | 82:6473597d706e | 174 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 175 | * API |
bogdanm | 82:6473597d706e | 176 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 177 | |
bogdanm | 82:6473597d706e | 178 | /*! @name System out clock access API*/ |
bogdanm | 82:6473597d706e | 179 | /*@{*/ |
bogdanm | 82:6473597d706e | 180 | |
bogdanm | 82:6473597d706e | 181 | /*! |
bogdanm | 82:6473597d706e | 182 | * @brief Gets the current out clock. |
bogdanm | 82:6473597d706e | 183 | * |
bogdanm | 82:6473597d706e | 184 | * @param none |
bogdanm | 82:6473597d706e | 185 | * |
bogdanm | 82:6473597d706e | 186 | * @return frequency Out clock frequency for the clock system |
bogdanm | 82:6473597d706e | 187 | */ |
bogdanm | 82:6473597d706e | 188 | extern uint32_t clock_hal_get_outclk(void); |
bogdanm | 82:6473597d706e | 189 | |
bogdanm | 82:6473597d706e | 190 | /*! |
bogdanm | 82:6473597d706e | 191 | * @brief Gets the current FLL clock. |
bogdanm | 82:6473597d706e | 192 | * |
bogdanm | 82:6473597d706e | 193 | * @param none |
bogdanm | 82:6473597d706e | 194 | * |
bogdanm | 82:6473597d706e | 195 | * @return frequency FLL clock frequency for the clock system |
bogdanm | 82:6473597d706e | 196 | */ |
bogdanm | 82:6473597d706e | 197 | extern uint32_t clock_hal_get_fllclk(void); |
bogdanm | 82:6473597d706e | 198 | |
bogdanm | 82:6473597d706e | 199 | /*! |
bogdanm | 82:6473597d706e | 200 | * @brief Gets the current PLL0 clock. |
bogdanm | 82:6473597d706e | 201 | * |
bogdanm | 82:6473597d706e | 202 | * @param none |
bogdanm | 82:6473597d706e | 203 | * |
bogdanm | 82:6473597d706e | 204 | * @return frequency PLL0 clock frequency for the clock system |
bogdanm | 82:6473597d706e | 205 | */ |
bogdanm | 82:6473597d706e | 206 | extern uint32_t clock_hal_get_pll0clk(void); |
bogdanm | 82:6473597d706e | 207 | |
bogdanm | 82:6473597d706e | 208 | /*! |
bogdanm | 82:6473597d706e | 209 | * @brief Gets the current PLL1 clock. |
bogdanm | 82:6473597d706e | 210 | * |
bogdanm | 82:6473597d706e | 211 | * @param none |
bogdanm | 82:6473597d706e | 212 | * |
bogdanm | 82:6473597d706e | 213 | * @return frequency PLL1 clock frequency for the clock system |
bogdanm | 82:6473597d706e | 214 | */ |
bogdanm | 82:6473597d706e | 215 | extern uint32_t clock_hal_get_pll1clk(void); |
bogdanm | 82:6473597d706e | 216 | |
bogdanm | 82:6473597d706e | 217 | /*! |
bogdanm | 82:6473597d706e | 218 | * @brief Get the current IR (internal reference) clock. |
bogdanm | 82:6473597d706e | 219 | * |
bogdanm | 82:6473597d706e | 220 | * @param none |
bogdanm | 82:6473597d706e | 221 | * |
bogdanm | 82:6473597d706e | 222 | * @return frequency IR clock frequency for the clock system |
bogdanm | 82:6473597d706e | 223 | */ |
bogdanm | 82:6473597d706e | 224 | extern uint32_t clock_hal_get_irclk(void); |
bogdanm | 82:6473597d706e | 225 | |
bogdanm | 82:6473597d706e | 226 | /*@}*/ |
bogdanm | 82:6473597d706e | 227 | |
bogdanm | 82:6473597d706e | 228 | /*! @}*/ |
bogdanm | 82:6473597d706e | 229 | |
bogdanm | 82:6473597d706e | 230 | #endif /* __FSL_CLOCK_MANAGER_PRIVATE_H__*/ |
bogdanm | 82:6473597d706e | 231 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 232 | * EOF |
bogdanm | 82:6473597d706e | 233 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 234 |