Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 593ccefc4e32dd51fb08fb2ef04ed3dfcbcf5032 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*******************************************************************************
 * 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 */

#if defined __MINGW32__

/******************thread********************/
void etThread_construct(etThread* self, const 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 );
}
/*********************************************/

#elif defined __GNUC__

/******************thread********************/
void etThread_construct(etThread* self, const etThreadname name, void (*func)(void *), etStacksize stacksize, etPriority prio){}

void etThread_destruct(etThread* self){}

/*****************mutex**********************/
void etMutex_construct(etMutex* self){}
void etMutex_destruct(etMutex* self){}
void etMutex_enter(etMutex* self){}
void etMutex_leave(etMutex* self){}

/********************semaphore****************/
void etSema_contruct(etSema* self){}
void etSema_destruct(etSema* self){}

void etSema_wakeup(etSema* self){}

void etSema_waitForWakeup(etSema* self){}
/*********************************************/

#endif

Back to the top