/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 07 18:28:36 2014 +0100
Revision:
82:6473597d706e
Child:
90:cb3d968589d8
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?

UserRevisionLine numberNew 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
bogdanm 82:6473597d706e 31 #if !defined(__FSL_CLOCK_MANAGER_H__)
bogdanm 82:6473597d706e 32 #define __FSL_CLOCK_MANAGER_H__
bogdanm 82:6473597d706e 33
bogdanm 82:6473597d706e 34 #include <stdint.h>
bogdanm 82:6473597d706e 35 #include <stdbool.h>
bogdanm 82:6473597d706e 36 #include <assert.h>
bogdanm 82:6473597d706e 37
bogdanm 82:6473597d706e 38 /*! @addtogroup clock_manager*/
bogdanm 82:6473597d706e 39 /*! @{*/
bogdanm 82:6473597d706e 40
bogdanm 82:6473597d706e 41 /*! @file*/
bogdanm 82:6473597d706e 42
bogdanm 82:6473597d706e 43 /*******************************************************************************
bogdanm 82:6473597d706e 44 * Definitions
bogdanm 82:6473597d706e 45 ******************************************************************************/
bogdanm 82:6473597d706e 46
bogdanm 82:6473597d706e 47 /*! @brief Clock names */
bogdanm 82:6473597d706e 48 typedef enum _clock_names {
bogdanm 82:6473597d706e 49
bogdanm 82:6473597d706e 50 /* default system clocks*/
bogdanm 82:6473597d706e 51 kCoreClock, /**/
bogdanm 82:6473597d706e 52 kSystemClock, /**/
bogdanm 82:6473597d706e 53 kPlatformClock, /**/
bogdanm 82:6473597d706e 54 kBusClock, /**/
bogdanm 82:6473597d706e 55 kFlexBusClock, /**/
bogdanm 82:6473597d706e 56 kFlashClock, /**/
bogdanm 82:6473597d706e 57
bogdanm 82:6473597d706e 58 /* other internal clocks used by peripherals*/
bogdanm 82:6473597d706e 59
bogdanm 82:6473597d706e 60 /* osc clock*/
bogdanm 82:6473597d706e 61 kOsc32kClock,
bogdanm 82:6473597d706e 62 kOsc0ErClock,
bogdanm 82:6473597d706e 63 kOsc1ErClock,
bogdanm 82:6473597d706e 64
bogdanm 82:6473597d706e 65 /* irc 48Mhz clock */
bogdanm 82:6473597d706e 66 kIrc48mClock,
bogdanm 82:6473597d706e 67
bogdanm 82:6473597d706e 68 /* rtc clock*/
bogdanm 82:6473597d706e 69 kRtc32kClock,
bogdanm 82:6473597d706e 70 kRtc1hzClock,
bogdanm 82:6473597d706e 71
bogdanm 82:6473597d706e 72 /* lpo clcok*/
bogdanm 82:6473597d706e 73 kLpoClock,
bogdanm 82:6473597d706e 74
bogdanm 82:6473597d706e 75 /* mcg clocks*/
bogdanm 82:6473597d706e 76 kMcgFllClock,
bogdanm 82:6473597d706e 77 kMcgPll0Clock,
bogdanm 82:6473597d706e 78 kMcgPll1Clock,
bogdanm 82:6473597d706e 79 kMcgOutClock,
bogdanm 82:6473597d706e 80 kMcgIrClock,
bogdanm 82:6473597d706e 81
bogdanm 82:6473597d706e 82 /* constant clocks (provided in other header files?)*/
bogdanm 82:6473597d706e 83 kSDHC0_CLKIN,
bogdanm 82:6473597d706e 84 kENET_1588_CLKIN,
bogdanm 82:6473597d706e 85 kEXTAL_Clock,
bogdanm 82:6473597d706e 86 kEXTAL1_Clock,
bogdanm 82:6473597d706e 87 kUSB_CLKIN,
bogdanm 82:6473597d706e 88
bogdanm 82:6473597d706e 89 /* reserved value*/
bogdanm 82:6473597d706e 90 kReserved,
bogdanm 82:6473597d706e 91
bogdanm 82:6473597d706e 92 /* clock name max */
bogdanm 82:6473597d706e 93 kClockNameCount
bogdanm 82:6473597d706e 94
bogdanm 82:6473597d706e 95 } clock_names_t;
bogdanm 82:6473597d706e 96
bogdanm 82:6473597d706e 97 /*! @brief Clock gate module names */
bogdanm 82:6473597d706e 98 typedef enum _clock_gate_module_names {
bogdanm 82:6473597d706e 99
bogdanm 82:6473597d706e 100 /* System modules*/
bogdanm 82:6473597d706e 101 kClockModuleDMA, /**/
bogdanm 82:6473597d706e 102 kClockModuleDMAMUX, /* instance 0, 1*/
bogdanm 82:6473597d706e 103 kClockModulePORT, /* instance 0 - 5 (A - F)*/
bogdanm 82:6473597d706e 104 kClockModuleMPU, /**/
bogdanm 82:6473597d706e 105 kClockModuleLLWU, /**/
bogdanm 82:6473597d706e 106 kClockModuleEWM, /**/
bogdanm 82:6473597d706e 107
bogdanm 82:6473597d706e 108 /* Clocks*/
bogdanm 82:6473597d706e 109 kClockModuleOSC1, /**/
bogdanm 82:6473597d706e 110
bogdanm 82:6473597d706e 111 /* Memory and memory interfaces*/
bogdanm 82:6473597d706e 112 kClockModuleFTF, /* Flash memory control clock*/
bogdanm 82:6473597d706e 113 kClockModuleNFC, /* NAND flash control clock*/
bogdanm 82:6473597d706e 114 kClockModuleFLEXBUS, /**/
bogdanm 82:6473597d706e 115 kClockModuleDDR, /**/
bogdanm 82:6473597d706e 116
bogdanm 82:6473597d706e 117 /* Security*/
bogdanm 82:6473597d706e 118 kClockModuleCRC, /**/
bogdanm 82:6473597d706e 119 kClockModuleRNGA, /**/
bogdanm 82:6473597d706e 120 kClockModuleREGFILE, /**/
bogdanm 82:6473597d706e 121 kClockModuleDRYICESECREG, /**/
bogdanm 82:6473597d706e 122 kClockModuleDRYICE, /**/
bogdanm 82:6473597d706e 123
bogdanm 82:6473597d706e 124 /* Analog*/
bogdanm 82:6473597d706e 125 kClockModuleADC, /* instance 0 - 3*/
bogdanm 82:6473597d706e 126 kClockModuleCMP, /* */
bogdanm 82:6473597d706e 127 kClockModuleDAC, /* instance 0, 1*/
bogdanm 82:6473597d706e 128 kClockModuleVREF, /* */
bogdanm 82:6473597d706e 129 kClockModuleSAI, /* instance 0, 1*/
bogdanm 82:6473597d706e 130
bogdanm 82:6473597d706e 131 /* Timers*/
bogdanm 82:6473597d706e 132 kClockModuleTPM, /* TPM timers 0 - 2*/
bogdanm 82:6473597d706e 133 kClockModulePDB, /* */
bogdanm 82:6473597d706e 134 kClockModuleFTM, /* instance 0 - 3*/
bogdanm 82:6473597d706e 135 kClockModulePIT, /**/
bogdanm 82:6473597d706e 136 kClockModuleLPTIMER, /**/
bogdanm 82:6473597d706e 137 kClockModuleCMT, /**/
bogdanm 82:6473597d706e 138 kClockModuleRTC, /**/
bogdanm 82:6473597d706e 139
bogdanm 82:6473597d706e 140 /* Communication Interfaces*/
bogdanm 82:6473597d706e 141 kClockModuleENET, /**/
bogdanm 82:6473597d706e 142 kClockModuleUSBHS, /**/
bogdanm 82:6473597d706e 143 kClockModuleUSBFS, /**/
bogdanm 82:6473597d706e 144 kClockModuleUSBDCD, /**/
bogdanm 82:6473597d706e 145 kClockModuleFLEXCAN, /* instance 0, 1*/
bogdanm 82:6473597d706e 146 kClockModuleSPI, /* instance 0 - 2*/
bogdanm 82:6473597d706e 147 kClockModuleI2C, /* instance 0, 1*/
bogdanm 82:6473597d706e 148 kClockModuleUART, /* instance 0 - 5*/
bogdanm 82:6473597d706e 149 kClockModuleESDHC, /**/
bogdanm 82:6473597d706e 150 kClockModuleLPUART, /**/
bogdanm 82:6473597d706e 151
bogdanm 82:6473597d706e 152 /* Human-machine Interfaces*/
bogdanm 82:6473597d706e 153 kClockModuleTSI, /**/
bogdanm 82:6473597d706e 154 kClockModuleLCDC, /**/
bogdanm 82:6473597d706e 155 kClockModuleMax
bogdanm 82:6473597d706e 156 } clock_gate_module_names_t;
bogdanm 82:6473597d706e 157
bogdanm 82:6473597d706e 158 /*! @brief Clock source and SEL names */
bogdanm 82:6473597d706e 159 typedef enum _clock_source_names {
bogdanm 82:6473597d706e 160 kClockNfcSrc, /* NFCSRC*/
bogdanm 82:6473597d706e 161 kClockEsdhcSrc, /* ESDHCSRC K70*/
bogdanm 82:6473597d706e 162 kClockSdhcSrc, /* SDHCSRC K64*/
bogdanm 82:6473597d706e 163 kClockLcdcSrc, /* LCDCSRC*/
bogdanm 82:6473597d706e 164 kClockTimeSrc, /* TIMESRC*/
bogdanm 82:6473597d706e 165 kClockRmiiSrc, /* RMIISRC*/
bogdanm 82:6473597d706e 166 kClockUsbfSrc, /* USBFSRC K70*/
bogdanm 82:6473597d706e 167 kClockUsbSrc, /* USBSRC K64, KL25, KV31, and K22*/
bogdanm 82:6473597d706e 168 kClockUsbhSrc, /* USBHSRC*/
bogdanm 82:6473597d706e 169 kClockUart0Src, /* UART0SRC*/
bogdanm 82:6473597d706e 170 kClockTpmSrc, /* TPMSRC*/
bogdanm 82:6473597d706e 171 kClockOsc32kSel, /* OSC32KSEL*/
bogdanm 82:6473597d706e 172 kClockUsbfSel, /* USBF_CLKSEL*/
bogdanm 82:6473597d706e 173 kClockPllfllSel, /* PLLFLLSEL*/
bogdanm 82:6473597d706e 174 kClockNfcSel, /* NFC_CLKSEL*/
bogdanm 82:6473597d706e 175 kClockLcdcSel, /* LCDC_CLKSEL*/
bogdanm 82:6473597d706e 176 kClockTraceSel, /* TRACE_CLKSEL*/
bogdanm 82:6473597d706e 177 kClockClkoutSel, /* CLKOUTSEL*/
bogdanm 82:6473597d706e 178 kClockRtcClkoutSel, /* RTCCLKOUTSEL */
bogdanm 82:6473597d706e 179 kClockSourceMax
bogdanm 82:6473597d706e 180 } clock_source_names_t;
bogdanm 82:6473597d706e 181
bogdanm 82:6473597d706e 182 /*!
bogdanm 82:6473597d706e 183 * @brief Error code definition for the clock manager APIs
bogdanm 82:6473597d706e 184 */
bogdanm 82:6473597d706e 185 typedef enum _clock_manager_error_code {
bogdanm 82:6473597d706e 186 kClockManagerSuccess, /*!< success */
bogdanm 82:6473597d706e 187 kClockManagerNoSuchClockName, /*!< cannot find the clock name */
bogdanm 82:6473597d706e 188 kClockManagerNoSuchClockModule, /*!< cannot find the clock module name */
bogdanm 82:6473597d706e 189 kClockManagerNoSuchClockSource, /*!< cannot find the clock source name */
bogdanm 82:6473597d706e 190 kClockManagerNoSuchDivider, /*!< cannot find the divider name */
bogdanm 82:6473597d706e 191 kClockManagerUnknown /*!< unknown error*/
bogdanm 82:6473597d706e 192 } clock_manager_error_code_t;
bogdanm 82:6473597d706e 193
bogdanm 82:6473597d706e 194
bogdanm 82:6473597d706e 195 /*******************************************************************************
bogdanm 82:6473597d706e 196 * API
bogdanm 82:6473597d706e 197 ******************************************************************************/
bogdanm 82:6473597d706e 198
bogdanm 82:6473597d706e 199 #if defined(__cplusplus)
bogdanm 82:6473597d706e 200 extern "C" {
bogdanm 82:6473597d706e 201 #endif /* __cplusplus*/
bogdanm 82:6473597d706e 202
bogdanm 82:6473597d706e 203 /*! @name Clock Gating*/
bogdanm 82:6473597d706e 204 /*@{*/
bogdanm 82:6473597d706e 205
bogdanm 82:6473597d706e 206 /*!
bogdanm 82:6473597d706e 207 * @brief Enables or disables the clock for a specific clock module.
bogdanm 82:6473597d706e 208 *
bogdanm 82:6473597d706e 209 * This function enables/disables the clock for a specified clock module and
bogdanm 82:6473597d706e 210 * instance. See the clock_gate_module_names_t for supported clock module names
bogdanm 82:6473597d706e 211 * for a specific function and see the Reference Manual for supported clock module
bogdanm 82:6473597d706e 212 * name for a specific chip family. Most module drivers call this function
bogdanm 82:6473597d706e 213 * to gate(disable)/ungate(enable) the clock for a module. However, the application
bogdanm 82:6473597d706e 214 * can also call this function as needed. Disabling the clock causes the module
bogdanm 82:6473597d706e 215 * to stop working. See the Reference Manual to properly enable
bogdanm 82:6473597d706e 216 * and disable the clock for a device module.
bogdanm 82:6473597d706e 217 *
bogdanm 82:6473597d706e 218 * @param moduleName Gate control module name defined in clock_gate_module_names_t
bogdanm 82:6473597d706e 219 * @param instance Instance of the module
bogdanm 82:6473597d706e 220 * @param enable Enable or disable the clock for the module
bogdanm 82:6473597d706e 221 * - true: Enable
bogdanm 82:6473597d706e 222 * - false: Disable
bogdanm 82:6473597d706e 223 * @return status Error code defined in clock_manager_error_code_t
bogdanm 82:6473597d706e 224 */
bogdanm 82:6473597d706e 225 clock_manager_error_code_t clock_manager_set_gate(clock_gate_module_names_t moduleName,
bogdanm 82:6473597d706e 226 uint8_t instance, bool enable);
bogdanm 82:6473597d706e 227
bogdanm 82:6473597d706e 228 /*!
bogdanm 82:6473597d706e 229 * @brief Gets the current clock gate status for a specific clock module.
bogdanm 82:6473597d706e 230 *
bogdanm 82:6473597d706e 231 * This function returns the current clock gate status for a specific clock
bogdanm 82:6473597d706e 232 * module. See clock_gate_module_names_t for supported clock module name.
bogdanm 82:6473597d706e 233 *
bogdanm 82:6473597d706e 234 * @param moduleName Gate control module name defined in clock_gate_module_names_t
bogdanm 82:6473597d706e 235 * @param instance Instance of the module
bogdanm 82:6473597d706e 236 * @param isEnabled Status of the module clock
bogdanm 82:6473597d706e 237 * - true: Enabled
bogdanm 82:6473597d706e 238 * - false: Disabled
bogdanm 82:6473597d706e 239 * @return status Error code defined in clock_manager_error_code_t
bogdanm 82:6473597d706e 240 */
bogdanm 82:6473597d706e 241 clock_manager_error_code_t clock_manager_get_gate(clock_gate_module_names_t moduleName,
bogdanm 82:6473597d706e 242 uint8_t instance, bool *isEnabled);
bogdanm 82:6473597d706e 243
bogdanm 82:6473597d706e 244 /*@}*/
bogdanm 82:6473597d706e 245
bogdanm 82:6473597d706e 246 /*! @name Clock Frequencies*/
bogdanm 82:6473597d706e 247 /*@{*/
bogdanm 82:6473597d706e 248
bogdanm 82:6473597d706e 249 /*!
bogdanm 82:6473597d706e 250 * @brief Gets the clock frequency for a specific clock name.
bogdanm 82:6473597d706e 251 *
bogdanm 82:6473597d706e 252 * This function checks the current clock configurations and then calculates
bogdanm 82:6473597d706e 253 * the clock frequency for a specific clock name defined in clock_names_t.
bogdanm 82:6473597d706e 254 * The MCG must be properly configured before using this function. See
bogdanm 82:6473597d706e 255 * the Reference Manual for supported clock names for different chip families.
bogdanm 82:6473597d706e 256 * The returned value is in Hertz. If it cannot find the clock name
bogdanm 82:6473597d706e 257 * or the name is not supported for a specific chip family, it returns an
bogdanm 82:6473597d706e 258 * error.
bogdanm 82:6473597d706e 259 *
bogdanm 82:6473597d706e 260 * @param clockName Clock names defined in clock_names_t
bogdanm 82:6473597d706e 261 * @param frequency Returned clock frequency value in Hertz
bogdanm 82:6473597d706e 262 * @return status Error code defined in clock_manager_error_code_t
bogdanm 82:6473597d706e 263 */
bogdanm 82:6473597d706e 264 clock_manager_error_code_t clock_manager_get_frequency(clock_names_t clockName,
bogdanm 82:6473597d706e 265 uint32_t *frequency);
bogdanm 82:6473597d706e 266
bogdanm 82:6473597d706e 267 /*!
bogdanm 82:6473597d706e 268 * @brief Gets the clock frequency for a specified clock source.
bogdanm 82:6473597d706e 269 *
bogdanm 82:6473597d706e 270 * This function gets the specified clock source setting and converts it
bogdanm 82:6473597d706e 271 * into a clock name. It calls the internal function to get the value
bogdanm 82:6473597d706e 272 * for that clock name. The returned value is in Hertz.
bogdanm 82:6473597d706e 273 * If it cannot find the clock source or the source is not supported for the
bogdanm 82:6473597d706e 274 * specific chip family, it returns an error.
bogdanm 82:6473597d706e 275 *
bogdanm 82:6473597d706e 276 * @param clockSource Clock source names defined in clock_source_names_t
bogdanm 82:6473597d706e 277 * @param frequency Returned clock frequency value in Hertz
bogdanm 82:6473597d706e 278 * @return status Error code defined in clock_manager_error_code_t
bogdanm 82:6473597d706e 279 */
bogdanm 82:6473597d706e 280 clock_manager_error_code_t clock_manager_get_frequency_by_source(
bogdanm 82:6473597d706e 281 clock_source_names_t clockSource, uint32_t *frequency);
bogdanm 82:6473597d706e 282
bogdanm 82:6473597d706e 283 /*@}*/
bogdanm 82:6473597d706e 284
bogdanm 82:6473597d706e 285 #if defined(__cplusplus)
bogdanm 82:6473597d706e 286 }
bogdanm 82:6473597d706e 287 #endif /* __cplusplus*/
bogdanm 82:6473597d706e 288
bogdanm 82:6473597d706e 289 /*! @}*/
bogdanm 82:6473597d706e 290
bogdanm 82:6473597d706e 291 #endif /* __FSL_CLOCK_MANAGER_H__*/
bogdanm 82:6473597d706e 292 /*******************************************************************************
bogdanm 82:6473597d706e 293 * EOF
bogdanm 82:6473597d706e 294 ******************************************************************************/
bogdanm 82:6473597d706e 295