Knight KE
/
Game_Master
游戏王对战板,目前code还是空的
mbed-os/events/mbed_shared_queues.h@0:9b3d4731edbb, 2018-06-21 (annotated)
- Committer:
- WFKnight
- Date:
- Thu Jun 21 13:51:43 2018 +0000
- Revision:
- 0:9b3d4731edbb
UART, RTOS, LED
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WFKnight | 0:9b3d4731edbb | 1 | |
WFKnight | 0:9b3d4731edbb | 2 | /** \addtogroup events */ |
WFKnight | 0:9b3d4731edbb | 3 | /** @{*/ |
WFKnight | 0:9b3d4731edbb | 4 | /* events |
WFKnight | 0:9b3d4731edbb | 5 | * Copyright (c) 2017 ARM Limited |
WFKnight | 0:9b3d4731edbb | 6 | * |
WFKnight | 0:9b3d4731edbb | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
WFKnight | 0:9b3d4731edbb | 8 | * you may not use this file except in compliance with the License. |
WFKnight | 0:9b3d4731edbb | 9 | * You may obtain a copy of the License at |
WFKnight | 0:9b3d4731edbb | 10 | * |
WFKnight | 0:9b3d4731edbb | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
WFKnight | 0:9b3d4731edbb | 12 | * |
WFKnight | 0:9b3d4731edbb | 13 | * Unless required by applicable law or agreed to in writing, software |
WFKnight | 0:9b3d4731edbb | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
WFKnight | 0:9b3d4731edbb | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
WFKnight | 0:9b3d4731edbb | 16 | * See the License for the specific language governing permissions and |
WFKnight | 0:9b3d4731edbb | 17 | * limitations under the License. |
WFKnight | 0:9b3d4731edbb | 18 | */ |
WFKnight | 0:9b3d4731edbb | 19 | #ifndef MBED_SHARED_QUEUES_H |
WFKnight | 0:9b3d4731edbb | 20 | #define MBED_SHARED_QUEUES_H |
WFKnight | 0:9b3d4731edbb | 21 | |
WFKnight | 0:9b3d4731edbb | 22 | #include "events/EventQueue.h" |
WFKnight | 0:9b3d4731edbb | 23 | |
WFKnight | 0:9b3d4731edbb | 24 | namespace mbed { |
WFKnight | 0:9b3d4731edbb | 25 | |
WFKnight | 0:9b3d4731edbb | 26 | /** |
WFKnight | 0:9b3d4731edbb | 27 | * Return a pointer to an EventQueue, on which normal tasks can be queued. |
WFKnight | 0:9b3d4731edbb | 28 | * |
WFKnight | 0:9b3d4731edbb | 29 | * All calls to this return the same EventQueue - it and its dispatch thread |
WFKnight | 0:9b3d4731edbb | 30 | * are created on the first call to this function. The dispatch thread |
WFKnight | 0:9b3d4731edbb | 31 | * runs at default priority (currently osPriorityNormal). |
WFKnight | 0:9b3d4731edbb | 32 | * |
WFKnight | 0:9b3d4731edbb | 33 | * The EventQueue returned may be used to call() Events, or to chain() other |
WFKnight | 0:9b3d4731edbb | 34 | * EventQueues so that they are run in the same context. |
WFKnight | 0:9b3d4731edbb | 35 | * |
WFKnight | 0:9b3d4731edbb | 36 | * Events (or chained EventQueues) executing on the normal event queue should |
WFKnight | 0:9b3d4731edbb | 37 | * normally take less than 10ms to execute, to avoid starving other users. As |
WFKnight | 0:9b3d4731edbb | 38 | * such, users can expect that event latency will typically be 10ms or less, |
WFKnight | 0:9b3d4731edbb | 39 | * but could occasionally be significantly higher if many events are queued. |
WFKnight | 0:9b3d4731edbb | 40 | * |
WFKnight | 0:9b3d4731edbb | 41 | * If an RTOS is not present or the configuration option |
WFKnight | 0:9b3d4731edbb | 42 | * `events.shared-dispatch-from-application` is set to true, then this |
WFKnight | 0:9b3d4731edbb | 43 | * does not create a dedicated dispatch thread - instead the application is |
WFKnight | 0:9b3d4731edbb | 44 | * expected to run the EventQueue's dispatch, eg from main. This is necessary |
WFKnight | 0:9b3d4731edbb | 45 | * for the event loop to work without an RTOS, or an RTOS system can can save |
WFKnight | 0:9b3d4731edbb | 46 | * memory by reusing the main stack. |
WFKnight | 0:9b3d4731edbb | 47 | * |
WFKnight | 0:9b3d4731edbb | 48 | * @note |
WFKnight | 0:9b3d4731edbb | 49 | * mbed_event_queue is not itself IRQ safe. To use the mbed_event_queue in |
WFKnight | 0:9b3d4731edbb | 50 | * interrupt context, you must first call `mbed_event_queue()` in threaded |
WFKnight | 0:9b3d4731edbb | 51 | * context and store the pointer for later use. |
WFKnight | 0:9b3d4731edbb | 52 | * |
WFKnight | 0:9b3d4731edbb | 53 | * @return pointer to event queue |
WFKnight | 0:9b3d4731edbb | 54 | */ |
WFKnight | 0:9b3d4731edbb | 55 | events::EventQueue *mbed_event_queue(); |
WFKnight | 0:9b3d4731edbb | 56 | |
WFKnight | 0:9b3d4731edbb | 57 | #ifdef MBED_CONF_RTOS_PRESENT |
WFKnight | 0:9b3d4731edbb | 58 | /** |
WFKnight | 0:9b3d4731edbb | 59 | * Return a pointer to an EventQueue, on which small high-priority tasks can |
WFKnight | 0:9b3d4731edbb | 60 | * be queues, such as simple deferrals from interrupt. |
WFKnight | 0:9b3d4731edbb | 61 | * |
WFKnight | 0:9b3d4731edbb | 62 | * All calls to this return the same EventQueue - it and its thread are |
WFKnight | 0:9b3d4731edbb | 63 | * created on the first call to this function. The dispatch thread |
WFKnight | 0:9b3d4731edbb | 64 | * runs at a high priority (currently osPriorityHigh). |
WFKnight | 0:9b3d4731edbb | 65 | * |
WFKnight | 0:9b3d4731edbb | 66 | * The EventQueue returned may be used to call() Events, or to chain() other |
WFKnight | 0:9b3d4731edbb | 67 | * EventQueues so that they are run in the same context. |
WFKnight | 0:9b3d4731edbb | 68 | * |
WFKnight | 0:9b3d4731edbb | 69 | * Events (or chained EventQueues) executing on the high-priority event queue |
WFKnight | 0:9b3d4731edbb | 70 | * should normally take less than 100us to execute, to avoid starving other |
WFKnight | 0:9b3d4731edbb | 71 | * users. As such, users can expect that event latency will typically be 100us |
WFKnight | 0:9b3d4731edbb | 72 | * or less, but could occasionally be significantly higher if many events are |
WFKnight | 0:9b3d4731edbb | 73 | * queued. |
WFKnight | 0:9b3d4731edbb | 74 | * |
WFKnight | 0:9b3d4731edbb | 75 | * @note |
WFKnight | 0:9b3d4731edbb | 76 | * mbed_highprio_event_queue is not itself IRQ safe. To use the |
WFKnight | 0:9b3d4731edbb | 77 | * mbed_highprio_event_queue in interrupt context, you must first call |
WFKnight | 0:9b3d4731edbb | 78 | * `mbed_event_queue()` in threaded context and store the pointer for |
WFKnight | 0:9b3d4731edbb | 79 | * later use. |
WFKnight | 0:9b3d4731edbb | 80 | * |
WFKnight | 0:9b3d4731edbb | 81 | * @return pointer to high-priority event queue |
WFKnight | 0:9b3d4731edbb | 82 | */ |
WFKnight | 0:9b3d4731edbb | 83 | |
WFKnight | 0:9b3d4731edbb | 84 | events::EventQueue *mbed_highprio_event_queue(); |
WFKnight | 0:9b3d4731edbb | 85 | |
WFKnight | 0:9b3d4731edbb | 86 | #endif // MBED_CONF_RTOS_PRESENT |
WFKnight | 0:9b3d4731edbb | 87 | |
WFKnight | 0:9b3d4731edbb | 88 | }; |
WFKnight | 0:9b3d4731edbb | 89 | |
WFKnight | 0:9b3d4731edbb | 90 | #endif |
WFKnight | 0:9b3d4731edbb | 91 | |
WFKnight | 0:9b3d4731edbb | 92 | /** @}*/ |