21,11 → 21,11 |
|
/** |
------------ |
CVS : $Id: func.h,v 1.2 2002-11-11 08:36:01 pj Exp $ |
CVS : $Id: func.h,v 1.3 2003-01-07 17:12:19 pj Exp $ |
|
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2002-11-11 08:36:01 $ |
Revision: $Revision: 1.3 $ |
Last update: $Date: 2003-01-07 17:12:19 $ |
------------ |
|
Kernel functions: |
98,11 → 98,39 |
TIME __kernel_register_levels__(void *arg); |
|
/*+ This function returns a level_des **. the value returned shall be |
used to register a level module. The function shall be called only at |
module registration time. It assume that the system is not yet |
initialized, so we shall not call sys_abort... +*/ |
LEVEL level_alloc_descriptor(); |
used to register a level module. |
|
The function is usually called at module registration time. The |
function can also be called when the system is already started, to |
allow the implementation of dynamic module registration. |
|
The argument must be the size of the data block that have to be allocated |
|
The function returns the number of the descriptor allocated for the module |
or -1 in case there are no free descriptors. |
|
The function also reserves a descriptor with size s, initialized |
with default function pointers. |
|
+*/ |
LEVEL level_alloc_descriptor(size_t s); |
|
/*+ This function release a level descriptor previously allocated using |
level_alloc_descriptor(). |
|
The function returns 0 if the level has been freed, or -1 if someone is |
using it, -2 if the level has never been registered. |
|
+*/ |
int level_free_descriptor(LEVEL l); |
|
/* Call this if you want to say that your module is using module l |
(e.g., for calling its private functions) */ |
int level_use_descriptor(LEVEL l); |
|
/* Call this when you no more need the module l */ |
int level_unuse_descriptor(LEVEL l); |
|
/*+ This function returns a resource_des **. the value returned shall be |
used to register a resource module. The function shall be called only at |
module registration time. It assume that the system is not yet |
128,13 → 156,6 |
(when uses some defines contained in const.h) +*/ |
int sys_atrunlevel(void (*func_code)(void *),void *parm, BYTE when); |
|
/*+ These functions can be used to set a nice (I hope) default |
signal handler. If not used, they are not linked. |
They returns -1 if an error occurred, as done by the |
sigaction primitive. +*/ |
int set_exchandler_grx(); |
int set_exchandler_text(); |
|
/*---------------------------------------------------------------------*/ |
/* Kernel global functions: scheduler, */ |
/*---------------------------------------------------------------------*/ |
153,6 → 174,8 |
|
int guarantee(); |
|
void levels_init(void); /* see init.c */ |
|
void runlevel_init(); |
void call_runlevel_func(int runlevel, int aborting); |
|
234,6 → 257,8 |
return e; |
} |
|
#define kern_event_delete event_delete |
|
/*+ the default capacity timer used by the kernel... +*/ |
void capacity_timer(void *arg); |
|
240,17 → 265,17 |
|
#define kern_printf message |
|
extern __inline__ TIME kern_gettime(struct timespec *t) |
{ |
return ll_gettime(TIME_EXACT, t); |
} |
|
|
|
/*---------------------------------------------------------------------*/ |
/* Kernel global functions: IRQ, errors and exception handling */ |
/* Kernel global functions: IRQ handling */ |
/*---------------------------------------------------------------------*/ |
|
/*+ Generic exception trapping routine +*/ |
void act_exc(int code); |
|
/* |
* User level interrupt/exception primitives |
*/ |
|
/*+ Interrupt handler installation +*/ |
int handler_set(int no, void (*fast)(int), PID pi); |
|
288,18 → 313,6 |
/*+ prints an error message (see perror.c) +*/ |
void perror (const char *s); |
|
/*+ Convert a status in a string. Useful for sys_status and level_status +*/ |
char *status_to_a(WORD status); |
|
/*+ this primitive prints the status of the system. cw contains a set of |
the statuses to be prompted... see const.h +*/ |
void sys_status(DWORD cw); |
|
/*+ sys_status flags +*/ |
#define CLOCK_STATUS 1 |
#define SCHED_STATUS 2 |
#define MEM_STATUS 4 |
|
/*+ this primitive returns the time read from the system timer +*/ |
TIME sys_gettime(struct timespec *t); |
|
345,6 → 358,34 |
void jet_update_endcycle(); |
|
/*---------------------------------------------------------------------*/ |
/* Internal Macros */ |
/*---------------------------------------------------------------------*/ |
|
extern __inline__ void kern_epilogue_macro(void) |
{ |
TIME tx; /* a dummy used for time computation */ |
struct timespec ty; /* a dummy used for time computation */ |
|
kern_gettime(&schedule_time); |
|
/* manage the capacity event */ |
SUBTIMESPEC(&schedule_time, &cap_lasttime, &ty); |
tx = TIMESPEC2USEC(&ty); |
proc_table[exec_shadow].avail_time -= tx; |
jet_update_slice(tx); |
|
/* if the event didn't fire before, we delete it. */ |
if (cap_timer != NIL) { |
kern_event_delete(cap_timer); |
cap_timer = NIL; |
} |
} |
|
/* This function is called by the kernel into kern.c to register a default |
exception handler */ |
int set_default_exception_handler(void); |
|
/*---------------------------------------------------------------------*/ |
/* Task management primitives */ |
/*---------------------------------------------------------------------*/ |
|
487,16 → 528,18 |
/*+ Enable the preemption mechanism on the task. +*/ |
void task_preempt(void); |
|
/*+ sends a message to the scheduling module that is handling the task +*/ |
int task_message(void *m, int reschedule); |
|
/*+ This function signals to the kernel that the current istance of |
the task (periodic or aperiodic) is ended; so the task can be |
suspended until it is activated again. Pending activations may be saved |
depending on the task model +*/ |
void task_endcycle(void); |
extern __inline__ void task_endcycle(void) |
{ |
task_message(NULL, 1); |
} |
|
/*+ This function suspend the actual task until an explicit activation |
Pending activations are discarded +*/ |
void task_sleep(void); |
|
/*+ This primitives refers the group id which is supplied |
by the application, not by the kernel +*/ |
int group_activate(WORD g); |