Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c79c2ac1a0cef911cfeba7ef67f248583f9c37d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*******************************************************************************
 * Copyright (c) 2012 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 Schuetz (initial contribution)
 *
 *******************************************************************************/

#include <etDatatypes.h>

/* implemenatation for eTrice interfaces*/

void etUserEntry(void){ }

void etUserPreRun(void){ }

void etUserPostRun(void){ }

void etUserExit(void){ }


/* platform specific functions */

/******************thread********************/
void etThread_construct(etThread* self, etThreadname name,void (*func)(void *),etStacksize stacksize, etPriority prio){
	   *self = (HANDLE)_beginthread( func, stacksize, NULL );
	   SetThreadPriority(*self,THREAD_PRIORITY_NORMAL);
}

void etThread_destruct(etThread* self){}

/*****************mutex**********************/
void etMutex_construct(etMutex* self){
	InitializeCriticalSection( self );
}
void etMutex_destruct(etMutex* self){}
void etMutex_enter(etMutex* self){
    EnterCriticalSection( self );
}
void etMutex_leave(etMutex* self){
    LeaveCriticalSection( self );
}

/********************semaphore****************/
void etSema_contruct(etSema* self){
	*self = CreateEvent( NULL, FALSE, FALSE, NULL );
}
void etSema_destruct(etSema* self){}

void etSema_wakeup(etSema* self){
	SetEvent(self);
}

void etSema_waitForWakeup(etSema* self){
	WaitForSingleObject( self, INFINITE );
}
/*********************************************/

Back to the top