游戏王对战板,目前code还是空的

Committer:
WFKnight
Date:
Thu Jun 21 13:51:43 2018 +0000
Revision:
0:9b3d4731edbb
UART, RTOS, LED

Who changed what in which revision?

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