realtime.h

00001 #ifndef REALTIME_H
00002 #define REALTIME_H
00003 
00004 #include <gnu_defs.h>
00005 #include <arch/regdefs.h>
00006 
00021 
00023 typedef unsigned long RTIME;
00024 
00025 extern RTIME sys_clock;
00026 
00028 typedef long taskdata;
00029 
00034 typedef void __attribute__((far))(*ptask)(taskdata);
00035 
00042 static inline void BIG_LOCK(){ 
00043 __asm("psha");
00044 __asm("tfr ccr,a");
00045 __asm("anda #0x10");
00046 __asm("staa 0x1101");
00047 __asm("pula");
00048 idisable();
00049 }
00050 static inline void BIG_UNLOCK() {if(!(*(u8 *)0x1101))ienable();}
00051 
00055 typedef volatile struct RTaskNode{
00056 volatile struct RTaskNode *previous;
00057 volatile struct RTaskNode *next;
00058 volatile ptask task;
00059 volatile taskdata arg;
00060 volatile RTIME time;
00061 }RTaskNode;
00062 
00063 
00066 typedef struct RTaskList{
00067 
00068 RTaskNode *head;
00069 RTaskNode *tail;
00070 int size;
00071 }RTaskList;
00072 
00073 
00074 
00092 RTaskNode *__attribute__((far))RTaddtask(ptask task,taskdata arg, RTIME time);
00093 
00099 void __attribute__((far))RTremove_task(RTaskNode *taskptr);
00100 
00104 void __attribute__((far))RTdisable(void);
00105 
00109 void __attribute__((far))RTenable(void);
00110 
00114 void __attribute__((far))RTsaveflags(void);
00115 
00120 void __attribute__((far))RTrestoreflags(void);
00121 
00123 #endif

Generated on Fri Mar 3 17:25:45 2006 for EMAC-HCS12-SDK by  doxygen 1.4.6