mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sleep_api.h Source File

sleep_api.h

00001 
00002 /** \addtogroup hal */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 2006-2013 ARM Limited
00006  * SPDX-License-Identifier: Apache-2.0
00007  *
00008  * Licensed under the Apache License, Version 2.0 (the "License");
00009  * you may not use this file except in compliance with the License.
00010  * You may obtain a copy of the License at
00011  *
00012  *     http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  * Unless required by applicable law or agreed to in writing, software
00015  * distributed under the License is distributed on an "AS IS" BASIS,
00016  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017  * See the License for the specific language governing permissions and
00018  * limitations under the License.
00019  */
00020 #ifndef MBED_SLEEP_API_H
00021 #define MBED_SLEEP_API_H
00022 
00023 #include "device.h"
00024 
00025 #if DEVICE_SLEEP
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 /**
00032  * \defgroup hal_sleep sleep hal requirements
00033  * Low level interface to the sleep mode of a target.
00034  *
00035  * # Defined behaviour
00036  *
00037  * * Sleep mode
00038  *   * wake-up time should be less than 10 us - Verified by sleep_usticker_test().
00039  *   * the processor can be woken up by any internal peripheral interrupt  - Verified by sleep_usticker_test().
00040  *   * all peripherals operate as in run mode - not verified.
00041  *   * the processor can be woken up by external pin interrupt - not verified.
00042  * * Deep sleep
00043  *   * the wake-up time should be less than 10 ms - Verified by deepsleep_lpticker_test().
00044  *   * lp ticker should wake up a target from this mode - Verified by deepsleep_lpticker_test().
00045  *   * RTC should wake up a target from this mode - not verified.
00046  *   * an external interrupt on a pin should wake up a target from this mode - not verified.
00047  *   * a watchdog timer should wake up a target from this mode - not verified.
00048  *   * High-speed clocks are turned off - Verified by deepsleep_high_speed_clocks_turned_off_test().
00049  *   * RTC keeps time - Verified by rtc_sleep_test().
00050  *
00051  * # Undefined behaviour
00052  *
00053  * * peripherals aside from RTC, GPIO and lp ticker result in undefined behaviour in deep sleep.
00054  * @{
00055  */
00056 
00057 /**
00058  * \defgroup hal_sleep_tests sleep hal tests
00059  * The sleep HAL tests ensure driver conformance to defined behaviour.
00060  *
00061  * To run the sleep hal tests use the command:
00062  *
00063  *     mbed test -t <toolchain> -m <target> -n tests-mbed_hal-sleep*
00064  *
00065  */
00066 
00067 /** Send the microcontroller to sleep
00068  *
00069  * The processor is setup ready for sleep, and sent to sleep. In this mode, the
00070  * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
00071  * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
00072  * memory state are maintained, and the peripherals continue to work and can generate interrupts.
00073  *
00074  * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
00075  *
00076  * The wake-up time shall be less than 10 us.
00077  *
00078  */
00079 void hal_sleep(void);
00080 
00081 /** Send the microcontroller to deep sleep
00082  *
00083  * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
00084  * has the same sleep features as sleep plus it powers down peripherals and high frequency clocks.
00085  * All state is still maintained.
00086  *
00087  * The processor can only be woken up by low power ticker, RTC, an external interrupt on a pin or a watchdog timer.
00088  *
00089  * The wake-up time shall be less than 10 ms.
00090  */
00091 void hal_deepsleep(void);
00092 
00093 /**@}*/
00094 
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098 
00099 #endif
00100 
00101 #endif
00102 
00103 /**@}*/