RTC auf true
events/mbed_shared_queues.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 events */ |
kevman | 0:38ceb79fef03 | 3 | /** @{*/ |
kevman | 0:38ceb79fef03 | 4 | /* events |
kevman | 0:38ceb79fef03 | 5 | * Copyright (c) 2017 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_SHARED_QUEUES_H |
kevman | 0:38ceb79fef03 | 20 | #define MBED_SHARED_QUEUES_H |
kevman | 0:38ceb79fef03 | 21 | |
kevman | 0:38ceb79fef03 | 22 | #include "events/EventQueue.h" |
kevman | 0:38ceb79fef03 | 23 | |
kevman | 0:38ceb79fef03 | 24 | namespace mbed { |
kevman | 0:38ceb79fef03 | 25 | |
kevman | 0:38ceb79fef03 | 26 | /** |
kevman | 0:38ceb79fef03 | 27 | * Return a pointer to an EventQueue, on which normal tasks can be queued. |
kevman | 0:38ceb79fef03 | 28 | * |
kevman | 0:38ceb79fef03 | 29 | * All calls to this return the same EventQueue - it and its dispatch thread |
kevman | 0:38ceb79fef03 | 30 | * are created on the first call to this function. The dispatch thread |
kevman | 0:38ceb79fef03 | 31 | * runs at default priority (currently osPriorityNormal). |
kevman | 0:38ceb79fef03 | 32 | * |
kevman | 0:38ceb79fef03 | 33 | * The EventQueue returned may be used to call() Events, or to chain() other |
kevman | 0:38ceb79fef03 | 34 | * EventQueues so that they are run in the same context. |
kevman | 0:38ceb79fef03 | 35 | * |
kevman | 0:38ceb79fef03 | 36 | * Events (or chained EventQueues) executing on the normal event queue should |
kevman | 0:38ceb79fef03 | 37 | * normally take less than 10ms to execute, to avoid starving other users. As |
kevman | 0:38ceb79fef03 | 38 | * such, users can expect that event latency will typically be 10ms or less, |
kevman | 0:38ceb79fef03 | 39 | * but could occasionally be significantly higher if many events are queued. |
kevman | 0:38ceb79fef03 | 40 | * |
kevman | 0:38ceb79fef03 | 41 | * If an RTOS is not present or the configuration option |
kevman | 0:38ceb79fef03 | 42 | * `events.shared-dispatch-from-application` is set to true, then this |
kevman | 0:38ceb79fef03 | 43 | * does not create a dedicated dispatch thread - instead the application is |
kevman | 0:38ceb79fef03 | 44 | * expected to run the EventQueue's dispatch, for example from main. This is |
kevman | 0:38ceb79fef03 | 45 | * necessary for the event loop to work without an RTOS, or an RTOS system can |
kevman | 0:38ceb79fef03 | 46 | * save memory by reusing the main stack. |
kevman | 0:38ceb79fef03 | 47 | * |
kevman | 0:38ceb79fef03 | 48 | * @note |
kevman | 0:38ceb79fef03 | 49 | * mbed_event_queue is not itself IRQ safe. To use the mbed_event_queue in |
kevman | 0:38ceb79fef03 | 50 | * interrupt context, you must first call `mbed_event_queue()` in threaded |
kevman | 0:38ceb79fef03 | 51 | * context and store the pointer for later use. |
kevman | 0:38ceb79fef03 | 52 | * |
kevman | 0:38ceb79fef03 | 53 | * @return pointer to event queue |
kevman | 0:38ceb79fef03 | 54 | */ |
kevman | 0:38ceb79fef03 | 55 | events::EventQueue *mbed_event_queue(); |
kevman | 0:38ceb79fef03 | 56 | |
kevman | 0:38ceb79fef03 | 57 | #ifdef MBED_CONF_RTOS_PRESENT |
kevman | 0:38ceb79fef03 | 58 | /** |
kevman | 0:38ceb79fef03 | 59 | * Return a pointer to an EventQueue, on which small high-priority tasks can |
kevman | 0:38ceb79fef03 | 60 | * be queues, such as simple deferrals from interrupt. |
kevman | 0:38ceb79fef03 | 61 | * |
kevman | 0:38ceb79fef03 | 62 | * All calls to this return the same EventQueue - it and its thread are |
kevman | 0:38ceb79fef03 | 63 | * created on the first call to this function. The dispatch thread |
kevman | 0:38ceb79fef03 | 64 | * runs at a high priority (currently osPriorityHigh). |
kevman | 0:38ceb79fef03 | 65 | * |
kevman | 0:38ceb79fef03 | 66 | * The EventQueue returned may be used to call() Events, or to chain() other |
kevman | 0:38ceb79fef03 | 67 | * EventQueues so that they are run in the same context. |
kevman | 0:38ceb79fef03 | 68 | * |
kevman | 0:38ceb79fef03 | 69 | * Events (or chained EventQueues) executing on the high-priority event queue |
kevman | 0:38ceb79fef03 | 70 | * should normally take less than 100us to execute, to avoid starving other |
kevman | 0:38ceb79fef03 | 71 | * users. As such, users can expect that event latency will typically be 100us |
kevman | 0:38ceb79fef03 | 72 | * or less, but could occasionally be significantly higher if many events are |
kevman | 0:38ceb79fef03 | 73 | * queued. |
kevman | 0:38ceb79fef03 | 74 | * |
kevman | 0:38ceb79fef03 | 75 | * @note |
kevman | 0:38ceb79fef03 | 76 | * mbed_highprio_event_queue is not itself IRQ safe. To use the |
kevman | 0:38ceb79fef03 | 77 | * mbed_highprio_event_queue in interrupt context, you must first call |
kevman | 0:38ceb79fef03 | 78 | * `mbed_highprio_event_queue()` in threaded context and store the pointer for |
kevman | 0:38ceb79fef03 | 79 | * later use. |
kevman | 0:38ceb79fef03 | 80 | * |
kevman | 0:38ceb79fef03 | 81 | * @return pointer to high-priority event queue |
kevman | 0:38ceb79fef03 | 82 | */ |
kevman | 0:38ceb79fef03 | 83 | |
kevman | 0:38ceb79fef03 | 84 | events::EventQueue *mbed_highprio_event_queue(); |
kevman | 0:38ceb79fef03 | 85 | |
kevman | 0:38ceb79fef03 | 86 | #endif // MBED_CONF_RTOS_PRESENT |
kevman | 0:38ceb79fef03 | 87 | |
kevman | 0:38ceb79fef03 | 88 | }; |
kevman | 0:38ceb79fef03 | 89 | |
kevman | 0:38ceb79fef03 | 90 | #endif |
kevman | 0:38ceb79fef03 | 91 | |
kevman | 0:38ceb79fef03 | 92 | /** @}*/ |