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.02.00b" 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 00097 extern unsigned long op_idleCounter; 00098 00107 void op_KernelInit( register t_op_BUFFER* buffer asm("%a0"), register unsigned char rotationMask asm("%d0") ); 00108 00114 void op_KernelStart( void ); 00115 00120 void op_KernelStop( void ) __attribute__ ((noreturn)); 00121 00133 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") ); 00134 00138 void op_TaskStop( void ); 00139 00144 void op_TaskWaitForTicks( register unsigned short ticks asm("%d0") ); 00145 00147 typedef struct t_SEMAPHORE { 00149 unsigned long count; 00151 t_TASK_BLOCK waitingTasks; 00152 } t_SEMAPHORE; 00153 00155 typedef struct t_MAILBOX { 00157 void* message; 00159 t_TASK_BLOCK waitingTasks; 00160 } t_MAILBOX; 00161 00163 typedef struct { 00165 void** messageBuffer; 00167 t_TASK_BLOCK waitingTasks; 00169 unsigned short front; 00171 unsigned short back; 00173 unsigned short bufferSize; 00175 unsigned short bufferUsage; 00176 } t_QUEUE; 00177 00182 void op_SemaphoreInit( register t_SEMAPHORE* semaphore asm("%a0"), register unsigned long initValue asm("%d0") ); 00183 00184 00189 void op_SemaphorePost( register t_SEMAPHORE* semaphore asm("%a0") ); 00190 00196 void op_SemaphorePend( register t_SEMAPHORE* semaphore asm("%a0") ); 00197 00202 void op_MailBoxInit( register t_MAILBOX* mailbox asm("%a0"), register void* initMessage asm("%d0") ); 00203 00210 unsigned short op_MailBoxPost( register t_MAILBOX* mailBox asm("%a0"), register void* message asm("%d0") ); 00211 00219 void* op_MailBoxPend( register t_MAILBOX* mailBox asm("%a0") ); 00220 00225 void op_QueueInit( register t_QUEUE* queue asm("%a0"), register void* buffer asm("%d0"), register unsigned short size asm("%d1") ); 00226 00234 unsigned short op_QueuePost( register t_QUEUE* queue asm("%a0"), register void* message asm("%d0") ); 00235 00244 unsigned short op_QueuePostFront( register t_QUEUE* queue asm("%a0"), register void* message asm("%d0") ); 00245 00253 void* op_QueuePend( register t_QUEUE* queue asm("%a0") ); 00254 00255 #endif 00256 00257 00258 00259 /* end of file */

Generated on Thu Apr 21 21:59:16 2005 for Opale by doxygen 1.3.8