local fork
Fork of mbed-rtos by
Revision 11:2162c1c1f255, committed 2013-04-26
- Comitter:
- ashleymills
- Date:
- Fri Apr 26 16:49:39 2013 +0000
- Parent:
- 10:fcb1f103f7a1
- Commit message:
- tiny change due to resolution of error.h
Changed in this revision
--- a/rtos/Mutex.cpp Wed Apr 24 14:45:21 2013 +0000
+++ b/rtos/Mutex.cpp Fri Apr 26 16:49:39 2013 +0000
@@ -1,56 +1,56 @@
-/* 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);
-}
-
-}
+/* 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 "capi/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/Thread.cpp Wed Apr 24 14:45:21 2013 +0000
+++ b/rtos/Thread.cpp Fri Apr 26 16:49:39 2013 +0000
@@ -1,90 +1,90 @@
-/* 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);
- }
-}
-
-}
+/* 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 "capi/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/rtx/RTX_CM_lib.h Wed Apr 24 14:45:21 2013 +0000 +++ b/rtx/RTX_CM_lib.h Fri Apr 26 16:49:39 2013 +0000 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *---------------------------------------------------------------------------*/ -#include "error.h" +#include "capi/error.h" #if defined (__CC_ARM) #pragma O3
