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