mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Committer:
dkato
Date:
Fri Feb 02 05:42:23 2018 +0000
Revision:
0:f782d9c66c49
mbed-os for GR-LYCHEE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:f782d9c66c49 1
dkato 0:f782d9c66c49 2 /** \addtogroup platform */
dkato 0:f782d9c66c49 3 /** @{*/
dkato 0:f782d9c66c49 4 /* mbed Microcontroller Library
dkato 0:f782d9c66c49 5 * Copyright (c) 2006-2017 ARM Limited
dkato 0:f782d9c66c49 6 *
dkato 0:f782d9c66c49 7 * Licensed under the Apache License, Version 2.0 (the "License");
dkato 0:f782d9c66c49 8 * you may not use this file except in compliance with the License.
dkato 0:f782d9c66c49 9 * You may obtain a copy of the License at
dkato 0:f782d9c66c49 10 *
dkato 0:f782d9c66c49 11 * http://www.apache.org/licenses/LICENSE-2.0
dkato 0:f782d9c66c49 12 *
dkato 0:f782d9c66c49 13 * Unless required by applicable law or agreed to in writing, software
dkato 0:f782d9c66c49 14 * distributed under the License is distributed on an "AS IS" BASIS,
dkato 0:f782d9c66c49 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dkato 0:f782d9c66c49 16 * See the License for the specific language governing permissions and
dkato 0:f782d9c66c49 17 * limitations under the License.
dkato 0:f782d9c66c49 18 */
dkato 0:f782d9c66c49 19 #ifndef MBED_SLEEP_H
dkato 0:f782d9c66c49 20 #define MBED_SLEEP_H
dkato 0:f782d9c66c49 21
dkato 0:f782d9c66c49 22 #include "sleep_api.h"
dkato 0:f782d9c66c49 23
dkato 0:f782d9c66c49 24 #ifdef __cplusplus
dkato 0:f782d9c66c49 25 extern "C" {
dkato 0:f782d9c66c49 26 #endif
dkato 0:f782d9c66c49 27
dkato 0:f782d9c66c49 28 /** Send the microcontroller to sleep
dkato 0:f782d9c66c49 29 *
dkato 0:f782d9c66c49 30 * @note This function can be a noop if not implemented by the platform.
dkato 0:f782d9c66c49 31 * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
dkato 0:f782d9c66c49 32 *
dkato 0:f782d9c66c49 33 * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
dkato 0:f782d9c66c49 34 * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
dkato 0:f782d9c66c49 35 * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
dkato 0:f782d9c66c49 36 * memory state are maintained, and the peripherals continue to work and can generate interrupts.
dkato 0:f782d9c66c49 37 *
dkato 0:f782d9c66c49 38 * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
dkato 0:f782d9c66c49 39 *
dkato 0:f782d9c66c49 40 * @note
dkato 0:f782d9c66c49 41 * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
dkato 0:f782d9c66c49 42 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
dkato 0:f782d9c66c49 43 * able to access the LocalFileSystem
dkato 0:f782d9c66c49 44 */
dkato 0:f782d9c66c49 45 __INLINE static void sleep(void)
dkato 0:f782d9c66c49 46 {
dkato 0:f782d9c66c49 47 #ifdef NDEBUG
dkato 0:f782d9c66c49 48 #if DEVICE_SLEEP
dkato 0:f782d9c66c49 49 hal_sleep();
dkato 0:f782d9c66c49 50 #endif /* DEVICE_SLEEP */
dkato 0:f782d9c66c49 51 #endif /* NDEBUG */
dkato 0:f782d9c66c49 52 }
dkato 0:f782d9c66c49 53
dkato 0:f782d9c66c49 54 /** Send the microcontroller to deep sleep
dkato 0:f782d9c66c49 55 *
dkato 0:f782d9c66c49 56 * @note This function can be a noop if not implemented by the platform.
dkato 0:f782d9c66c49 57 * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
dkato 0:f782d9c66c49 58 *
dkato 0:f782d9c66c49 59 * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
dkato 0:f782d9c66c49 60 * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
dkato 0:f782d9c66c49 61 * is still maintained.
dkato 0:f782d9c66c49 62 *
dkato 0:f782d9c66c49 63 * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
dkato 0:f782d9c66c49 64 *
dkato 0:f782d9c66c49 65 * @note
dkato 0:f782d9c66c49 66 * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
dkato 0:f782d9c66c49 67 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
dkato 0:f782d9c66c49 68 * able to access the LocalFileSystem
dkato 0:f782d9c66c49 69 */
dkato 0:f782d9c66c49 70 __INLINE static void deepsleep(void)
dkato 0:f782d9c66c49 71 {
dkato 0:f782d9c66c49 72 #ifdef NDEBUG
dkato 0:f782d9c66c49 73 #if DEVICE_SLEEP
dkato 0:f782d9c66c49 74 hal_deepsleep();
dkato 0:f782d9c66c49 75 #endif /* DEVICE_SLEEP */
dkato 0:f782d9c66c49 76 #endif /* NDEBUG */
dkato 0:f782d9c66c49 77 }
dkato 0:f782d9c66c49 78
dkato 0:f782d9c66c49 79 #ifdef __cplusplus
dkato 0:f782d9c66c49 80 }
dkato 0:f782d9c66c49 81 #endif
dkato 0:f782d9c66c49 82
dkato 0:f782d9c66c49 83 #endif
dkato 0:f782d9c66c49 84
dkato 0:f782d9c66c49 85 /** @}*/