meh
Fork of mbed by
TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sim/fsl_sim_hal.h@82:6473597d706e, 2014-04-07 (annotated)
- 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?
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 | |
bogdanm | 82:6473597d706e | 31 | #if !defined(__FSL_SIM_HAL_H__) |
bogdanm | 82:6473597d706e | 32 | #define __FSL_SIM_HAL_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 | #include "fsl_device_registers.h" |
bogdanm | 82:6473597d706e | 38 | #include "fsl_sim_features.h" |
bogdanm | 82:6473597d706e | 39 | |
bogdanm | 82:6473597d706e | 40 | /*! @addtogroup sim_hal*/ |
bogdanm | 82:6473597d706e | 41 | /*! @{*/ |
bogdanm | 82:6473597d706e | 42 | |
bogdanm | 82:6473597d706e | 43 | /*! @file*/ |
bogdanm | 82:6473597d706e | 44 | |
bogdanm | 82:6473597d706e | 45 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 46 | * Definitions |
bogdanm | 82:6473597d706e | 47 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 48 | typedef enum _sim_clock_names { |
bogdanm | 82:6473597d706e | 49 | |
bogdanm | 82:6473597d706e | 50 | /* default clocks*/ |
bogdanm | 82:6473597d706e | 51 | kSimCoreClock, /**/ |
bogdanm | 82:6473597d706e | 52 | kSimSystemClock, /**/ |
bogdanm | 82:6473597d706e | 53 | kSimPlatformClock, /**/ |
bogdanm | 82:6473597d706e | 54 | kSimBusClock, /**/ |
bogdanm | 82:6473597d706e | 55 | kSimFlexBusClock, /**/ |
bogdanm | 82:6473597d706e | 56 | kSimFlashClock, /**/ |
bogdanm | 82:6473597d706e | 57 | |
bogdanm | 82:6473597d706e | 58 | /* other internal clocks used by peripherals*/ |
bogdanm | 82:6473597d706e | 59 | /* osc clock*/ |
bogdanm | 82:6473597d706e | 60 | kSimOsc32kClock, |
bogdanm | 82:6473597d706e | 61 | kSimOsc0ErClock, |
bogdanm | 82:6473597d706e | 62 | kSimOsc1ErClock, |
bogdanm | 82:6473597d706e | 63 | |
bogdanm | 82:6473597d706e | 64 | /* irc 48Mhz clock */ |
bogdanm | 82:6473597d706e | 65 | kSimIrc48mClock, |
bogdanm | 82:6473597d706e | 66 | |
bogdanm | 82:6473597d706e | 67 | /* rtc clock*/ |
bogdanm | 82:6473597d706e | 68 | kSimRtc32kClock, |
bogdanm | 82:6473597d706e | 69 | kSimRtc1hzClock, |
bogdanm | 82:6473597d706e | 70 | |
bogdanm | 82:6473597d706e | 71 | /* lpo clcok*/ |
bogdanm | 82:6473597d706e | 72 | kSimLpoClock, |
bogdanm | 82:6473597d706e | 73 | |
bogdanm | 82:6473597d706e | 74 | /* mcg clocks*/ |
bogdanm | 82:6473597d706e | 75 | kSimMcgFllClock, |
bogdanm | 82:6473597d706e | 76 | kSimMcgPll0Clock, |
bogdanm | 82:6473597d706e | 77 | kSimMcgPll1Clock, |
bogdanm | 82:6473597d706e | 78 | kSimMcgOutClock, |
bogdanm | 82:6473597d706e | 79 | kSimMcgIrClock, |
bogdanm | 82:6473597d706e | 80 | |
bogdanm | 82:6473597d706e | 81 | /* constant clocks (provided in other header files?)*/ |
bogdanm | 82:6473597d706e | 82 | kSimSDHC0_CLKIN, |
bogdanm | 82:6473597d706e | 83 | kSimENET_1588_CLKIN, |
bogdanm | 82:6473597d706e | 84 | kSimEXTAL_Clock, |
bogdanm | 82:6473597d706e | 85 | kSimEXTAL1_Clock, |
bogdanm | 82:6473597d706e | 86 | kSimUSB_CLKIN, |
bogdanm | 82:6473597d706e | 87 | |
bogdanm | 82:6473597d706e | 88 | /* reserved value*/ |
bogdanm | 82:6473597d706e | 89 | kSimReserved, |
bogdanm | 82:6473597d706e | 90 | |
bogdanm | 82:6473597d706e | 91 | kSimClockNameCount |
bogdanm | 82:6473597d706e | 92 | } sim_clock_names_t; |
bogdanm | 82:6473597d706e | 93 | |
bogdanm | 82:6473597d706e | 94 | /*! @brief Clock gate module names */ |
bogdanm | 82:6473597d706e | 95 | typedef enum _sim_clock_gate_module_names { |
bogdanm | 82:6473597d706e | 96 | |
bogdanm | 82:6473597d706e | 97 | /* System modules*/ |
bogdanm | 82:6473597d706e | 98 | kSimClockModuleDMA, /**/ |
bogdanm | 82:6473597d706e | 99 | kSimClockModuleDMAMUX, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 100 | kSimClockModulePORT, /* instance 0 - 5 (A - F)*/ |
bogdanm | 82:6473597d706e | 101 | kSimClockModuleMPU, /**/ |
bogdanm | 82:6473597d706e | 102 | kSimClockModuleLLWU, /**/ |
bogdanm | 82:6473597d706e | 103 | kSimClockModuleEWM, /**/ |
bogdanm | 82:6473597d706e | 104 | |
bogdanm | 82:6473597d706e | 105 | /* Clocks*/ |
bogdanm | 82:6473597d706e | 106 | kSimClockModuleOSC1, /**/ |
bogdanm | 82:6473597d706e | 107 | |
bogdanm | 82:6473597d706e | 108 | /* Memory and memory interfaces*/ |
bogdanm | 82:6473597d706e | 109 | kSimClockModuleFTF, /* Flash memory control clock*/ |
bogdanm | 82:6473597d706e | 110 | kSimClockModuleNFC, /* NAND flash control clock*/ |
bogdanm | 82:6473597d706e | 111 | kSimClockModuleFLEXBUS, /**/ |
bogdanm | 82:6473597d706e | 112 | kSimClockModuleDDR, /**/ |
bogdanm | 82:6473597d706e | 113 | |
bogdanm | 82:6473597d706e | 114 | /* Security*/ |
bogdanm | 82:6473597d706e | 115 | kSimClockModuleCRC, /**/ |
bogdanm | 82:6473597d706e | 116 | kSimClockModuleRNGA, /**/ |
bogdanm | 82:6473597d706e | 117 | kSimClockModuleREGFILE, /**/ |
bogdanm | 82:6473597d706e | 118 | kSimClockModuleDRYICESECREG, /**/ |
bogdanm | 82:6473597d706e | 119 | kSimClockModuleDRYICE, /**/ |
bogdanm | 82:6473597d706e | 120 | |
bogdanm | 82:6473597d706e | 121 | /* Analog*/ |
bogdanm | 82:6473597d706e | 122 | kSimClockModuleADC, /* instance 0 - 3*/ |
bogdanm | 82:6473597d706e | 123 | kSimClockModuleCMP, /* */ |
bogdanm | 82:6473597d706e | 124 | kSimClockModuleDAC, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 125 | kSimClockModuleVREF, /* */ |
bogdanm | 82:6473597d706e | 126 | kSimClockModuleSAI, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 127 | |
bogdanm | 82:6473597d706e | 128 | /* Timers*/ |
bogdanm | 82:6473597d706e | 129 | kSimClockModuleTPM, /* TPM timers 0 - 2*/ |
bogdanm | 82:6473597d706e | 130 | kSimClockModulePDB, /* */ |
bogdanm | 82:6473597d706e | 131 | kSimClockModuleFTM, /* instance 0 - 3*/ |
bogdanm | 82:6473597d706e | 132 | kSimClockModulePIT, /**/ |
bogdanm | 82:6473597d706e | 133 | kSimClockModuleLPTIMER, /**/ |
bogdanm | 82:6473597d706e | 134 | kSimClockModuleCMT, /**/ |
bogdanm | 82:6473597d706e | 135 | kSimClockModuleRTC, /**/ |
bogdanm | 82:6473597d706e | 136 | |
bogdanm | 82:6473597d706e | 137 | /* Communication Interfaces*/ |
bogdanm | 82:6473597d706e | 138 | kSimClockModuleENET, /**/ |
bogdanm | 82:6473597d706e | 139 | kSimClockModuleUSBHS, /**/ |
bogdanm | 82:6473597d706e | 140 | kSimClockModuleUSBFS, /**/ |
bogdanm | 82:6473597d706e | 141 | kSimClockModuleUSBDCD, /**/ |
bogdanm | 82:6473597d706e | 142 | kSimClockModuleFLEXCAN, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 143 | kSimClockModuleSPI, /* instance 0 - 2*/ |
bogdanm | 82:6473597d706e | 144 | kSimClockModuleI2C, /* instance 0, 1*/ |
bogdanm | 82:6473597d706e | 145 | kSimClockModuleUART, /* instance 0 - 5*/ |
bogdanm | 82:6473597d706e | 146 | kSimClockModuleESDHC, /**/ |
bogdanm | 82:6473597d706e | 147 | kSimClockModuleLPUART, /**/ |
bogdanm | 82:6473597d706e | 148 | |
bogdanm | 82:6473597d706e | 149 | /* Human-machine Interfaces*/ |
bogdanm | 82:6473597d706e | 150 | kSimClockModuleTSI, /**/ |
bogdanm | 82:6473597d706e | 151 | kSimClockModuleLCDC, /**/ |
bogdanm | 82:6473597d706e | 152 | kSimClockModuleMax |
bogdanm | 82:6473597d706e | 153 | } sim_clock_gate_module_names_t; |
bogdanm | 82:6473597d706e | 154 | |
bogdanm | 82:6473597d706e | 155 | /*! @brief Clock source and sel names */ |
bogdanm | 82:6473597d706e | 156 | typedef enum _sim_clock_source_names { |
bogdanm | 82:6473597d706e | 157 | kSimClockNfcSrc, /* NFCSRC*/ |
bogdanm | 82:6473597d706e | 158 | kSimClockEsdhcSrc, /* ESDHCSRC K70*/ |
bogdanm | 82:6473597d706e | 159 | kSimClockSdhcSrc, /* SDHCSRC K64*/ |
bogdanm | 82:6473597d706e | 160 | kSimClockLcdcSrc, /* LCDCSRC*/ |
bogdanm | 82:6473597d706e | 161 | kSimClockTimeSrc, /* TIMESRC*/ |
bogdanm | 82:6473597d706e | 162 | kSimClockRmiiSrc, /* RMIISRC*/ |
bogdanm | 82:6473597d706e | 163 | kSimClockUsbfSrc, /* USBFSRC K70*/ |
bogdanm | 82:6473597d706e | 164 | kSimClockUsbSrc, /* USBSRC K64, KL25, KV31, and K22*/ |
bogdanm | 82:6473597d706e | 165 | kSimClockUsbhSrc, /* USBHSRC*/ |
bogdanm | 82:6473597d706e | 166 | kSimClockUart0Src, /* UART0SRC*/ |
bogdanm | 82:6473597d706e | 167 | kSimClockTpmSrc, /* TPMSRC*/ |
bogdanm | 82:6473597d706e | 168 | kSimClockOsc32kSel, /* OSC32KSEL*/ |
bogdanm | 82:6473597d706e | 169 | kSimClockUsbfSel, /* USBF_CLKSEL*/ |
bogdanm | 82:6473597d706e | 170 | kSimClockPllfllSel, /* PLLFLLSEL*/ |
bogdanm | 82:6473597d706e | 171 | kSimClockNfcSel, /* NFC_CLKSEL*/ |
bogdanm | 82:6473597d706e | 172 | kSimClockLcdcSel, /* LCDC_CLKSEL*/ |
bogdanm | 82:6473597d706e | 173 | kSimClockTraceSel, /* TRACE_CLKSEL*/ |
bogdanm | 82:6473597d706e | 174 | kSimClockClkoutSel, /* CLKOUTSEL*/ |
bogdanm | 82:6473597d706e | 175 | kSimClockRtcClkoutSel, /* RTCCLKOUTSEL */ |
bogdanm | 82:6473597d706e | 176 | kSimClockSourceMax |
bogdanm | 82:6473597d706e | 177 | } sim_clock_source_names_t; |
bogdanm | 82:6473597d706e | 178 | |
bogdanm | 82:6473597d706e | 179 | /*! @brief Clock Divider names*/ |
bogdanm | 82:6473597d706e | 180 | typedef enum _sim_clock_divider_names { |
bogdanm | 82:6473597d706e | 181 | kSimClockDividerOutdiv1, /* OUTDIV1*/ |
bogdanm | 82:6473597d706e | 182 | kSimClockDividerOutdiv2, /* OUTDIV2*/ |
bogdanm | 82:6473597d706e | 183 | kSimClockDividerOutdiv3, /* OUTDIV3*/ |
bogdanm | 82:6473597d706e | 184 | kSimClockDividerOutdiv4, /* OUTDIV4*/ |
bogdanm | 82:6473597d706e | 185 | kSimClockDividerUsbFrac, /* (USBFRAC + 1) / (USBDIV + 1)*/ |
bogdanm | 82:6473597d706e | 186 | kSimClockDividerUsbDiv, |
bogdanm | 82:6473597d706e | 187 | kSimClockDividerUsbfsFrac, /* (USBFSFRAC + 1) / (USBFSDIV) + 1)*/ |
bogdanm | 82:6473597d706e | 188 | kSimClockDividerUsbfsDiv, |
bogdanm | 82:6473597d706e | 189 | kSimClockDividerUsbhsFrac, /* (USBHSFRAC + 1) / (USBHSDIV + 1)*/ |
bogdanm | 82:6473597d706e | 190 | kSimClockDividerUsbhsDiv, |
bogdanm | 82:6473597d706e | 191 | kSimClockDividerLcdcFrac, /* (LCDCFRAC + 1) / (LCDCDIV + 1)*/ |
bogdanm | 82:6473597d706e | 192 | kSimClockDividerLcdcDiv, |
bogdanm | 82:6473597d706e | 193 | kSimClockDividerNfcFrac, /* (NFCFRAC + 1) / (NFCDIV + 1)*/ |
bogdanm | 82:6473597d706e | 194 | kSimClockDividerNfcDiv, |
bogdanm | 82:6473597d706e | 195 | kSimClockDividerSpecial1, /* special divider 1*/ |
bogdanm | 82:6473597d706e | 196 | kSimClockDividerMax |
bogdanm | 82:6473597d706e | 197 | } sim_clock_divider_names_t; |
bogdanm | 82:6473597d706e | 198 | |
bogdanm | 82:6473597d706e | 199 | /*! @brief SIM USB voltage regulator in standby mode setting during stop modes */ |
bogdanm | 82:6473597d706e | 200 | typedef enum _sim_usbsstby_stop |
bogdanm | 82:6473597d706e | 201 | { |
bogdanm | 82:6473597d706e | 202 | kSimUsbsstbyNoRegulator, /* regulator not in standby during Stop modes */ |
bogdanm | 82:6473597d706e | 203 | kSimUsbsstbyWithRegulator /* regulator in standby during Stop modes */ |
bogdanm | 82:6473597d706e | 204 | } sim_usbsstby_stop_t; |
bogdanm | 82:6473597d706e | 205 | |
bogdanm | 82:6473597d706e | 206 | /*! @brief SIM USB voltage regulator in standby mode setting during VLPR and VLPW modes */ |
bogdanm | 82:6473597d706e | 207 | typedef enum _sim_usbvstby_stop |
bogdanm | 82:6473597d706e | 208 | { |
bogdanm | 82:6473597d706e | 209 | kSimUsbvstbyNoRegulator, /* regulator not in standby during VLPR and VLPW modes */ |
bogdanm | 82:6473597d706e | 210 | kSimUsbvstbyWithRegulator /* regulator in standby during VLPR and VLPW modes */ |
bogdanm | 82:6473597d706e | 211 | } sim_usbvstby_stop_t; |
bogdanm | 82:6473597d706e | 212 | |
bogdanm | 82:6473597d706e | 213 | /*! @brief SIM CMT/UART pad drive strength */ |
bogdanm | 82:6473597d706e | 214 | typedef enum _sim_cmtuartpad_strengh |
bogdanm | 82:6473597d706e | 215 | { |
bogdanm | 82:6473597d706e | 216 | kSimCmtuartSinglePad, /* Single-pad drive strength for CMT IRO or UART0_TXD */ |
bogdanm | 82:6473597d706e | 217 | kSimCmtuartDualPad /* Dual-pad drive strength for CMT IRO or UART0_TXD */ |
bogdanm | 82:6473597d706e | 218 | } sim_cmtuartpad_strengh_t; |
bogdanm | 82:6473597d706e | 219 | |
bogdanm | 82:6473597d706e | 220 | /*! @brief SIM PTD7 pad drive strength */ |
bogdanm | 82:6473597d706e | 221 | typedef enum _sim_ptd7pad_strengh |
bogdanm | 82:6473597d706e | 222 | { |
bogdanm | 82:6473597d706e | 223 | kSimPtd7padSinglePad, /* Single-pad drive strength for PTD7 */ |
bogdanm | 82:6473597d706e | 224 | kSimPtd7padDualPad /* Dual-pad drive strength for PTD7 */ |
bogdanm | 82:6473597d706e | 225 | } sim_ptd7pad_strengh_t; |
bogdanm | 82:6473597d706e | 226 | |
bogdanm | 82:6473597d706e | 227 | /*! @brief SIM FlexBus security level */ |
bogdanm | 82:6473597d706e | 228 | typedef enum _sim_flexbus_security_level |
bogdanm | 82:6473597d706e | 229 | { |
bogdanm | 82:6473597d706e | 230 | kSimFbslLevel0, /* All off-chip accesses (op code and data) via the FlexBus */ |
bogdanm | 82:6473597d706e | 231 | /* and DDR controller are disallowed */ |
bogdanm | 82:6473597d706e | 232 | kSimFbslLevel1, /* Undefined */ |
bogdanm | 82:6473597d706e | 233 | kSimFbslLevel2, /* Off-chip op code accesses are disallowed. Data accesses */ |
bogdanm | 82:6473597d706e | 234 | /* are allowed */ |
bogdanm | 82:6473597d706e | 235 | kSimFbslLevel3 /* Off-chip op code accesses and data accesses are allowed */ |
bogdanm | 82:6473597d706e | 236 | } sim_flexbus_security_level_t; |
bogdanm | 82:6473597d706e | 237 | |
bogdanm | 82:6473597d706e | 238 | /*! @brief SIM ADCx pre-trigger select */ |
bogdanm | 82:6473597d706e | 239 | typedef enum _sim_pretrgsel |
bogdanm | 82:6473597d706e | 240 | { |
bogdanm | 82:6473597d706e | 241 | kSimAdcPretrgselA, /* Pre-trigger A selected for ADCx */ |
bogdanm | 82:6473597d706e | 242 | kSimAdcPretrgselB /* Pre-trigger B selected for ADCx */ |
bogdanm | 82:6473597d706e | 243 | } sim_pretrgsel_t; |
bogdanm | 82:6473597d706e | 244 | |
bogdanm | 82:6473597d706e | 245 | /*! @brief SIM ADCx trigger select */ |
bogdanm | 82:6473597d706e | 246 | typedef enum _sim_trgsel |
bogdanm | 82:6473597d706e | 247 | { |
bogdanm | 82:6473597d706e | 248 | kSimAdcTrgselExt, /* External trigger */ |
bogdanm | 82:6473597d706e | 249 | kSimAdcTrgSelHighSpeedComp0, /* High speed comparator 0 asynchronous interrupt */ |
bogdanm | 82:6473597d706e | 250 | kSimAdcTrgSelHighSpeedComp1, /* High speed comparator 1 asynchronous interrupt */ |
bogdanm | 82:6473597d706e | 251 | kSimAdcTrgSelHighSpeedComp2, /* High speed comparator 2 asynchronous interrupt */ |
bogdanm | 82:6473597d706e | 252 | kSimAdcTrgSelPit0, /* PIT trigger 0 */ |
bogdanm | 82:6473597d706e | 253 | kSimAdcTrgSelPit1, /* PIT trigger 1 */ |
bogdanm | 82:6473597d706e | 254 | kSimAdcTrgSelPit2, /* PIT trigger 2 */ |
bogdanm | 82:6473597d706e | 255 | kSimAdcTrgSelPit3, /* PIT trigger 3 */ |
bogdanm | 82:6473597d706e | 256 | kSimAdcTrgSelFtm0, /* FTM0 trigger */ |
bogdanm | 82:6473597d706e | 257 | kSimAdcTrgSelFtm1, /* FTM1 trigger */ |
bogdanm | 82:6473597d706e | 258 | kSimAdcTrgSelFtm2, /* FTM2 trigger */ |
bogdanm | 82:6473597d706e | 259 | kSimAdcTrgSelFtm3, /* FTM3 trigger */ |
bogdanm | 82:6473597d706e | 260 | kSimAdcTrgSelRtcAlarm, /* RTC alarm */ |
bogdanm | 82:6473597d706e | 261 | kSimAdcTrgSelRtcSec, /* RTC seconds */ |
bogdanm | 82:6473597d706e | 262 | kSimAdcTrgSelLptimer, /* Low-power timer trigger */ |
bogdanm | 82:6473597d706e | 263 | kSimAdcTrgSelHigSpeedComp3 /* High speed comparator 3 asynchronous interrupt */ |
bogdanm | 82:6473597d706e | 264 | } sim_trgsel_t; |
bogdanm | 82:6473597d706e | 265 | |
bogdanm | 82:6473597d706e | 266 | /*! @brief SIM receive data source select */ |
bogdanm | 82:6473597d706e | 267 | typedef enum _sim_uart_rxsrc |
bogdanm | 82:6473597d706e | 268 | { |
bogdanm | 82:6473597d706e | 269 | kSimUartRxsrcPin, /* UARTx_RX Pin */ |
bogdanm | 82:6473597d706e | 270 | kSimUartRxsrcCmp0, /* CMP0 */ |
bogdanm | 82:6473597d706e | 271 | kSimUartRxsrcCmp1, /* CMP1 */ |
bogdanm | 82:6473597d706e | 272 | kSimUartRxsrcReserved /* Reserved */ |
bogdanm | 82:6473597d706e | 273 | } sim_uart_rxsrc_t; |
bogdanm | 82:6473597d706e | 274 | |
bogdanm | 82:6473597d706e | 275 | /*! @brief SIM transmit data source select */ |
bogdanm | 82:6473597d706e | 276 | typedef enum _sim_uart_txsrc |
bogdanm | 82:6473597d706e | 277 | { |
bogdanm | 82:6473597d706e | 278 | kSimUartTxsrcPin, /* UARTx_TX Pin */ |
bogdanm | 82:6473597d706e | 279 | kSimUartTxsrcCmp0, /* UARTx_TX pin modulated with FTM1 channel 0 output */ |
bogdanm | 82:6473597d706e | 280 | kSimUartTxsrcCmp1, /* UARTx_TX pin modulated with FTM2 channel 0 output */ |
bogdanm | 82:6473597d706e | 281 | kSimUartTxsrcReserved /* Reserved */ |
bogdanm | 82:6473597d706e | 282 | } sim_uart_txsrc_t; |
bogdanm | 82:6473597d706e | 283 | |
bogdanm | 82:6473597d706e | 284 | /*! @brief SIM FlexTimer x trigger y select */ |
bogdanm | 82:6473597d706e | 285 | typedef enum _sim_ftm_trg_src |
bogdanm | 82:6473597d706e | 286 | { |
bogdanm | 82:6473597d706e | 287 | kSimFtmTrgSrc0, /* FlexTimer x trigger y select 0 */ |
bogdanm | 82:6473597d706e | 288 | kSimFtmTrgSrc1 /* FlexTimer x trigger y select 1 */ |
bogdanm | 82:6473597d706e | 289 | } sim_ftm_trg_src_t; |
bogdanm | 82:6473597d706e | 290 | |
bogdanm | 82:6473597d706e | 291 | /*! @brief SIM FlexTimer external clock select */ |
bogdanm | 82:6473597d706e | 292 | typedef enum _sim_ftm_clk_sel |
bogdanm | 82:6473597d706e | 293 | { |
bogdanm | 82:6473597d706e | 294 | kSimFtmClkSel0, /* FTM CLKIN0 pin. */ |
bogdanm | 82:6473597d706e | 295 | kSimFtmClkSel1 /* FTM CLKIN1 pin. */ |
bogdanm | 82:6473597d706e | 296 | } sim_ftm_clk_sel_t; |
bogdanm | 82:6473597d706e | 297 | |
bogdanm | 82:6473597d706e | 298 | /*! @brief SIM FlexTimer x channel y input capture source select */ |
bogdanm | 82:6473597d706e | 299 | typedef enum _sim_ftm_ch_src |
bogdanm | 82:6473597d706e | 300 | { |
bogdanm | 82:6473597d706e | 301 | kSimFtmChSrc0, /* See RM for details of each selection for each channel */ |
bogdanm | 82:6473597d706e | 302 | kSimFtmChSrc1, /* See RM for details of each selection for each channel */ |
bogdanm | 82:6473597d706e | 303 | kSimFtmChSrc2, /* See RM for details of each selection for each channel */ |
bogdanm | 82:6473597d706e | 304 | kSimFtmChSrc3 /* See RM for details of each selection for each channel */ |
bogdanm | 82:6473597d706e | 305 | } sim_ftm_ch_src_t; |
bogdanm | 82:6473597d706e | 306 | |
bogdanm | 82:6473597d706e | 307 | /*! @brief SIM FlexTimer x Fault y select */ |
bogdanm | 82:6473597d706e | 308 | typedef enum _sim_ftm_flt_sel |
bogdanm | 82:6473597d706e | 309 | { |
bogdanm | 82:6473597d706e | 310 | kSimFtmFltSel0, /* FlexTimer x fault y select 0 */ |
bogdanm | 82:6473597d706e | 311 | kSimFtmFltSel1 /* FlexTimer x fault y select 1 */ |
bogdanm | 82:6473597d706e | 312 | } sim_ftm_flt_sel_t; |
bogdanm | 82:6473597d706e | 313 | |
bogdanm | 82:6473597d706e | 314 | /*! @brief SIM Timer/PWM external clock select */ |
bogdanm | 82:6473597d706e | 315 | typedef enum _sim_tpm_clk_sel |
bogdanm | 82:6473597d706e | 316 | { |
bogdanm | 82:6473597d706e | 317 | kSimTpmClkSel0, /* Timer/PWM TPM_CLKIN0 pin. */ |
bogdanm | 82:6473597d706e | 318 | kSimTpmClkSel1 /* Timer/PWM TPM_CLKIN1 pin. */ |
bogdanm | 82:6473597d706e | 319 | } sim_tpm_clk_sel_t; |
bogdanm | 82:6473597d706e | 320 | |
bogdanm | 82:6473597d706e | 321 | /*! @brief SIM Timer/PWM x channel y input capture source select */ |
bogdanm | 82:6473597d706e | 322 | typedef enum _sim_tpm_ch_src |
bogdanm | 82:6473597d706e | 323 | { |
bogdanm | 82:6473597d706e | 324 | kSimTpmChSrc0, /* TPMx_CH0 signal */ |
bogdanm | 82:6473597d706e | 325 | kSimTpmChSrc1 /* CMP0 output */ |
bogdanm | 82:6473597d706e | 326 | } sim_tpm_ch_src_t; |
bogdanm | 82:6473597d706e | 327 | |
bogdanm | 82:6473597d706e | 328 | /*! @brief SIM HAL API return status*/ |
bogdanm | 82:6473597d706e | 329 | typedef enum _sim_hal_status { |
bogdanm | 82:6473597d706e | 330 | kSimHalSuccess, |
bogdanm | 82:6473597d706e | 331 | kSimHalFail, |
bogdanm | 82:6473597d706e | 332 | kSimHalNoSuchModule, |
bogdanm | 82:6473597d706e | 333 | kSimHalNoSuchClockSrc, |
bogdanm | 82:6473597d706e | 334 | kSimHalNoSuchDivider |
bogdanm | 82:6473597d706e | 335 | } sim_hal_status_t; |
bogdanm | 82:6473597d706e | 336 | |
bogdanm | 82:6473597d706e | 337 | /*! @brief Clock gate module configuration table structure*/ |
bogdanm | 82:6473597d706e | 338 | typedef struct SimClockGateModuleConfig { |
bogdanm | 82:6473597d706e | 339 | sim_clock_gate_module_names_t clockGateModuleName; /*!< clock module name*/ |
bogdanm | 82:6473597d706e | 340 | uint8_t deviceInstance; /*!< device instance*/ |
bogdanm | 82:6473597d706e | 341 | uint32_t scgcRegAddress; /*!< clock gate control register address*/ |
bogdanm | 82:6473597d706e | 342 | uint32_t deviceMask; /*!< device mask in control register*/ |
bogdanm | 82:6473597d706e | 343 | } sim_clock_gate_module_config_t; |
bogdanm | 82:6473597d706e | 344 | |
bogdanm | 82:6473597d706e | 345 | /*! @brief clock source value table structure*/ |
bogdanm | 82:6473597d706e | 346 | typedef struct SimClockSourceValue { |
bogdanm | 82:6473597d706e | 347 | union{ |
bogdanm | 82:6473597d706e | 348 | uint8_t name; |
bogdanm | 82:6473597d706e | 349 | sim_clock_names_t clockName; /*!< clock name*/ |
bogdanm | 82:6473597d706e | 350 | sim_clock_source_names_t clockSelName; |
bogdanm | 82:6473597d706e | 351 | }; |
bogdanm | 82:6473597d706e | 352 | bool isSel; /*!< clock sel flag*/ |
bogdanm | 82:6473597d706e | 353 | bool hasDivider; /*!< has divider*/ |
bogdanm | 82:6473597d706e | 354 | sim_clock_divider_names_t dividerName; /*!< divider name*/ |
bogdanm | 82:6473597d706e | 355 | } sim_clock_source_value_t; |
bogdanm | 82:6473597d706e | 356 | |
bogdanm | 82:6473597d706e | 357 | /*! @brief Clock name configuration table structure*/ |
bogdanm | 82:6473597d706e | 358 | typedef struct SimClockNameConfig { |
bogdanm | 82:6473597d706e | 359 | sim_clock_names_t clockName; /*!< clock name*/ |
bogdanm | 82:6473597d706e | 360 | bool useOtherRefClock; /*!< if it uses the other ref clock*/ |
bogdanm | 82:6473597d706e | 361 | sim_clock_names_t otherRefClockName; /*!< other ref clock name*/ |
bogdanm | 82:6473597d706e | 362 | sim_clock_divider_names_t dividerName; /*!< clock divider name*/ |
bogdanm | 82:6473597d706e | 363 | } sim_clock_name_config_t; |
bogdanm | 82:6473597d706e | 364 | |
bogdanm | 82:6473597d706e | 365 | /*! @brief clock name configuration table for specified CPU defined in fsl_clock_module_names_Kxxx.h*/ |
bogdanm | 82:6473597d706e | 366 | extern const sim_clock_name_config_t kSimClockNameConfigTable[]; |
bogdanm | 82:6473597d706e | 367 | |
bogdanm | 82:6473597d706e | 368 | /*! @brief SIM configuration table for clock module names*/ |
bogdanm | 82:6473597d706e | 369 | extern const sim_clock_gate_module_config_t kSimClockGateModuleConfigTable[]; |
bogdanm | 82:6473597d706e | 370 | |
bogdanm | 82:6473597d706e | 371 | /*! @brief clock source value table for specified CPU */ |
bogdanm | 82:6473597d706e | 372 | extern const sim_clock_source_value_t *kClockSourceValueTable[]; |
bogdanm | 82:6473597d706e | 373 | |
bogdanm | 82:6473597d706e | 374 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 375 | * API |
bogdanm | 82:6473597d706e | 376 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 377 | |
bogdanm | 82:6473597d706e | 378 | #if defined(__cplusplus) |
bogdanm | 82:6473597d706e | 379 | extern "C" { |
bogdanm | 82:6473597d706e | 380 | #endif /* __cplusplus*/ |
bogdanm | 82:6473597d706e | 381 | |
bogdanm | 82:6473597d706e | 382 | /*! @name clock related feature APIs*/ |
bogdanm | 82:6473597d706e | 383 | /*@{*/ |
bogdanm | 82:6473597d706e | 384 | |
bogdanm | 82:6473597d706e | 385 | /*! |
bogdanm | 82:6473597d706e | 386 | * @brief Enables or disables the clock for a specified clock module. |
bogdanm | 82:6473597d706e | 387 | * |
bogdanm | 82:6473597d706e | 388 | * This function enables/disables the clock for a specified clock module and instance. |
bogdanm | 82:6473597d706e | 389 | * |
bogdanm | 82:6473597d706e | 390 | * @param clockModule Clock module name defined in the sim_clock_gate_module_names_t |
bogdanm | 82:6473597d706e | 391 | * @param instance Module instance |
bogdanm | 82:6473597d706e | 392 | * @param enable Enable or disable the clock |
bogdanm | 82:6473597d706e | 393 | * - true: enable the clock |
bogdanm | 82:6473597d706e | 394 | * - false: disable the clock |
bogdanm | 82:6473597d706e | 395 | * @return status If the clock module name doesn't exist, it returns an error. |
bogdanm | 82:6473597d706e | 396 | */ |
bogdanm | 82:6473597d706e | 397 | sim_hal_status_t clock_hal_set_gate(sim_clock_gate_module_names_t clockModule, uint8_t instance, |
bogdanm | 82:6473597d706e | 398 | bool enable); |
bogdanm | 82:6473597d706e | 399 | |
bogdanm | 82:6473597d706e | 400 | /*! |
bogdanm | 82:6473597d706e | 401 | * @brief Gets the clock enabled or disabled state. |
bogdanm | 82:6473597d706e | 402 | * |
bogdanm | 82:6473597d706e | 403 | * This function gets the current clock gate status of the specified clock |
bogdanm | 82:6473597d706e | 404 | * module and instance. |
bogdanm | 82:6473597d706e | 405 | * |
bogdanm | 82:6473597d706e | 406 | * @param clockModule Clock module name defined in sim_clock_gate_module_names_t |
bogdanm | 82:6473597d706e | 407 | * @param instance Module instance |
bogdanm | 82:6473597d706e | 408 | * @param isEnabled returned status, clock is enabled or disabled for the module. |
bogdanm | 82:6473597d706e | 409 | * - true: enabled |
bogdanm | 82:6473597d706e | 410 | * - false: disabled |
bogdanm | 82:6473597d706e | 411 | * @return status if the clock module name doesn't exist, it returns an error. |
bogdanm | 82:6473597d706e | 412 | */ |
bogdanm | 82:6473597d706e | 413 | sim_hal_status_t clock_hal_get_gate(sim_clock_gate_module_names_t clockModule, uint8_t instance, |
bogdanm | 82:6473597d706e | 414 | bool *isEnabled); |
bogdanm | 82:6473597d706e | 415 | |
bogdanm | 82:6473597d706e | 416 | /*! |
bogdanm | 82:6473597d706e | 417 | * @brief Sets the clock source setting. |
bogdanm | 82:6473597d706e | 418 | * |
bogdanm | 82:6473597d706e | 419 | * This function sets the settings for a specified clock source. Each clock |
bogdanm | 82:6473597d706e | 420 | * source has its own clock selection settings. See the chip reference manual for |
bogdanm | 82:6473597d706e | 421 | * clock source detailed settings and the sim_clock_source_names_t |
bogdanm | 82:6473597d706e | 422 | * for clock sources. |
bogdanm | 82:6473597d706e | 423 | * |
bogdanm | 82:6473597d706e | 424 | * @param clockSource Clock source name defined in sim_clock_source_names_t |
bogdanm | 82:6473597d706e | 425 | * @param setting Setting value |
bogdanm | 82:6473597d706e | 426 | * @return status If the clock source doesn't exist, it returns an error. |
bogdanm | 82:6473597d706e | 427 | */ |
bogdanm | 82:6473597d706e | 428 | sim_hal_status_t clock_hal_set_clock_source(sim_clock_source_names_t clockSource, uint8_t setting); |
bogdanm | 82:6473597d706e | 429 | |
bogdanm | 82:6473597d706e | 430 | /*! |
bogdanm | 82:6473597d706e | 431 | * @brief Gets the clock source setting. |
bogdanm | 82:6473597d706e | 432 | * |
bogdanm | 82:6473597d706e | 433 | * This function gets the settings for a specified clock source. Each clock |
bogdanm | 82:6473597d706e | 434 | * source has its own clock selection settings. See the reference manual for |
bogdanm | 82:6473597d706e | 435 | * clock source detailed settings and the sim_clock_source_names_t |
bogdanm | 82:6473597d706e | 436 | * for clock sources. |
bogdanm | 82:6473597d706e | 437 | * |
bogdanm | 82:6473597d706e | 438 | * @param clockSource Clock source name |
bogdanm | 82:6473597d706e | 439 | * @param setting Current setting for the clock source |
bogdanm | 82:6473597d706e | 440 | * @return status If the clock source doesn't exist, it returns an error. |
bogdanm | 82:6473597d706e | 441 | */ |
bogdanm | 82:6473597d706e | 442 | sim_hal_status_t clock_hal_get_clock_source(sim_clock_source_names_t clockSource, |
bogdanm | 82:6473597d706e | 443 | uint8_t *setting); |
bogdanm | 82:6473597d706e | 444 | |
bogdanm | 82:6473597d706e | 445 | /*! |
bogdanm | 82:6473597d706e | 446 | * @brief Sets the clock divider setting. |
bogdanm | 82:6473597d706e | 447 | * |
bogdanm | 82:6473597d706e | 448 | * This function sets the setting for a specified clock divider. See the |
bogdanm | 82:6473597d706e | 449 | * reference manual for a supported clock divider and value range and the |
bogdanm | 82:6473597d706e | 450 | * sim_clock_divider_names_t for dividers. |
bogdanm | 82:6473597d706e | 451 | * |
bogdanm | 82:6473597d706e | 452 | * @param clockDivider Clock divider name |
bogdanm | 82:6473597d706e | 453 | * @param divider Divider setting |
bogdanm | 82:6473597d706e | 454 | * @return status If the clock divider doesn't exist, it returns an error. |
bogdanm | 82:6473597d706e | 455 | */ |
bogdanm | 82:6473597d706e | 456 | sim_hal_status_t clock_hal_set_clock_divider(sim_clock_divider_names_t clockDivider, |
bogdanm | 82:6473597d706e | 457 | uint32_t setting); |
bogdanm | 82:6473597d706e | 458 | |
bogdanm | 82:6473597d706e | 459 | /*! |
bogdanm | 82:6473597d706e | 460 | * @brief Sets the clock out dividers setting. |
bogdanm | 82:6473597d706e | 461 | * |
bogdanm | 82:6473597d706e | 462 | * This function sets the setting for all clock out dividers at the same time. |
bogdanm | 82:6473597d706e | 463 | * See the reference manual for a supported clock divider and value range and the |
bogdanm | 82:6473597d706e | 464 | * sim_clock_divider_names_t for clock out dividers. |
bogdanm | 82:6473597d706e | 465 | * |
bogdanm | 82:6473597d706e | 466 | * @param outdiv1 Outdivider1 setting |
bogdanm | 82:6473597d706e | 467 | * @param outdiv2 Outdivider2 setting |
bogdanm | 82:6473597d706e | 468 | * @param outdiv3 Outdivider3 setting |
bogdanm | 82:6473597d706e | 469 | * @param outdiv4 Outdivider4 setting |
bogdanm | 82:6473597d706e | 470 | */ |
bogdanm | 82:6473597d706e | 471 | void clock_hal_set_clock_out_dividers(uint32_t outdiv1, uint32_t outdiv2, |
bogdanm | 82:6473597d706e | 472 | uint32_t outdiv3, uint32_t outdiv4); |
bogdanm | 82:6473597d706e | 473 | |
bogdanm | 82:6473597d706e | 474 | /*! |
bogdanm | 82:6473597d706e | 475 | * @brief Gets the clock divider setting. |
bogdanm | 82:6473597d706e | 476 | * |
bogdanm | 82:6473597d706e | 477 | * This function gets the setting for a specified clock divider. See the |
bogdanm | 82:6473597d706e | 478 | * reference manual for a supported clock divider and value range and the |
bogdanm | 82:6473597d706e | 479 | * sim_clock_divider_names_t for dividers. |
bogdanm | 82:6473597d706e | 480 | * |
bogdanm | 82:6473597d706e | 481 | * @param clockDivider Clock divider name |
bogdanm | 82:6473597d706e | 482 | * @param divider Divider value pointer |
bogdanm | 82:6473597d706e | 483 | * @return status If the clock divider doesn't exist, it returns an error. |
bogdanm | 82:6473597d706e | 484 | */ |
bogdanm | 82:6473597d706e | 485 | sim_hal_status_t clock_hal_get_clock_divider(sim_clock_divider_names_t clockDivider, |
bogdanm | 82:6473597d706e | 486 | uint32_t *setting); |
bogdanm | 82:6473597d706e | 487 | |
bogdanm | 82:6473597d706e | 488 | /*@}*/ |
bogdanm | 82:6473597d706e | 489 | |
bogdanm | 82:6473597d706e | 490 | /*! @name individual field access APIs*/ |
bogdanm | 82:6473597d706e | 491 | /*@{*/ |
bogdanm | 82:6473597d706e | 492 | |
bogdanm | 82:6473597d706e | 493 | /*! |
bogdanm | 82:6473597d706e | 494 | * @brief Sets the USB voltage regulator enabled setting. |
bogdanm | 82:6473597d706e | 495 | * |
bogdanm | 82:6473597d706e | 496 | * This function controls whether the USB voltage regulator is enabled. This bit |
bogdanm | 82:6473597d706e | 497 | * can only be written when the SOPT1CFG[URWE] bit is set. |
bogdanm | 82:6473597d706e | 498 | * |
bogdanm | 82:6473597d706e | 499 | * @param enable USB voltage regulator enable setting |
bogdanm | 82:6473597d706e | 500 | * - true: USB voltage regulator is enabled. |
bogdanm | 82:6473597d706e | 501 | * - false: USB voltage regulator is disabled. |
bogdanm | 82:6473597d706e | 502 | */ |
bogdanm | 82:6473597d706e | 503 | static inline void sim_set_usbregen(bool enable) |
bogdanm | 82:6473597d706e | 504 | { |
bogdanm | 82:6473597d706e | 505 | BW_SIM_SOPT1_USBREGEN(enable ? 1 : 0); |
bogdanm | 82:6473597d706e | 506 | } |
bogdanm | 82:6473597d706e | 507 | |
bogdanm | 82:6473597d706e | 508 | /*! |
bogdanm | 82:6473597d706e | 509 | * @brief Gets the USB voltage regulator enabled setting. |
bogdanm | 82:6473597d706e | 510 | * |
bogdanm | 82:6473597d706e | 511 | * This function gets the USB voltage regulator enabled setting. |
bogdanm | 82:6473597d706e | 512 | * |
bogdanm | 82:6473597d706e | 513 | * @return enabled True if the USB voltage regulator is enabled. |
bogdanm | 82:6473597d706e | 514 | */ |
bogdanm | 82:6473597d706e | 515 | static inline bool sim_get_usbregen(void) |
bogdanm | 82:6473597d706e | 516 | { |
bogdanm | 82:6473597d706e | 517 | return BR_SIM_SOPT1_USBREGEN; |
bogdanm | 82:6473597d706e | 518 | } |
bogdanm | 82:6473597d706e | 519 | |
bogdanm | 82:6473597d706e | 520 | /*! |
bogdanm | 82:6473597d706e | 521 | * @brief Sets the USB voltage regulator in a standby mode setting during Stop, VLPS, LLS, and VLLS. |
bogdanm | 82:6473597d706e | 522 | * |
bogdanm | 82:6473597d706e | 523 | * This function controls whether the USB voltage regulator is placed in a standby |
bogdanm | 82:6473597d706e | 524 | * mode during Stop, VLPS, LLS, and VLLS modes. This bit can only be written when the |
bogdanm | 82:6473597d706e | 525 | * SOPT1CFG[USSWE] bit is set. |
bogdanm | 82:6473597d706e | 526 | * |
bogdanm | 82:6473597d706e | 527 | * @param setting USB voltage regulator in standby mode setting |
bogdanm | 82:6473597d706e | 528 | * - 0: USB voltage regulator not in standby during Stop, VLPS, LLS and |
bogdanm | 82:6473597d706e | 529 | * VLLS modes. |
bogdanm | 82:6473597d706e | 530 | * - 1: USB voltage regulator in standby during Stop, VLPS, LLS and VLLS |
bogdanm | 82:6473597d706e | 531 | * modes. |
bogdanm | 82:6473597d706e | 532 | */ |
bogdanm | 82:6473597d706e | 533 | static inline void sim_set_usbsstby(sim_usbsstby_stop_t setting) |
bogdanm | 82:6473597d706e | 534 | { |
bogdanm | 82:6473597d706e | 535 | BW_SIM_SOPT1_USBSSTBY(setting); |
bogdanm | 82:6473597d706e | 536 | } |
bogdanm | 82:6473597d706e | 537 | |
bogdanm | 82:6473597d706e | 538 | /*! |
bogdanm | 82:6473597d706e | 539 | * @brief Gets the USB voltage regulator in a standby mode setting. |
bogdanm | 82:6473597d706e | 540 | * |
bogdanm | 82:6473597d706e | 541 | * This function gets the USB voltage regulator in a standby mode setting. |
bogdanm | 82:6473597d706e | 542 | * |
bogdanm | 82:6473597d706e | 543 | * @return setting USB voltage regulator in a standby mode setting |
bogdanm | 82:6473597d706e | 544 | */ |
bogdanm | 82:6473597d706e | 545 | static inline sim_usbsstby_stop_t sim_get_usbsstby(void) |
bogdanm | 82:6473597d706e | 546 | { |
bogdanm | 82:6473597d706e | 547 | return (sim_usbsstby_stop_t)BR_SIM_SOPT1_USBSSTBY; |
bogdanm | 82:6473597d706e | 548 | } |
bogdanm | 82:6473597d706e | 549 | |
bogdanm | 82:6473597d706e | 550 | /*! |
bogdanm | 82:6473597d706e | 551 | * @brief Sets the USB voltage regulator in a standby mode during the VLPR or the VLPW. |
bogdanm | 82:6473597d706e | 552 | * |
bogdanm | 82:6473597d706e | 553 | * This function controls whether the USB voltage regulator is placed in a standby |
bogdanm | 82:6473597d706e | 554 | * mode during the VLPR and the VLPW modes. This bit can only be written when the |
bogdanm | 82:6473597d706e | 555 | * SOPT1CFG[UVSWE] bit is set. |
bogdanm | 82:6473597d706e | 556 | * |
bogdanm | 82:6473597d706e | 557 | * @param setting USB voltage regulator in standby mode setting |
bogdanm | 82:6473597d706e | 558 | * - 0: USB voltage regulator not in standby during VLPR and VLPW modes. |
bogdanm | 82:6473597d706e | 559 | * - 1: USB voltage regulator in standby during VLPR and VLPW modes. |
bogdanm | 82:6473597d706e | 560 | */ |
bogdanm | 82:6473597d706e | 561 | static inline void sim_set_usbvstby(sim_usbvstby_stop_t setting) |
bogdanm | 82:6473597d706e | 562 | { |
bogdanm | 82:6473597d706e | 563 | BW_SIM_SOPT1_USBVSTBY(setting); |
bogdanm | 82:6473597d706e | 564 | } |
bogdanm | 82:6473597d706e | 565 | |
bogdanm | 82:6473597d706e | 566 | /*! |
bogdanm | 82:6473597d706e | 567 | * @brief Gets the USB voltage regulator in a standby mode during the VLPR or the VLPW. |
bogdanm | 82:6473597d706e | 568 | * |
bogdanm | 82:6473597d706e | 569 | * This function gets the USB voltage regulator in a standby mode during the VLPR or the VLPW. |
bogdanm | 82:6473597d706e | 570 | * |
bogdanm | 82:6473597d706e | 571 | * @return setting USB voltage regulator in a standby mode during the VLPR or the VLPW |
bogdanm | 82:6473597d706e | 572 | */ |
bogdanm | 82:6473597d706e | 573 | static inline sim_usbvstby_stop_t sim_get_usbvstby(void) |
bogdanm | 82:6473597d706e | 574 | { |
bogdanm | 82:6473597d706e | 575 | return (sim_usbvstby_stop_t)BR_SIM_SOPT1_USBVSTBY; |
bogdanm | 82:6473597d706e | 576 | } |
bogdanm | 82:6473597d706e | 577 | |
bogdanm | 82:6473597d706e | 578 | #if FSL_FEATURE_SIM_OPT_HAS_RAMSIZE |
bogdanm | 82:6473597d706e | 579 | /*! |
bogdanm | 82:6473597d706e | 580 | * @brief Gets the RAM size. |
bogdanm | 82:6473597d706e | 581 | * |
bogdanm | 82:6473597d706e | 582 | * This function gets the RAM size. The field specifies the amount of system RAM, which is |
bogdanm | 82:6473597d706e | 583 | * available on the device. |
bogdanm | 82:6473597d706e | 584 | * |
bogdanm | 82:6473597d706e | 585 | * @return size RAM size on the device |
bogdanm | 82:6473597d706e | 586 | */ |
bogdanm | 82:6473597d706e | 587 | static inline uint32_t sim_get_ramsize(void) |
bogdanm | 82:6473597d706e | 588 | { |
bogdanm | 82:6473597d706e | 589 | return BR_SIM_SOPT1_RAMSIZE; |
bogdanm | 82:6473597d706e | 590 | } |
bogdanm | 82:6473597d706e | 591 | #endif /* FSL_FEATURE_SIM_OPT_HAS_RAMSIZE */ |
bogdanm | 82:6473597d706e | 592 | |
bogdanm | 82:6473597d706e | 593 | /*! |
bogdanm | 82:6473597d706e | 594 | * @brief Sets the USB voltage regulator stop standby write enable setting. |
bogdanm | 82:6473597d706e | 595 | * |
bogdanm | 82:6473597d706e | 596 | * This function controls whether the USB voltage regulator stop standby write |
bogdanm | 82:6473597d706e | 597 | * feature is enabled. Writing one to this bit allows the SOPT1[USBSSTBY] bit to be written. This |
bogdanm | 82:6473597d706e | 598 | * register bit clears after a write to SOPT1[USBSSTBY]. |
bogdanm | 82:6473597d706e | 599 | * |
bogdanm | 82:6473597d706e | 600 | * @param enable USB voltage regulator stop standby write enable setting |
bogdanm | 82:6473597d706e | 601 | * - true: SOPT1[USBSSTBY] can be written. |
bogdanm | 82:6473597d706e | 602 | * - false: SOPT1[USBSSTBY] cannot be written. |
bogdanm | 82:6473597d706e | 603 | */ |
bogdanm | 82:6473597d706e | 604 | static inline void sim_set_usswe(bool enable) |
bogdanm | 82:6473597d706e | 605 | { |
bogdanm | 82:6473597d706e | 606 | BW_SIM_SOPT1CFG_USSWE(enable ? 1 : 0); |
bogdanm | 82:6473597d706e | 607 | } |
bogdanm | 82:6473597d706e | 608 | |
bogdanm | 82:6473597d706e | 609 | /*! |
bogdanm | 82:6473597d706e | 610 | * @brief Gets the USB voltage regulator stop standby write enable setting. |
bogdanm | 82:6473597d706e | 611 | * |
bogdanm | 82:6473597d706e | 612 | * This function gets the USB voltage regulator stop standby write enable setting. |
bogdanm | 82:6473597d706e | 613 | * |
bogdanm | 82:6473597d706e | 614 | * @return enabled True if the USB voltage regulator stop standby write is enabled. |
bogdanm | 82:6473597d706e | 615 | */ |
bogdanm | 82:6473597d706e | 616 | static inline bool sim_get_usswe(void) |
bogdanm | 82:6473597d706e | 617 | { |
bogdanm | 82:6473597d706e | 618 | return BR_SIM_SOPT1CFG_USSWE; |
bogdanm | 82:6473597d706e | 619 | } |
bogdanm | 82:6473597d706e | 620 | |
bogdanm | 82:6473597d706e | 621 | /*! |
bogdanm | 82:6473597d706e | 622 | * @brief Sets the USB voltage regulator VLP standby write enable setting. |
bogdanm | 82:6473597d706e | 623 | * |
bogdanm | 82:6473597d706e | 624 | * This function controls whether USB voltage regulator VLP standby write |
bogdanm | 82:6473597d706e | 625 | * feature is enabled. Writing one to this bit allows the SOPT1[USBVSTBY] bit to be written. This |
bogdanm | 82:6473597d706e | 626 | * register bit clears after a write to SOPT1[USBVSTBY]. |
bogdanm | 82:6473597d706e | 627 | * |
bogdanm | 82:6473597d706e | 628 | * @param enable USB voltage regulator VLP standby write enable setting |
bogdanm | 82:6473597d706e | 629 | * - true: SOPT1[USBSSTBY] can be written. |
bogdanm | 82:6473597d706e | 630 | * - false: SOPT1[USBSSTBY] cannot be written. |
bogdanm | 82:6473597d706e | 631 | */ |
bogdanm | 82:6473597d706e | 632 | static inline void sim_set_uvswe(bool enable) |
bogdanm | 82:6473597d706e | 633 | { |
bogdanm | 82:6473597d706e | 634 | BW_SIM_SOPT1CFG_UVSWE(enable ? 1 : 0); |
bogdanm | 82:6473597d706e | 635 | } |
bogdanm | 82:6473597d706e | 636 | |
bogdanm | 82:6473597d706e | 637 | /*! |
bogdanm | 82:6473597d706e | 638 | * @brief Gets the USB voltage regulator VLP standby write enable setting. |
bogdanm | 82:6473597d706e | 639 | * |
bogdanm | 82:6473597d706e | 640 | * This function gets the USB voltage regulator VLP standby write enable setting. |
bogdanm | 82:6473597d706e | 641 | * |
bogdanm | 82:6473597d706e | 642 | * @return enabled True if the USB voltage regulator VLP standby write is enabled. |
bogdanm | 82:6473597d706e | 643 | */ |
bogdanm | 82:6473597d706e | 644 | static inline bool sim_get_uvswe(void) |
bogdanm | 82:6473597d706e | 645 | { |
bogdanm | 82:6473597d706e | 646 | return BR_SIM_SOPT1CFG_UVSWE; |
bogdanm | 82:6473597d706e | 647 | } |
bogdanm | 82:6473597d706e | 648 | |
bogdanm | 82:6473597d706e | 649 | /*! |
bogdanm | 82:6473597d706e | 650 | * @brief Sets the USB voltage regulator enable write enable setting. |
bogdanm | 82:6473597d706e | 651 | * |
bogdanm | 82:6473597d706e | 652 | * This function controls whether the USB voltage regulator write enable |
bogdanm | 82:6473597d706e | 653 | * feature is enabled. Writing one to this bit allows the SOPT1[USBREGEN] bit to be written. |
bogdanm | 82:6473597d706e | 654 | * This register bit clears after a write to SOPT1[USBREGEN]. |
bogdanm | 82:6473597d706e | 655 | * |
bogdanm | 82:6473597d706e | 656 | * @param enable USB voltage regulator enable write enable setting |
bogdanm | 82:6473597d706e | 657 | * - true: SOPT1[USBSSTBY] can be written. |
bogdanm | 82:6473597d706e | 658 | * - false: SOPT1[USBSSTBY] cannot be written. |
bogdanm | 82:6473597d706e | 659 | */ |
bogdanm | 82:6473597d706e | 660 | static inline void sim_set_urwe(bool enable) |
bogdanm | 82:6473597d706e | 661 | { |
bogdanm | 82:6473597d706e | 662 | BW_SIM_SOPT1CFG_URWE(enable ? 1 : 0); |
bogdanm | 82:6473597d706e | 663 | } |
bogdanm | 82:6473597d706e | 664 | |
bogdanm | 82:6473597d706e | 665 | /*! |
bogdanm | 82:6473597d706e | 666 | * @brief Gets the USB voltage regulator enable write enable setting. |
bogdanm | 82:6473597d706e | 667 | * |
bogdanm | 82:6473597d706e | 668 | * This function gets the USB voltage regulator enable write enable setting. |
bogdanm | 82:6473597d706e | 669 | * |
bogdanm | 82:6473597d706e | 670 | * @return enabled True if USB voltage regulator enable write is enabled. |
bogdanm | 82:6473597d706e | 671 | */ |
bogdanm | 82:6473597d706e | 672 | static inline bool sim_get_urwe(void) |
bogdanm | 82:6473597d706e | 673 | { |
bogdanm | 82:6473597d706e | 674 | return BR_SIM_SOPT1CFG_URWE; |
bogdanm | 82:6473597d706e | 675 | } |
bogdanm | 82:6473597d706e | 676 | |
bogdanm | 82:6473597d706e | 677 | #if FSL_FEATURE_SIM_OPT_HAS_CMTUARTPAD |
bogdanm | 82:6473597d706e | 678 | /*! |
bogdanm | 82:6473597d706e | 679 | * @brief Sets the CMT/UART pad drive strength setting. |
bogdanm | 82:6473597d706e | 680 | * |
bogdanm | 82:6473597d706e | 681 | * This function controls the output drive strength of the CMT IRO signal or |
bogdanm | 82:6473597d706e | 682 | * UART0_TXD signal on PTD7 pin by selecting either one or two pads to drive it. |
bogdanm | 82:6473597d706e | 683 | * |
bogdanm | 82:6473597d706e | 684 | * @param setting CMT/UART pad drive strength setting |
bogdanm | 82:6473597d706e | 685 | * - 0: Single-pad drive strength for CMT IRO or UART0_TXD. |
bogdanm | 82:6473597d706e | 686 | * - 1: Dual-pad drive strength for CMT IRO or UART0_TXD. |
bogdanm | 82:6473597d706e | 687 | */ |
bogdanm | 82:6473597d706e | 688 | static inline void sim_set_cmtuartpad(sim_cmtuartpad_strengh_t setting) |
bogdanm | 82:6473597d706e | 689 | { |
bogdanm | 82:6473597d706e | 690 | BW_SIM_SOPT2_CMTUARTPAD(setting); |
bogdanm | 82:6473597d706e | 691 | } |
bogdanm | 82:6473597d706e | 692 | |
bogdanm | 82:6473597d706e | 693 | /*! |
bogdanm | 82:6473597d706e | 694 | * @brief Gets the CMT/UART pad drive strength setting. |
bogdanm | 82:6473597d706e | 695 | * |
bogdanm | 82:6473597d706e | 696 | * This function gets the CMT/UART pad drive strength setting. |
bogdanm | 82:6473597d706e | 697 | * |
bogdanm | 82:6473597d706e | 698 | * @return setting CMT/UART pad drive strength setting |
bogdanm | 82:6473597d706e | 699 | */ |
bogdanm | 82:6473597d706e | 700 | static inline sim_cmtuartpad_strengh_t sim_get_cmtuartpad(void) |
bogdanm | 82:6473597d706e | 701 | { |
bogdanm | 82:6473597d706e | 702 | return (sim_cmtuartpad_strengh_t)BR_SIM_SOPT2_CMTUARTPAD; |
bogdanm | 82:6473597d706e | 703 | } |
bogdanm | 82:6473597d706e | 704 | #endif /* FSL_FEATURE_SIM_OPT_HAS_CMTUARTPAD */ |
bogdanm | 82:6473597d706e | 705 | |
bogdanm | 82:6473597d706e | 706 | #if FSL_FEATURE_SIM_OPT_HAS_PTD7PAD |
bogdanm | 82:6473597d706e | 707 | /*! |
bogdanm | 82:6473597d706e | 708 | * @brief Sets the PTD7 pad drive strength setting. |
bogdanm | 82:6473597d706e | 709 | * |
bogdanm | 82:6473597d706e | 710 | * This function controls the output drive strength of the PTD7 pin by selecting |
bogdanm | 82:6473597d706e | 711 | * either one or two pads to drive it. |
bogdanm | 82:6473597d706e | 712 | * |
bogdanm | 82:6473597d706e | 713 | * @param setting PTD7 pad drive strength setting |
bogdanm | 82:6473597d706e | 714 | * - 0: Single-pad drive strength for PTD7. |
bogdanm | 82:6473597d706e | 715 | * - 1: Double pad drive strength for PTD7. |
bogdanm | 82:6473597d706e | 716 | */ |
bogdanm | 82:6473597d706e | 717 | static inline void sim_set_ptd7pad(sim_ptd7pad_strengh_t setting) |
bogdanm | 82:6473597d706e | 718 | { |
bogdanm | 82:6473597d706e | 719 | BW_SIM_SOPT2_PTD7PAD(setting); |
bogdanm | 82:6473597d706e | 720 | } |
bogdanm | 82:6473597d706e | 721 | |
bogdanm | 82:6473597d706e | 722 | /*! |
bogdanm | 82:6473597d706e | 723 | * @brief Gets the PTD7 pad drive strength setting. |
bogdanm | 82:6473597d706e | 724 | * |
bogdanm | 82:6473597d706e | 725 | * This function gets the PTD7 pad drive strength setting. |
bogdanm | 82:6473597d706e | 726 | * |
bogdanm | 82:6473597d706e | 727 | * @return setting PTD7 pad drive strength setting |
bogdanm | 82:6473597d706e | 728 | */ |
bogdanm | 82:6473597d706e | 729 | static inline sim_ptd7pad_strengh_t sim_get_ptd7pad(void) |
bogdanm | 82:6473597d706e | 730 | { |
bogdanm | 82:6473597d706e | 731 | return (sim_ptd7pad_strengh_t)BR_SIM_SOPT2_PTD7PAD; |
bogdanm | 82:6473597d706e | 732 | } |
bogdanm | 82:6473597d706e | 733 | #endif /* FSL_FEATURE_SIM_OPT_HAS_PTD7PAD */ |
bogdanm | 82:6473597d706e | 734 | |
bogdanm | 82:6473597d706e | 735 | #if FSL_FEATURE_SIM_OPT_HAS_FBSL |
bogdanm | 82:6473597d706e | 736 | /*! |
bogdanm | 82:6473597d706e | 737 | * @brief Sets the FlexBus security level setting. |
bogdanm | 82:6473597d706e | 738 | * |
bogdanm | 82:6473597d706e | 739 | * This function sets the FlexBus security level setting. If the security is enabled, |
bogdanm | 82:6473597d706e | 740 | * this field affects which CPU operations can access the off-chip via the FlexBus |
bogdanm | 82:6473597d706e | 741 | * and DDR controller interfaces. This field has no effect if the security is not enabled. |
bogdanm | 82:6473597d706e | 742 | * |
bogdanm | 82:6473597d706e | 743 | * @param setting FlexBus security level setting |
bogdanm | 82:6473597d706e | 744 | * - 00: All off-chip accesses (op code and data) via the FlexBus and |
bogdanm | 82:6473597d706e | 745 | * DDR controller are disallowed. |
bogdanm | 82:6473597d706e | 746 | * - 10: Off-chip op code accesses are disallowed. Data accesses are |
bogdanm | 82:6473597d706e | 747 | * allowed. |
bogdanm | 82:6473597d706e | 748 | * - 11: Off-chip op code accesses and data accesses are allowed. |
bogdanm | 82:6473597d706e | 749 | */ |
bogdanm | 82:6473597d706e | 750 | static inline void sim_set_fbsl(sim_flexbus_security_level_t setting) |
bogdanm | 82:6473597d706e | 751 | { |
bogdanm | 82:6473597d706e | 752 | BW_SIM_SOPT2_FBSL(setting); |
bogdanm | 82:6473597d706e | 753 | } |
bogdanm | 82:6473597d706e | 754 | |
bogdanm | 82:6473597d706e | 755 | /*! |
bogdanm | 82:6473597d706e | 756 | * @brief Gets the FlexBus security level setting. |
bogdanm | 82:6473597d706e | 757 | * |
bogdanm | 82:6473597d706e | 758 | * This function gets the FlexBus security level setting. |
bogdanm | 82:6473597d706e | 759 | * |
bogdanm | 82:6473597d706e | 760 | * @return setting FlexBus security level setting |
bogdanm | 82:6473597d706e | 761 | */ |
bogdanm | 82:6473597d706e | 762 | static inline sim_flexbus_security_level_t sim_get_fbsl(void) |
bogdanm | 82:6473597d706e | 763 | { |
bogdanm | 82:6473597d706e | 764 | return (sim_flexbus_security_level_t)BR_SIM_SOPT2_FBSL; |
bogdanm | 82:6473597d706e | 765 | } |
bogdanm | 82:6473597d706e | 766 | #endif /* FSL_FEATURE_SIM_OPT_HAS_FBSL */ |
bogdanm | 82:6473597d706e | 767 | |
bogdanm | 82:6473597d706e | 768 | #if FSL_FEATURE_SIM_OPT_HAS_PCR |
bogdanm | 82:6473597d706e | 769 | /*! |
bogdanm | 82:6473597d706e | 770 | * @brief Sets the PCR setting. |
bogdanm | 82:6473597d706e | 771 | * |
bogdanm | 82:6473597d706e | 772 | * This function sets the PCR setting. This is the FlexBus hold cycles before |
bogdanm | 82:6473597d706e | 773 | * FlexBus can release bus to NFC or to IDLE. |
bogdanm | 82:6473597d706e | 774 | * |
bogdanm | 82:6473597d706e | 775 | * @param setting PCR setting |
bogdanm | 82:6473597d706e | 776 | */ |
bogdanm | 82:6473597d706e | 777 | static inline void sim_set_pcr(uint32_t setting) |
bogdanm | 82:6473597d706e | 778 | { |
bogdanm | 82:6473597d706e | 779 | BW_SIM_SOPT6_PCR(setting); |
bogdanm | 82:6473597d706e | 780 | } |
bogdanm | 82:6473597d706e | 781 | |
bogdanm | 82:6473597d706e | 782 | /*! |
bogdanm | 82:6473597d706e | 783 | * @brief Gets the PCR setting. |
bogdanm | 82:6473597d706e | 784 | * |
bogdanm | 82:6473597d706e | 785 | * This function gets the PCR setting. |
bogdanm | 82:6473597d706e | 786 | * |
bogdanm | 82:6473597d706e | 787 | * @return setting PCR setting |
bogdanm | 82:6473597d706e | 788 | */ |
bogdanm | 82:6473597d706e | 789 | static inline uint32_t sim_get_pcr(void) |
bogdanm | 82:6473597d706e | 790 | { |
bogdanm | 82:6473597d706e | 791 | return BR_SIM_SOPT6_PCR; |
bogdanm | 82:6473597d706e | 792 | } |
bogdanm | 82:6473597d706e | 793 | #endif /* FSL_FEATURE_SIM_OPT_HAS_PCR */ |
bogdanm | 82:6473597d706e | 794 | |
bogdanm | 82:6473597d706e | 795 | #if FSL_FEATURE_SIM_OPT_HAS_MCC |
bogdanm | 82:6473597d706e | 796 | /*! |
bogdanm | 82:6473597d706e | 797 | * @brief Sets the MCC setting. |
bogdanm | 82:6473597d706e | 798 | * |
bogdanm | 82:6473597d706e | 799 | * This function sets the MCC setting. This is the NFC hold cycle in case the |
bogdanm | 82:6473597d706e | 800 | * FlexBus request during NFC is granted. |
bogdanm | 82:6473597d706e | 801 | * |
bogdanm | 82:6473597d706e | 802 | * @param setting MCC setting |
bogdanm | 82:6473597d706e | 803 | */ |
bogdanm | 82:6473597d706e | 804 | static inline void sim_set_mcc(uint32_t setting) |
bogdanm | 82:6473597d706e | 805 | { |
bogdanm | 82:6473597d706e | 806 | BW_SIM_SOPT6_MCC(setting); |
bogdanm | 82:6473597d706e | 807 | } |
bogdanm | 82:6473597d706e | 808 | |
bogdanm | 82:6473597d706e | 809 | /*! |
bogdanm | 82:6473597d706e | 810 | * @brief Gets the MCC setting. |
bogdanm | 82:6473597d706e | 811 | * |
bogdanm | 82:6473597d706e | 812 | * This function gets the MCC setting. |
bogdanm | 82:6473597d706e | 813 | * |
bogdanm | 82:6473597d706e | 814 | * @return setting MCC setting |
bogdanm | 82:6473597d706e | 815 | */ |
bogdanm | 82:6473597d706e | 816 | static inline uint32_t sim_get_mcc(void) |
bogdanm | 82:6473597d706e | 817 | { |
bogdanm | 82:6473597d706e | 818 | return BR_SIM_SOPT6_MCC; |
bogdanm | 82:6473597d706e | 819 | } |
bogdanm | 82:6473597d706e | 820 | #endif /* FSL_FEATURE_SIM_OPT_HAS_MCC */ |
bogdanm | 82:6473597d706e | 821 | |
bogdanm | 82:6473597d706e | 822 | /*! |
bogdanm | 82:6473597d706e | 823 | * @brief Sets the ADCx alternate trigger enable setting. |
bogdanm | 82:6473597d706e | 824 | * |
bogdanm | 82:6473597d706e | 825 | * This function enables/disables the alternative conversion triggers for ADCx. |
bogdanm | 82:6473597d706e | 826 | * |
bogdanm | 82:6473597d706e | 827 | * @param enable Enable alternative conversion triggers for ADCx |
bogdanm | 82:6473597d706e | 828 | * - true: Select alternative conversion trigger. |
bogdanm | 82:6473597d706e | 829 | * - false: Select PDB trigger. |
bogdanm | 82:6473597d706e | 830 | */ |
bogdanm | 82:6473597d706e | 831 | void sim_set_alttrgen(uint8_t instance, bool enable); |
bogdanm | 82:6473597d706e | 832 | |
bogdanm | 82:6473597d706e | 833 | /*! |
bogdanm | 82:6473597d706e | 834 | * @brief Gets the ADCx alternate trigger enable setting. |
bogdanm | 82:6473597d706e | 835 | * |
bogdanm | 82:6473597d706e | 836 | * This function gets the ADCx alternate trigger enable setting. |
bogdanm | 82:6473597d706e | 837 | * |
bogdanm | 82:6473597d706e | 838 | * @return enabled True if ADCx alternate trigger is enabled |
bogdanm | 82:6473597d706e | 839 | */ |
bogdanm | 82:6473597d706e | 840 | bool sim_get_alttrgen(uint8_t instance); |
bogdanm | 82:6473597d706e | 841 | |
bogdanm | 82:6473597d706e | 842 | /*! |
bogdanm | 82:6473597d706e | 843 | * @brief Sets the ADCx pre-trigger select setting. |
bogdanm | 82:6473597d706e | 844 | * |
bogdanm | 82:6473597d706e | 845 | * This function selects the ADCx pre-trigger source when the alternative triggers |
bogdanm | 82:6473597d706e | 846 | * are enabled through ADCxALTTRGEN. |
bogdanm | 82:6473597d706e | 847 | * |
bogdanm | 82:6473597d706e | 848 | * @param select pre-trigger select setting for ADCx |
bogdanm | 82:6473597d706e | 849 | * - 0: Pre-trigger A selected for ADCx. |
bogdanm | 82:6473597d706e | 850 | * - 1: Pre-trigger B selected for ADCx. |
bogdanm | 82:6473597d706e | 851 | */ |
bogdanm | 82:6473597d706e | 852 | void sim_set_pretrgsel(uint8_t instance, sim_pretrgsel_t select); |
bogdanm | 82:6473597d706e | 853 | |
bogdanm | 82:6473597d706e | 854 | /*! |
bogdanm | 82:6473597d706e | 855 | * @brief Gets the ADCx pre-trigger select setting. |
bogdanm | 82:6473597d706e | 856 | * |
bogdanm | 82:6473597d706e | 857 | * This function gets the ADCx pre-trigger select setting. |
bogdanm | 82:6473597d706e | 858 | * |
bogdanm | 82:6473597d706e | 859 | * @return select ADCx pre-trigger select setting |
bogdanm | 82:6473597d706e | 860 | */ |
bogdanm | 82:6473597d706e | 861 | sim_pretrgsel_t sim_get_pretrgsel(uint8_t instance); |
bogdanm | 82:6473597d706e | 862 | |
bogdanm | 82:6473597d706e | 863 | /*! |
bogdanm | 82:6473597d706e | 864 | * @brief Sets the ADCx trigger select setting. |
bogdanm | 82:6473597d706e | 865 | * |
bogdanm | 82:6473597d706e | 866 | * This function selects the ADCx trigger source when alternative triggers |
bogdanm | 82:6473597d706e | 867 | * are enabled through ADCxALTTRGEN. |
bogdanm | 82:6473597d706e | 868 | * |
bogdanm | 82:6473597d706e | 869 | * @param select trigger select setting for ADCx |
bogdanm | 82:6473597d706e | 870 | * - 0000: External trigger |
bogdanm | 82:6473597d706e | 871 | * - 0001: High speed comparator 0 asynchronous interrupt |
bogdanm | 82:6473597d706e | 872 | * - 0010: High speed comparator 1 asynchronous interrupt |
bogdanm | 82:6473597d706e | 873 | * - 0011: High speed comparator 2 asynchronous interrupt |
bogdanm | 82:6473597d706e | 874 | * - 0100: PIT trigger 0 |
bogdanm | 82:6473597d706e | 875 | * - 0101: PIT trigger 1 |
bogdanm | 82:6473597d706e | 876 | * - 0110: PIT trigger 2 |
bogdanm | 82:6473597d706e | 877 | * - 0111: PIT trigger 3 |
bogdanm | 82:6473597d706e | 878 | * - 1000: FTM0 trigger |
bogdanm | 82:6473597d706e | 879 | * - 1001: FTM1 trigger |
bogdanm | 82:6473597d706e | 880 | * - 1010: FTM2 trigger |
bogdanm | 82:6473597d706e | 881 | * - 1011: FTM3 trigger |
bogdanm | 82:6473597d706e | 882 | * - 1100: RTC alarm |
bogdanm | 82:6473597d706e | 883 | * - 1101: RTC seconds |
bogdanm | 82:6473597d706e | 884 | * - 1110: Low-power timer trigger |
bogdanm | 82:6473597d706e | 885 | * - 1111: High speed comparator 3 asynchronous interrupt |
bogdanm | 82:6473597d706e | 886 | */ |
bogdanm | 82:6473597d706e | 887 | void sim_set_trgsel(uint8_t instance, sim_trgsel_t select); |
bogdanm | 82:6473597d706e | 888 | |
bogdanm | 82:6473597d706e | 889 | /*! |
bogdanm | 82:6473597d706e | 890 | * @brief Gets the ADCx trigger select setting. |
bogdanm | 82:6473597d706e | 891 | * |
bogdanm | 82:6473597d706e | 892 | * This function gets the ADCx trigger select setting. |
bogdanm | 82:6473597d706e | 893 | * |
bogdanm | 82:6473597d706e | 894 | * @return select ADCx trigger select setting |
bogdanm | 82:6473597d706e | 895 | */ |
bogdanm | 82:6473597d706e | 896 | sim_pretrgsel_t sims_get_trgsel(uint8_t instance); |
bogdanm | 82:6473597d706e | 897 | |
bogdanm | 82:6473597d706e | 898 | /*! |
bogdanm | 82:6473597d706e | 899 | * @brief Sets the UARTx receive data source select setting. |
bogdanm | 82:6473597d706e | 900 | * |
bogdanm | 82:6473597d706e | 901 | * This function selects the source for the UARTx receive data. |
bogdanm | 82:6473597d706e | 902 | * |
bogdanm | 82:6473597d706e | 903 | * @param select the source for the UARTx receive data |
bogdanm | 82:6473597d706e | 904 | * - 00: UARTx_RX pin. |
bogdanm | 82:6473597d706e | 905 | * - 01: CMP0. |
bogdanm | 82:6473597d706e | 906 | * - 10: CMP1. |
bogdanm | 82:6473597d706e | 907 | * - 11: Reserved. |
bogdanm | 82:6473597d706e | 908 | */ |
bogdanm | 82:6473597d706e | 909 | void sim_set_uart_rxsrc(uint8_t instance, sim_uart_rxsrc_t select); |
bogdanm | 82:6473597d706e | 910 | |
bogdanm | 82:6473597d706e | 911 | /*! |
bogdanm | 82:6473597d706e | 912 | * @brief Gets the UARTx receive data source select setting. |
bogdanm | 82:6473597d706e | 913 | * |
bogdanm | 82:6473597d706e | 914 | * This function gets the UARTx receive data source select setting. |
bogdanm | 82:6473597d706e | 915 | * |
bogdanm | 82:6473597d706e | 916 | * @return select UARTx receive data source select setting |
bogdanm | 82:6473597d706e | 917 | */ |
bogdanm | 82:6473597d706e | 918 | sim_uart_rxsrc_t sim_get_uart_rxsrc(uint8_t instance); |
bogdanm | 82:6473597d706e | 919 | |
bogdanm | 82:6473597d706e | 920 | /*! |
bogdanm | 82:6473597d706e | 921 | * @brief Sets the UARTx transmit data source select setting. |
bogdanm | 82:6473597d706e | 922 | * |
bogdanm | 82:6473597d706e | 923 | * This function selects the source for the UARTx transmit data. |
bogdanm | 82:6473597d706e | 924 | * |
bogdanm | 82:6473597d706e | 925 | * @param select the source for the UARTx transmit data |
bogdanm | 82:6473597d706e | 926 | * - 00: UARTx_TX pin. |
bogdanm | 82:6473597d706e | 927 | * - 01: UARTx_TX pin modulated with FTM1 channel 0 output. |
bogdanm | 82:6473597d706e | 928 | * - 10: UARTx_TX pin modulated with FTM2 channel 0 output. |
bogdanm | 82:6473597d706e | 929 | * - 11: Reserved. |
bogdanm | 82:6473597d706e | 930 | */ |
bogdanm | 82:6473597d706e | 931 | void sim_set_uart_txsrc(uint8_t instance, sim_uart_txsrc_t select); |
bogdanm | 82:6473597d706e | 932 | |
bogdanm | 82:6473597d706e | 933 | /*! |
bogdanm | 82:6473597d706e | 934 | * @brief Gets the UARTx transmit data source select setting. |
bogdanm | 82:6473597d706e | 935 | * |
bogdanm | 82:6473597d706e | 936 | * This function gets the UARTx transmit data source select setting. |
bogdanm | 82:6473597d706e | 937 | * |
bogdanm | 82:6473597d706e | 938 | * @return select UARTx transmit data source select setting |
bogdanm | 82:6473597d706e | 939 | */ |
bogdanm | 82:6473597d706e | 940 | sim_uart_txsrc_t sim_get_uart_txsrc(uint8_t instance); |
bogdanm | 82:6473597d706e | 941 | |
bogdanm | 82:6473597d706e | 942 | #if FSL_FEATURE_SIM_OPT_HAS_ODE |
bogdanm | 82:6473597d706e | 943 | /*! |
bogdanm | 82:6473597d706e | 944 | * @brief Sets the UARTx Open Drain Enable setting. |
bogdanm | 82:6473597d706e | 945 | * |
bogdanm | 82:6473597d706e | 946 | * This function enables/disables the UARTx Open Drain. |
bogdanm | 82:6473597d706e | 947 | * |
bogdanm | 82:6473597d706e | 948 | * @param enable Enable/disable UARTx Open Drain |
bogdanm | 82:6473597d706e | 949 | * - True: Enable UARTx Open Drain |
bogdanm | 82:6473597d706e | 950 | * - False: Disable UARTx Open Drain |
bogdanm | 82:6473597d706e | 951 | */ |
bogdanm | 82:6473597d706e | 952 | void sim_set_uart_ode(uint8_t instance, bool enable); |
bogdanm | 82:6473597d706e | 953 | |
bogdanm | 82:6473597d706e | 954 | /*! |
bogdanm | 82:6473597d706e | 955 | * @brief Gets the UARTx Open Drain Enable setting. |
bogdanm | 82:6473597d706e | 956 | * |
bogdanm | 82:6473597d706e | 957 | * This function gets the UARTx Open Drain Enable setting. |
bogdanm | 82:6473597d706e | 958 | * |
bogdanm | 82:6473597d706e | 959 | * @return enabled True if UARTx Open Drain is enabled. |
bogdanm | 82:6473597d706e | 960 | */ |
bogdanm | 82:6473597d706e | 961 | bool sim_get_uart_ode(uint8_t instance); |
bogdanm | 82:6473597d706e | 962 | #endif |
bogdanm | 82:6473597d706e | 963 | |
bogdanm | 82:6473597d706e | 964 | #if FSL_FEATURE_SIM_OPT_HAS_FTM |
bogdanm | 82:6473597d706e | 965 | /*! |
bogdanm | 82:6473597d706e | 966 | * @brief Sets the FlexTimer x hardware trigger y source select setting. |
bogdanm | 82:6473597d706e | 967 | * |
bogdanm | 82:6473597d706e | 968 | * This function selects the source of FTMx hardware trigger y. |
bogdanm | 82:6473597d706e | 969 | * |
bogdanm | 82:6473597d706e | 970 | * @param select FlexTimer x hardware trigger y |
bogdanm | 82:6473597d706e | 971 | * - 0: Pre-trigger A selected for ADCx. |
bogdanm | 82:6473597d706e | 972 | * - 1: Pre-trigger B selected for ADCx. |
bogdanm | 82:6473597d706e | 973 | */ |
bogdanm | 82:6473597d706e | 974 | void sim_set_ftm_trg_src(uint8_t instance, uint8_t trigger, sim_ftm_trg_src_t select); |
bogdanm | 82:6473597d706e | 975 | |
bogdanm | 82:6473597d706e | 976 | /*! |
bogdanm | 82:6473597d706e | 977 | * @brief Gets the FlexTimer x hardware trigger y source select setting. |
bogdanm | 82:6473597d706e | 978 | * |
bogdanm | 82:6473597d706e | 979 | * This function gets the FlexTimer x hardware trigger y source select setting. |
bogdanm | 82:6473597d706e | 980 | * |
bogdanm | 82:6473597d706e | 981 | * @return select FlexTimer x hardware trigger y source select setting |
bogdanm | 82:6473597d706e | 982 | */ |
bogdanm | 82:6473597d706e | 983 | sim_ftm_trg_src_t sim_get_ftm_trg_src(uint8_t instance, uint8_t trigger); |
bogdanm | 82:6473597d706e | 984 | |
bogdanm | 82:6473597d706e | 985 | /*! |
bogdanm | 82:6473597d706e | 986 | * @brief Sets the FlexTimer x external clock pin select setting. |
bogdanm | 82:6473597d706e | 987 | * |
bogdanm | 82:6473597d706e | 988 | * This function selects the source of FTMx external clock pin select. |
bogdanm | 82:6473597d706e | 989 | * |
bogdanm | 82:6473597d706e | 990 | * @param select FTMx external clock pin select |
bogdanm | 82:6473597d706e | 991 | * - 0: FTMx external clock driven by FTM CLKIN0 pin. |
bogdanm | 82:6473597d706e | 992 | * - 1: FTMx external clock driven by FTM CLKIN1 pin. |
bogdanm | 82:6473597d706e | 993 | */ |
bogdanm | 82:6473597d706e | 994 | void sim_set_ftm_clk_sel(uint8_t instance, sim_ftm_clk_sel_t select); |
bogdanm | 82:6473597d706e | 995 | |
bogdanm | 82:6473597d706e | 996 | /*! |
bogdanm | 82:6473597d706e | 997 | * @brief Gets the FlexTimer x external clock pin select setting. |
bogdanm | 82:6473597d706e | 998 | * |
bogdanm | 82:6473597d706e | 999 | * This function gets the FlexTimer x external clock pin select setting. |
bogdanm | 82:6473597d706e | 1000 | * |
bogdanm | 82:6473597d706e | 1001 | * @return select FlexTimer x external clock pin select setting |
bogdanm | 82:6473597d706e | 1002 | */ |
bogdanm | 82:6473597d706e | 1003 | sim_ftm_clk_sel_t sim_get_ftm_clk_sel(uint8_t instance); |
bogdanm | 82:6473597d706e | 1004 | |
bogdanm | 82:6473597d706e | 1005 | /*! |
bogdanm | 82:6473597d706e | 1006 | * @brief Sets the FlexTimer x channel y input capture source select setting. |
bogdanm | 82:6473597d706e | 1007 | * |
bogdanm | 82:6473597d706e | 1008 | * This function selects the FlexTimer x channel y input capture source. |
bogdanm | 82:6473597d706e | 1009 | * |
bogdanm | 82:6473597d706e | 1010 | * @param select FlexTimer x channel y input capture source |
bogdanm | 82:6473597d706e | 1011 | * See the reference manual for detailed definition for each channel and selection. |
bogdanm | 82:6473597d706e | 1012 | */ |
bogdanm | 82:6473597d706e | 1013 | void sim_set_ftm_ch_src(uint8_t instance, uint8_t channel, sim_ftm_ch_src_t select); |
bogdanm | 82:6473597d706e | 1014 | |
bogdanm | 82:6473597d706e | 1015 | /*! |
bogdanm | 82:6473597d706e | 1016 | * @brief Gets the FlexTimer x channel y input capture source select setting. |
bogdanm | 82:6473597d706e | 1017 | * |
bogdanm | 82:6473597d706e | 1018 | * This function gets the FlexTimer x channel y input capture source select setting. |
bogdanm | 82:6473597d706e | 1019 | * |
bogdanm | 82:6473597d706e | 1020 | * @return select FlexTimer x channel y input capture source select setting |
bogdanm | 82:6473597d706e | 1021 | */ |
bogdanm | 82:6473597d706e | 1022 | sim_ftm_ch_src_t sim_get_ftm_ch_src(uint8_t instance, uint8_t channel); |
bogdanm | 82:6473597d706e | 1023 | |
bogdanm | 82:6473597d706e | 1024 | /*! |
bogdanm | 82:6473597d706e | 1025 | * @brief Sets the FlexTimer x fault y select setting. |
bogdanm | 82:6473597d706e | 1026 | * |
bogdanm | 82:6473597d706e | 1027 | * This function sets the FlexTimer x fault y select setting. |
bogdanm | 82:6473597d706e | 1028 | * |
bogdanm | 82:6473597d706e | 1029 | * @param select FlexTimer x fault y select setting |
bogdanm | 82:6473597d706e | 1030 | * - 0: FlexTimer x fault y select 0. |
bogdanm | 82:6473597d706e | 1031 | * - 1: FlexTimer x fault y select 1. |
bogdanm | 82:6473597d706e | 1032 | */ |
bogdanm | 82:6473597d706e | 1033 | void sim_set_ftm_flt_sel(uint8_t instance, uint8_t fault, sim_ftm_flt_sel_t select); |
bogdanm | 82:6473597d706e | 1034 | |
bogdanm | 82:6473597d706e | 1035 | /*! |
bogdanm | 82:6473597d706e | 1036 | * @brief Gets the FlexTimer x fault y select setting. |
bogdanm | 82:6473597d706e | 1037 | * |
bogdanm | 82:6473597d706e | 1038 | * This function gets the FlexTimer x fault y select setting. |
bogdanm | 82:6473597d706e | 1039 | * |
bogdanm | 82:6473597d706e | 1040 | * @return select FlexTimer x fault y select setting |
bogdanm | 82:6473597d706e | 1041 | */ |
bogdanm | 82:6473597d706e | 1042 | sim_ftm_flt_sel_t sim_get_ftm_flt_sel(uint8_t instance, uint8_t fault); |
bogdanm | 82:6473597d706e | 1043 | #endif |
bogdanm | 82:6473597d706e | 1044 | |
bogdanm | 82:6473597d706e | 1045 | #if FSL_FEATURE_SIM_OPT_HAS_TPM |
bogdanm | 82:6473597d706e | 1046 | /*! |
bogdanm | 82:6473597d706e | 1047 | * @brief Sets the Timer/PWM x external clock pin select setting. |
bogdanm | 82:6473597d706e | 1048 | * |
bogdanm | 82:6473597d706e | 1049 | * This function selects the source of the Timer/PWM x external clock pin select. |
bogdanm | 82:6473597d706e | 1050 | * |
bogdanm | 82:6473597d706e | 1051 | * @param select Timer/PWM x external clock pin select |
bogdanm | 82:6473597d706e | 1052 | * - 0: Timer/PWM x external clock driven by the TPM_CLKIN0 pin. |
bogdanm | 82:6473597d706e | 1053 | * - 1: Timer/PWM x external clock driven by the TPM_CLKIN1 pin. |
bogdanm | 82:6473597d706e | 1054 | */ |
bogdanm | 82:6473597d706e | 1055 | void sim_set_tpm_clk_sel(uint8_t instance, sim_tpm_clk_sel_t select); |
bogdanm | 82:6473597d706e | 1056 | |
bogdanm | 82:6473597d706e | 1057 | /*! |
bogdanm | 82:6473597d706e | 1058 | * @brief Gets the Timer/PWM x external clock pin select setting. |
bogdanm | 82:6473597d706e | 1059 | * |
bogdanm | 82:6473597d706e | 1060 | * This function gets the Timer/PWM x external clock pin select setting. |
bogdanm | 82:6473597d706e | 1061 | * |
bogdanm | 82:6473597d706e | 1062 | * @return select Timer/PWM x external clock pin select setting |
bogdanm | 82:6473597d706e | 1063 | */ |
bogdanm | 82:6473597d706e | 1064 | sim_tpm_clk_sel_t sim_get_tpm_clk_sel(uint8_t instance); |
bogdanm | 82:6473597d706e | 1065 | |
bogdanm | 82:6473597d706e | 1066 | /*! |
bogdanm | 82:6473597d706e | 1067 | * @brief Sets the Timer/PWM x channel y input capture source select setting. |
bogdanm | 82:6473597d706e | 1068 | * |
bogdanm | 82:6473597d706e | 1069 | * This function selects the Timer/PWM x channel y input capture source. |
bogdanm | 82:6473597d706e | 1070 | * |
bogdanm | 82:6473597d706e | 1071 | * @param select Timer/PWM x channel y input capture source |
bogdanm | 82:6473597d706e | 1072 | * - 0: TPMx_CH0 signal |
bogdanm | 82:6473597d706e | 1073 | * - 1: CMP0 output |
bogdanm | 82:6473597d706e | 1074 | */ |
bogdanm | 82:6473597d706e | 1075 | void sim_set_tpm_ch_src(uint8_t instance, uint8_t channel, sim_tpm_ch_src_t select); |
bogdanm | 82:6473597d706e | 1076 | |
bogdanm | 82:6473597d706e | 1077 | /*! |
bogdanm | 82:6473597d706e | 1078 | * @brief Gets the Timer/PWM x channel y input capture source select setting. |
bogdanm | 82:6473597d706e | 1079 | * |
bogdanm | 82:6473597d706e | 1080 | * This function gets the Timer/PWM x channel y input capture source select setting. |
bogdanm | 82:6473597d706e | 1081 | * |
bogdanm | 82:6473597d706e | 1082 | * @return select Timer/PWM x channel y input capture source select setting |
bogdanm | 82:6473597d706e | 1083 | */ |
bogdanm | 82:6473597d706e | 1084 | sim_tpm_ch_src_t sim_get_tpm_ch_src(uint8_t instance, uint8_t channel); |
bogdanm | 82:6473597d706e | 1085 | #endif |
bogdanm | 82:6473597d706e | 1086 | |
bogdanm | 82:6473597d706e | 1087 | #if FSL_FEATURE_SIM_SDID_HAS_FAMILYID |
bogdanm | 82:6473597d706e | 1088 | /*! |
bogdanm | 82:6473597d706e | 1089 | * @brief Gets the Kinetis Family ID in the System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1090 | * |
bogdanm | 82:6473597d706e | 1091 | * This function gets the Kinetis Family ID in the System Device ID register. |
bogdanm | 82:6473597d706e | 1092 | * |
bogdanm | 82:6473597d706e | 1093 | * @return id Kinetis Family ID |
bogdanm | 82:6473597d706e | 1094 | */ |
bogdanm | 82:6473597d706e | 1095 | static inline uint32_t sim_get_family_id(void) |
bogdanm | 82:6473597d706e | 1096 | { |
bogdanm | 82:6473597d706e | 1097 | return BR_SIM_SDID_FAMILYID; |
bogdanm | 82:6473597d706e | 1098 | } |
bogdanm | 82:6473597d706e | 1099 | #endif |
bogdanm | 82:6473597d706e | 1100 | |
bogdanm | 82:6473597d706e | 1101 | #if FSL_FEATURE_SIM_SDID_HAS_SUBFAMID |
bogdanm | 82:6473597d706e | 1102 | /*! |
bogdanm | 82:6473597d706e | 1103 | * @brief Gets the Kinetis Sub-Family ID in the System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1104 | * |
bogdanm | 82:6473597d706e | 1105 | * This function gets the Kinetis Sub-Family ID in System Device ID register. |
bogdanm | 82:6473597d706e | 1106 | * |
bogdanm | 82:6473597d706e | 1107 | * @return id Kinetis Sub-Family ID |
bogdanm | 82:6473597d706e | 1108 | */ |
bogdanm | 82:6473597d706e | 1109 | static inline uint32_t sim_get_subfam_id(void) |
bogdanm | 82:6473597d706e | 1110 | { |
bogdanm | 82:6473597d706e | 1111 | return BR_SIM_SDID_SUBFAMID; |
bogdanm | 82:6473597d706e | 1112 | } |
bogdanm | 82:6473597d706e | 1113 | #endif |
bogdanm | 82:6473597d706e | 1114 | |
bogdanm | 82:6473597d706e | 1115 | #if FSL_FEATURE_SIM_SDID_HAS_SERIESID |
bogdanm | 82:6473597d706e | 1116 | /*! |
bogdanm | 82:6473597d706e | 1117 | * @brief Gets the Kinetis SeriesID in the System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1118 | * |
bogdanm | 82:6473597d706e | 1119 | * This function gets the Kinetis Series ID in System Device ID register. |
bogdanm | 82:6473597d706e | 1120 | * |
bogdanm | 82:6473597d706e | 1121 | * @return id Kinetis Series ID |
bogdanm | 82:6473597d706e | 1122 | */ |
bogdanm | 82:6473597d706e | 1123 | static inline uint32_t sim_get_series_id(void) |
bogdanm | 82:6473597d706e | 1124 | { |
bogdanm | 82:6473597d706e | 1125 | return BR_SIM_SDID_SERIESID; |
bogdanm | 82:6473597d706e | 1126 | } |
bogdanm | 82:6473597d706e | 1127 | #endif |
bogdanm | 82:6473597d706e | 1128 | |
bogdanm | 82:6473597d706e | 1129 | /*! |
bogdanm | 82:6473597d706e | 1130 | * @brief Gets the Kinetis Fam ID in System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1131 | * |
bogdanm | 82:6473597d706e | 1132 | * This function gets the Kinetis Fam ID in System Device ID register. |
bogdanm | 82:6473597d706e | 1133 | * |
bogdanm | 82:6473597d706e | 1134 | * @return id Kinetis Fam ID |
bogdanm | 82:6473597d706e | 1135 | */ |
bogdanm | 82:6473597d706e | 1136 | static inline uint32_t sim_get_fam_id(void) |
bogdanm | 82:6473597d706e | 1137 | { |
bogdanm | 82:6473597d706e | 1138 | return BR_SIM_SDID_FAMID; |
bogdanm | 82:6473597d706e | 1139 | } |
bogdanm | 82:6473597d706e | 1140 | |
bogdanm | 82:6473597d706e | 1141 | /*! |
bogdanm | 82:6473597d706e | 1142 | * @brief Gets the Kinetis Pincount ID in System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1143 | * |
bogdanm | 82:6473597d706e | 1144 | * This function gets the Kinetis Pincount ID in System Device ID register. |
bogdanm | 82:6473597d706e | 1145 | * |
bogdanm | 82:6473597d706e | 1146 | * @return id Kinetis Pincount ID |
bogdanm | 82:6473597d706e | 1147 | */ |
bogdanm | 82:6473597d706e | 1148 | static inline uint32_t sim_get_pin_id(void) |
bogdanm | 82:6473597d706e | 1149 | { |
bogdanm | 82:6473597d706e | 1150 | return BR_SIM_SDID_PINID; |
bogdanm | 82:6473597d706e | 1151 | } |
bogdanm | 82:6473597d706e | 1152 | |
bogdanm | 82:6473597d706e | 1153 | /*! |
bogdanm | 82:6473597d706e | 1154 | * @brief Gets the Kinetis Revision ID in the System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1155 | * |
bogdanm | 82:6473597d706e | 1156 | * This function gets the Kinetis Revision ID in System Device ID register. |
bogdanm | 82:6473597d706e | 1157 | * |
bogdanm | 82:6473597d706e | 1158 | * @return id Kinetis Revision ID |
bogdanm | 82:6473597d706e | 1159 | */ |
bogdanm | 82:6473597d706e | 1160 | static inline uint32_t sim_get_rev_id(void) |
bogdanm | 82:6473597d706e | 1161 | { |
bogdanm | 82:6473597d706e | 1162 | return BR_SIM_SDID_REVID; |
bogdanm | 82:6473597d706e | 1163 | } |
bogdanm | 82:6473597d706e | 1164 | |
bogdanm | 82:6473597d706e | 1165 | #if FSL_FEATURE_SIM_SDID_HAS_DIEID |
bogdanm | 82:6473597d706e | 1166 | /*! |
bogdanm | 82:6473597d706e | 1167 | * @brief Gets the Kinetis Die ID in the System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1168 | * |
bogdanm | 82:6473597d706e | 1169 | * This function gets the Kinetis Die ID in System Device ID register. |
bogdanm | 82:6473597d706e | 1170 | * |
bogdanm | 82:6473597d706e | 1171 | * @return id Kinetis Die ID |
bogdanm | 82:6473597d706e | 1172 | */ |
bogdanm | 82:6473597d706e | 1173 | static inline uint32_t sim_get_die_id(void) |
bogdanm | 82:6473597d706e | 1174 | { |
bogdanm | 82:6473597d706e | 1175 | return BR_SIM_SDID_DIEID; |
bogdanm | 82:6473597d706e | 1176 | } |
bogdanm | 82:6473597d706e | 1177 | #endif |
bogdanm | 82:6473597d706e | 1178 | |
bogdanm | 82:6473597d706e | 1179 | #if FSL_FEATURE_SIM_SDID_HAS_SRAMSIZE |
bogdanm | 82:6473597d706e | 1180 | /*! |
bogdanm | 82:6473597d706e | 1181 | * @brief Gets the Kinetis SRAM size in the System Device ID register (SIM_SDID). |
bogdanm | 82:6473597d706e | 1182 | * |
bogdanm | 82:6473597d706e | 1183 | * This function gets the Kinetis SRAM Size in System Device ID register. |
bogdanm | 82:6473597d706e | 1184 | * |
bogdanm | 82:6473597d706e | 1185 | * @return id Kinetis SRAM Size |
bogdanm | 82:6473597d706e | 1186 | */ |
bogdanm | 82:6473597d706e | 1187 | static inline uint32_t sim_get_sram_size(void) |
bogdanm | 82:6473597d706e | 1188 | { |
bogdanm | 82:6473597d706e | 1189 | return BR_SIM_SDID_SRAMSIZE; |
bogdanm | 82:6473597d706e | 1190 | } |
bogdanm | 82:6473597d706e | 1191 | #endif |
bogdanm | 82:6473597d706e | 1192 | |
bogdanm | 82:6473597d706e | 1193 | #if FSL_FEATURE_SIM_FCFG_HAS_NVMSIZE |
bogdanm | 82:6473597d706e | 1194 | /*! |
bogdanm | 82:6473597d706e | 1195 | * @brief Gets the FlexNVM size in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1196 | * |
bogdanm | 82:6473597d706e | 1197 | * This function gets the FlexNVM size in the Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1198 | * |
bogdanm | 82:6473597d706e | 1199 | * @return size FlexNVM Size |
bogdanm | 82:6473597d706e | 1200 | */ |
bogdanm | 82:6473597d706e | 1201 | static inline uint32_t sim_get_nvm_size(void) |
bogdanm | 82:6473597d706e | 1202 | { |
bogdanm | 82:6473597d706e | 1203 | return BR_SIM_FCFG1_NVMSIZE; |
bogdanm | 82:6473597d706e | 1204 | } |
bogdanm | 82:6473597d706e | 1205 | #endif |
bogdanm | 82:6473597d706e | 1206 | |
bogdanm | 82:6473597d706e | 1207 | /*! |
bogdanm | 82:6473597d706e | 1208 | * @brief Gets the program flash size in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1209 | * |
bogdanm | 82:6473597d706e | 1210 | * This function gets the program flash size in the Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1211 | * |
bogdanm | 82:6473597d706e | 1212 | * @return size Program flash Size |
bogdanm | 82:6473597d706e | 1213 | */ |
bogdanm | 82:6473597d706e | 1214 | static inline uint32_t sim_get_pf_size(void) |
bogdanm | 82:6473597d706e | 1215 | { |
bogdanm | 82:6473597d706e | 1216 | return BR_SIM_FCFG1_PFSIZE; |
bogdanm | 82:6473597d706e | 1217 | } |
bogdanm | 82:6473597d706e | 1218 | |
bogdanm | 82:6473597d706e | 1219 | #if FSL_FEATURE_SIM_FCFG_HAS_EESIZE |
bogdanm | 82:6473597d706e | 1220 | /*! |
bogdanm | 82:6473597d706e | 1221 | * @brief Gets the EEProm size in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1222 | * |
bogdanm | 82:6473597d706e | 1223 | * This function gets the EEProm size in the Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1224 | * |
bogdanm | 82:6473597d706e | 1225 | * @return size EEProm Size |
bogdanm | 82:6473597d706e | 1226 | */ |
bogdanm | 82:6473597d706e | 1227 | static inline uint32_t sim_get_eeprom_size(void) |
bogdanm | 82:6473597d706e | 1228 | { |
bogdanm | 82:6473597d706e | 1229 | return BR_SIM_FCFG1_EESIZE; |
bogdanm | 82:6473597d706e | 1230 | } |
bogdanm | 82:6473597d706e | 1231 | #endif |
bogdanm | 82:6473597d706e | 1232 | |
bogdanm | 82:6473597d706e | 1233 | #if FSL_FEATURE_SIM_FCFG_HAS_DEPART |
bogdanm | 82:6473597d706e | 1234 | /*! |
bogdanm | 82:6473597d706e | 1235 | * @brief Gets the FlexNVM partition in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1236 | * |
bogdanm | 82:6473597d706e | 1237 | * This function gets the FlexNVM partition in the Flash Configuration Register 1 |
bogdanm | 82:6473597d706e | 1238 | * |
bogdanm | 82:6473597d706e | 1239 | * @return setting FlexNVM partition setting |
bogdanm | 82:6473597d706e | 1240 | */ |
bogdanm | 82:6473597d706e | 1241 | static inline uint32_t sim_get_depart(void) |
bogdanm | 82:6473597d706e | 1242 | { |
bogdanm | 82:6473597d706e | 1243 | return BR_SIM_FCFG1_DEPART; |
bogdanm | 82:6473597d706e | 1244 | } |
bogdanm | 82:6473597d706e | 1245 | #endif |
bogdanm | 82:6473597d706e | 1246 | |
bogdanm | 82:6473597d706e | 1247 | #if FSL_FEATURE_SIM_FCFG_HAS_FLASHDOZE |
bogdanm | 82:6473597d706e | 1248 | /*! |
bogdanm | 82:6473597d706e | 1249 | * @brief Sets the Flash Doze in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1250 | * |
bogdanm | 82:6473597d706e | 1251 | * This function sets the Flash Doze in the Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1252 | * |
bogdanm | 82:6473597d706e | 1253 | * @param setting Flash Doze setting |
bogdanm | 82:6473597d706e | 1254 | */ |
bogdanm | 82:6473597d706e | 1255 | static inline void sim_set_flashdoze(uint32_t setting) |
bogdanm | 82:6473597d706e | 1256 | { |
bogdanm | 82:6473597d706e | 1257 | BW_SIM_FCFG1_FLASHDOZE(setting); |
bogdanm | 82:6473597d706e | 1258 | } |
bogdanm | 82:6473597d706e | 1259 | |
bogdanm | 82:6473597d706e | 1260 | /*! |
bogdanm | 82:6473597d706e | 1261 | * @brief Gets the Flash Doze in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1262 | * |
bogdanm | 82:6473597d706e | 1263 | * This function gets the Flash Doze in the Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1264 | * |
bogdanm | 82:6473597d706e | 1265 | * @return setting Flash Doze setting |
bogdanm | 82:6473597d706e | 1266 | */ |
bogdanm | 82:6473597d706e | 1267 | static inline uint32_t sim_get_flashdoze(void) |
bogdanm | 82:6473597d706e | 1268 | { |
bogdanm | 82:6473597d706e | 1269 | return BR_SIM_FCFG1_FLASHDOZE; |
bogdanm | 82:6473597d706e | 1270 | } |
bogdanm | 82:6473597d706e | 1271 | #endif |
bogdanm | 82:6473597d706e | 1272 | |
bogdanm | 82:6473597d706e | 1273 | #if FSL_FEATURE_SIM_FCFG_HAS_FLASHDIS |
bogdanm | 82:6473597d706e | 1274 | /*! |
bogdanm | 82:6473597d706e | 1275 | * @brief Sets the Flash disable setting in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1276 | * |
bogdanm | 82:6473597d706e | 1277 | * This function sets the Flash disable setting in the Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1278 | * |
bogdanm | 82:6473597d706e | 1279 | * @param setting Flash disable setting |
bogdanm | 82:6473597d706e | 1280 | */ |
bogdanm | 82:6473597d706e | 1281 | static inline void sim_set_flashdis(uint32_t setting) |
bogdanm | 82:6473597d706e | 1282 | { |
bogdanm | 82:6473597d706e | 1283 | BW_SIM_FCFG1_FLASHDIS(setting); |
bogdanm | 82:6473597d706e | 1284 | } |
bogdanm | 82:6473597d706e | 1285 | |
bogdanm | 82:6473597d706e | 1286 | /*! |
bogdanm | 82:6473597d706e | 1287 | * @brief Gets the Flash disable setting in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1288 | * |
bogdanm | 82:6473597d706e | 1289 | * This function gets the Flash disable setting in the Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1290 | * |
bogdanm | 82:6473597d706e | 1291 | * @return setting Flash disable setting |
bogdanm | 82:6473597d706e | 1292 | */ |
bogdanm | 82:6473597d706e | 1293 | static inline uint32_t sim_get_flashdis(void) |
bogdanm | 82:6473597d706e | 1294 | { |
bogdanm | 82:6473597d706e | 1295 | return BR_SIM_FCFG1_FLASHDIS; |
bogdanm | 82:6473597d706e | 1296 | } |
bogdanm | 82:6473597d706e | 1297 | #endif |
bogdanm | 82:6473597d706e | 1298 | |
bogdanm | 82:6473597d706e | 1299 | #if FSL_FEATURE_SIM_FCFG_HAS_MAXADDR0 |
bogdanm | 82:6473597d706e | 1300 | /*! |
bogdanm | 82:6473597d706e | 1301 | * @brief Gets the Flash maximum address block 0 in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1302 | * |
bogdanm | 82:6473597d706e | 1303 | * This function gets the Flash maximum block 0 in Flash Configuration Register 2. |
bogdanm | 82:6473597d706e | 1304 | * |
bogdanm | 82:6473597d706e | 1305 | * @return address Flash maximum block 0 address |
bogdanm | 82:6473597d706e | 1306 | */ |
bogdanm | 82:6473597d706e | 1307 | static inline uint32_t sim_get_maxaddr0(void) |
bogdanm | 82:6473597d706e | 1308 | { |
bogdanm | 82:6473597d706e | 1309 | return BR_SIM_FCFG2_MAXADDR0; |
bogdanm | 82:6473597d706e | 1310 | } |
bogdanm | 82:6473597d706e | 1311 | #endif |
bogdanm | 82:6473597d706e | 1312 | |
bogdanm | 82:6473597d706e | 1313 | #if FSL_FEATURE_SIM_FCFG_HAS_MAXADDR1 |
bogdanm | 82:6473597d706e | 1314 | /*! |
bogdanm | 82:6473597d706e | 1315 | * @brief Gets the Flash maximum address block 1 in Flash Configuration Register 2. |
bogdanm | 82:6473597d706e | 1316 | * |
bogdanm | 82:6473597d706e | 1317 | * This function gets the Flash maximum block 1 in Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1318 | * |
bogdanm | 82:6473597d706e | 1319 | * @return address Flash maximum block 0 address |
bogdanm | 82:6473597d706e | 1320 | */ |
bogdanm | 82:6473597d706e | 1321 | static inline uint32_t sim_get_maxaddr1(void) |
bogdanm | 82:6473597d706e | 1322 | { |
bogdanm | 82:6473597d706e | 1323 | return BR_SIM_FCFG2_MAXADDR1; |
bogdanm | 82:6473597d706e | 1324 | } |
bogdanm | 82:6473597d706e | 1325 | #endif |
bogdanm | 82:6473597d706e | 1326 | |
bogdanm | 82:6473597d706e | 1327 | #if FSL_FEATURE_SIM_FCFG_HAS_MAXADDR01 |
bogdanm | 82:6473597d706e | 1328 | /*! |
bogdanm | 82:6473597d706e | 1329 | * @brief Gets the Flash maximum address block 0 in the Flash Configuration Register 1 (SIM_FCFG). |
bogdanm | 82:6473597d706e | 1330 | * |
bogdanm | 82:6473597d706e | 1331 | * This function gets the Flash maximum block 0 in Flash Configuration Register 2. |
bogdanm | 82:6473597d706e | 1332 | * |
bogdanm | 82:6473597d706e | 1333 | * @return address Flash maximum block 0 address |
bogdanm | 82:6473597d706e | 1334 | */ |
bogdanm | 82:6473597d706e | 1335 | static inline uint32_t sim_get_maxaddr01(void) |
bogdanm | 82:6473597d706e | 1336 | { |
bogdanm | 82:6473597d706e | 1337 | return BR_SIM_FCFG2_MAXADDR01; |
bogdanm | 82:6473597d706e | 1338 | } |
bogdanm | 82:6473597d706e | 1339 | #endif |
bogdanm | 82:6473597d706e | 1340 | |
bogdanm | 82:6473597d706e | 1341 | #if FSL_FEATURE_SIM_FCFG_HAS_MAXADDR23 |
bogdanm | 82:6473597d706e | 1342 | /*! |
bogdanm | 82:6473597d706e | 1343 | * @brief Gets the Flash maximum address block 1 in the Flash Configuration Register 2. |
bogdanm | 82:6473597d706e | 1344 | * |
bogdanm | 82:6473597d706e | 1345 | * This function gets the Flash maximum block 1 in Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1346 | * |
bogdanm | 82:6473597d706e | 1347 | * @return address Flash maximum block 0 address |
bogdanm | 82:6473597d706e | 1348 | */ |
bogdanm | 82:6473597d706e | 1349 | static inline uint32_t sim_get_maxaddr23(void) |
bogdanm | 82:6473597d706e | 1350 | { |
bogdanm | 82:6473597d706e | 1351 | return BR_SIM_FCFG2_MAXADDR23; |
bogdanm | 82:6473597d706e | 1352 | } |
bogdanm | 82:6473597d706e | 1353 | #endif |
bogdanm | 82:6473597d706e | 1354 | |
bogdanm | 82:6473597d706e | 1355 | #if FSL_FEATURE_SIM_FCFG_HAS_PFLSH |
bogdanm | 82:6473597d706e | 1356 | /*! |
bogdanm | 82:6473597d706e | 1357 | * @brief Gets the program flash in the Flash Configuration Register 2. |
bogdanm | 82:6473597d706e | 1358 | * |
bogdanm | 82:6473597d706e | 1359 | * This function gets the program flash maximum block 0 in Flash Configuration Register 1. |
bogdanm | 82:6473597d706e | 1360 | * |
bogdanm | 82:6473597d706e | 1361 | * @return status program flash status |
bogdanm | 82:6473597d706e | 1362 | */ |
bogdanm | 82:6473597d706e | 1363 | static inline uint32_t sim_get_pflsh(void) |
bogdanm | 82:6473597d706e | 1364 | { |
bogdanm | 82:6473597d706e | 1365 | return BR_SIM_FCFG2_PFLSH; |
bogdanm | 82:6473597d706e | 1366 | } |
bogdanm | 82:6473597d706e | 1367 | #endif |
bogdanm | 82:6473597d706e | 1368 | |
bogdanm | 82:6473597d706e | 1369 | /*@}*/ |
bogdanm | 82:6473597d706e | 1370 | |
bogdanm | 82:6473597d706e | 1371 | #if defined(__cplusplus) |
bogdanm | 82:6473597d706e | 1372 | } |
bogdanm | 82:6473597d706e | 1373 | #endif /* __cplusplus*/ |
bogdanm | 82:6473597d706e | 1374 | |
bogdanm | 82:6473597d706e | 1375 | /*! @}*/ |
bogdanm | 82:6473597d706e | 1376 | |
bogdanm | 82:6473597d706e | 1377 | #endif /* __FSL_SIM_HAL_H__*/ |
bogdanm | 82:6473597d706e | 1378 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 1379 | * EOF |
bogdanm | 82:6473597d706e | 1380 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 1381 |