Main Page | Data Structures | File List | Data Fields | Globals

opale.h

Go to the documentation of this file.
00001 // Header File 00002 // Created 05/02/05; 00:42:29 00003 00004 #ifndef __OPALE_H 00005 #define __OPALE_H 00006 00008 #define Opale_version "00.03.000" 00009 00014 #define _N_ 3 00015 00020 #define _Y_ 8 00021 00023 #define _X_ (1<<_N_) 00024 00025 #if _N_ > 3 00026 #error "_N_ priority coord can't be more than 3" 00027 #endif 00028 00029 #if _Y_ > 8 00030 #error "_Y_ priority coord can't be more than 8" 00031 #endif 00032 00036 #define NUM_TASKS (_X_*_Y_) 00037 00039 #define TO_LOWEST_SETTED_BIT_TABLE_SIZE ((_X_>_Y_)?(1<<_X_):(1<<_Y_)) 00040 00043 #define IDLE_TASK_STACK_SIZE 70 00044 00046 #define LOWEST_PRIORITY (NUM_TASKS-1) 00047 00051 #define op_EnterCriticalSection() asm(" trap #7") 00052 00055 #define op_ExitCriticalSection() asm(" trap #8") 00056 00059 typedef struct t_TASK { 00061 char* stackPointer; 00063 unsigned short tickDelay; 00065 struct t_TASK* nextSleeping; 00067 struct t_TASK* prevSleeping; 00069 unsigned char ident; 00070 } t_TASK; 00071 00073 typedef struct t_TASK_BLOCK { 00075 unsigned char rowIndex; 00077 unsigned char tasksTable[ _Y_ ]; 00078 } t_TASK_BLOCK; 00079 00082 typedef struct t_op_BUFFER { 00084 t_TASK_BLOCK readyTasks; 00086 t_TASK_BLOCK roundRobin; 00088 t_TASK* runningTasks[ NUM_TASKS ]; 00090 char idleTaskStack[ IDLE_TASK_STACK_SIZE ]; 00093 unsigned char indexToLowestSettedBit[ TO_LOWEST_SETTED_BIT_TABLE_SIZE ]; 00094 } t_op_BUFFER; 00095 00096 extern unsigned long op_idleCounter; 00097 00098 void op_KernelInit( register t_op_BUFFER* buffer asm("%a0"), register unsigned char rotationMask asm("%d0") ); 00099 void op_KernelStart( void ); 00100 void op_KernelStop( void ) __attribute__ ((noreturn)); 00101 00102 short op_TaskStart( register t_TASK* task asm("%a3"), register void(*taskEntryFunction)( register void* asm("%a0") ) asm("%a2"), register char* stackPointer asm("%a1"), register unsigned char ident asm("%d0"), register void* taskFunctionArgs asm("%a0") ); 00103 void op_TaskStop( void ); 00104 void op_TaskWaitForTicks( register unsigned short ticks asm("%d0") ); 00105 00107 typedef struct t_SEMAPHORE { 00109 unsigned long count; 00111 t_TASK_BLOCK waitingTasks; 00112 } t_SEMAPHORE; 00113 00115 typedef struct t_MAILBOX { 00117 void* message; 00119 t_TASK_BLOCK waitingTasks; 00120 } t_MAILBOX; 00121 00123 typedef struct { 00125 void** messageBuffer; 00127 t_TASK_BLOCK waitingTasks; 00129 unsigned short front; 00131 unsigned short back; 00133 unsigned short bufferSize; 00135 unsigned short bufferUsage; 00136 } t_QUEUE; 00137 00138 void op_SemaphoreInit( register t_SEMAPHORE* semaphore asm("%a0"), register unsigned long initValue asm("%d0") ); 00139 void op_SemaphorePost( register t_SEMAPHORE* semaphore asm("%a0") ); 00140 void op_SemaphorePend( register t_SEMAPHORE* semaphore asm("%a0") ); 00141 00142 void op_MailBoxInit( register t_MAILBOX* mailbox asm("%a0"), register void* initMessage asm("%d0") ); 00143 unsigned short op_MailBoxPost( register t_MAILBOX* mailBox asm("%a0"), register void* message asm("%d0") ); 00144 void* op_MailBoxPend( register t_MAILBOX* mailBox asm("%a0") ); 00145 00146 void op_QueueInit( register t_QUEUE* queue asm("%a0"), register void* buffer asm("%d0"), register unsigned short size asm("%d1") ); 00147 unsigned short op_QueuePost( register t_QUEUE* queue asm("%a0"), register void* message asm("%d0") ); 00148 unsigned short op_QueuePostFront( register t_QUEUE* queue asm("%a0"), register void* message asm("%d0") ); 00149 void* op_QueuePend( register t_QUEUE* queue asm("%a0") ); 00150 00151 #endif 00152 00153 00154 00155 /* end of file */

Generated on Sun May 14 22:31:06 2006 for Opale by doxygen 1.3.8