mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c
Dependents: Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay
Fork of mbed-dev by
targets/TARGET_Maxim/TARGET_MAX32630/mxc/clkman.h@177:619788de047e, 2017-11-07 (annotated)
- Committer:
- maxxir
- Date:
- Tue Nov 07 16:46:29 2017 +0000
- Revision:
- 177:619788de047e
- Parent:
- 157:ff67d9f36b67
To fix broken RTC on Nucleo_F103RB / STM32F103 BluePill etc..; Used direct RTC register manipulation for STM32F1xx; rtc_read() && rtc_write() (native rtc_init() - works good); also added stub for non-working on STM32F1xx rtc_read_subseconds().
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 157:ff67d9f36b67 | 1 | /** |
<> | 157:ff67d9f36b67 | 2 | * @file |
<> | 157:ff67d9f36b67 | 3 | * @brief Registers, Bit Masks and Bit Positions for the System Clock |
<> | 157:ff67d9f36b67 | 4 | * Management (CLKMAN) module. |
<> | 157:ff67d9f36b67 | 5 | */ |
<> | 157:ff67d9f36b67 | 6 | /* **************************************************************************** |
<> | 157:ff67d9f36b67 | 7 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
<> | 157:ff67d9f36b67 | 8 | * |
<> | 157:ff67d9f36b67 | 9 | * Permission is hereby granted, free of charge, to any person obtaining a |
<> | 157:ff67d9f36b67 | 10 | * copy of this software and associated documentation files (the "Software"), |
<> | 157:ff67d9f36b67 | 11 | * to deal in the Software without restriction, including without limitation |
<> | 157:ff67d9f36b67 | 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
<> | 157:ff67d9f36b67 | 13 | * and/or sell copies of the Software, and to permit persons to whom the |
<> | 157:ff67d9f36b67 | 14 | * Software is furnished to do so, subject to the following conditions: |
<> | 157:ff67d9f36b67 | 15 | * |
<> | 157:ff67d9f36b67 | 16 | * The above copyright notice and this permission notice shall be included |
<> | 157:ff67d9f36b67 | 17 | * in all copies or substantial portions of the Software. |
<> | 157:ff67d9f36b67 | 18 | * |
<> | 157:ff67d9f36b67 | 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
<> | 157:ff67d9f36b67 | 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
<> | 157:ff67d9f36b67 | 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
<> | 157:ff67d9f36b67 | 22 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
<> | 157:ff67d9f36b67 | 23 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
<> | 157:ff67d9f36b67 | 24 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
<> | 157:ff67d9f36b67 | 25 | * OTHER DEALINGS IN THE SOFTWARE. |
<> | 157:ff67d9f36b67 | 26 | * |
<> | 157:ff67d9f36b67 | 27 | * Except as contained in this notice, the name of Maxim Integrated |
<> | 157:ff67d9f36b67 | 28 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
<> | 157:ff67d9f36b67 | 29 | * Products, Inc. Branding Policy. |
<> | 157:ff67d9f36b67 | 30 | * |
<> | 157:ff67d9f36b67 | 31 | * The mere transfer of this software does not imply any licenses |
<> | 157:ff67d9f36b67 | 32 | * of trade secrets, proprietary technology, copyrights, patents, |
<> | 157:ff67d9f36b67 | 33 | * trademarks, maskwork rights, or any other form of intellectual |
<> | 157:ff67d9f36b67 | 34 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
<> | 157:ff67d9f36b67 | 35 | * ownership rights. |
<> | 157:ff67d9f36b67 | 36 | * |
<> | 157:ff67d9f36b67 | 37 | * $Date: 2016-08-15 11:08:12 -0500 (Mon, 15 Aug 2016) $ |
<> | 157:ff67d9f36b67 | 38 | * $Revision: 24058 $ |
<> | 157:ff67d9f36b67 | 39 | * |
<> | 157:ff67d9f36b67 | 40 | **************************************************************************** */ |
<> | 157:ff67d9f36b67 | 41 | |
<> | 157:ff67d9f36b67 | 42 | /* Define to prevent redundant inclusion */ |
<> | 157:ff67d9f36b67 | 43 | #ifndef _CLKMAN_H_ |
<> | 157:ff67d9f36b67 | 44 | #define _CLKMAN_H_ |
<> | 157:ff67d9f36b67 | 45 | |
<> | 157:ff67d9f36b67 | 46 | /* **** Includes **** */ |
<> | 157:ff67d9f36b67 | 47 | #include "mxc_config.h" |
<> | 157:ff67d9f36b67 | 48 | #include "clkman_regs.h" |
<> | 157:ff67d9f36b67 | 49 | |
<> | 157:ff67d9f36b67 | 50 | #ifdef __cplusplus |
<> | 157:ff67d9f36b67 | 51 | extern "C" { |
<> | 157:ff67d9f36b67 | 52 | #endif |
<> | 157:ff67d9f36b67 | 53 | |
<> | 157:ff67d9f36b67 | 54 | /** |
<> | 157:ff67d9f36b67 | 55 | * @defgroup clkman Clock Management |
<> | 157:ff67d9f36b67 | 56 | * @ingroup sysconfig |
<> | 157:ff67d9f36b67 | 57 | * @{ |
<> | 157:ff67d9f36b67 | 58 | */ |
<> | 157:ff67d9f36b67 | 59 | |
<> | 157:ff67d9f36b67 | 60 | /* **** Definitions **** */ |
<> | 157:ff67d9f36b67 | 61 | |
<> | 157:ff67d9f36b67 | 62 | /** |
<> | 157:ff67d9f36b67 | 63 | * Enumeration type specifying the System Clock Rate. @see CLKMAN_SYSTEM_SOURCE_values |
<> | 157:ff67d9f36b67 | 64 | */ |
<> | 157:ff67d9f36b67 | 65 | typedef enum { |
<> | 157:ff67d9f36b67 | 66 | CLKMAN_SYSTEM_SOURCE_96MHZ = 0, /**< Clock select for 96MHz oscillator.*/ |
<> | 157:ff67d9f36b67 | 67 | CLKMAN_SYSTEM_SOURCE_4MHZ = 1 /**< Clock select for 4MHz oscillator. */ |
<> | 157:ff67d9f36b67 | 68 | } |
<> | 157:ff67d9f36b67 | 69 | clkman_system_source_select_t; |
<> | 157:ff67d9f36b67 | 70 | |
<> | 157:ff67d9f36b67 | 71 | /** |
<> | 157:ff67d9f36b67 | 72 | * Enumeration type for setting the system clock divider. |
<> | 157:ff67d9f36b67 | 73 | * @note 4MHz System source can only be divided down by a maximum factor of 8. |
<> | 157:ff67d9f36b67 | 74 | */ |
<> | 157:ff67d9f36b67 | 75 | typedef enum { |
<> | 157:ff67d9f36b67 | 76 | CLKMAN_SYSTEM_SCALE_DIV_1 = 0, /**< Clock scale for dividing system by 1. */ |
<> | 157:ff67d9f36b67 | 77 | CLKMAN_SYSTEM_SCALE_DIV_2 = 1, /**< Clock scale for dividing system by 2. */ |
<> | 157:ff67d9f36b67 | 78 | CLKMAN_SYSTEM_SCALE_DIV_4 = 2, /**< Clock scale for dividing system by 4. */ |
<> | 157:ff67d9f36b67 | 79 | CLKMAN_SYSTEM_SCALE_DIV_8 = 3, /**< Clock scale for dividing system by 8. */ |
<> | 157:ff67d9f36b67 | 80 | CLKMAN_SYSTEM_SCALE_DIV_16 = 4 /**< Clock scale for dividing system by 16. */ |
<> | 157:ff67d9f36b67 | 81 | } clkman_system_scale_t; |
<> | 157:ff67d9f36b67 | 82 | |
<> | 157:ff67d9f36b67 | 83 | /** |
<> | 157:ff67d9f36b67 | 84 | * Enumeration type for selecting a peripheral module for setting and getting it's clock scale. |
<> | 157:ff67d9f36b67 | 85 | */ |
<> | 157:ff67d9f36b67 | 86 | typedef enum { |
<> | 157:ff67d9f36b67 | 87 | CLKMAN_CLK_CPU = 0, /**< CPU clock. */ |
<> | 157:ff67d9f36b67 | 88 | CLKMAN_CLK_SYNC = 1, /**< Synchronizer clock. */ |
<> | 157:ff67d9f36b67 | 89 | CLKMAN_CLK_SPIX = 2, /**< SPI XIP module clock. */ |
<> | 157:ff67d9f36b67 | 90 | CLKMAN_CLK_PRNG = 3, /**< PRNG module clock. */ |
<> | 157:ff67d9f36b67 | 91 | CLKMAN_CLK_WDT0 = 4, /**< Watchdog Timer 0 clock. */ |
<> | 157:ff67d9f36b67 | 92 | CLKMAN_CLK_WDT1 = 5, /**< Watchdog Timer 1 clock. */ |
<> | 157:ff67d9f36b67 | 93 | CLKMAN_CLK_GPIO = 6, /**< GPIO module clock. */ |
<> | 157:ff67d9f36b67 | 94 | CLKMAN_CLK_PT = 7, /**< Pulse Train engine clock. */ |
<> | 157:ff67d9f36b67 | 95 | CLKMAN_CLK_UART = 8, /**< UART clock. */ |
<> | 157:ff67d9f36b67 | 96 | CLKMAN_CLK_I2CM = 9, /**< I2C Master module clock (for all instances). */ |
<> | 157:ff67d9f36b67 | 97 | CLKMAN_CLK_I2CS = 10, /**< I2C Slave module clock. */ |
<> | 157:ff67d9f36b67 | 98 | CLKMAN_CLK_SPIM0 = 11, /**< SPI Master instance 0 module clock. */ |
<> | 157:ff67d9f36b67 | 99 | CLKMAN_CLK_SPIM1 = 12, /**< SPI Master instance 1 module clock. */ |
<> | 157:ff67d9f36b67 | 100 | CLKMAN_CLK_SPIM2 = 13, /**< SPI Master instance 2 module clock. */ |
<> | 157:ff67d9f36b67 | 101 | CLKMAN_CLK_SPIB = 14, /**< SPI Bridge module clock. */ |
<> | 157:ff67d9f36b67 | 102 | CLKMAN_CLK_OWM = 15, /**< OWM module clock. */ |
<> | 157:ff67d9f36b67 | 103 | CLKMAN_CLK_SPIS = 16, /**< SPI Slave module clock. */ |
<> | 157:ff67d9f36b67 | 104 | CLKMAN_CRYPTO_CLK_AES = 17, /**< AES engine clock. */ |
<> | 157:ff67d9f36b67 | 105 | CLKMAN_CRYPTO_CLK_MAA = 18, /**< Modular Arithmetic Accelerator (MAA) clock. */ |
<> | 157:ff67d9f36b67 | 106 | CLKMAN_CRYPTO_CLK_PRNG = 19, /**< Pseudo-random number Generator (PRNG) clock. */ |
<> | 157:ff67d9f36b67 | 107 | CLKMAN_CLK_MAX /**< Maximum value of enum for limit checking. */ |
<> | 157:ff67d9f36b67 | 108 | } clkman_clk_t; |
<> | 157:ff67d9f36b67 | 109 | |
<> | 157:ff67d9f36b67 | 110 | /** |
<> | 157:ff67d9f36b67 | 111 | * Enumeration type for selecting a peripheral module (USB, Cryto, ADC, WDT0, WDT1 and RTC/RTOS) |
<> | 157:ff67d9f36b67 | 112 | * to enable/disable clock gating. |
<> | 157:ff67d9f36b67 | 113 | */ |
<> | 157:ff67d9f36b67 | 114 | typedef enum { |
<> | 157:ff67d9f36b67 | 115 | CLKMAN_USB_CLOCK = MXC_F_CLKMAN_CLK_CTRL_USB_CLOCK_ENABLE, /**< Enable/Disable mask for USB. */ |
<> | 157:ff67d9f36b67 | 116 | CLKMAN_CRYPTO_CLOCK = MXC_F_CLKMAN_CLK_CTRL_CRYPTO_CLOCK_ENABLE, /**< Enable/Disable mask for Crypto Clock. */ |
<> | 157:ff67d9f36b67 | 117 | CLKMAN_ADC_CLOCK = MXC_F_CLKMAN_CLK_CTRL_ADC_CLOCK_ENABLE, /**< Enable/Disable mask for ADC. */ |
<> | 157:ff67d9f36b67 | 118 | CLKMAN_WDT0_CLOCK = MXC_F_CLKMAN_CLK_CTRL_WDT0_CLOCK_ENABLE, /**< Enable/Disable mask for Watch Dog Timer 0. */ |
<> | 157:ff67d9f36b67 | 119 | CLKMAN_WDT1_CLOCK = MXC_F_CLKMAN_CLK_CTRL_WDT1_CLOCK_ENABLE, /**< Enable/Disable mask for Watch Dog Timer 1. */ |
<> | 157:ff67d9f36b67 | 120 | CLKMAN_RTOS_MODE = MXC_F_CLKMAN_CLK_CTRL_RTOS_MODE /**< Enable/Disable mask for 32kHz clock in LP1 |
<> | 157:ff67d9f36b67 | 121 | * required to use JTAG for debug. |
<> | 157:ff67d9f36b67 | 122 | */ |
<> | 157:ff67d9f36b67 | 123 | } clkman_enable_clk_t; |
<> | 157:ff67d9f36b67 | 124 | |
<> | 157:ff67d9f36b67 | 125 | /** |
<> | 157:ff67d9f36b67 | 126 | * Enumeration type for selecting the clock scale for the system or peripheral module. |
<> | 157:ff67d9f36b67 | 127 | */ |
<> | 157:ff67d9f36b67 | 128 | typedef enum { |
<> | 157:ff67d9f36b67 | 129 | CLKMAN_SCALE_DISABLED = MXC_V_CLKMAN_CLK_SCALE_DISABLED, /**< Clock disabled. */ |
<> | 157:ff67d9f36b67 | 130 | CLKMAN_SCALE_DIV_1 = MXC_V_CLKMAN_CLK_SCALE_DIV_1, /**< Clock scale for dividing by 1. */ |
<> | 157:ff67d9f36b67 | 131 | CLKMAN_SCALE_DIV_2 = MXC_V_CLKMAN_CLK_SCALE_DIV_2, /**< Clock scale for dividing by 2. */ |
<> | 157:ff67d9f36b67 | 132 | CLKMAN_SCALE_DIV_4 = MXC_V_CLKMAN_CLK_SCALE_DIV_4, /**< Clock scale for dividing by 4. */ |
<> | 157:ff67d9f36b67 | 133 | CLKMAN_SCALE_DIV_8 = MXC_V_CLKMAN_CLK_SCALE_DIV_8, /**< Clock scale for dividing by 8. */ |
<> | 157:ff67d9f36b67 | 134 | CLKMAN_SCALE_DIV_16 = MXC_V_CLKMAN_CLK_SCALE_DIV_16, /**< Clock scale for dividing by 16. */ |
<> | 157:ff67d9f36b67 | 135 | CLKMAN_SCALE_DIV_32 = MXC_V_CLKMAN_CLK_SCALE_DIV_32, /**< Clock scale for dividing by 32. */ |
<> | 157:ff67d9f36b67 | 136 | CLKMAN_SCALE_DIV_64 = MXC_V_CLKMAN_CLK_SCALE_DIV_64, /**< Clock scale for dividing by 64. */ |
<> | 157:ff67d9f36b67 | 137 | CLKMAN_SCALE_DIV_128 = MXC_V_CLKMAN_CLK_SCALE_DIV_128, /**< Clock scale for dividing by 128. */ |
<> | 157:ff67d9f36b67 | 138 | CLKMAN_SCALE_DIV_256 = MXC_V_CLKMAN_CLK_SCALE_DIV_256, /**< Clock scale for dividing by 256. */ |
<> | 157:ff67d9f36b67 | 139 | CLKMAN_SCALE_AUTO /**< Clock scale to auto select divider. */ |
<> | 157:ff67d9f36b67 | 140 | } clkman_scale_t; |
<> | 157:ff67d9f36b67 | 141 | |
<> | 157:ff67d9f36b67 | 142 | /* |
<> | 157:ff67d9f36b67 | 143 | * Enumeration type for selecting the source clock for the Watch Dog Timers. |
<> | 157:ff67d9f36b67 | 144 | * | Enumeration Selection | Value | WDT Clock Source | |
<> | 157:ff67d9f36b67 | 145 | * | :--------------------------------------: | :---: | :-------------------------- | |
<> | 157:ff67d9f36b67 | 146 | * | CLKMAN_WDT_SELECT_SCALED_SYS_CLK_CTRL | 0 | Scaled System Clock | |
<> | 157:ff67d9f36b67 | 147 | * | CLKMAN_WDT_SELECT_32KHZ_RTC_OSCILLATOR | 1 | 32 kHz Real-Time Clock | |
<> | 157:ff67d9f36b67 | 148 | * | CLKMAN_WDT_SELECT_96MHZ_OSCILLATOR | 2 | 96 MHz Oscillator unscaled | |
<> | 157:ff67d9f36b67 | 149 | * | CLKMAN_WDT_SELECT_NANO_RING_OSCILLATOR | 3 | Nano-ring clock | |
<> | 157:ff67d9f36b67 | 150 | * | CLKMAN_WDT_SELECT_DISABLED | 4 | WDT0 Clock is disabled | |
<> | 157:ff67d9f36b67 | 151 | */ |
<> | 157:ff67d9f36b67 | 152 | typedef enum { |
<> | 157:ff67d9f36b67 | 153 | CLKMAN_WDT_SELECT_SCALED_SYS_CLK_CTRL = MXC_V_CLKMAN_WDT0_CLOCK_SELECT_SCALED_SYS_CLK_CTRL_4_WDT0, /**< Use scaled system clock for Watchdog Timer 0. */ |
<> | 157:ff67d9f36b67 | 154 | CLKMAN_WDT_SELECT_32KHZ_RTC_OSCILLATOR = MXC_V_CLKMAN_WDT0_CLOCK_SELECT_32KHZ_RTC_OSCILLATOR, /**< Use 32kHz oscillator for Watchdog Timer 0. */ |
<> | 157:ff67d9f36b67 | 155 | CLKMAN_WDT_SELECT_96MHZ_OSCILLATOR = MXC_V_CLKMAN_WDT0_CLOCK_SELECT_96MHZ_OSCILLATOR, /**< Use 96MHz clock for Watchdog Timer 0. */ |
<> | 157:ff67d9f36b67 | 156 | CLKMAN_WDT_SELECT_NANO_RING_OSCILLATOR = MXC_V_CLKMAN_WDT0_CLOCK_SELECT_NANO_RING_OSCILLATOR, /**< Use Nano-Ring Oscillator (8kHz) for Watchdog Timer 0 clock.*/ |
<> | 157:ff67d9f36b67 | 157 | CLKMAN_WDT_SELECT_DISABLED /**< Watchdog Timer 0 clock disabled. */ |
<> | 157:ff67d9f36b67 | 158 | } clkman_wdt_clk_select_t; |
<> | 157:ff67d9f36b67 | 159 | |
<> | 157:ff67d9f36b67 | 160 | |
<> | 157:ff67d9f36b67 | 161 | /* **** Function Prototypes **** */ |
<> | 157:ff67d9f36b67 | 162 | |
<> | 157:ff67d9f36b67 | 163 | /** |
<> | 157:ff67d9f36b67 | 164 | * @brief Selects the system clock source, |
<> | 157:ff67d9f36b67 | 165 | * @note 4MHz System source can only be divided down by a maximum factor |
<> | 157:ff67d9f36b67 | 166 | * of 8. |
<> | 157:ff67d9f36b67 | 167 | * |
<> | 157:ff67d9f36b67 | 168 | * @param select System clock source. |
<> | 157:ff67d9f36b67 | 169 | * @param scale System clock scaler. |
<> | 157:ff67d9f36b67 | 170 | */ |
<> | 157:ff67d9f36b67 | 171 | void CLKMAN_SetSystemClock(clkman_system_source_select_t select, clkman_system_scale_t scale); |
<> | 157:ff67d9f36b67 | 172 | |
<> | 157:ff67d9f36b67 | 173 | /** |
<> | 157:ff67d9f36b67 | 174 | * @brief Enables/disables the Crypto/TPU relaxation oscillator |
<> | 157:ff67d9f36b67 | 175 | * |
<> | 157:ff67d9f36b67 | 176 | * @param enable |:------- | :---: | |
<> | 157:ff67d9f36b67 | 177 | * | Enable | 1 | |
<> | 157:ff67d9f36b67 | 178 | * | Disable | 0 | |
<> | 157:ff67d9f36b67 | 179 | */ |
<> | 157:ff67d9f36b67 | 180 | void CLKMAN_CryptoClockEnable(int enable); |
<> | 157:ff67d9f36b67 | 181 | |
<> | 157:ff67d9f36b67 | 182 | /** |
<> | 157:ff67d9f36b67 | 183 | * @brief Enables/Disables clock gating for the specified peripheral |
<> | 157:ff67d9f36b67 | 184 | * module. |
<> | 157:ff67d9f36b67 | 185 | * |
<> | 157:ff67d9f36b67 | 186 | * @param clk Peripheral module to enable/disable clock gating. |
<> | 157:ff67d9f36b67 | 187 | * @param enable Enable (1) or Disable (0). |
<> | 157:ff67d9f36b67 | 188 | */ |
<> | 157:ff67d9f36b67 | 189 | void CLKMAN_ClockGate(clkman_enable_clk_t clk, int enable); |
<> | 157:ff67d9f36b67 | 190 | |
<> | 157:ff67d9f36b67 | 191 | /** |
<> | 157:ff67d9f36b67 | 192 | * @brief Sets the specified clock scaler value. |
<> | 157:ff67d9f36b67 | 193 | * |
<> | 157:ff67d9f36b67 | 194 | * @param clk Peripheral module to set the desired clock scale. |
<> | 157:ff67d9f36b67 | 195 | * @param scale Clock scale/divisor for the specified peripheral module. |
<> | 157:ff67d9f36b67 | 196 | */ |
<> | 157:ff67d9f36b67 | 197 | void CLKMAN_SetClkScale(clkman_clk_t clk, clkman_scale_t scale); |
<> | 157:ff67d9f36b67 | 198 | |
<> | 157:ff67d9f36b67 | 199 | /** |
<> | 157:ff67d9f36b67 | 200 | * @brief Get the clock scaler/divisor value for the specified peripheral |
<> | 157:ff67d9f36b67 | 201 | * module. |
<> | 157:ff67d9f36b67 | 202 | * |
<> | 157:ff67d9f36b67 | 203 | * @param clk The peripheral module to get the current clock scale setting, see #clkman_clk_t. |
<> | 157:ff67d9f36b67 | 204 | * @return A value indicating the clock divisor/scale of the requested |
<> | 157:ff67d9f36b67 | 205 | * peripheral module. |
<> | 157:ff67d9f36b67 | 206 | */ |
<> | 157:ff67d9f36b67 | 207 | clkman_scale_t CLKMAN_GetClkScale(clkman_clk_t clk); |
<> | 157:ff67d9f36b67 | 208 | |
<> | 157:ff67d9f36b67 | 209 | /** |
<> | 157:ff67d9f36b67 | 210 | * @brief Selects the clock source for the specified watchdog timer. |
<> | 157:ff67d9f36b67 | 211 | * |
<> | 157:ff67d9f36b67 | 212 | * @param idx Value indicating the WDT to set the clock source on. |
<> | 157:ff67d9f36b67 | 213 | * @param select Value of the desired clock source for the WDT. |
<> | 157:ff67d9f36b67 | 214 | */ |
<> | 157:ff67d9f36b67 | 215 | int CLKMAN_WdtClkSelect(unsigned int idx, clkman_wdt_clk_select_t select); |
<> | 157:ff67d9f36b67 | 216 | |
<> | 157:ff67d9f36b67 | 217 | /** |
<> | 157:ff67d9f36b67 | 218 | * @brief Get the interrupt flags for the CLKMAN module. |
<> | 157:ff67d9f36b67 | 219 | * |
<> | 157:ff67d9f36b67 | 220 | * @return The current interrupt flags. |
<> | 157:ff67d9f36b67 | 221 | */ |
<> | 157:ff67d9f36b67 | 222 | __STATIC_INLINE uint32_t CLKMAN_GetFlags(void) |
<> | 157:ff67d9f36b67 | 223 | { |
<> | 157:ff67d9f36b67 | 224 | return MXC_CLKMAN->intfl; |
<> | 157:ff67d9f36b67 | 225 | } |
<> | 157:ff67d9f36b67 | 226 | |
<> | 157:ff67d9f36b67 | 227 | /** |
<> | 157:ff67d9f36b67 | 228 | * @brief Clear the specified interrupt flags |
<> | 157:ff67d9f36b67 | 229 | * |
<> | 157:ff67d9f36b67 | 230 | * @param mask mask of clock management interrupt flags to clear |
<> | 157:ff67d9f36b67 | 231 | */ |
<> | 157:ff67d9f36b67 | 232 | __STATIC_INLINE void CLKMAN_ClrFlags(uint32_t mask) |
<> | 157:ff67d9f36b67 | 233 | { |
<> | 157:ff67d9f36b67 | 234 | MXC_CLKMAN->intfl = mask; |
<> | 157:ff67d9f36b67 | 235 | } |
<> | 157:ff67d9f36b67 | 236 | |
<> | 157:ff67d9f36b67 | 237 | /** |
<> | 157:ff67d9f36b67 | 238 | * @brief Enable the interrupts specified in the mask parameter. |
<> | 157:ff67d9f36b67 | 239 | * |
<> | 157:ff67d9f36b67 | 240 | * @param mask Mask of clock management interrupts to enable, 1 to enable |
<> | 157:ff67d9f36b67 | 241 | * a specific interrupt. |
<> | 157:ff67d9f36b67 | 242 | */ |
<> | 157:ff67d9f36b67 | 243 | __STATIC_INLINE void CLKMAN_EnableInt(uint32_t mask) |
<> | 157:ff67d9f36b67 | 244 | { |
<> | 157:ff67d9f36b67 | 245 | MXC_CLKMAN->inten |= mask; |
<> | 157:ff67d9f36b67 | 246 | } |
<> | 157:ff67d9f36b67 | 247 | |
<> | 157:ff67d9f36b67 | 248 | /** |
<> | 157:ff67d9f36b67 | 249 | * @brief Disable the specified interrupts |
<> | 157:ff67d9f36b67 | 250 | * |
<> | 157:ff67d9f36b67 | 251 | * @param mask Mask of CLKMAN interrupts to disable, 1 to disable a |
<> | 157:ff67d9f36b67 | 252 | * specific interrupt. |
<> | 157:ff67d9f36b67 | 253 | */ |
<> | 157:ff67d9f36b67 | 254 | __STATIC_INLINE void CLKMAN_DisableInt(uint32_t mask) |
<> | 157:ff67d9f36b67 | 255 | { |
<> | 157:ff67d9f36b67 | 256 | MXC_CLKMAN->inten &= ~mask; |
<> | 157:ff67d9f36b67 | 257 | } |
<> | 157:ff67d9f36b67 | 258 | |
<> | 157:ff67d9f36b67 | 259 | /** |
<> | 157:ff67d9f36b67 | 260 | * @brief Trim the ring oscillator. |
<> | 157:ff67d9f36b67 | 261 | * @note CLKMAN_TrimRO() is implemented in system_max32XXX.c |
<> | 157:ff67d9f36b67 | 262 | */ |
<> | 157:ff67d9f36b67 | 263 | void CLKMAN_TrimRO(void); |
<> | 157:ff67d9f36b67 | 264 | |
<> | 157:ff67d9f36b67 | 265 | /**@} end of group clkman */ |
<> | 157:ff67d9f36b67 | 266 | |
<> | 157:ff67d9f36b67 | 267 | #ifdef __cplusplus |
<> | 157:ff67d9f36b67 | 268 | } |
<> | 157:ff67d9f36b67 | 269 | #endif |
<> | 157:ff67d9f36b67 | 270 | |
<> | 157:ff67d9f36b67 | 271 | #endif /* _CLKMAN_H_ */ |