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