Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
mbed_shared_queues.h
00001 00002 /** \addtogroup events */ 00003 /** @{*/ 00004 /* events 00005 * Copyright (c) 2017 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 #ifndef MBED_SHARED_QUEUES_H 00020 #define MBED_SHARED_QUEUES_H 00021 00022 #include "events/EventQueue.h" 00023 00024 namespace mbed { 00025 00026 /** 00027 * Return a pointer to an EventQueue, on which normal tasks can be queued. 00028 * 00029 * All calls to this return the same EventQueue - it and its dispatch thread 00030 * are created on the first call to this function. The dispatch thread 00031 * runs at default priority (currently osPriorityNormal). 00032 * 00033 * The EventQueue returned may be used to call() Events, or to chain() other 00034 * EventQueues so that they are run in the same context. 00035 * 00036 * Events (or chained EventQueues) executing on the normal event queue should 00037 * normally take less than 10ms to execute, to avoid starving other users. As 00038 * such, users can expect that event latency will typically be 10ms or less, 00039 * but could occasionally be significantly higher if many events are queued. 00040 * 00041 * If an RTOS is not present or the configuration option 00042 * `events.shared-dispatch-from-application` is set to true, then this 00043 * does not create a dedicated dispatch thread - instead the application is 00044 * expected to run the EventQueue's dispatch, eg from main. This is necessary 00045 * for the event loop to work without an RTOS, or an RTOS system can can save 00046 * memory by reusing the main stack. 00047 * 00048 * @return pointer to event queue 00049 */ 00050 events::EventQueue *mbed_event_queue(); 00051 00052 #ifdef MBED_CONF_RTOS_PRESENT 00053 /** 00054 * Return a pointer to an EventQueue, on which small high-priority tasks can 00055 * be queues, such as simple deferrals from interrupt. 00056 * 00057 * All calls to this return the same EventQueue - it and its thread are 00058 * created on the first call to this function. The dispatch thread 00059 * runs at a high priority (currently osPriorityHigh). 00060 * 00061 * The EventQueue returned may be used to call() Events, or to chain() other 00062 * EventQueues so that they are run in the same context. 00063 * 00064 * Events (or chained EventQueues) executing on the high-priority event queue 00065 * should normally take less than 100us to execute, to avoid starving other 00066 * users. As such, users can expect that event latency will typically be 100us 00067 * or less, but could occasionally be significantly higher if many events are 00068 * queued. 00069 * 00070 * @return pointer to high-priority event queue 00071 */ 00072 00073 events::EventQueue *mbed_highprio_event_queue(); 00074 00075 #endif // MBED_CONF_RTOS_PRESENT 00076 00077 }; 00078 00079 #endif 00080 00081 /** @}*/
Generated on Sun Jul 17 2022 08:25:27 by 1.7.2