HeMPS  8.0
api.h
Go to the documentation of this file.
1 
15 #ifndef __TASK_H__
16 #define __TASK_H__
17 
18 /* Syscalls*/
19 #define EXIT 0
20 #define WRITEPIPE 1
21 #define READPIPE 2
22 #define GETTICK 3
23 #define ECHO 4
24 #define REALTIME 5
25 
26 #define MemoryWrite(A,V) *(volatile unsigned int*)(A)=(V)
27 #define TRUE 1
28 #define FALSE 0
29 
30 extern int SystemCall();
31 
32 #define Send(msg, target) while(!SystemCall(WRITEPIPE, (unsigned int*)msg, target,0))
33 #define Receive(msg, source) while(!SystemCall(READPIPE, (unsigned int*)msg, source,0))
34 #define GetTick() SystemCall(GETTICK,0,0,0)
35 #define Echo(str) SystemCall(ECHO, (char*)str,0,0)
36 #define exit() while(!SystemCall(EXIT, 0, 0, 0))
37 
38 //Real-Time API - time represented in microseconds
39 #define RealTime(period, deadline, execution_time) while(!SystemCall(REALTIME, period, deadline, execution_time))
40 
41 /*--------------------------------------------------------------------
42  * struct Message
43  *
44  * DESCRIPTION:
45  * Used to handle messages inside the task.
46  * This is not the same structure used in the kernels.
47  *
48  *--------------------------------------------------------------------*/
49 #define MSG_SIZE 128
50 
51 typedef struct {
52  int length;
53  int msg[MSG_SIZE];
54 } Message;
55 
56 #endif /*__TASK_H__*/
57 
Definition: api.h:51