diff options
author | Henrik Rentz-Reichert | 2016-04-18 08:29:12 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2016-04-18 08:30:57 +0000 |
commit | f7e62f7bc4fe98822a874c96befc9d765f40bac0 (patch) | |
tree | 6f1ca52a45954d73853666e395aa67721ace6b2f /runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c | |
parent | dc6cd1b7851886e81d58fb717197f090d0c9959a (diff) | |
download | org.eclipse.etrice-f7e62f7bc4fe98822a874c96befc9d765f40bac0.tar.gz org.eclipse.etrice-f7e62f7bc4fe98822a874c96befc9d765f40bac0.tar.xz org.eclipse.etrice-f7e62f7bc4fe98822a874c96befc9d765f40bac0.zip |
added new runtimes for Dave (on behalf of Thomas Jung)
Change-Id: I24ce70a6a5a2f1885e9e8252eb1e0f0df967e585
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c')
-rw-r--r-- | runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c new file mode 100644 index 000000000..7d473ce3e --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_XMC_FreeRTOS_Dave/etMutex.c @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Jung (initial contribution) + * + *******************************************************************************/ + +/** + * + * etMutex.c FreeRTOS implementation of etMutex + * + */ + +#include "osal/etMutex.h" + +#include "debugging/etLogger.h" +#include "debugging/etMSCLogger.h" + +void etMutex_construct(etMutex* self){ + ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "construct") + self->osData = xSemaphoreCreateMutex(); + if((self->osData) == NULL){ + while(1){}; + } + ET_MSC_LOGGER_SYNC_EXIT +} +void etMutex_destruct(etMutex* self){ + ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "destruct") + vSemaphoreDelete( self->osData ); + ET_MSC_LOGGER_SYNC_EXIT +} + +void etMutex_enter(etMutex* self){ + ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "enter") + xSemaphoreTake(self->osData,portMAX_DELAY ); + ET_MSC_LOGGER_SYNC_EXIT +} +void etMutex_leave(etMutex* self){ + ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "leave") + xSemaphoreGive(self->osData); + ET_MSC_LOGGER_SYNC_EXIT +} |