Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 66d56c8940b123713577ae8b7b904c9f2652227a (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
/*******************************************************************************
 * 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)
 *
 *******************************************************************************/

#ifndef __ETPLATFORM_H__
#define __ETPLATFORM_H__

#include "etDatatypes.h"

/*
 * etPlatform.h defines a generic interface for platform specific implementations
 *
 * */

/* platform specific functions */

/******************thread********************/

typedef int32 etStacksize;
typedef int32 etPriority;
typedef charPtr etThreadname;
typedef void (*etThreadFunction)(void *);

typedef struct etThread{
	etOSThreadData osData;  /* OS specific thread data (e.g. handle or id) */
	etStacksize stacksize;
	etPriority priority;
	etThreadname threadName;
	etThreadFunction threadFunction;
	void* threadFunctionData;
} etThread;


void etThread_construct(etThread* self);
void etThread_destruct(etThread* self);

/******************thread helpers********************/
void etThread_sleep(etInt32 millis);


/*****************mutex**********************/

typedef struct etMutex {
	etOSMutexData osData;
} etMutex;

void etMutex_construct(etMutex* self);
void etMutex_destruct(etMutex* self);
void etMutex_enter(etMutex* self);
void etMutex_leave(etMutex* self);

/********************semaphore****************/

typedef struct etSema {
	etOSSemaData osData;
} etSema;

void etSema_construct(etSema* self);
void etSema_destruct(etSema* self);
void etSema_wakeup(etSema* self);
void etSema_waitForWakeup(etSema* self);

/*********************************************/



/*
 * Platform startup and shutdown -> generated code for SubSystemClass uses these interfaces
 * */

void etUserEntry(void);
void etUserPreRun(void);
/* void etUserRun(void); */ /* TODO: do we need this function? */
void etUserPostRun(void);
void etUserExit(void);

#endif /* __ETPLATFORM_H__ */

Back to the top