Fork of official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.
Dependents: Final_Coffee_Roaster
Fork of mbed-rtos by
Revision 8:88a1a9c26ae3, committed 2012-11-27
- Comitter:
- emilmont
- Date:
- Tue Nov 27 16:55:38 2012 +0000
- Parent:
- 7:80173c64d05d
- Child:
- 9:53e6cccd8782
- Commit message:
- Add "Thread::get_state" method.; Update license.; Update documentation.
Changed in this revision
--- a/rtos/Mail.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Mail.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,89 +1,109 @@ -/* Copyright (c) 2012 mbed.org */ -#ifndef MAIL_H -#define MAIL_H - -#include <stdint.h> -#include <string.h> - -#include "cmsis_os.h" - -namespace rtos { - -/*! The Mail class allow to control, send, receive, or wait for mail. - A mail is a memory block that is send to a thread or interrupt service routine. - \tparam T data type of a single message element. - \tparam queue_sz maximum number of messages in queue. -*/ -template<typename T, uint32_t queue_sz> -class Mail { -public: - /*! Create and Initialise Mail queue. */ - Mail() { - #ifdef CMSIS_OS_RTX - memset(_mail_q, 0, sizeof(_mail_q)); - _mail_p[0] = _mail_q; - - memset(_mail_m, 0, sizeof(_mail_m)); - _mail_p[1] = _mail_m; - - _mail_def.pool = _mail_p; - _mail_def.queue_sz = queue_sz; - _mail_def.item_sz = sizeof(T); - #endif - _mail_id = osMailCreate(&_mail_def, NULL); - } - - /*! Allocate a memory block of type T - \param millisec timeout value or 0 in case of no time-out. (default: 0). - \return pointer to memory block that can be filled with mail or NULL in case error. - */ - T* alloc(uint32_t millisec=0) { - return (T*)osMailAlloc(_mail_id, millisec); - } - - /*! Allocate a memory block of type T and set memory block to zero. - \param millisec timeout value or 0 in case of no time-out. (default: 0). - \return pointer to memory block that can be filled with mail or NULL in case error. - */ - T* calloc(uint32_t millisec=0) { - return (T*)osMailCAlloc(_mail_id, millisec); - } - - /*! Put a mail in the queue. - \param mptr memory block previously allocated with Mail::alloc or Mail::calloc. - \return status code that indicates the execution status of the function. - */ - osStatus put(T *mptr) { - return osMailPut(_mail_id, (void*)mptr); - } - - /*! Get a mail from a queue. - \param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). - \return event that contains mail information or error code. - */ - osEvent get(uint32_t millisec=osWaitForever) { - return osMailGet(_mail_id, millisec); - } - - /*! Free a memory block from a mail. - \param mptr pointer to the memory block that was obtained with Mail::get. - \return status code that indicates the execution status of the function. - */ - osStatus free(T *mptr) { - return osMailFree(_mail_id, (void*)mptr); - } - -private: - osMailQId _mail_id; - osMailQDef_t _mail_def; -#ifdef CMSIS_OS_RTX - uint32_t _mail_q[4+(queue_sz)]; - uint32_t _mail_m[3+((sizeof(T)+3)/4)*(queue_sz)]; - void *_mail_p[2]; -#endif -}; - -} - -#endif - +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef MAIL_H +#define MAIL_H + +#include <stdint.h> +#include <string.h> + +#include "cmsis_os.h" + +namespace rtos { + +/** The Mail class allow to control, send, receive, or wait for mail. + A mail is a memory block that is send to a thread or interrupt service routine. + @tparam T data type of a single message element. + @tparam queue_sz maximum number of messages in queue. +*/ +template<typename T, uint32_t queue_sz> +class Mail { +public: + /** Create and Initialise Mail queue. */ + Mail() { + #ifdef CMSIS_OS_RTX + memset(_mail_q, 0, sizeof(_mail_q)); + _mail_p[0] = _mail_q; + + memset(_mail_m, 0, sizeof(_mail_m)); + _mail_p[1] = _mail_m; + + _mail_def.pool = _mail_p; + _mail_def.queue_sz = queue_sz; + _mail_def.item_sz = sizeof(T); + #endif + _mail_id = osMailCreate(&_mail_def, NULL); + } + + /** Allocate a memory block of type T + @param millisec timeout value or 0 in case of no time-out. (default: 0). + @return pointer to memory block that can be filled with mail or NULL in case error. + */ + T* alloc(uint32_t millisec=0) { + return (T*)osMailAlloc(_mail_id, millisec); + } + + /** Allocate a memory block of type T and set memory block to zero. + @param millisec timeout value or 0 in case of no time-out. (default: 0). + @return pointer to memory block that can be filled with mail or NULL in case error. + */ + T* calloc(uint32_t millisec=0) { + return (T*)osMailCAlloc(_mail_id, millisec); + } + + /** Put a mail in the queue. + @param mptr memory block previously allocated with Mail::alloc or Mail::calloc. + @return status code that indicates the execution status of the function. + */ + osStatus put(T *mptr) { + return osMailPut(_mail_id, (void*)mptr); + } + + /** Get a mail from a queue. + @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). + @return event that contains mail information or error code. + */ + osEvent get(uint32_t millisec=osWaitForever) { + return osMailGet(_mail_id, millisec); + } + + /** Free a memory block from a mail. + @param mptr pointer to the memory block that was obtained with Mail::get. + @return status code that indicates the execution status of the function. + */ + osStatus free(T *mptr) { + return osMailFree(_mail_id, (void*)mptr); + } + +private: + osMailQId _mail_id; + osMailQDef_t _mail_def; +#ifdef CMSIS_OS_RTX + uint32_t _mail_q[4+(queue_sz)]; + uint32_t _mail_m[3+((sizeof(T)+3)/4)*(queue_sz)]; + void *_mail_p[2]; +#endif +}; + +} + +#endif +
--- a/rtos/MemoryPool.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/MemoryPool.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,62 +1,82 @@ -/* Copyright (c) 2012 mbed.org */ -#ifndef MEMORYPOOL_H -#define MEMORYPOOL_H - -#include <stdint.h> -#include <string.h> - -#include "cmsis_os.h" - -namespace rtos { - -/*! Define and manage fixed-size memory pools of objects of a given type. - \tparam T data type of a single object (element). - \tparam queue_sz maximum number of objects (elements) in the memory pool. -*/ -template<typename T, uint32_t pool_sz> -class MemoryPool { -public: - /*! Create and Initialize a memory pool. */ - MemoryPool() { - #ifdef CMSIS_OS_RTX - memset(_pool_m, 0, sizeof(_pool_m)); - _pool_def.pool = _pool_m; - - _pool_def.pool_sz = pool_sz; - _pool_def.item_sz = sizeof(T); - #endif - _pool_id = osPoolCreate(&_pool_def); - } - - /*! Allocate a memory block of type T from a memory pool. - \return address of the allocated memory block or NULL in case of no memory available. - */ - T* alloc(void) { - return (T*)osPoolAlloc(_pool_id); - } - - /*! Allocate a memory block of type T from a memory pool and set memory block to zero. - \return address of the allocated memory block or NULL in case of no memory available. - */ - T* calloc(void) { - return (T*)osPoolCAlloc(_pool_id); - } - - /*! Return an allocated memory block back to a specific memory pool. - \param address of the allocated memory block that is returned to the memory pool. - \return status code that indicates the execution status of the function. - */ - osStatus free(T *block) { - return osPoolFree(_pool_id, (void*)block); - } - -private: - osPoolId _pool_id; - osPoolDef_t _pool_def; -#ifdef CMSIS_OS_RTX - uint32_t _pool_m[3+((sizeof(T)+3)/4)*(pool_sz)]; -#endif -}; - -} -#endif +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef MEMORYPOOL_H +#define MEMORYPOOL_H + +#include <stdint.h> +#include <string.h> + +#include "cmsis_os.h" + +namespace rtos { + +/** Define and manage fixed-size memory pools of objects of a given type. + @tparam T data type of a single object (element). + @tparam queue_sz maximum number of objects (elements) in the memory pool. +*/ +template<typename T, uint32_t pool_sz> +class MemoryPool { +public: + /** Create and Initialize a memory pool. */ + MemoryPool() { + #ifdef CMSIS_OS_RTX + memset(_pool_m, 0, sizeof(_pool_m)); + _pool_def.pool = _pool_m; + + _pool_def.pool_sz = pool_sz; + _pool_def.item_sz = sizeof(T); + #endif + _pool_id = osPoolCreate(&_pool_def); + } + + /** Allocate a memory block of type T from a memory pool. + @return address of the allocated memory block or NULL in case of no memory available. + */ + T* alloc(void) { + return (T*)osPoolAlloc(_pool_id); + } + + /** Allocate a memory block of type T from a memory pool and set memory block to zero. + @return address of the allocated memory block or NULL in case of no memory available. + */ + T* calloc(void) { + return (T*)osPoolCAlloc(_pool_id); + } + + /** Return an allocated memory block back to a specific memory pool. + @param address of the allocated memory block that is returned to the memory pool. + @return status code that indicates the execution status of the function. + */ + osStatus free(T *block) { + return osPoolFree(_pool_id, (void*)block); + } + +private: + osPoolId _pool_id; + osPoolDef_t _pool_def; +#ifdef CMSIS_OS_RTX + uint32_t _pool_m[3+((sizeof(T)+3)/4)*(pool_sz)]; +#endif +}; + +} +#endif
--- a/rtos/Mutex.cpp Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Mutex.cpp Tue Nov 27 16:55:38 2012 +0000 @@ -1,35 +1,56 @@ -#include "Mutex.h" - -#include <string.h> -#include "error.h" - -namespace rtos { - -Mutex::Mutex() { -#ifdef CMSIS_OS_RTX - memset(_mutex_data, 0, sizeof(_mutex_data)); - _osMutexDef.mutex = _mutex_data; -#endif - _osMutexId = osMutexCreate(&_osMutexDef); - if (_osMutexId == NULL) { - error("Error initializing the mutex object\n"); - } -} - -osStatus Mutex::lock(uint32_t millisec) { - return osMutexWait(_osMutexId, millisec); -} - -bool Mutex::trylock() { - return (osMutexWait(_osMutexId, 0) == osOK); -} - -osStatus Mutex::unlock() { - return osMutexRelease(_osMutexId); -} - -Mutex::~Mutex() { - osMutexDelete(_osMutexId); -} - -} +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Mutex.h" + +#include <string.h> +#include "error.h" + +namespace rtos { + +Mutex::Mutex() { +#ifdef CMSIS_OS_RTX + memset(_mutex_data, 0, sizeof(_mutex_data)); + _osMutexDef.mutex = _mutex_data; +#endif + _osMutexId = osMutexCreate(&_osMutexDef); + if (_osMutexId == NULL) { + error("Error initializing the mutex object\n"); + } +} + +osStatus Mutex::lock(uint32_t millisec) { + return osMutexWait(_osMutexId, millisec); +} + +bool Mutex::trylock() { + return (osMutexWait(_osMutexId, 0) == osOK); +} + +osStatus Mutex::unlock() { + return osMutexRelease(_osMutexId); +} + +Mutex::~Mutex() { + osMutexDelete(_osMutexId); +} + +}
--- a/rtos/Mutex.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Mutex.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,45 +1,65 @@ -/* Copyright (c) 2012 mbed.org */ -#ifndef MUTEX_H -#define MUTEX_H - -#include <stdint.h> -#include "cmsis_os.h" - -namespace rtos { - -/*! The Mutex class is used to synchronise the execution of threads. - This is for example used to protect access to a shared resource. -*/ -class Mutex { -public: - /*! Create and Initialize a Mutex object */ - Mutex(); - - /*! Wait until a Mutex becomes available. - \param millisec timeout value or 0 in case of no time-out. (default: osWaitForever) - \return status code that indicates the execution status of the function. - */ - osStatus lock(uint32_t millisec=osWaitForever); - - /*! Try to lock the mutex, and return immediately - \return true if the mutex was acquired, false otherwise. - */ - bool trylock(); - - /*! Unlock the mutex that has previously been locked by the same thread - \return status code that indicates the execution status of the function. - */ - osStatus unlock(); - - ~Mutex(); - -private: - osMutexId _osMutexId; - osMutexDef_t _osMutexDef; -#ifdef CMSIS_OS_RTX - int32_t _mutex_data[3]; -#endif -}; - -} -#endif +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef MUTEX_H +#define MUTEX_H + +#include <stdint.h> +#include "cmsis_os.h" + +namespace rtos { + +/** The Mutex class is used to synchronise the execution of threads. + This is for example used to protect access to a shared resource. +*/ +class Mutex { +public: + /** Create and Initialize a Mutex object */ + Mutex(); + + /** Wait until a Mutex becomes available. + @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever) + @return status code that indicates the execution status of the function. + */ + osStatus lock(uint32_t millisec=osWaitForever); + + /** Try to lock the mutex, and return immediately + @return true if the mutex was acquired, false otherwise. + */ + bool trylock(); + + /** Unlock the mutex that has previously been locked by the same thread + @return status code that indicates the execution status of the function. + */ + osStatus unlock(); + + ~Mutex(); + +private: + osMutexId _osMutexId; + osMutexDef_t _osMutexDef; +#ifdef CMSIS_OS_RTX + int32_t _mutex_data[3]; +#endif +}; + +} +#endif
--- a/rtos/Queue.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Queue.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,61 +1,81 @@ -/* Copyright (c) 2012 mbed.org */ -#ifndef QUEUE_H -#define QUEUE_H - -#include <stdint.h> -#include <string.h> - -#include "cmsis_os.h" -#include "error.h" - -namespace rtos { - -/*! The Queue class allow to control, send, receive, or wait for messages. - A message can be a integer or pointer value to a certain type T that is send - to a thread or interrupt service routine. - \tparam T data type of a single message element. - \tparam queue_sz maximum number of messages in queue. -*/ -template<typename T, uint32_t queue_sz> -class Queue { -public: - /*! Create and initialise a message Queue. */ - Queue() { - #ifdef CMSIS_OS_RTX - memset(_queue_q, 0, sizeof(_queue_q)); - _queue_def.pool = _queue_q; - _queue_def.queue_sz = queue_sz; - #endif - _queue_id = osMessageCreate(&_queue_def, NULL); - if (_queue_id == NULL) { - error("Error initialising the queue object\n"); - } - } - - /*! Put a message in a Queue. - \param data message pointer. - \param millisec timeout value or 0 in case of no time-out. (default: 0) - \return status code that indicates the execution status of the function. - */ - osStatus put(T* data, uint32_t millisec=0) { - return osMessagePut(_queue_id, (uint32_t)data, millisec); - } - - /*! Get a message or Wait for a message from a Queue. - \param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). - \return event information that includes the message and the status code. - */ - osEvent get(uint32_t millisec=osWaitForever) { - return osMessageGet(_queue_id, millisec); - } - -private: - osMessageQId _queue_id; - osMessageQDef_t _queue_def; -#ifdef CMSIS_OS_RTX - uint32_t _queue_q[4+(queue_sz)]; -#endif -}; - -} -#endif +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef QUEUE_H +#define QUEUE_H + +#include <stdint.h> +#include <string.h> + +#include "cmsis_os.h" +#include "error.h" + +namespace rtos { + +/** The Queue class allow to control, send, receive, or wait for messages. + A message can be a integer or pointer value to a certain type T that is send + to a thread or interrupt service routine. + @tparam T data type of a single message element. + @tparam queue_sz maximum number of messages in queue. +*/ +template<typename T, uint32_t queue_sz> +class Queue { +public: + /** Create and initialise a message Queue. */ + Queue() { + #ifdef CMSIS_OS_RTX + memset(_queue_q, 0, sizeof(_queue_q)); + _queue_def.pool = _queue_q; + _queue_def.queue_sz = queue_sz; + #endif + _queue_id = osMessageCreate(&_queue_def, NULL); + if (_queue_id == NULL) { + error("Error initialising the queue object\n"); + } + } + + /** Put a message in a Queue. + @param data message pointer. + @param millisec timeout value or 0 in case of no time-out. (default: 0) + @return status code that indicates the execution status of the function. + */ + osStatus put(T* data, uint32_t millisec=0) { + return osMessagePut(_queue_id, (uint32_t)data, millisec); + } + + /** Get a message or Wait for a message from a Queue. + @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). + @return event information that includes the message and the status code. + */ + osEvent get(uint32_t millisec=osWaitForever) { + return osMessageGet(_queue_id, millisec); + } + +private: + osMessageQId _queue_id; + osMessageQDef_t _queue_def; +#ifdef CMSIS_OS_RTX + uint32_t _queue_q[4+(queue_sz)]; +#endif +}; + +} +#endif
--- a/rtos/RtosTimer.cpp Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/RtosTimer.cpp Tue Nov 27 16:55:38 2012 +0000 @@ -1,32 +1,53 @@ -#include "RtosTimer.h" - -#include <string.h> - -#include "cmsis_os.h" -#include "error.h" - -namespace rtos { - -RtosTimer::RtosTimer(void (*periodic_task)(void const *argument), os_timer_type type, void *argument) { -#ifdef CMSIS_OS_RTX - _timer.ptimer = periodic_task; - - memset(_timer_data, 0, sizeof(_timer_data)); - _timer.timer = _timer_data; -#endif - _timer_id = osTimerCreate(&_timer, type, argument); -} - -osStatus RtosTimer::start(uint32_t millisec) { - return osTimerStart(_timer_id, millisec); -} - -osStatus RtosTimer::stop(void) { - return osTimerStop(_timer_id); -} - -RtosTimer::~RtosTimer() { - osTimerDelete(_timer_id); -} - -} +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "RtosTimer.h" + +#include <string.h> + +#include "cmsis_os.h" +#include "error.h" + +namespace rtos { + +RtosTimer::RtosTimer(void (*periodic_task)(void const *argument), os_timer_type type, void *argument) { +#ifdef CMSIS_OS_RTX + _timer.ptimer = periodic_task; + + memset(_timer_data, 0, sizeof(_timer_data)); + _timer.timer = _timer_data; +#endif + _timer_id = osTimerCreate(&_timer, type, argument); +} + +osStatus RtosTimer::start(uint32_t millisec) { + return osTimerStart(_timer_id, millisec); +} + +osStatus RtosTimer::stop(void) { + return osTimerStop(_timer_id); +} + +RtosTimer::~RtosTimer() { + osTimerDelete(_timer_id); +} + +}
--- a/rtos/RtosTimer.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/RtosTimer.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,51 +1,71 @@ -/* Copyright (c) 2012 mbed.org */ -#ifndef TIMER_H -#define TIMER_H - -#include <stdint.h> -#include "cmsis_os.h" - -namespace rtos { - -/*! The RtosTimer class allow creating and and controlling of timer functions in the system. - A timer function is called when a time period expires whereby both on-shot and - periodic timers are possible. A timer can be started, restarted, or stopped. - - Timers are handled in the thread osTimerThread. - Callback functions run under control of this thread and may use CMSIS-RTOS API calls. -*/ -class RtosTimer { -public: - /*! Create and Start timer. - \param task name of the timer call back function. - \param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic) - \param argument argument to the timer call back function. (default: NULL) - */ - RtosTimer(void (*task)(void const *argument), - os_timer_type type=osTimerPeriodic, - void *argument=NULL); - - /*! Stop the timer. - \return status code that indicates the execution status of the function. - */ - osStatus stop(void); - - /*! start a timer. - \param millisec time delay value of the timer. - \return status code that indicates the execution status of the function. - */ - osStatus start(uint32_t millisec); - - ~RtosTimer(); - -private: - osTimerId _timer_id; - osTimerDef_t _timer; -#ifdef CMSIS_OS_RTX - uint32_t _timer_data[5]; -#endif -}; - -} - -#endif +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef RTOS_TIMER_H +#define RTOS_TIMER_H + +#include <stdint.h> +#include "cmsis_os.h" + +namespace rtos { + +/** The RtosTimer class allow creating and and controlling of timer functions in the system. + A timer function is called when a time period expires whereby both on-shot and + periodic timers are possible. A timer can be started, restarted, or stopped. + + Timers are handled in the thread osTimerThread. + Callback functions run under control of this thread and may use CMSIS-RTOS API calls. +*/ +class RtosTimer { +public: + /** Create and Start timer. + @param task name of the timer call back function. + @param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic) + @param argument argument to the timer call back function. (default: NULL) + */ + RtosTimer(void (*task)(void const *argument), + os_timer_type type=osTimerPeriodic, + void *argument=NULL); + + /** Stop the timer. + @return status code that indicates the execution status of the function. + */ + osStatus stop(void); + + /** start a timer. + @param millisec time delay value of the timer. + @return status code that indicates the execution status of the function. + */ + osStatus start(uint32_t millisec); + + ~RtosTimer(); + +private: + osTimerId _timer_id; + osTimerDef_t _timer; +#ifdef CMSIS_OS_RTX + uint32_t _timer_data[5]; +#endif +}; + +} + +#endif
--- a/rtos/Semaphore.cpp Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Semaphore.cpp Tue Nov 27 16:55:38 2012 +0000 @@ -1,28 +1,49 @@ -#include "Semaphore.h" - -#include <string.h> -#include "error.h" - -namespace rtos { - -Semaphore::Semaphore(int32_t count) { -#ifdef CMSIS_OS_RTX - memset(_semaphore_data, 0, sizeof(_semaphore_data)); - _osSemaphoreDef.semaphore = _semaphore_data; -#endif - _osSemaphoreId = osSemaphoreCreate(&_osSemaphoreDef, count); -} - -int32_t Semaphore::wait(uint32_t millisec) { - return osSemaphoreWait(_osSemaphoreId, millisec); -} - -osStatus Semaphore::release(void) { - return osSemaphoreRelease(_osSemaphoreId); -} - -Semaphore::~Semaphore() { - osSemaphoreDelete(_osSemaphoreId); -} - -} +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Semaphore.h" + +#include <string.h> +#include "error.h" + +namespace rtos { + +Semaphore::Semaphore(int32_t count) { +#ifdef CMSIS_OS_RTX + memset(_semaphore_data, 0, sizeof(_semaphore_data)); + _osSemaphoreDef.semaphore = _semaphore_data; +#endif + _osSemaphoreId = osSemaphoreCreate(&_osSemaphoreDef, count); +} + +int32_t Semaphore::wait(uint32_t millisec) { + return osSemaphoreWait(_osSemaphoreId, millisec); +} + +osStatus Semaphore::release(void) { + return osSemaphoreRelease(_osSemaphoreId); +} + +Semaphore::~Semaphore() { + osSemaphoreDelete(_osSemaphoreId); +} + +}
--- a/rtos/Semaphore.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Semaphore.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,40 +1,60 @@ -/* Copyright (c) 2012 mbed.org */ -#ifndef SEMAPHORE_H -#define SEMAPHORE_H - -#include <stdint.h> -#include "cmsis_os.h" - -namespace rtos { - -/*! The Semaphore class is used to manage and protect access to a set of shared resources. */ -class Semaphore { -public: - /*! Create and Initialize a Semaphore object used for managing resources. - \param number of available resources; maximum index value is (count-1). - */ - Semaphore(int32_t count); - - /*! Wait until a Semaphore resource becomes available. - \param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). - \return number of available tokens, or -1 in case of incorrect parameters - */ - int32_t wait(uint32_t millisec=osWaitForever); - - /*! Release a Semaphore resource that was obtain with Semaphore::wait. - \return status code that indicates the execution status of the function. - */ - osStatus release(void); - - ~Semaphore(); - -private: - osSemaphoreId _osSemaphoreId; - osSemaphoreDef_t _osSemaphoreDef; -#ifdef CMSIS_OS_RTX - uint32_t _semaphore_data[2]; -#endif -}; - -} -#endif +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SEMAPHORE_H +#define SEMAPHORE_H + +#include <stdint.h> +#include "cmsis_os.h" + +namespace rtos { + +/** The Semaphore class is used to manage and protect access to a set of shared resources. */ +class Semaphore { +public: + /** Create and Initialize a Semaphore object used for managing resources. + @param number of available resources; maximum index value is (count-1). + */ + Semaphore(int32_t count); + + /** Wait until a Semaphore resource becomes available. + @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). + @return number of available tokens, or -1 in case of incorrect parameters + */ + int32_t wait(uint32_t millisec=osWaitForever); + + /** Release a Semaphore resource that was obtain with Semaphore::wait. + @return status code that indicates the execution status of the function. + */ + osStatus release(void); + + ~Semaphore(); + +private: + osSemaphoreId _osSemaphoreId; + osSemaphoreDef_t _osSemaphoreDef; +#ifdef CMSIS_OS_RTX + uint32_t _semaphore_data[2]; +#endif +}; + +} +#endif
--- a/rtos/Thread.cpp Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Thread.cpp Tue Nov 27 16:55:38 2012 +0000 @@ -1,65 +1,90 @@ -#include "Thread.h" - -#include "error.h" - -namespace rtos { - -Thread::Thread(void (*task)(void const *argument), void *argument, - osPriority priority, uint32_t stack_size, unsigned char *stack_pointer) { -#ifdef CMSIS_OS_RTX - _thread_def.pthread = task; - _thread_def.tpriority = priority; - _thread_def.stacksize = stack_size; - if (stack_pointer != NULL) { - _thread_def.stack_pointer = stack_pointer; - _dynamic_stack = false; - } else { - _thread_def.stack_pointer = new unsigned char[stack_size]; - if (_thread_def.stack_pointer == NULL) - error("Error allocating the stack memory"); - _dynamic_stack = true; - } -#endif - _tid = osThreadCreate(&_thread_def, argument); -} - -osStatus Thread::terminate() { - return osThreadTerminate(_tid); -} - -osStatus Thread::set_priority(osPriority priority) { - return osThreadSetPriority(_tid, priority); -} - -osPriority Thread::get_priority() { - return osThreadGetPriority(_tid); -} - -int32_t Thread::signal_set(int32_t signals) { - return osSignalSet(_tid, signals); -} - -osEvent Thread::signal_wait(int32_t signals, uint32_t millisec) { - return osSignalWait(signals, millisec); -} - -osStatus Thread::wait(uint32_t millisec) { - return osDelay(millisec); -} - -osStatus Thread::yield() { - return osThreadYield(); -} - -osThreadId Thread::gettid() { - return osThreadGetId(); -} - -Thread::~Thread() { - terminate(); - if (_dynamic_stack) { - delete[] (_thread_def.stack_pointer); - } -} - -} +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Thread.h" + +#include "error.h" + +namespace rtos { + +Thread::Thread(void (*task)(void const *argument), void *argument, + osPriority priority, uint32_t stack_size, unsigned char *stack_pointer) { +#ifdef CMSIS_OS_RTX + _thread_def.pthread = task; + _thread_def.tpriority = priority; + _thread_def.stacksize = stack_size; + if (stack_pointer != NULL) { + _thread_def.stack_pointer = stack_pointer; + _dynamic_stack = false; + } else { + _thread_def.stack_pointer = new unsigned char[stack_size]; + if (_thread_def.stack_pointer == NULL) + error("Error allocating the stack memory"); + _dynamic_stack = true; + } +#endif + _tid = osThreadCreate(&_thread_def, argument); +} + +osStatus Thread::terminate() { + return osThreadTerminate(_tid); +} + +osStatus Thread::set_priority(osPriority priority) { + return osThreadSetPriority(_tid, priority); +} + +osPriority Thread::get_priority() { + return osThreadGetPriority(_tid); +} + +int32_t Thread::signal_set(int32_t signals) { + return osSignalSet(_tid, signals); +} + +Thread::State Thread::get_state() { + return ((State)_thread_def.tcb.state); +} + +osEvent Thread::signal_wait(int32_t signals, uint32_t millisec) { + return osSignalWait(signals, millisec); +} + +osStatus Thread::wait(uint32_t millisec) { + return osDelay(millisec); +} + +osStatus Thread::yield() { + return osThreadYield(); +} + +osThreadId Thread::gettid() { + return osThreadGetId(); +} + +Thread::~Thread() { + terminate(); + if (_dynamic_stack) { + delete[] (_thread_def.stack_pointer); + } +} + +}
--- a/rtos/Thread.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/Thread.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,70 +1,108 @@ -/* Copyright (c) 2012 mbed.org */ +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #ifndef THREAD_H -#define THREAD_H +#define THREAD_H #include <stdint.h> #include "cmsis_os.h" namespace rtos { -/*! The Thread class allow defining, creating, and controlling thread functions in the system. */ +/** The Thread class allow defining, creating, and controlling thread functions in the system. */ class Thread { public: - /*! Create a new thread, and start it executing the specified function. - \param task function to be executed by this thread. - \param argument pointer that is passed to the thread function as start argument. (default: NULL). - \param priority initial priority of the thread function. (default: osPriorityNormal). - \param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE). - \param stack_pointer pointer to the stack area to be used by this thread (default: NULL). + /** Create a new thread, and start it executing the specified function. + @param task function to be executed by this thread. + @param argument pointer that is passed to the thread function as start argument. (default: NULL). + @param priority initial priority of the thread function. (default: osPriorityNormal). + @param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE). + @param stack_pointer pointer to the stack area to be used by this thread (default: NULL). */ Thread(void (*task)(void const *argument), void *argument=NULL, osPriority priority=osPriorityNormal, uint32_t stack_size=DEFAULT_STACK_SIZE, unsigned char *stack_pointer=NULL); - /*! Terminate execution of a thread and remove it from Active Threads - \return status code that indicates the execution status of the function. + /** Terminate execution of a thread and remove it from Active Threads + @return status code that indicates the execution status of the function. */ osStatus terminate(); - /*! Set priority of an active thread - \param priority new priority value for the thread function. - \return status code that indicates the execution status of the function. + /** Set priority of an active thread + @param priority new priority value for the thread function. + @return status code that indicates the execution status of the function. */ osStatus set_priority(osPriority priority); - /*! Get priority of an active thread - \ return current priority value of the thread function. + /** Get priority of an active thread + @return current priority value of the thread function. */ osPriority get_priority(); - /*! Set the specified Signal Flags of an active thread. - \param signals specifies the signal flags of the thread that should be set. - \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters. + /** Set the specified Signal Flags of an active thread. + @param signals specifies the signal flags of the thread that should be set. + @return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters. */ int32_t signal_set(int32_t signals); - /*! Wait for one or more Signal Flags to become signaled for the current RUNNING thread. - \param signals wait until all specified signal flags set or 0 for any single signal flag. - \param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). - \return event flag information or error code. + /** State of the Thread */ + enum State { + Inactive, /**< Not created or terminated */ + Ready, /**< Ready to run */ + Running, /**< Running */ + WaitingDelay, /**< Waiting for a delay to occur */ + WaitingInterval, /**< Waiting for an interval to occur */ + WaitingOr, /**< Waiting for one event in a set to occur */ + WaitingAnd, /**< Waiting for multiple events in a set to occur */ + WaitingSemaphore, /**< Waiting for a semaphore event to occur */ + WaitingMailbox, /**< Waiting for a mailbox event to occur */ + WaitingMutex, /**< Waiting for a mutex event to occur */ + }; + + /** State of this Thread + @return the State of this Thread + */ + State get_state(); + + /** Wait for one or more Signal Flags to become signaled for the current RUNNING thread. + @param signals wait until all specified signal flags set or 0 for any single signal flag. + @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). + @return event flag information or error code. */ static osEvent signal_wait(int32_t signals, uint32_t millisec=osWaitForever); - - /*! Wait for a specified time period in millisec: - \param millisec time delay value - \return status code that indicates the execution status of the function. + /** Wait for a specified time period in millisec: + @param millisec time delay value + @return status code that indicates the execution status of the function. */ static osStatus wait(uint32_t millisec); - /*! Pass control to next thread that is in state READY. - \return status code that indicates the execution status of the function. + /** Pass control to next thread that is in state READY. + @return status code that indicates the execution status of the function. */ static osStatus yield(); - /*! Get the thread id of the current running thread. - \return thread ID for reference by other functions or NULL in case of error. + /** Get the thread id of the current running thread. + @return thread ID for reference by other functions or NULL in case of error. */ static osThreadId gettid();
--- a/rtos/rtos.h Fri Nov 23 10:16:38 2012 +0000 +++ b/rtos/rtos.h Tue Nov 27 16:55:38 2012 +0000 @@ -1,17 +1,35 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited. All rights reserved. - */ -#ifndef RTOS_H -#define RTOS_H - -#include "Thread.h" -#include "Mutex.h" -#include "RtosTimer.h" -#include "Semaphore.h" -#include "Mail.h" -#include "MemoryPool.h" -#include "Queue.h" - -using namespace rtos; - -#endif +/* mbed Microcontroller Library + * Copyright (c) 2006-2012 ARM Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef RTOS_H +#define RTOS_H + +#include "Thread.h" +#include "Mutex.h" +#include "RtosTimer.h" +#include "Semaphore.h" +#include "Mail.h" +#include "MemoryPool.h" +#include "Queue.h" + +using namespace rtos; + +#endif