Theo/Ludo/Joe / ER2_Labyrinthe_V3

Dependencies:   mbed

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