]> rtime.felk.cvut.cz Git - arc.git/blobdiff - include/arc.h
Again, loads of refactoring and removing and adding files.
[arc.git] / include / arc.h
index d2d473a35db31a519711092a695e10785db55bc9..7a2dcdd405ec7b08789e93b98eaacc55ddc8f582 100644 (file)
@@ -1,15 +1,60 @@
-/*\r
- * arc.h\r
- *\r
- *  Created on: 28 sep 2009\r
- *      Author: mahi\r
- */\r
 \r
 #ifndef ARC_H_\r
 #define ARC_H_\r
 \r
-#include "arc.h"\r
 \r
+#define ARRAY_SIZE(_x)         sizeof(_x)/sizeof((_x)[0])\r
+\r
+#define OS_STR__(x)            #x\r
+#define OS_STRSTR__(x)         OS_STR__(x)\r
+\r
+#ifndef MIN\r
+#define MIN(_x,_y) (((_x) < (_y)) ? (_x) : (_y))\r
+#endif\r
+#ifndef MAX\r
+#define MAX(_x,_y) (((_x) > (_y)) ? (_x) : (_y))\r
+#endif\r
+\r
+/**\r
+ * Holds information about stack usage
+ */\r
+typedef struct StackInfo_s {\r
+       /* This task was swapped in with this stack */\r
+       void *  at_swap;\r
+       /* Pointer to the top of the stack */\r
+       void *  top;\r
+       /* The size of the stack in bytes */\r
+       int     size;\r
+       /* Pointer to the current place of the stack */\r
+       void *  curr;\r
+       /* Calculated usage in % of total */\r
+       void *  usage;\r
+} StackInfoType;\r
+\r
+/**\r
+ * Converts OSEK StatusType to a string for easy printing
+ */\r
 const char *Arc_StatusToString(StatusType);\r
 \r
+void Os_Arc_GetStackInfo( TaskType pid, StackInfoType *s );\r
+\r
+#define OS_STACK_USAGE(_x) ((((_x)->size - (uint32_t)((_x)->usage - (_x)->top))*100)/(_x)->size)\r
+\r
+// int simple_printf(const char *format, ...);\r
+\r
+TaskType Os_Arc_CreateIsr( void  (*entry)(void), uint8_t prio, const char *name );\r
+\r
+/**\r
+ * Get the task activation limit\r
+ * @param task\r
+ */\r
+int Os_ArcTest_GetTaskActivationLimit( TaskType task );\r
+\r
+/**\r
+ * Fake Irq. Used for API testing.\r
+ * @param level The level\r
+ */\r
+void Os_ArcTest_SetIrqNestLevel( int level );\r
+\r
+\r
 #endif /* ARC_H_ */\r