RTC auf true

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?

UserRevisionLine numberNew contents of line
kevman 0:38ceb79fef03 1 /** \addtogroup hal */
kevman 0:38ceb79fef03 2 /** @{*/
kevman 0:38ceb79fef03 3 /* mbed Microcontroller Library
kevman 0:38ceb79fef03 4 * Copyright (c) 2006-2017 ARM Limited
kevman 0:38ceb79fef03 5 *
kevman 0:38ceb79fef03 6 * Licensed under the Apache License, Version 2.0 (the "License");
kevman 0:38ceb79fef03 7 * you may not use this file except in compliance with the License.
kevman 0:38ceb79fef03 8 * You may obtain a copy of the License at
kevman 0:38ceb79fef03 9 *
kevman 0:38ceb79fef03 10 * http://www.apache.org/licenses/LICENSE-2.0
kevman 0:38ceb79fef03 11 *
kevman 0:38ceb79fef03 12 * Unless required by applicable law or agreed to in writing, software
kevman 0:38ceb79fef03 13 * distributed under the License is distributed on an "AS IS" BASIS,
kevman 0:38ceb79fef03 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
kevman 0:38ceb79fef03 15 * See the License for the specific language governing permissions and
kevman 0:38ceb79fef03 16 * limitations under the License.
kevman 0:38ceb79fef03 17 */
kevman 0:38ceb79fef03 18 #ifndef MBED_CRITICAL_SECTION_API_H
kevman 0:38ceb79fef03 19 #define MBED_CRITICAL_SECTION_API_H
kevman 0:38ceb79fef03 20
kevman 0:38ceb79fef03 21 #include <stdbool.h>
kevman 0:38ceb79fef03 22
kevman 0:38ceb79fef03 23 #ifdef __cplusplus
kevman 0:38ceb79fef03 24 extern "C" {
kevman 0:38ceb79fef03 25 #endif
kevman 0:38ceb79fef03 26
kevman 0:38ceb79fef03 27 /**
kevman 0:38ceb79fef03 28 * \defgroup hal_critical Critical Section HAL functions
kevman 0:38ceb79fef03 29 * @{
kevman 0:38ceb79fef03 30 */
kevman 0:38ceb79fef03 31
kevman 0:38ceb79fef03 32 /**
kevman 0:38ceb79fef03 33 * Mark the start of a critical section
kevman 0:38ceb79fef03 34 *
kevman 0:38ceb79fef03 35 * This function will be called by core_util_critical_section_enter() each time
kevman 0:38ceb79fef03 36 * the application requests to enter a critical section. The purpose of the
kevman 0:38ceb79fef03 37 * critical section is to ensure mutual-exclusion synchronisation of the
kevman 0:38ceb79fef03 38 * processor by preventing any change in processor control, the default
kevman 0:38ceb79fef03 39 * behaviour requires storing the state of interrupts in the system before
kevman 0:38ceb79fef03 40 * disabling them.
kevman 0:38ceb79fef03 41 *
kevman 0:38ceb79fef03 42 * The critical section code supports nesting. When a thread has entered a
kevman 0:38ceb79fef03 43 * critical section it can make additional calls to
kevman 0:38ceb79fef03 44 * core_util_critical_section_enter() without deadlocking itself. The critical
kevman 0:38ceb79fef03 45 * section driver API tracks the number of nested calls to the critical section.
kevman 0:38ceb79fef03 46 * The critical section will only be exited when
kevman 0:38ceb79fef03 47 * core_util_critical_section_exit() has been called once for each time it
kevman 0:38ceb79fef03 48 * entered the critical section.
kevman 0:38ceb79fef03 49 *
kevman 0:38ceb79fef03 50 * On the first call to enter a critical section this function MUST store the
kevman 0:38ceb79fef03 51 * state of any interrupts or other application settings it will modify to
kevman 0:38ceb79fef03 52 * facilitate the critical section.
kevman 0:38ceb79fef03 53 *
kevman 0:38ceb79fef03 54 * Each successive call to enter the critical section MUST ignore storing or
kevman 0:38ceb79fef03 55 * modifying any application state.
kevman 0:38ceb79fef03 56 *
kevman 0:38ceb79fef03 57 * The default implementation of this function which will save the current state
kevman 0:38ceb79fef03 58 * of interrupts before disabling them. This implementation can be found in
kevman 0:38ceb79fef03 59 * mbed_critical_section_api.c. This behaviour is can be overridden on a per
kevman 0:38ceb79fef03 60 * platform basis by providing a different implementation within the correct
kevman 0:38ceb79fef03 61 * targets directory.
kevman 0:38ceb79fef03 62 */
kevman 0:38ceb79fef03 63 void hal_critical_section_enter(void);
kevman 0:38ceb79fef03 64
kevman 0:38ceb79fef03 65
kevman 0:38ceb79fef03 66 /** Mark the end of a critical section.
kevman 0:38ceb79fef03 67 *
kevman 0:38ceb79fef03 68 * The purpose of this function is to restore any state that was modified upon
kevman 0:38ceb79fef03 69 * entering the critical section, allowing other threads or interrupts to change
kevman 0:38ceb79fef03 70 * the processor control.
kevman 0:38ceb79fef03 71 *
kevman 0:38ceb79fef03 72 * This function will be called once by core_util_critical_section_exit() per
kevman 0:38ceb79fef03 73 * critical section on last call to exit. When called, the application MUST
kevman 0:38ceb79fef03 74 * restore the saved interrupt/application state that was saved when entering
kevman 0:38ceb79fef03 75 * the critical section.
kevman 0:38ceb79fef03 76 *
kevman 0:38ceb79fef03 77 * There is a default implementation of this function, it will restore the state
kevman 0:38ceb79fef03 78 * of interrupts that were previously saved when hal_critical_section_enter was
kevman 0:38ceb79fef03 79 * first called, this implementation can be found in
kevman 0:38ceb79fef03 80 * mbed_critical_section_api.c. This behaviour is overridable by providing a
kevman 0:38ceb79fef03 81 * different function implementation within the correct targets directory.
kevman 0:38ceb79fef03 82 */
kevman 0:38ceb79fef03 83 void hal_critical_section_exit(void);
kevman 0:38ceb79fef03 84
kevman 0:38ceb79fef03 85
kevman 0:38ceb79fef03 86 /** Determine if the application is currently running in a critical section
kevman 0:38ceb79fef03 87 *
kevman 0:38ceb79fef03 88 * The purpose of this function is to inform the caller whether or not the
kevman 0:38ceb79fef03 89 * application is running in a critical section. This is done by checking if
kevman 0:38ceb79fef03 90 * the current interrupt state has been saved in the underlying implementation,
kevman 0:38ceb79fef03 91 * this could also be done by checking the state of the interrupts at the time
kevman 0:38ceb79fef03 92 * of calling.
kevman 0:38ceb79fef03 93 *
kevman 0:38ceb79fef03 94 * @return True if running in a critical section, false if not.
kevman 0:38ceb79fef03 95 */
kevman 0:38ceb79fef03 96 bool hal_in_critical_section(void);
kevman 0:38ceb79fef03 97
kevman 0:38ceb79fef03 98
kevman 0:38ceb79fef03 99 /**@}*/
kevman 0:38ceb79fef03 100
kevman 0:38ceb79fef03 101 #ifdef __cplusplus
kevman 0:38ceb79fef03 102 }
kevman 0:38ceb79fef03 103 #endif
kevman 0:38ceb79fef03 104
kevman 0:38ceb79fef03 105 #endif // MBED_CRITICAL_SECTION_API_H
kevman 0:38ceb79fef03 106
kevman 0:38ceb79fef03 107 /** @}*/