mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/sleep.c@160:d5399cc887bb, 2017-03-14 (annotated)
- Committer:
- <>
- Date:
- Tue Mar 14 16:40:56 2017 +0000
- Revision:
- 160:d5399cc887bb
- Parent:
- 154:37f96f9d4de2
- Child:
- 169:e3b6fe271b81
This updates the lib to the mbed lib v138
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 154:37f96f9d4de2 | 1 | /* mbed Microcontroller Library |
<> | 154:37f96f9d4de2 | 2 | * Copyright (c) 2006-2013 ARM Limited |
<> | 154:37f96f9d4de2 | 3 | * |
<> | 154:37f96f9d4de2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 154:37f96f9d4de2 | 5 | * you may not use this file except in compliance with the License. |
<> | 154:37f96f9d4de2 | 6 | * You may obtain a copy of the License at |
<> | 154:37f96f9d4de2 | 7 | * |
<> | 154:37f96f9d4de2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 154:37f96f9d4de2 | 9 | * |
<> | 154:37f96f9d4de2 | 10 | * Unless required by applicable law or agreed to in writing, software |
<> | 154:37f96f9d4de2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 154:37f96f9d4de2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 154:37f96f9d4de2 | 13 | * See the License for the specific language governing permissions and |
<> | 154:37f96f9d4de2 | 14 | * limitations under the License. |
<> | 154:37f96f9d4de2 | 15 | */ |
<> | 154:37f96f9d4de2 | 16 | #include "sleep_api.h" |
<> | 154:37f96f9d4de2 | 17 | #include "cmsis.h" |
<> | 154:37f96f9d4de2 | 18 | #include "fsl_smc.h" |
<> | 154:37f96f9d4de2 | 19 | #include "fsl_clock_config.h" |
<> | 154:37f96f9d4de2 | 20 | |
<> | 160:d5399cc887bb | 21 | void hal_sleep(void) |
<> | 154:37f96f9d4de2 | 22 | { |
<> | 154:37f96f9d4de2 | 23 | SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll); |
<> | 154:37f96f9d4de2 | 24 | |
<> | 154:37f96f9d4de2 | 25 | SMC_SetPowerModeWait(SMC); |
<> | 154:37f96f9d4de2 | 26 | } |
<> | 154:37f96f9d4de2 | 27 | |
<> | 160:d5399cc887bb | 28 | void hal_deepsleep(void) |
<> | 154:37f96f9d4de2 | 29 | { |
<> | 154:37f96f9d4de2 | 30 | #if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT) |
<> | 154:37f96f9d4de2 | 31 | mcg_mode_t mode = CLOCK_GetMode(); |
<> | 154:37f96f9d4de2 | 32 | #endif |
<> | 154:37f96f9d4de2 | 33 | SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll); |
<> | 154:37f96f9d4de2 | 34 | |
<> | 154:37f96f9d4de2 | 35 | SMC_SetPowerModeVlps(SMC); |
<> | 154:37f96f9d4de2 | 36 | |
<> | 154:37f96f9d4de2 | 37 | #if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT) |
<> | 154:37f96f9d4de2 | 38 | /* |
<> | 154:37f96f9d4de2 | 39 | * If enter stop modes when MCG in PEE mode, then after wakeup, the MCG is in PBE mode, |
<> | 154:37f96f9d4de2 | 40 | * need to enter PEE mode manually. |
<> | 154:37f96f9d4de2 | 41 | */ |
<> | 154:37f96f9d4de2 | 42 | #if defined(kMCG_ModePEE) |
<> | 154:37f96f9d4de2 | 43 | if (mode == kMCG_ModePEE) { |
<> | 154:37f96f9d4de2 | 44 | BOARD_BootClockRUN(); |
<> | 154:37f96f9d4de2 | 45 | } |
<> | 154:37f96f9d4de2 | 46 | #endif |
<> | 154:37f96f9d4de2 | 47 | #endif |
<> | 154:37f96f9d4de2 | 48 | } |