RTC auf true
hal/sleep_api.h@2:7aab896b1a3b, 2019-03-13 (annotated)
- Committer:
- kevman
- Date:
- Wed Mar 13 11:03:24 2019 +0000
- Revision:
- 2:7aab896b1a3b
- Parent:
- 0:38ceb79fef03
2019-03-13
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kevman | 0:38ceb79fef03 | 1 | |
kevman | 0:38ceb79fef03 | 2 | /** \addtogroup hal */ |
kevman | 0:38ceb79fef03 | 3 | /** @{*/ |
kevman | 0:38ceb79fef03 | 4 | /* mbed Microcontroller Library |
kevman | 0:38ceb79fef03 | 5 | * Copyright (c) 2006-2013 ARM Limited |
kevman | 0:38ceb79fef03 | 6 | * |
kevman | 0:38ceb79fef03 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kevman | 0:38ceb79fef03 | 8 | * you may not use this file except in compliance with the License. |
kevman | 0:38ceb79fef03 | 9 | * You may obtain a copy of the License at |
kevman | 0:38ceb79fef03 | 10 | * |
kevman | 0:38ceb79fef03 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
kevman | 0:38ceb79fef03 | 12 | * |
kevman | 0:38ceb79fef03 | 13 | * Unless required by applicable law or agreed to in writing, software |
kevman | 0:38ceb79fef03 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
kevman | 0:38ceb79fef03 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kevman | 0:38ceb79fef03 | 16 | * See the License for the specific language governing permissions and |
kevman | 0:38ceb79fef03 | 17 | * limitations under the License. |
kevman | 0:38ceb79fef03 | 18 | */ |
kevman | 0:38ceb79fef03 | 19 | #ifndef MBED_SLEEP_API_H |
kevman | 0:38ceb79fef03 | 20 | #define MBED_SLEEP_API_H |
kevman | 0:38ceb79fef03 | 21 | |
kevman | 0:38ceb79fef03 | 22 | #include "device.h" |
kevman | 0:38ceb79fef03 | 23 | |
kevman | 0:38ceb79fef03 | 24 | #if DEVICE_SLEEP |
kevman | 0:38ceb79fef03 | 25 | |
kevman | 0:38ceb79fef03 | 26 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 27 | extern "C" { |
kevman | 0:38ceb79fef03 | 28 | #endif |
kevman | 0:38ceb79fef03 | 29 | |
kevman | 0:38ceb79fef03 | 30 | /** |
kevman | 0:38ceb79fef03 | 31 | * \defgroup hal_sleep sleep hal requirements |
kevman | 0:38ceb79fef03 | 32 | * Low level interface to the sleep mode of a target. |
kevman | 0:38ceb79fef03 | 33 | * |
kevman | 0:38ceb79fef03 | 34 | * # Defined behaviour |
kevman | 0:38ceb79fef03 | 35 | * |
kevman | 0:38ceb79fef03 | 36 | * * Sleep mode |
kevman | 0:38ceb79fef03 | 37 | * * wake-up time should be less than 10 us - Verified by sleep_usticker_test(). |
kevman | 0:38ceb79fef03 | 38 | * * the processor can be woken up by any internal peripheral interrupt - Verified by sleep_usticker_test(). |
kevman | 0:38ceb79fef03 | 39 | * * all peripherals operate as in run mode - not verified. |
kevman | 0:38ceb79fef03 | 40 | * * the processor can be woken up by external pin interrupt - not verified. |
kevman | 0:38ceb79fef03 | 41 | * * Deep sleep |
kevman | 0:38ceb79fef03 | 42 | * * the wake-up time should be less than 10 ms - Verified by deepsleep_lpticker_test(). |
kevman | 0:38ceb79fef03 | 43 | * * lp ticker should wake up a target from this mode - Verified by deepsleep_lpticker_test(). |
kevman | 0:38ceb79fef03 | 44 | * * RTC should wake up a target from this mode - not verified. |
kevman | 0:38ceb79fef03 | 45 | * * an external interrupt on a pin should wake up a target from this mode - not verified. |
kevman | 0:38ceb79fef03 | 46 | * * a watchdog timer should wake up a target from this mode - not verified. |
kevman | 0:38ceb79fef03 | 47 | * * High-speed clocks are turned off - Verified by deepsleep_high_speed_clocks_turned_off_test(). |
kevman | 0:38ceb79fef03 | 48 | * * RTC keeps time - Verified by rtc_sleep_test(). |
kevman | 0:38ceb79fef03 | 49 | * |
kevman | 0:38ceb79fef03 | 50 | * # Undefined behaviour |
kevman | 0:38ceb79fef03 | 51 | * |
kevman | 0:38ceb79fef03 | 52 | * * peripherals aside from RTC, GPIO and lp ticker result in undefined behaviour in deep sleep. |
kevman | 0:38ceb79fef03 | 53 | * @{ |
kevman | 0:38ceb79fef03 | 54 | */ |
kevman | 0:38ceb79fef03 | 55 | |
kevman | 0:38ceb79fef03 | 56 | /** |
kevman | 0:38ceb79fef03 | 57 | * \defgroup hal_sleep_tests sleep hal tests |
kevman | 0:38ceb79fef03 | 58 | * The sleep HAL tests ensure driver conformance to defined behaviour. |
kevman | 0:38ceb79fef03 | 59 | * |
kevman | 0:38ceb79fef03 | 60 | * To run the sleep hal tests use the command: |
kevman | 0:38ceb79fef03 | 61 | * |
kevman | 0:38ceb79fef03 | 62 | * mbed test -t <toolchain> -m <target> -n tests-mbed_hal-sleep* |
kevman | 0:38ceb79fef03 | 63 | * |
kevman | 0:38ceb79fef03 | 64 | */ |
kevman | 0:38ceb79fef03 | 65 | |
kevman | 0:38ceb79fef03 | 66 | /** Send the microcontroller to sleep |
kevman | 0:38ceb79fef03 | 67 | * |
kevman | 0:38ceb79fef03 | 68 | * The processor is setup ready for sleep, and sent to sleep. In this mode, the |
kevman | 0:38ceb79fef03 | 69 | * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates |
kevman | 0:38ceb79fef03 | 70 | * dynamic power used by the processor, memory systems and buses. The processor, peripheral and |
kevman | 0:38ceb79fef03 | 71 | * memory state are maintained, and the peripherals continue to work and can generate interrupts. |
kevman | 0:38ceb79fef03 | 72 | * |
kevman | 0:38ceb79fef03 | 73 | * The processor can be woken up by any internal peripheral interrupt or external pin interrupt. |
kevman | 0:38ceb79fef03 | 74 | * |
kevman | 0:38ceb79fef03 | 75 | * The wake-up time shall be less than 10 us. |
kevman | 0:38ceb79fef03 | 76 | * |
kevman | 0:38ceb79fef03 | 77 | */ |
kevman | 0:38ceb79fef03 | 78 | void hal_sleep(void); |
kevman | 0:38ceb79fef03 | 79 | |
kevman | 0:38ceb79fef03 | 80 | /** Send the microcontroller to deep sleep |
kevman | 0:38ceb79fef03 | 81 | * |
kevman | 0:38ceb79fef03 | 82 | * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode |
kevman | 0:38ceb79fef03 | 83 | * has the same sleep features as sleep plus it powers down peripherals and high frequency clocks. |
kevman | 0:38ceb79fef03 | 84 | * All state is still maintained. |
kevman | 0:38ceb79fef03 | 85 | * |
kevman | 0:38ceb79fef03 | 86 | * The processor can only be woken up by low power ticker, RTC, an external interrupt on a pin or a watchdog timer. |
kevman | 0:38ceb79fef03 | 87 | * |
kevman | 0:38ceb79fef03 | 88 | * The wake-up time shall be less than 10 ms. |
kevman | 0:38ceb79fef03 | 89 | */ |
kevman | 0:38ceb79fef03 | 90 | void hal_deepsleep(void); |
kevman | 0:38ceb79fef03 | 91 | |
kevman | 0:38ceb79fef03 | 92 | /**@}*/ |
kevman | 0:38ceb79fef03 | 93 | |
kevman | 0:38ceb79fef03 | 94 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 95 | } |
kevman | 0:38ceb79fef03 | 96 | #endif |
kevman | 0:38ceb79fef03 | 97 | |
kevman | 0:38ceb79fef03 | 98 | #endif |
kevman | 0:38ceb79fef03 | 99 | |
kevman | 0:38ceb79fef03 | 100 | #endif |
kevman | 0:38ceb79fef03 | 101 | |
kevman | 0:38ceb79fef03 | 102 | /**@}*/ |