Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 2 → Rev 39

/shark/tags/rel_0_3/include/kernel/func.h
21,11 → 21,11
 
/**
------------
CVS : $Id: func.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: func.h,v 1.3 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.3 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
Kernel functions:
89,15 → 89,6
/* if a source use printk() it should include log.h not func.h */
#include <kernel/log.h>
 
#if 0
#ifdef __DEBUG_ON__
#define printk(fmt,args...) \
VM_printf(fmt,##args)
#else
#define printk(fmt,args...)
#endif
#endif
 
/*---------------------------------------------------------------------*/
/* Kernel global functions: initialization & termination... */
/*---------------------------------------------------------------------*/
107,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
137,15 → 156,8
(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, queues */
/* Kernel global functions: scheduler, */
/*---------------------------------------------------------------------*/
 
/*+ This is the generic scheduler.
157,31 → 169,13
the end of an event list +*/
void event_need_reschedule();
 
/* Simple QUEUE management functions */
void q_insert (PID p, QUEUE *q);
void q_timespec_insert (PID p, QUEUE *q);
void q_extract (PID p, QUEUE *q);
PID q_getfirst ( QUEUE *q);
void q_insertfirst (PID p, QUEUE *q);
 
 
/* QQUEUE management functions */
void qq_init ( QQUEUE *q);
void qq_insert (PID p, QQUEUE *q);
void qq_timespec_insert (PID p, QQUEUE *q);
void qq_extract (PID p, QQUEUE *q);
PID qq_getfirst ( QQUEUE *q);
void qq_insertfirst (PID p, QQUEUE *q);
void qq_insertlast (PID p, QQUEUE *q);
PID qq_queryfirst ( QQUEUE *q);
PID qq_querylast ( QQUEUE *q);
 
 
void task_makefree(void *ret);
void check_killed_async(void);
 
int guarantee();
 
void levels_init(void); /* see init.c */
 
void runlevel_init();
void call_runlevel_func(int runlevel, int aborting);
 
221,15 → 215,6
return ll_context_from();
}
 
 
 
#ifdef __TEST1__
extern int useds;
extern int testactive;
extern struct timespec s_send[];
#endif
 
 
/*+ this functions are called every time a context is changed +*/
void kern_after_dispatch(void);
 
243,10 → 228,6
{
ll_context_to(c);
kern_after_dispatch();
 
#ifdef __TEST1__
if (testactive) ll_gettime(TIME_EXACT,&s_send[useds-1] );
#endif
sti();
}
 
276,6 → 257,8
return e;
}
 
#define kern_event_delete event_delete
 
/*+ the default capacity timer used by the kernel... +*/
void capacity_timer(void *arg);
 
282,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);
 
330,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);
 
387,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 */
/*---------------------------------------------------------------------*/
 
529,19 → 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 function suspend the actual task for a minimum delay time +*/
void task_delay(DWORD delay);
 
/*+ This primitives refers the group id which is supplied
by the application, not by the kernel +*/
int group_activate(WORD g);
/shark/tags/rel_0_3/include/kernel/model.h
21,11 → 21,11
 
/**
------------
CVS : $Id: model.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: model.h,v 1.2 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
This file contains the definitions of the task and resource models.
55,8 → 55,8
#define __KERNEL_MODEL_H__
 
#include "ll/ll.h"
#include "kernel/types.h"
 
 
/* -----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
165,6 → 165,7
 
typedef struct {
WORD pclass;
LEVEL level;
size_t stacksize;
void *stackaddr;
WORD group;
210,13 → 211,13
 
/* Some macros to set various task-model parameters */
#define task_default_model(m,p) (m).pclass = (p), \
(m).level = 0; \
(m).stacksize = 4096, \
(m).stackaddr = NULL, \
(m).group = 0, \
(m).arg = NULL,\
(m).control = 0
#define task_def_level(m,l) (m).pclass = ((m).pclass & 0xFF00) | \
((l) & 0xFF)
#define task_def_level(m,l) (m).level = (l)
#define task_def_arg(m,a) (m).arg = (a)
#define task_def_stack(m,s) (m).stacksize = (s)
#define task_def_stackaddr(m,s) (m).stackaddr = (s)
237,16 → 238,13
PCLASS values
----------------------------------------------------------------------- */
 
/*+ These are the value for the pclass field;
a level l that accept a task model with pclass p
accept also the alias pclass (p | l)
=> the LSByte MUST be 0 (256 levels maximum) +*/
/* These are the value for the pclass field */
 
#define DUMMY_PCLASS 0x0000
#define HARD_PCLASS 0x0100
#define SOFT_PCLASS 0x0200
#define NRT_PCLASS 0x0300
#define JOB_PCLASS 0x0400
#define DUMMY_PCLASS 0
#define HARD_PCLASS 1
#define SOFT_PCLASS 2
#define NRT_PCLASS 3
#define JOB_PCLASS 4
 
 
/* -----------------------------------------------------------------------
559,11 → 557,12
+*/
 
typedef struct {
int rclass; // protocollo a cui si riferisce il modello di task
int rclass; /* protocol */
RLEVEL level; /* level */
} RES_MODEL;
 
#define res_default_model(r, p) (r).rclass = (p)
#define res_def_level(r,l) (r).rclass = ((r).rclass & 0xFF00) | (l)
#define res_default_model(r, p) (r).rclass = (p), (r).level = 0
#define res_def_level(r,l) (r).level = (l)
 
 
 
/shark/tags/rel_0_3/include/kernel/descr.h
21,11 → 21,11
 
/**
------------
CVS : $Id: descr.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: descr.h,v 1.3 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.3 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
Kernel main data structures
70,6 → 70,7
#include <ll/ll.h>
#include <kernel/model.h>
#include <kernel/types.h>
#include <kernel/iqueue.h>
#include <limits.h>
 
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
129,8 → 130,6
int sigpending; /*+ The signal pending mask +*/
int sigwaiting; /*+ The signal waiting mask +*/
 
struct timespec request_time;
/*+ Last request time for the task +*/
int avail_time; /*+ the time the task can execute before a
timer fire. see also the control field
and bits related in model.h +*/
140,8 → 139,8
struct _task_handler_rec *cleanup_stack;
/*+ The cleanup stack +*/
 
QUEUE next,prev; /*+ Next/Prev Index in the queue +*/
 
 
int errnumber;
 
/* Job Execution Time fields */
174,8 → 173,7
* the generic kernel, with exclusion of delay_timer that is used
* also in cond_timedwait
*/
DWORD priority; /*+ A priority field +*/
struct timespec timespec_priority; /*+ Another priority field +*/
 
int delay_timer; /*+ A field useful to store the delay timer +*/
 
int wcet; /*+ a worst case time execution +*/
193,139 → 191,107
All the informations that depends on the particular module are put
in the level module files.
 
The initialization of a level is splitted in two parts:
- the registration -> called before the system initialization, typically
AFTER the resource registration
- the level_init -> called during the system initialization,
BEFORE the resource_init(s)
Here a small description of the various functions:
 
-------------------------------------------------------------------
- PUBLIC Functions:
on one side, a module should export an interface to the Generic
Kernel, giving a set of functions that the Generic Kernel can use
to ask a service to the module. That is, the Public Functions are
called ONLY by the Generic Kernel.
 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
- PRIVATE Functions: on the other side, a module can export an
interface to the public part of the same or of another
module. That is, Private Functions are called ONLY by Public and
Private Functions.
-------------------------------------------------------------------
 
typedef struct {
char level_name[MAX_LEVELNAME]; /*+ for statistical pourposes +*/
WORD level_code; /*+ level identification code +*/
BYTE level_version; /*+ level version +*/
int (*private_insert )(LEVEL l, PID p, TASK_MODEL *m);
Inserts a task into the internal module data structure.
void (*private_extract )(LEVEL l, PID p);
Removes a task from the internal module data structure.
 
/* LEVEL CALLS */
int (*level_accept_task_model)(LEVEL l, TASK_MODEL *m);
/*+ models that a task can manage. returns
0 if the level can manage the model,
-1 if not +*/
int (*private_eligible)(LEVEL l, PID p);
A task inserted into the internal module data structure needs to be
scheduled. returns 0 if it can be scheduled, -1 if not.
 
int (*level_accept_guest_model)(LEVEL l, TASK_MODEL *m);
/*+ models that a task can manage as guest
tasks. returns
0 if the level can manage the model,
-1 if not +*/
void (*private_dispatch)(LEVEL l, PID p, int nostop);
A task inserted into the internal module data structure has been dispatched.
 
// void (*level_init)(); /*+ initialization of the level module +*/
// void (*level_end)(); /*+ level termination (at system end... +*/
void (*level_status)(LEVEL l);/*+ print level statistics... +*/
void (*private_epilogue)(LEVEL l, PID p);
A task inserted into the internal module data structure has been preempted.
 
PID (*level_scheduler)(LEVEL l);
/*+ the level scheduler returns a task
chosen among those belonging to the
level +*/
 
int (*level_guarantee)(LEVEL l, bandwidth_t *freebandwidth);
/*+ 0 if the level is guaranteed, -1 if not
no guarantee if (*f)()=null
the function updates the parameter
(see guarantee() ) +*/
 
/* TASK CALLS */
int (*task_create)(LEVEL l, PID p, TASK_MODEL *m);
/*+ the task p is created into the level
returns 0->ok, -1->error +*/
void (*task_detach)(LEVEL l, PID p);
/*+ there is an error in the task_create
after the task call task_create.
The function delete all the informations
about the task in the level.
For the resources levels there is the
res_detach: res_detach is called also
when killing a task +*/
int (*task_eligible)(LEVEL l, PID p);
/*+ correctness control when a task is
chosen by a level scheduler (used with
aperiodic servers) 0->ok, -1->no +*/
void (*task_dispatch)(LEVEL l, PID p, int nostop);
/*+ a task go in the EXEC status (called
by dispatch() ) +*/
void (*task_epilogue)(LEVEL l, PID p);
/*+ a task has finished the current slice+*/
PID (*public_scheduler)(LEVEL l);
returns a task to schedule, or -1 if no tasks are ready
 
void (*task_activate)(LEVEL l, PID p);
/*+ the task is activated... +*/
int (*public_guarantee)(LEVEL l, bandwidth_t *freebandwidth);
returns 0 if the level is guaranteed, -1 if not
no guarantee if (*f)()=null
the function updates the parameter freebandwidth (see guarantee() )
int (*public_create )(LEVEL l, PID p, TASK_MODEL *m);
the task p is created into the module
returns 0->ok, -1->error
 
void (*task_insert)(LEVEL l, PID p);
/*+ opposite to task_extract +*/
void (*task_extract)(LEVEL l, PID p);
/*+ remove the task from the "ready" (if any)
queue +*/
void (*public_detach )(LEVEL l, PID p);
there is an error in the public_create. The function removes all the
informations about the task in the module.
 
void (*task_endcycle)(LEVEL l, PID p);
/*+ the (periodic) task finish the cycle +*/
void (*task_end)(LEVEL l, PID p);
/*+ the task is killed; we have to remove
it from the level queues, test if it
is in the exec state, etc... it can
modify the state of the task (-> FREE,
ZOMBIE...), but
cannot call the scheduler directly (it
is called by the task_makefree.
Note: the task can be in a state
different from those managed by the
level because the task may be blocked.
the res_detach is in any case called
AFTER the task_end. +*/
void (*public_end )(LEVEL l, PID p);
the task has been killed, or it ended regularly
 
void (*task_sleep)(LEVEL l, PID p);
/*+ this function will fall asleep the
task in the EXE state. +*/
int (*public_eligible )(LEVEL l, PID p);
A task needs to be scheduled. returns 0 if it can be scheduled, -1 if not.
void (*public_dispatch )(LEVEL l, PID p, int nostop);
A task has been dispatched.
 
void (*public_epilogue )(LEVEL l, PID p);
A task has been preempted (or its capacity is exausted).
 
void (*task_delay)(LEVEL l, PID p,DWORD tickdelay);
void (*public_activate )(LEVEL l, PID p);
A task has been activated.
 
void (*public_unblock )(LEVEL l, PID p);
void (*public_block )(LEVEL l, PID p);
A task has been unblocked/blocked on a synchronization point
(e.g. a semaphore, a mailbox, a nanosleep).
 
/* guest CALLS:
these functions are called from an Aperiodic Server Level for the task
that are inserted in the local queues */
int (*guest_create)(LEVEL l, PID p, TASK_MODEL *m);
/*+ the task is already created in another
level and it is inserted in the current
level; returns 0->ok, -1->error +*/
void (*guest_detach)(LEVEL l, PID p);
/*+ there is an error in a task creation
of a task made by an aperiodic server
The function delete all the informations
about the task in the level. +*/
void (*guest_dispatch)(LEVEL l, PID p, int nostop);
/*+ a task belonging to another level but
inserted in the current level go in the
EXEC status (called by dispatch() ) +*/
void (*guest_epilogue)(LEVEL l, PID p);
/*+ a task has finished the current slice+*/
int (*public_message )(LEVEL l, PID p, void *m);
A task sent a message m to the module.
 
void (*guest_activate)(LEVEL l, PID p);
/*+ the task is activated... +*/
If the message has value NULL the
behavior should be the task_endcycle primitive behavior.
 
void (*guest_insert)(LEVEL l, PID p);
/*+ remove the task from the "ready" (if any)
queue +*/
void (*guest_extract)(LEVEL l, PID p);
/*+ opposite to guest_insert +*/
The function returns an integer to the user.
 
If you want to avoid the call to public_epilogue, after public_message,
just write exec = exec_shadow = -1; in your public_message code.
 
void (*guest_endcycle)(LEVEL l, PID p);
/*+ the task finish the cycle +*/
void (*guest_end)(LEVEL l, PID p);
/*+ the task is killed +*/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 
void (*guest_sleep)(LEVEL l, PID p);
void (*guest_delay)(LEVEL l, PID p, TIME tickdelay);
typedef struct {
void (*private_insert )(LEVEL l, PID p, TASK_MODEL *m);
void (*private_extract )(LEVEL l, PID p);
int (*private_eligible)(LEVEL l, PID p);
void (*private_dispatch)(LEVEL l, PID p, int nostop);
void (*private_epilogue)(LEVEL l, PID p);
 
PID (*public_scheduler)(LEVEL l);
int (*public_guarantee)(LEVEL l, bandwidth_t *freebandwidth);
int (*public_create )(LEVEL l, PID p, TASK_MODEL *m);
void (*public_detach )(LEVEL l, PID p);
void (*public_end )(LEVEL l, PID p);
int (*public_eligible )(LEVEL l, PID p);
void (*public_dispatch )(LEVEL l, PID p, int nostop);
void (*public_epilogue )(LEVEL l, PID p);
void (*public_activate )(LEVEL l, PID p);
void (*public_unblock )(LEVEL l, PID p);
void (*public_block )(LEVEL l, PID p);
int (*public_message )(LEVEL l, PID p, void *m);
} level_des;
 
 
350,27 → 316,18
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 
typedef struct {
char res_name[MAX_MODULENAME];/*+ for statistical pourposes +*/
WORD res_code; /*+ resource module identification code +*/
BYTE res_version; /*+ resource module version +*/
 
int rtype; /*+ resource module extented interface
code (see model.h) +*/
 
void (*resource_status)(); /*+ print resource protocol statistics...+*/
int (*res_register)(RLEVEL l, PID p, RES_MODEL *r);
/*+ When the system knows that a
resource model can be registered
by a level, it calls this
function. It registers all the
information about the task and the
model. returns 0 if the model
can be handled, -1 otherwise+*/
 
int (*level_accept_resource_model)(RLEVEL l, RES_MODEL *r);
/*+ this function is called when the process
is created. it returns 0 if the RES_MODEL
can be managed by the level,-1 if not+*/
 
void (*res_register)(RLEVEL l, PID p, RES_MODEL *r);
/*+ When the system knows that a resource
model can be registered by a level,
it calls this function. It registers all
the information about the task and the
model. +*/
 
void (*res_detach)(RLEVEL l, PID p);
/*+ this function is called when the task
is killed or some error is occurred
417,13 → 374,10
typedef struct {
resource_des r;
 
int (*level_accept_mutexattr)(RLEVEL l, const mutexattr_t *a);
/*+ this function is called when a mutex
is created. it returns 0 if the
mutexattr_t
can be managed by the level,-1 if not+*/
 
int (*init) (RLEVEL l, mutex_t *m, const mutexattr_t *a);
/*+ this function is called when a mutex is created. it returns
>=0 if the mutexattr_t can be managed by the level (=0 Ok, an
error otherwise), -1 otherwise +*/
int (*destroy)(RLEVEL l, mutex_t *m);
int (*lock) (RLEVEL l, mutex_t *m);
int (*trylock)(RLEVEL l, mutex_t *m);
438,7 → 392,7
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 
typedef struct condition_struct {
QUEUE waiters; /*+ queue for tasks waiting on the condition +*/
IQUEUE waiters; /*+ queue for tasks waiting on the condition +*/
mutex_t *used_for_waiting;
} cond_t;
 
/shark/tags/rel_0_3/include/kernel/const.h
16,11 → 16,11
 
/**
------------
CVS : $Id: const.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: const.h,v 1.2 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
System constants:
156,17 → 156,13
 
/*+ sys_atrunlevel status bit values: used to signal that the function
has to be called +*/
#define RUNLEVEL_STARTUP 0 /*+ startup in real mode +*/
#define RUNLEVEL_INIT 1 /*+ init time +*/
#define RUNLEVEL_SHUTDOWN 2 /*+ shutting down the system +*/
#define RUNLEVEL_BEFORE_EXIT 3 /*+ before the kernel has been terminated +*/
#define RUNLEVEL_AFTER_EXIT 4 /*+ after the kernel has been terminated +*/
#define RUNLEVEL_RUNNING 2 /*+ system is running!!! +*/
#define RUNLEVEL_SHUTDOWN 3 /*+ shutting down the system +*/
#define RUNLEVEL_BEFORE_EXIT 4 /*+ before the kernel has been terminated +*/
#define RUNLEVEL_AFTER_EXIT 5 /*+ after the kernel has been terminated +*/
#define NO_AT_ABORT 8 /*+ only when sys_end is called +*/
 
/*
#define EXC_CLEAR 0
#define EXC_INSTALLED 1
#define EXC_ACTIVE 2
#define EXC_MASKED 4
*/
#endif /* __CONST_H__ */
 
/shark/tags/rel_0_3/include/kernel/var.h
21,11 → 21,11
 
/**
------------
CVS : $Id: var.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: var.h,v 1.3 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.3 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
Kernel global variables
63,7 → 63,17
/*---------------------------------------------------------------------*/
 
extern proc_des proc_table[]; /*+ Process descriptor table +*/
 
extern level_des *level_table[]; /*+ Level descriptor table +*/
/* for a description of the following fields, look in kernel/kern.c */
extern size_t level_size[];
extern int level_used[];
extern int level_first;
extern int level_last;
extern int level_free;
extern int level_next[];
extern int level_prev[];
 
extern resource_des *resource_table[]; /*+ Resource descriptor table +*/
 
 
70,7 → 80,7
extern PID exec; /*+ task suggested by the scheduler +*/
extern PID exec_shadow; /*+ task really executed +*/
 
extern QUEUE freedesc; /*+ Free descriptor handled as a queue +*/
extern IQUEUE freedesc; /*+ Free descriptor handled as a queue +*/
 
extern TIME sys_tick; /*+ System tick (in usec) +*/
extern struct timespec schedule_time;
84,7 → 94,6
event is posted. Normally, it is
equal to schedule_time +*/
 
extern DWORD sched_levels; /*+ Schedule levels active in the system +*/
extern DWORD res_levels; /*+ Resource levels active in the system +*/
 
extern int task_counter; /*+ Application task counter. It represent
/shark/tags/rel_0_3/include/kernel/iqueue.h
0,0 → 1,197
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
 
/*
------------
CVS : $Id: iqueue.h,v 1.1 2002-11-11 08:36:01 pj Exp $
 
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2002-11-11 08:36:01 $
------------
 
*/
 
/*
* Copyright (C) 2002 Paolo Gai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
 
/*
IQUEUEs
 
This file contains functions that helps to manage task queues.
 
These functions are different from the functions that manages the
QUEUE and QQUEUE types. In particular, these functions no more relies
on the prev & next fields of the task descriptor. In that way, tasks
can be inserted in more than one queue at a time.
 
Basically, an IQUEUE has an "I"nternal prev/next structure, that may
be shared between one or more queue. Of course, the user MUST
guarantee that the same task will not be inserted in two IQUEUEs that
share the same prev/next buffer.
 
The queue insertion is made by the following functions:
iq_insert -> insertion based on the priority field.
iq_timespec_insert -> same as above but use the timespec_priority field
iq_insertfirst -> insert in the first position of the queue
*/
 
#include <ll/ll.h>
#include <kernel/const.h>
#include <kernel/types.h>
 
#ifndef __KERNEL_IQUEUE_H__
#define __KERNEL_IQUEUE_H__
 
#define IQUEUE_NO_PRIORITY 1
#define IQUEUE_NO_TIMESPEC 2
 
struct IQUEUE_shared {
PID prev[MAX_PROC];
PID next[MAX_PROC];
struct timespec *timespec_priority;
DWORD *priority;
};
 
typedef struct {
PID first;
PID last;
struct IQUEUE_shared *s;
} IQUEUE;
 
 
 
/* Internal queue initialization:
 
share = &x -> the internal data structure of the IQUEUE x is used
to enqueue the tasks.
 
share = NULL -> an internal data structure to handle prev/next
pairs is dynamically allocated (The amount of
memory that is allocated can be reduced using the
flags).
 
flags can be used to reduce the memory usage of an IQUEUE when share=NULL:
IQUEUE_NO_PRIORITY -> the iqueue do not provide internally a priority field
IQUEUE_NO_TIMESPEC -> the iqueue do not provide internally a timespec field
 
- note that, if these flags are used, the corresponding insert
functions will not work!
- the default value for the flags is, of course, 0
*/
void iq_init (IQUEUE *q, IQUEUE *share, int flags);
 
/* Queue insert functions:
 
- inserts a p into the q. p must not be already inserted into q.
- four versions of the function;
- iq_priority_insert -> ordered insertion using the priority field
- iq_timespec_insert -> ordered insertion using the timespec field
- iq_insertfirst -> insert at the first position of the queue
- iq_insertlast -> insert at the last position of the queue
*/
void iq_priority_insert (PID p, IQUEUE *q);
void iq_timespec_insert (PID p, IQUEUE *q);
void iq_insertfirst (PID p, IQUEUE *q);
void iq_insertlast (PID p, IQUEUE *q);
 
/* Queue extract functions:
 
- extracts a task p from the queue q.
- three versions of the function;
- iq_extract -> extracts given a task p
(that must be inserted in the queue)
 
- iq_getfirst -> extracts the first task in the queue,
NIL if the queue is empty
- iq_getlast -> extracts the last task in the queue,
NIL if the queue is empty
 
*/
void iq_extract (PID p, IQUEUE *q);
PID iq_getfirst ( IQUEUE *q);
PID iq_getlast ( IQUEUE *q);
 
 
/* Queue query functions:
 
The first two functions return the first and the last task in the queue,
NIL if the queue is empty.
 
The second two functions can be used to get/set the priority or the
timespec field used when queuing.
*/
static __inline__ PID iq_query_first(IQUEUE *q)
{
return q->first;
}
 
static __inline__ PID iq_query_last(IQUEUE *q)
{
return q->last;
}
 
static __inline__ struct timespec *iq_query_timespec(PID p, IQUEUE *q)
{
return &q->s->timespec_priority[p];
}
 
static __inline__ DWORD *iq_query_priority (PID p, IQUEUE *q)
{
return &q->s->priority[p];
}
 
/* Queue iterators */
 
/* sometimes it is useful to go through the list. For that reason
You can use the following two functions... */
static __inline__ PID iq_query_next (PID p, IQUEUE *q)
{
return q->s->next[p];
}
 
static __inline__ PID iq_query_prev (PID p, IQUEUE *q)
{
return q->s->prev[p];
}
 
/* Queue test functions */
static __inline__ int iq_isempty (IQUEUE *q)
{
return q->first == NIL;
}
 
#endif
/shark/tags/rel_0_3/include/kernel/int_sem.h
21,11 → 21,11
 
/**
------------
CVS : $Id: int_sem.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: int_sem.h,v 1.2 2002-11-11 08:36:01 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:36:01 $
------------
 
Internal semaphores.
63,12 → 63,13
#define __INT_SEM_H__
 
#include <kernel/types.h>
#include <kernel/iqueue.h>
 
/* this is the structure normally pointed by the opt field in the
mutex_t structure */
typedef struct {
int count;
QQUEUE blocked;
IQUEUE blocked;
} internal_sem_t;
 
 
/shark/tags/rel_0_3/include/kernel/kern.h
21,11 → 21,11
 
/**
------------
CVS : $Id: kern.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: kern.h,v 1.2 2002-11-11 08:36:01 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:36:01 $
------------
 
Main kernel include file.
67,6 → 67,8
//#include <kernel/err.h>
//#include <kernel/exc.h>
#include <kernel/var.h>
#include <kernel/iqueue.h>
#include <kernel/func.h>
 
 
 
/shark/tags/rel_0_3/include/kernel/types.h
21,11 → 21,11
 
/**
------------
CVS : $Id: types.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: types.h,v 1.2 2002-11-11 08:36:01 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:36:01 $
------------
 
**/
49,27 → 49,9
*
*/
 
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HARTIK SYSTEM TYPES
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 
#ifndef __KERNEL_TYPES_H__
#define __KERNEL_TYPES_H__
 
 
/*+ Used to manage task queues +*/
typedef int QUEUE;
 
/*+ Used to manage task queues with tail +*/
typedef struct {
int first; /*+ first element of a task queue, NIL if empty +*/
int last; /*+ last element of a task qqueue, NIL if empty +*/
} QQUEUE;
 
 
/*+ Used to manage mutex queues +*/
//typedef int MQUEUE;
 
#define TASK void *
 
/*+ ... a task index +*/
/shark/tags/rel_0_3/include/kernel/config.h
21,11 → 21,11
 
/**
------------
CVS : $Id: config.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: config.h,v 1.2 2002-11-11 08:36:01 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2002-11-11 08:36:01 $
------------
 
Kernel configuration macros:
57,28 → 57,6
#ifndef __KERNEL_CONFIG_H__
#define __KERNEL_CONFIG_H__
 
 
/*+ Define this if you use the CABs... +*/
#define __CAB__
 
/*+ Define this if you use the ports... +*/
#define __PORT__
 
/*+ Define this if you use the tracer... +*/
#define __TRACE__
//#undef __TRACE__
 
/*+ Define this if you want the printk messages... +*/
#define __DEBUG_ON__
#undef __DEBUG_ON__
 
 
/*+ checks the Memory at the kern_mem_init... +*/
#undef __MEM_DEBUG__
 
/*+ defined if we are compiling test1.c with init1.c +*/
//#define __TEST1__
 
/*+ defined if we are compiling testG.c +*/
//#define TESTG
 
/shark/tags/rel_0_3/include/modules/codes.h
File deleted
/shark/tags/rel_0_3/include/modules/dummy.h
21,11 → 21,11
 
/**
------------
CVS : $Id: dummy.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: dummy.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the scheduling module RR (Round Robin)
78,6 → 78,8
#ifndef __DUMMY_H__
#define __DUMMY_H__
 
#include <kernel/types.h>
 
/*+
On upper Intel CPUs it is possible to avoid CPU power consumption
when the system is idle issuing the hlt instruction.
86,7 → 88,10
+*/
#define __HLT_WORKS__
 
/*+ Registration function +*/
void dummy_register_level();
/*+ Registration function
 
returns the level number at which the module has been registered.
+*/
LEVEL dummy_register_level();
 
#endif
/shark/tags/rel_0_3/include/modules/nop.h
21,11 → 21,11
 
/**
------------
CVS : $Id: nop.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: nop.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the No Protocol (NOP) implementation of mutexes
79,6 → 79,8
#ifndef __NOP_H__
#define __NOP_H__
 
void NOP_register_module(void);
#include <kernel/types.h>
 
RLEVEL NOP_register_module(void);
 
#endif
/shark/tags/rel_0_3/include/modules/edf.h
21,11 → 21,11
 
/**
------------
CVS : $Id: edf.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: edf.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the scheduling module EDF (Earliest Deadline First)
123,7 → 123,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
 
/*+ flags... +*/
137,9 → 136,12
 
 
/*+ Registration function:
int flag Options to be used in this level instance... +*/
void EDF_register_level(int flag);
int flag Options to be used in this level instance...
 
returns the level number at which the module has been registered.
+*/
LEVEL EDF_register_level(int flag);
 
/*+ Returns the used bandwidth of a level +*/
bandwidth_t EDF_usedbandwidth(LEVEL l);
 
/shark/tags/rel_0_3/include/modules/posix.h
21,11 → 21,11
 
/**
------------
CVS : $Id: posix.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: posix.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the scheduling module compatible with POSIX
96,7 → 96,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
extern TASK __init__(void *arg);
 
112,8 → 111,11
/*+ Registration function:
TIME slice the slice for the Round Robin queue
int createmain 1 if the level creates the main task 0 otherwise
struct multiboot_info *mb used if createmain specified +*/
void POSIX_register_level(TIME slice,
struct multiboot_info *mb used if createmain specified
 
returns the level number at which the module has been registered.
+*/
LEVEL POSIX_register_level(TIME slice,
int createmain,
struct multiboot_info *mb,
int prioritylevels);
/shark/tags/rel_0_3/include/modules/pc.h
21,11 → 21,11
 
/**
------------
CVS : $Id: pc.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: pc.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the Priority Ceiling (PC) Protocol
93,7 → 93,7
#include <kernel/types.h>
#include <kernel/descr.h>
 
void PC_register_module(void);
RLEVEL PC_register_module(void);
 
/*+ This function gets the ceiling of a PC mutex, and it have to be called
only by a task that owns the mutex.
/shark/tags/rel_0_3/include/modules/bd_edf.h
38,11 → 38,11
*/
 
/*
* CVS : $Id: bd_edf.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
* CVS : $Id: bd_edf.h,v 1.2 2003-01-07 17:12:19 pj Exp $
*
* File: $File$
* Revision: $Revision: 1.1.1.1 $
* Last update: $Date: 2002-03-29 14:12:51 $
* Revision: $Revision: 1.2 $
* Last update: $Date: 2003-01-07 17:12:19 $
*/
 
#ifndef __BD_EDF_H__
51,7 → 51,7
#include <kernel/types.h>
#include <kernel/descr.h>
 
void BD_EDF_register_module(void);
RLEVEL BD_EDF_register_module(void);
 
TIME bd_edf_getdl(void);
 
/shark/tags/rel_0_3/include/modules/srp.h
21,11 → 21,11
 
/**
------------
CVS : $Id: srp.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: srp.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the Stack Resource Policy (SRP) Protocol
108,7 → 108,7
#include <kernel/model.h>
#include <kernel/descr.h>
 
void SRP_register_module(void);
RLEVEL SRP_register_module(void);
 
extern __inline__ RES_MODEL *SRP_usemutex(mutex_t *m) {
return (RES_MODEL *)m->opt;
/shark/tags/rel_0_3/include/modules/rr2.h
21,11 → 21,11
 
/**
------------
CVS : $Id: rr2.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: rr2.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the scheduling module RR (Round Robin)
94,7 → 94,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
extern TASK __init__(void *arg);
 
110,8 → 109,11
/*+ Registration function:
TIME slice the slice for the Round Robin queue
int createmain 1 if the level creates the main task 0 otherwise
struct multiboot_info *mb used if createmain specified +*/
void RR2_register_level(TIME slice,
struct multiboot_info *b used if createmain specified
returns the level number at which the module has been registered.
+*/
LEVEL RR2_register_level(TIME slice,
int createmain,
struct multiboot_info *mb);
 
/shark/tags/rel_0_3/include/modules/ds.h
21,11 → 21,11
 
/**
------------
CVS : $Id: ds.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: ds.h,v 1.2 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
This file contains the aperiodic server DS (Polling Server)
92,7 → 92,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
/*+ 1 - ln(2) +*/
#ifndef RM_MINFREEBANDWIDTH
119,9 → 118,12
int flags Options to be used in this level instance...
LEVEL master the level that must be used as master level for the
TBS tasks
int num,den used to compute the TBS bandwidth +*/
void DS_register_level(int flags, LEVEL master, int Cs, int per);
int num,den used to compute the TBS bandwidth
 
returns the level number at which the module has been registered.
+*/
LEVEL DS_register_level(int flags, LEVEL master, int Cs, int per);
 
/*+ Returns the used bandwidth of a level +*/
bandwidth_t DS_usedbandwidth(LEVEL l);
 
/shark/tags/rel_0_3/include/modules/cbs.h
21,11 → 21,11
 
/**
------------
CVS : $Id: cbs.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: cbs.h,v 1.2 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
This file contains the aperiodic server CBS (Total Bandwidth Server)
103,7 → 103,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
/*+ flags... +*/
#define CBS_DISABLE_ALL 0 /*+ Task Guarantee enabled +*/
117,8 → 116,10
int flags Options to be used in this level instance...
LEVEL master the level that must be used as master level for the
CBS tasks
 
returns the level number at which the module has been registered.
+*/
void CBS_register_level(int flags, LEVEL master);
LEVEL CBS_register_level(int flags, LEVEL master);
 
/*+ Returns the used bandwidth of a level +*/
bandwidth_t CBS_usedbandwidth(LEVEL l);
/shark/tags/rel_0_3/include/modules/pi.h
21,11 → 21,11
 
/**
------------
CVS : $Id: pi.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: pi.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the Priority Inheritance (PI) Protocol
89,6 → 89,8
#ifndef __PI_H__
#define __PI_H__
 
void PI_register_module(void);
#include <kernel/types.h>
 
RLEVEL PI_register_module(void);
 
#endif
/shark/tags/rel_0_3/include/modules/bd_pscan.h
39,11 → 39,11
*/
 
/*
* CVS : $Id: bd_pscan.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
* CVS : $Id: bd_pscan.h,v 1.2 2003-01-07 17:12:19 pj Exp $
*
* File: $File$
* Revision: $Revision: 1.1.1.1 $
* Last update: $Date: 2002-03-29 14:12:51 $
* Revision: $Revision: 1.2 $
* Last update: $Date: 2003-01-07 17:12:19 $
*/
 
#ifndef __BD_PSCAN_H__
52,7 → 52,7
#include <kernel/types.h>
#include <kernel/descr.h>
 
void BD_PSCAN_register_module(void);
RLEVEL BD_PSCAN_register_module(void);
 
int bd_pscan_getpriority(void);
 
/shark/tags/rel_0_3/include/modules/rm.h
21,11 → 21,11
 
/**
------------
CVS : $Id: rm.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: rm.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the scheduling module RM (Rate Monotonic)
122,7 → 122,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
/*+ 1 - ln(2) +*/
 
143,9 → 142,12
 
 
/*+ Registration function:
int flag Options to be used in this level instance... +*/
void RM_register_level(int flag);
int flag Options to be used in this level instance...
 
returns the level number at which the module has been registered.
+*/
LEVEL RM_register_level(int flag);
 
/*+ Returns the used bandwidth of a level +*/
bandwidth_t RM_usedbandwidth(LEVEL l);
 
/shark/tags/rel_0_3/include/modules/rrsoft.h
21,11 → 21,11
 
/**
------------
CVS : $Id: rrsoft.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: rrsoft.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the scheduling module RRSOFT (Round Robin for
103,7 → 103,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
extern TASK __init__(void *arg);
 
124,8 → 123,12
/*+ Registration function:
TIME slice the slice for the Round Robin queue
int createmain 1 if the level creates the main task 0 otherwise
struct multiboot_info *mb used if createmain specified +*/
void RRSOFT_register_level(TIME slice,
struct multiboot_info *mb used if createmain specified
 
returns the level number at which the module has been registered.
+*/
 
LEVEL RRSOFT_register_level(TIME slice,
int createmain,
struct multiboot_info *mb,
BYTE models);
/shark/tags/rel_0_3/include/modules/ps.h
21,11 → 21,11
 
/**
------------
CVS : $Id: ps.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: ps.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the aperiodic server PS (Polling Server)
93,7 → 93,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
/*+ 1 - ln(2) +*/
#ifndef RM_MINFREEBANDWIDTH
120,9 → 119,12
int flags Options to be used in this level instance...
LEVEL master the level that must be used as master level for the
TBS tasks
int num,den used to compute the TBS bandwidth +*/
void PS_register_level(int flags, LEVEL master, int Cs, int per);
int num,den used to compute the TBS bandwidth
 
returns the level number at which the module has been registered.
+*/
LEVEL PS_register_level(int flags, LEVEL master, int Cs, int per);
 
/*+ Returns the used bandwidth of a level +*/
bandwidth_t PS_usedbandwidth(LEVEL l);
 
/shark/tags/rel_0_3/include/modules/rr.h
21,11 → 21,11
 
/**
------------
CVS : $Id: rr.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: rr.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the scheduling module RR (Round Robin)
95,7 → 95,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
extern TASK __init__(void *arg);
 
111,8 → 110,11
/*+ Registration function:
TIME slice the slice for the Round Robin queue
int createmain 1 if the level creates the main task 0 otherwise
struct multiboot_info *mb used if createmain specified +*/
void RR_register_level(TIME slice,
struct multiboot_info *mb used if createmain specified
 
returns the level number at which the module has been registered.
+*/
LEVEL RR_register_level(TIME slice,
int createmain,
struct multiboot_info *mb);
 
/shark/tags/rel_0_3/include/modules/ss.h
21,11 → 21,11
 
/**
------------
CVS : $Id: ss.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: ss.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the aperiodic server SS (Sporadic Server)
103,7 → 103,6
#include <kernel/config.h>
#include <kernel/types.h>
#include <sys/types.h>
#include <modules/codes.h>
 
/*+ 1 - ln(2) +*/
#ifndef RM_MINFREEBANDWIDTH
151,9 → 150,12
int flags Options to be used in this level instance...
LEVEL master The level that must be used as master level
int Cs Server capacity
int per Server period +*/
void SS_register_level(int flags, LEVEL master, int Cs, int per);
int per Server period
 
returns the level number at which the module has been registered.
+*/
LEVEL SS_register_level(int flags, LEVEL master, int Cs, int per);
 
/*+ Returns the used bandwidth of a level +*/
bandwidth_t SS_usedbandwidth(LEVEL l);
 
/shark/tags/rel_0_3/include/modules/tbs.h
21,11 → 21,11
 
/**
------------
CVS : $Id: tbs.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: tbs.h,v 1.2 2003-01-07 17:12:20 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:12:20 $
------------
 
This file contains the aperiodic server TBS (Total Bandwidth Server)
126,7 → 126,6
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>
 
/*+ flags... +*/
#define TBS_DISABLE_ALL 0
/shark/tags/rel_0_3/include/trace/qudp.h
21,16 → 21,26
#ifndef __TRACE_QUDP_H
#define __TRACE_QUDP_H
 
#include <kernel/model.h>
#include <drivers/udpip.h>
 
typedef struct TAGtrc_udp_queue_args_t {
UDP_ADDR addr;
int size;
UDP_ADDR local,remote;
TASK_MODEL *model;
} TRC_UDP_PARMS;
 
#define trc_udp_default_parms(m)
#define trc_udp_default_parms(m,l,r) (m).size=8192, \
(m).model = NULL, \
(m).local = (l), \
(m).remote = (r);
#define trc_udp_def_addr(m,addr)
#define trc_udp_def_size(m,s) (m).size=(s)
#define trc_udp_def_local(m,l) (m).local=(l)
#define trc_udp_def_remote(m,r) (m).remote=(r)
#define trc_udp_def_model(m,mod) (m).model=(mod)
 
 
int trc_register_udp_queue(void);
 
#endif
/shark/tags/rel_0_3/include/trace/queues.h
38,11 → 38,11
*/
 
/*
* CVS : $Id: queues.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
* CVS : $Id: queues.h,v 1.3 2002-10-28 07:53:40 pj Exp $
*
* File: $File$
* Revision: $Revision: 1.1.1.1 $
* Last update: $Date: 2002-03-29 14:12:51 $
* Revision: $Revision: 1.3 $
* Last update: $Date: 2002-10-28 07:53:40 $
*/
 
#ifndef __TRACE_QUEUES_H
58,19 → 58,20
void *data;
} trc_queue_t;
 
#define TRC_DUMMY_QUEUE 0
#define TRC_DUMMY_QUEUE 0
#include <trace/qdummy.h>
 
#define TRC_FIXED_QUEUE 1
#define TRC_FIXED_QUEUE 1
#define TRC_DOSFS_FIXED_QUEUE 2
#include <trace/qfixed.h>
 
#define TRC_CIRCULAR_QUEUE 2
#define TRC_CIRCULAR_QUEUE 3
#include <trace/qcirc.h>
 
#define TRC_UDP_QUEUE 3
#define TRC_UDP_QUEUE 4
#include <trace/qudp.h>
 
#define TRC_QUEUETYPESNUMBER 4
#define TRC_QUEUETYPESNUMBER 5
 
/* uniq!=0 append a this unique number to name */
void trc_create_name(char *basename, int uniq, char *pathname);
/shark/tags/rel_0_3/include/trace/trace.h
38,11 → 38,11
*/
 
/*
* CVS : $Id: trace.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
* CVS : $Id: trace.h,v 1.2 2002-10-21 10:17:26 pj Exp $
*
* File: $File$
* Revision: $Revision: 1.1.1.1 $
* Last update: $Date: 2002-03-29 14:12:51 $
* Revision: $Revision: 1.2 $
* Last update: $Date: 2002-10-21 10:17:26 $
*/
 
#ifndef __TRACE_TRACE_H
68,6 → 68,8
 
/* -- */
 
/* Register a "standard" tracer configuration; requires FAT16 filesystem
(see documentation) */
int TRC_init_phase1_standard(void);
int TRC_init_phase2_standard(void);
 
/shark/tags/rel_0_3/include/trace/qfixed.h
31,7 → 31,12
#define trc_fixed_def_filename(m,s) (m).filename=(s)
#define trc_fixed_def_size(m,s) (m).size=(s)
 
/* Fixed queue, FAT16 filesystem (see kernel/modules/trcfixed.c) */
int trc_register_fixed_queue(void);
 
/* Fixed queue, DOSFS filesystem (see kernel/modules/trcdfix.c)
Note: You MUST specify a valid filename... */
int trc_register_dosfs_fixed_queue(void);
 
#endif
 
/shark/tags/rel_0_3/include/bits/errno.h
20,11 → 20,11
 
/**
------------
CVS : $Id: errno.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
CVS : $Id: errno.h,v 1.3 2003-01-07 17:12:19 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:51 $
Revision: $Revision: 1.3 $
Last update: $Date: 2003-01-07 17:12:19 $
------------
 
- error codes used as values for errno
104,11 → 104,11
 
#define LAST_EXC_NUMBER 19
 
#define XDOUBLE_EXCEPTION 1 /* in act_exc */
#define XUNVALID_KILL_SHADOW 2 /* task_makefree */
// NOW UNUSED: XDOUBLE_EXCEPTION 1
#define XINVALID_KILL_SHADOW 2 /* task_makefree */
#define XNOMORE_CLEANUPS 3 /* task_cleanup_push */
#define XUNVALID_TASK 4 /* invalid operation for a task */
#define XUNVALID_GUEST 5 /* invalid operation for a guest task */
#define XINVALID_TASK 4 /* invalid operation for a task */
// NOW UNUSED: XINVALID_GUEST 5 /* invalid operation for a guest task */
#define XNOMORE_EVENTS 6 /* too many events posted... */
 
#define XDEADLINE_MISS 7 /* PERIODIC_PCLASS, SPORADIC_PCLASS */
116,10 → 116,10
#define XACTIVATION 9 /* PERIODIC_PCLASS, SPORADIC_PCLASS */
 
#define XMUTEX_OWNER_KILLED 10 /* Mutex */
#define XSRP_UNVALID_LOCK 11 /* SRP */
#define XSRP_INVALID_LOCK 11 /* SRP */
 
#define XUNVALID_DUMMY_OP 12 /* dummy.h hope it will never called... */
#define XUNVALID_SS_REPLENISH 13 /* kernel/mosules/ss.c */
#define XINVALID_DUMMY_OP 12 /* dummy.h hope it will never called... */
#define XINVALID_SS_REPLENISH 13 /* kernel/mosules/ss.c */
 
#define XARP_TABLE_FULL 14 /* drivers/net/arp.c */
 
149,14 → 149,14
#define ETOOMUCH_EXITFUNC (5 + LAST_STDERRNO) /* sys_atexit */
#define ENO_AVAIL_TASK (6 + LAST_STDERRNO) /* task_create */
#define ENO_AVAIL_SCHEDLEVEL (7 + LAST_STDERRNO) /* task_create */
#define ETASK_CREATE (8 + LAST_STDERRNO) /* task_create */
/* NOW UNUSED: ETASK_CREATE (8 + LAST_STDERRNO) task_create */
#define ENO_AVAIL_RESLEVEL (9 + LAST_STDERRNO) /* task_create */
#define ENO_GUARANTEE (10 + LAST_STDERRNO) /* task_create */
#define ENO_AVAIL_STACK_MEM (11 + LAST_STDERRNO) /* task_create */
#define ENO_AVAIL_TSS (12 + LAST_STDERRNO) /* task_create */
#define EUNVALID_KILL (13 + LAST_STDERRNO) /* task_kill */
#define EUNVALID_TASK_ID (14 + LAST_STDERRNO) /* task_activate */
#define EUNVALID_GROUP (15 + LAST_STDERRNO) /* group_activate e group_kill */
#define EINVALID_KILL (13 + LAST_STDERRNO) /* task_kill */
#define EINVALID_TASK_ID (14 + LAST_STDERRNO) /* task_activate */
#define EINVALID_GROUP (15 + LAST_STDERRNO) /* group_activate e group_kill */
 
#define EPORT_NO_MORE_DESCR (16 + LAST_STDERRNO)
#define EPORT_NO_MORE_INTERF (17 + LAST_STDERRNO)
167,11 → 167,11
#define EPORT_UNSUPPORTED_ACC (22 + LAST_STDERRNO)
#define EPORT_WRONG_OP (23 + LAST_STDERRNO)
#define EPORT_WRONG_TYPE (24 + LAST_STDERRNO)
#define EPORT_UNVALID_DESCR (25 + LAST_STDERRNO)
#define EPORT_INVALID_DESCR (25 + LAST_STDERRNO)
 
#define ECAB_UNVALID_ID (26 + LAST_STDERRNO)
#define ECAB_INVALID_ID (26 + LAST_STDERRNO)
#define ECAB_CLOSED (27 + LAST_STDERRNO)
#define ECAB_UNVALID_MSG_NUM (28 + LAST_STDERRNO)
#define ECAB_INVALID_MSG_NUM (28 + LAST_STDERRNO)
#define ECAB_NO_MORE_ENTRY (29 + LAST_STDERRNO)
#define ECAB_TOO_MUCH_MSG (30 + LAST_STDERRNO)
 
/shark/tags/rel_0_3/include/drivers/parport.h
0,0 → 1,241
/*
* Project:
* Parallel Port S.Ha.R.K. Project
*
* Module:
* ppDrv.h
*
* Description:
* file contents description
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors:
* Andrea Battistotti <btandrea@libero.it>
* Armando Leggio <a_leggio@hotmail.com>
*
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*
*/
 
/* PPDrv.h
header file for par port communication...
*/
 
/*
* Copyright (C) 2002 Andrea Battistotti , Armando Leggio
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* CVS : $Id: parport.h,v 1.1 2002-10-28 07:52:11 pj Exp $
*/
 
#include <kernel/kern.h>
#include <drivers/glib.h>
#include <drivers/keyb.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <kernel/func.h>
#include <string.h>
#include <ll/ll.h>
#include <kernel/types.h>
#include <kernel/descr.h>
#include <math.h>
 
 
/* general defs... */
#define PP_DEBUG 1 /* 1/0 Activate/Disactive internal debugs... */
#define PP_STATS 1 /* 1/0 Activate/Disactive internal statistics... */
 
/* return value... */
#define FALSE 0
#define TRUE 1
#define TIMEOUT 2
 
#define PP_BASE_ADR 0x0378 /* std addr for LPT1 */
 
#define BYTE unsigned char
#define BOOL unsigned char
#define BUF_IDX unsigned int
#define BUF_PNTR unsigned int
#define PIN_MASK unsigned int
 
#define clock() sys_gettime(NULL)
 
enum PIN_STATUS { PIN_OFF , PIN_ON } ; /* positive logic: off==0, on==1 */
 
/*********************************************************************************/
/* PART 1 : LOW LIVEL FUNC */
 
/* defs used in ppPinDrv....*/
/* for std & pin use of pp... */
#define PP_DATA_REG (PP_BASE_ADR+0) // address of data register
#define PP_STATUS_REG (PP_BASE_ADR+1) // address of status register
#define PP_CONTR_REG (PP_BASE_ADR+2) // address of control regist
 
/* out data pins... */
#define PP_PIN_D0 0x01 /* pin 2 */
#define PP_PIN_D1 0x02 /* pin 3 */
#define PP_PIN_D2 0x04 /* pin 4 */
#define PP_PIN_D3 0x08 /* pin 5 */
#define PP_PIN_D4 0x10 /* pin 6 */
#define PP_PIN_D5 0x20 /* pin 7 */
#define PP_PIN_D6 0x40 /* pin 8 */
#define PP_PIN_D7 0x80 /* pin 9 */
/* status pins... */
#define PP_PIN_ERROR 0x08 /* pin 15 */
#define PP_PIN_SELECTED 0x10 /* pin 13 */
#define PP_PIN_PAPEROUT 0x20 /* pin 12 */
#define PP_PIN_ACK 0x40 /* pin 10 */
#define PP_PIN_BUSY 0x80 /* pin 11 */
 
/* control pins... */
#define PP_PIN_DATASTROBE 0x01 /* pin 1 */
#define PP_PIN_AUTOFEED 0x02 /* pin 14 */
#define PP_PIN_INITOUT 0x04 /* pin 16 */
#define PP_PIN_SELECT 0x08 /* pin 17 */
/* Data i/o */
#define ppSetDataByte(a) outp(PP_DATA_REG,a)
#define ppReadDataByte() inp(PP_DATA_REG)
/* this is NOT bidirectional actually: simply read value that I myself wrote on parport early...*/
/* in std lpt you cannot lay down electric pin D0,D1,..D7 from extern and read value in pc...*/
/* this (in std lpt) will broke down lpt port!... */
/* there are obviously also bi-dir port on 8 bit (ECC & ECP) but ctrl & status pins have */
/* different meaning so we don't manage them... See docs. */
 
/* Data pins */
void ppSetDataPin(int state, PIN_MASK pin); /* in ppPinDrv.c */
#define ppSetPin_D0(a) ppSetDataPin(a,PP_PIN_D0) /* On ==1 , Off == 0 */
#define ppSetPin_D1(a) ppSetDataPin(a,PP_PIN_D1)
#define ppSetPin_D2(a) ppSetDataPin(a,PP_PIN_D2)
#define ppSetPin_D3(a) ppSetDataPin(a,PP_PIN_D3)
#define ppSetPin_D4(a) ppSetDataPin(a,PP_PIN_D4)
#define ppSetPin_D5(a) ppSetDataPin(a,PP_PIN_D5)
#define ppSetPin_D6(a) ppSetDataPin(a,PP_PIN_D6)
#define ppSetPin_D7(a) ppSetDataPin(a,PP_PIN_D7)
 
/* Status pins */
#define ppCheckPin_Error() (inp(PP_STATUS_REG & PP_PIN_ERROR)!=0?1:0)
#define ppCheckPin_Selected() (inp(PP_STATUS_REG & PP_PIN_SELECTED)!=0?1:0)
#define ppCheckPin_PaperOut() (inp(PP_STATUS_REG & PP_PIN_PAPEROUT)!=0?1:0)
#define ppCheckPin_Acknowledge() (inp(PP_STATUS_REG & PP_PIN_ACK)!=0?1:0)
#define ppCheckPin_Busy() (inp(PP_STATUS_REG & PP_PIN_BUSY)!=0?0:1) /* act low...*/
 
/* Control pins */
/* Control i/o */
#define ppSetCtrlByte(a) outp(PP_CONTR_REG,a)
#define ppReadCtrlByte() inp(PP_CONTR_REG)
/* idem...*/
void ppSetCtrlPin(int state, PIN_MASK pin); /* in ppPinDrv.c */
#define ppSetPin_DataStrobe(a) ppSetCtrlPin(!a,PP_PIN_DATASTROBE) /* low active...*/
#define ppSetPin_Autofeed(a) ppSetCtrlPin(!a,PP_PIN_AUTOFEED) /* low active...*/
#define ppSetPin_InitOut(a) ppSetCtrlPin(a,PP_PIN_INITOUT)
#define ppSetPin_Select(a) ppSetCtrlPin(!a,PP_PIN_SELECT) /* low active...*/
 
 
 
 
/*********************************************************************************/
/* PART 2 : DATA TRANSFER BETWEEN PC */
/* defs used in ppDrv & ppNRTDrv... */
#define PPDRV_PERIOD 1000 /* 300000 ok for debug...*/
#define PPDRV_WCET 150 /* lower bound: 120; more if debug & stats are on...*/
#define PP_BUF_LEN 1024 /* between 2^2 and 2^16 (64k) */
#define CLK_TIMEOUT 55000 /* timeout for sync pc-pc...*/
 
/* for laplink use of std pp... */
#define TX_PORT PP_BASE_ADR /* transmit port */
#define RX_PORT TX_PORT+1 /* receive port */
 
/* laplink bit mask */
#define TX_DATA 0x0F /* 0000 1111 pin 2,3,4,5 */
#define TX_CTR 0x10 /* 0001 0000 bit 4 port TX pin 6*/
#define RX_DATA 0x78 /* 0111 1000 pin 15,13,12,10 */
#define RX_CTR 0x80 /* 1000 0000 bit 7 port RX pin 11*/
#define LSN 0x0F /* 0000 1111 low significative nibble */
#define MSN 0xF0 /* 1111 0000 most significative nibble */
#define BYTE_CTR 0xAF /* 1010 1111 control char */
 
 
/* comm protocol */
#define ppSendRTS() ppSetOnPinTX_CTR()
#define ppIsRTS() ppReadIfPinRX_CTRIsOn()
#define ppSendOTS() ppSetOnPinTX_CTR()
#define ppIsOTS() ppReadIfPinRX_CTRIsOn()
#define ppSendDR() ppSetOffPinTX_CTR()
#define ppIsDR() ppReadIfPinRX_CTRIsOff()
#define ppSendER() ppSetOffPinTX_CTR()
#define ppIsER() ppReadIfPinRX_CTRIsOff()
 
 
#define ppSetOnPinTX_CTR() outp(TX_PORT,(inp(TX_PORT)|TX_CTR)) /* used by: ppSendRTS ppSendOTS */
#define ppSetOffPinTX_CTR() outp(TX_PORT,(inp(TX_PORT)&(~TX_CTR))) /* used by: ppSendDR ppSendER */
#define ppReadIfPinRX_CTRIsOn() ((((~inp(RX_PORT))&RX_CTR)==0)?FALSE:TRUE)
#define ppReadIfPinRX_CTRIsOff() (((BYTE)((~RX_CTR)|(~inp(RX_PORT)))==0x7F)?TRUE:FALSE)
 
/* Funct Return Code */
enum PP_COMM_RTR_CODE {
PP_COMM_OK,
PP_COMM_NOREADYBYTES_EXC,
PP_COMM_NOFREEBYTES_EXC
};
 
/* Funct Return Code */
enum PP_SYSMSG_RTR_CODE {
PP_SYSMSG_OK,
PP_NOSYSMSG_EXC,
PP_NOFREEMSG_EXC
};
 
/* NON REAL TIME (== BLOCK) functions...*/
/* from ppNRTDrv.c...*/
BOOL ppNRTOpenComm(void);
BOOL ppNRTWaitRTS(void);
BOOL ppNRTWaitDR(void);
BOOL ppNRTWaitOTS(void);
BOOL ppNRTWaitER(void);
BOOL ppNRTTxOneByte(BYTE c);
BOOL ppNRTRxOneByte(BYTE *c);
 
 
/* REAL TIME (== NON BLOCK) POLLING SERVER */
/* from ppDrv.c... */
void ppInitDrv(void (*pf)(char *)); /* NRT: to be called before start ppPollingSrv...*/
TASK ppPollingSvr(void *arg); /* periodic task to be started before any call to Rx/Tx...*/
 
/* input output function */
int ppRxOneByte(BYTE *c); /* retrive 1 byte */
int ppTxOneByte(BYTE c); /* send 1 byte */
 
int ppRxBytes(BYTE *c, unsigned int nbyte); /* retrive n byte... */
int ppTxBytes(BYTE *c, unsigned int nbyte); /* send n byte... */
 
 
/* System msg */
#define SYS_MSG_COLS 33
#define SYS_MSG_LINS 15
 
 
int ppReadSysMsg(char * buf);
int ppWriteSysMsg(char * buf, ...);