Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 37 → Rev 38

/shark/trunk/kernel/modules/npp.c
20,11 → 20,11
 
/**
------------
CVS : $Id: npp.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $
CVS : $Id: npp.c,v 1.2 2003-01-07 17:07:50 pj Exp $
 
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-03-29 14:12:52 $
Revision: $Revision: 1.2 $
Last update: $Date: 2003-01-07 17:07:50 $
------------
 
Non Preemptive Protocol. see npp.h for more details...
56,7 → 56,6
#include <ll/ll.h>
#include <ll/string.h>
#include <ll/stdio.h>
#include <modules/codes.h>
#include <kernel/const.h>
#include <sys/types.h>
#include <kernel/descr.h>
71,6 → 70,7
} NPP_mutex_resource_des;
 
 
#if 0
/*+ print resource protocol statistics...+*/
static void NPP_resource_status(RLEVEL r)
{
78,18 → 78,14
 
kern_printf("%d Resources owned by the tasks %d\n", m->nlocked, exec_shadow);
}
#endif
 
static int NPP_level_accept_resource_model(RLEVEL l, RES_MODEL *r)
static int NPP_res_register(RLEVEL l, PID p, RES_MODEL *r)
{
/* NPP works with all tasks without Resource parameters */
return -1;
}
 
static void NPP_res_register(RLEVEL l, PID p, RES_MODEL *r)
{
/* never called!!! */
}
 
static void NPP_res_detach(RLEVEL l, PID p)
{
NPP_mutex_resource_des *m = (NPP_mutex_resource_des *)(resource_table[l]);
98,16 → 94,11
kern_raise(XMUTEX_OWNER_KILLED, p);
}
 
static int NPP_level_accept_mutexattr(RLEVEL l, const mutexattr_t *a)
static int NPP_init(RLEVEL l, mutex_t *m, const mutexattr_t *a)
{
if (a->mclass == NPP_MCLASS || a->mclass == (NPP_MCLASS | l) )
return 0;
else
if (a->mclass != NPP_MCLASS)
return -1;
}
 
static int NPP_init(RLEVEL l, mutex_t *m, const mutexattr_t *a)
{
m->mutexlevel = l;
m->opt = (void *)NIL;
 
187,20 → 178,11
resource_table[l] = (resource_des *)m;
 
/* fill the resource_des descriptor */
strncpy(m->m.r.res_name, NPP_MODULENAME, MAX_MODULENAME);
m->m.r.res_code = NPP_MODULE_CODE;
m->m.r.res_version = NPP_MODULE_VERSION;
 
m->m.r.rtype = MUTEX_RTYPE;
 
m->m.r.resource_status = NPP_resource_status;
m->m.r.level_accept_resource_model = NPP_level_accept_resource_model;
m->m.r.res_register = NPP_res_register;
 
m->m.r.res_detach = NPP_res_detach;
 
/* fill the mutex_resource_des descriptor */
m->m.level_accept_mutexattr = NPP_level_accept_mutexattr;
m->m.init = NPP_init;
m->m.destroy = NPP_destroy;
m->m.lock = NPP_lock;