0,0 → 1,166 |
/* |
* Project: S.Ha.R.K. |
* |
* Coordinators: |
* Giorgio Buttazzo <giorgio@sssup.it> |
* Paolo Gai <pj@gandalf.sssup.it> |
* |
* Authors : |
* Trimarchi Michael <trimarchi@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 |
*/ |
|
/* |
* Copyright (C) 2000 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 WARR2ANTY; without even the implied waRR2anty 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 |
* |
*/ |
|
|
#include <ll/stdio.h> |
#include <ll/string.h> |
#include <kernel/model.h> |
#include <kernel/descr.h> |
#include <kernel/var.h> |
#include <kernel/func.h> |
#include <kernel/trace.h> |
#include "mpegstar.h" |
#include "fsf_server.h" |
|
#define MPEGSTAR_DEBUG |
|
/*+ Status used in the level +*/ |
#define MPEGSTAR_READY MODULE_STATUS_BASE |
|
/*+ the level redefinition for the Round Robin level +*/ |
typedef struct { |
level_des l; /*+ the standard level descriptor +*/ |
|
int scheduling_level; |
|
} MPEGSTAR_level_des; |
|
static int MPEGSTAR_public_eligible(LEVEL l, PID p) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
return level_table[ lev->scheduling_level ]-> |
private_eligible(lev->scheduling_level,p); |
|
return 0; |
} |
|
static int MPEGSTAR_public_create(LEVEL l, PID p, TASK_MODEL *m) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
return 0; /* OK */ |
} |
|
static void MPEGSTAR_public_dispatch(LEVEL l, PID p, int nostop) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
} |
|
static void MPEGSTAR_public_epilogue(LEVEL l, PID p) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
} |
|
static void MPEGSTAR_public_activate(LEVEL l, PID p) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
} |
|
static void MPEGSTAR_public_unblock(LEVEL l, PID p) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
} |
|
static void MPEGSTAR_public_block(LEVEL l, PID p) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
} |
|
static int MPEGSTAR_public_message(LEVEL l, PID p, void *m) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
switch ((long)(m)) { |
|
/* Task EndCycle */ |
case (long)(NULL): |
|
break; |
|
/* Task Disable */ |
case (long)(1): |
|
break; |
|
default: |
|
break; |
|
} |
|
return 0; |
|
} |
|
static void MPEGSTAR_public_end(LEVEL l, PID p) |
{ |
MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]); |
|
} |
|
/* Registration functions */ |
|
/*+ Registration function: |
TIME slice the slice for the Round Robin queue +*/ |
LEVEL MPEGSTAR_register_level() |
{ |
LEVEL l; /* the level that we register */ |
MPEGSTAR_level_des *lev; /* for readableness only */ |
|
l = level_alloc_descriptor(sizeof(MPEGSTAR_level_des)); |
|
lev = (MPEGSTAR_level_des *)level_table[l]; |
|
lev->l.public_guarantee = NULL; |
lev->l.public_create = MPEGSTAR_public_create; |
lev->l.public_end = MPEGSTAR_public_end; |
lev->l.public_dispatch = MPEGSTAR_public_dispatch; |
lev->l.public_epilogue = MPEGSTAR_public_epilogue; |
lev->l.public_activate = MPEGSTAR_public_activate; |
lev->l.public_unblock = MPEGSTAR_public_unblock; |
lev->l.public_block = MPEGSTAR_public_block; |
lev->l.public_message = MPEGSTAR_public_message; |
lev->l.public_eligible = MPEGSTAR_public_eligible; |
|
return l; |
|
} |