/******************************************************************************* * 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 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * CONTRIBUTORS: * Thomas Schuetz, Thomas Jung (initial contribution) * *******************************************************************************/ /** * * etThread.c FreeRTOS implementation of etThread * */ #include "osal/etThread.h" #include "debugging/etLogger.h" #include "debugging/etMSCLogger.h" void etThread_execute(etThread* self); void etThread_construct( etThread* self, etStacksize stacksize, etPriority priority, etThreadname threadName, etThreadFunction threadFunction, void* threadFunctionData) { ET_MSC_LOGGER_SYNC_ENTRY("etThread", "construct") /* fill in data */ self->stacksize = stacksize; self->priority = priority; self->threadName = threadName; self->threadFunction = threadFunction; self->threadFunctionData = threadFunctionData; if (xTaskCreate( threadFunction, ( signed char * ) threadName, stacksize, self->threadFunctionData, priority, &(self->osData)) != pdPASS){ while(1){}; } /* xTaskCreate( threadFunction, ( signed char * ) threadName, stacksize, self->threadFunctionData, priority, &(self->osData) ); */ ET_MSC_LOGGER_SYNC_EXIT } void etThread_start(etThread* self) { ET_MSC_LOGGER_SYNC_ENTRY("etThread", "start") ET_MSC_LOGGER_SYNC_EXIT } void etThread_execute(etThread* self){ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "execute") /* etThread_execute redirects the call from the thread to the execute function in the eTrice runtime to enable correct synchronous MSC logging */ self->threadFunction(self->threadFunctionData); ET_MSC_LOGGER_SYNC_EXIT } void etThread_destruct(etThread* self){ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "destruct") vTaskDelete( self->osData ); ET_MSC_LOGGER_SYNC_EXIT } void etThread_sleep(etInt32 millis){ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep") ET_MSC_LOGGER_SYNC_EXIT } /* etOSThreadData etThread_self(void){ return GetCurrentThread(); } etOSThreadId etThread_self_id(void){ return GetCurrentThreadId(); } */