void Testee_receiveMessage(void* self, void* ifitem, const etMessage* msg){ ET_MSC_LOGGER_SYNC_ENTRY("Testee", "_receiveMessage") receiveEvent(self, (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage)))); ET_MSC_LOGGER_SYNC_EXIT }
void etMessageService_start(etMessageService* self){ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "start") etThread_start( &(self->thread) ); if (self->execmode==EXECMODE_POLLED || self->execmode==EXECMODE_MIXED) { etTimer_start(&self->timer); } ET_MSC_LOGGER_SYNC_EXIT }
void Testee_init(Testee* self){ ET_MSC_LOGGER_SYNC_ENTRY("Testee", "init") self->state = STATE_TOP; { int i; for (i=0; i<TESTEE_HISTORY_SIZE; ++i) self->history[i] = NO_STATE; } executeInitTransition(self); ET_MSC_LOGGER_SYNC_EXIT }
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; ET_MSC_LOGGER_SYNC_EXIT }
/* * initialize message service with all needed data and initialize message queue and message pool * */ void etMessageService_init( etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize, etStacksize stacksize, etPriority priority, etTime interval, etDispatcherReceiveMessage msgDispatcher, etMessageService_execmode execmode){ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "init") /* copy init data to self */ self->messageBuffer.buffer = buffer; self->messageBuffer.maxBlocks = maxBlocks; self->messageBuffer.blockSize = blockSize; self->msgDispatcher = msgDispatcher; self->execmode = execmode; /* init queue and pool */ etMessageQueue_init( &(self->messagePool) ); /* the pool is also a queue*/ etMessageQueue_init( &(self->messageQueue) ); etMessageService_initMessagePool(self); /* init mutexes and semaphores */ etMutex_construct( &(self->poolMutex) ); etMutex_construct( &(self->queueMutex) ); etSema_construct( &(self->executionSemaphore) ); /* init thread */ etThread_construct(&self->thread, stacksize, priority, "MessageService", (etThreadFunction) etMessageService_deliverAllMessages, self); if (execmode==EXECMODE_POLLED || execmode==EXECMODE_MIXED) { /* init timer */ etTimer_construct(&self->timer, &interval, etMessageService_timerCallback, self); } ET_MSC_LOGGER_SYNC_EXIT }
void etSema_waitForWakeup(etSema* self){ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "waitForWakeup") WaitForSingleObject( self->osData, INFINITE ); ET_MSC_LOGGER_SYNC_EXIT }
void etSema_wakeup(etSema* self){ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeup") SetEvent( self->osData ); ET_MSC_LOGGER_SYNC_EXIT }
void etSema_construct(etSema* self){ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct") self->osData = CreateEvent( NULL, FALSE, FALSE, NULL ); ET_MSC_LOGGER_SYNC_EXIT }
* */ #include "osal/etSema.h" #include "etDatatypes.h" #include "debugging/etMSCLogger.h" void etSema_construct(etSema* self){ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct") self->osData = CreateEvent( NULL, FALSE, FALSE, NULL ); ET_MSC_LOGGER_SYNC_EXIT } void etSema_destruct(etSema* self){ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "destruct") /* TODO: implement this function */ ET_MSC_LOGGER_SYNC_EXIT } void etSema_wakeup(etSema* self){ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeup") SetEvent( self->osData ); ET_MSC_LOGGER_SYNC_EXIT } void etSema_waitForWakeup(etSema* self){ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "waitForWakeup") WaitForSingleObject( self->osData, INFINITE ); ET_MSC_LOGGER_SYNC_EXIT }
void CLass1_f(void) { ET_MSC_LOGGER_SYNC_ENTRY("Class1", "f") Class2_ff(); ET_MSC_LOGGER_SYNC_EXIT }
#include "debugging/etLogger.h" #include "debugging/etMSCLogger.h" void Class2_ff(void) { ET_MSC_LOGGER_SYNC_ENTRY("Class2", "ff") ET_MSC_LOGGER_SYNC_EXIT } void CLass1_f(void) { ET_MSC_LOGGER_SYNC_ENTRY("Class1", "f") Class2_ff(); ET_MSC_LOGGER_SYNC_EXIT } //int main(void) { // // etLogger_logInfo("*** T H E B E G I N ***"); // // ET_MSC_LOGGER_OPEN("main"); // CLass1_f(); // ET_MSC_LOGGER_CLOSE // // etLogger_logInfo("*** T H E E N D ***"); // // return 0; //}
void etThread_sleep(etInt32 millis){ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep") Sleep(millis); ET_MSC_LOGGER_SYNC_EXIT }
void etThread_destruct(etThread* self){ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "destruct") TerminateThread(self->osData, 0); 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_start(etThread* self) { ET_MSC_LOGGER_SYNC_ENTRY("etThread", "start") self->osData = (HANDLE)_beginthread( (etThreadFunction)etThread_execute, self->stacksize, self ); SetThreadPriority(self->osData, self->priority); ET_MSC_LOGGER_SYNC_EXIT }
void PTimerPort_timeout(const PTimerPort* self) { ET_MSC_LOGGER_SYNC_ENTRY("PTimerPort", "timeout") etPort_sendMessage(self, PTimer_OUT_timeout, 0, NULL); ET_MSC_LOGGER_SYNC_EXIT }