]> rtime.felk.cvut.cz Git - arc.git/blob - include/arc.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / include / arc.h
1 \r
2 #ifndef ARC_H_\r
3 #define ARC_H_\r
4 \r
5 #ifndef ARRAY_SIZE\r
6 #define ARRAY_SIZE(_x)  sizeof(_x)/sizeof((_x)[0])\r
7 #endif\r
8 \r
9 #define OS_STR__(x)             #x\r
10 #define OS_STRSTR__(x)  OS_STR__(x)\r
11 \r
12 #ifndef MIN\r
13 #define MIN(_x,_y) (((_x) < (_y)) ? (_x) : (_y))\r
14 #endif\r
15 #ifndef MAX\r
16 #define MAX(_x,_y) (((_x) > (_y)) ? (_x) : (_y))\r
17 #endif\r
18 \r
19 /**\r
20  * Holds information about stack usage\r
21  */\r
22 typedef struct StackInfo_s {\r
23         /* This task was swapped in with this stack */\r
24         void *  at_swap;\r
25         /* Pointer to the top of the stack */\r
26         void *  top;\r
27         /* The size of the stack in bytes */\r
28         int     size;\r
29         /* Pointer to the current place of the stack */\r
30         void *  curr;\r
31         /* Calculated usage in % of total */\r
32         void *  usage;\r
33 } StackInfoType;\r
34 \r
35 /**\r
36  * Converts OSEK StatusType to a string for easy printing\r
37  */\r
38 const char *Arc_StatusToString(StatusType);\r
39 \r
40 void Os_Arc_GetStackInfo( TaskType pid, StackInfoType *s );\r
41 \r
42 #define OS_STACK_USAGE(_x) ((((_x)->size - (uint32_t)((size_t)(_x)->usage - (size_t)(_x)->top))*100)/(_x)->size)\r
43 \r
44 // int printf(const char *format, ...);\r
45 \r
46 TaskType Os_Arc_CreateIsr( void  (*entry)(void), uint8_t prio, const char *name );\r
47 \r
48 /**\r
49  * Get the task activation limit\r
50  * @param task\r
51  */\r
52 int Os_ArcTest_GetTaskActivationLimit( TaskType task );\r
53 \r
54 /**\r
55  * Fake Irq. Used for API testing.\r
56  * @param level The level\r
57  */\r
58 void Os_ArcTest_SetIrqNestLevel( int level );\r
59 \r
60 \r
61 #endif /* ARC_H_ */\r