Blame |
Last modification |
View Log
| RSS feed
/*
* 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: valmodel.h,v 1.1 2004-07-05 14:17:18 pj Exp $
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2004-07-05 14:17:18 $
------------
**/
/*
* Copyright (C) 2001 Paolo Gai and Tomas Lenvall
*
* 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
*
*/
#ifndef __VALMODEL_H__
#define __VALMODEL_H__
#include <kernel/types.h>
#include <kernel/model.h>
/*
* Registration functions
*
*
* Note that the module that will handle the aperiodic tasks should also
* support group creation. To support group creation you need a function
* that have to be called for "accept" the task. The test application
* will ensure you that the crunch_taskaccepted function will be called.
*
* The periodic tasks will be created as usual, with task_create.
*
* Please look at the template that you can use to create your own
* Scheduling Module (it should be distributed with this file.
*/
/*
* This function will be called into the __kernel_register_modules__
* function in the middle of the registration of the Modules.
* You can do what you want here.
*
* In particular, you should register some scheduling Modules
* that will be capable to handle these two task models:
* - HARD_TASK_MODEL: periodic tasks with wcet and period != 0
* - VALUE_TASK_MODEL: aperiodic tasks with wcet, reldline, and values
*/
void crunch_register_models(struct multiboot_info *mb);
/*
* This function will be used by the test application to accept value tasks.
* It returns 1 if the task p is accepted, 0 if not.
*/
int crunch_taskaccepted(PID p);
/*
* This function just returns the accumulated value by the scheduling
* modules.
*/
int crunch_getvalue();
/* -----------------------------------------------------------------------
VALUE_TASK_MODEL: elastic hard Tasks
----------------------------------------------------------------------- */
/*
* this is the Value Task Model that has been used in the
* Lab assignments of the Advanced Real-Time Course in
* the Malardalens University, Sweden
*
* This is an aperiodic task with deadline and wcet.
* if the task run to completion the Module gains some value points
* if it cannot be run it will loose some (penalty) points
*/
// a random unused number
#define VALUE_PCLASS 0x6900
typedef struct {
TASK_MODEL t;
TIME wcet; // the worst case execution time of the task
TIME dline; // relative deadline
DWORD value; // the value gained if the task runs to completion
DWORD penalty; // the penalty gained if the task does not finish
} VALUE_TASK_MODEL;
#define value_task_default_model(m) \
task_default_model((m).t,VALUE_PCLASS), \
(m).wcet = 0, \
(m).dline = 0, \
(m).value = 0, \
(m).penalty = 0
#define value_task_def_level(m,l) task_def_level((m).t,l)
#define value_task_def_arg(m,a) task_def_arg((m).t,a)
#define value_task_def_stack(m,s) task_def_stack((m).t,s)
#define value_task_def_stackaddr(m,s) task_def_stackaddr((m).t,s)
#define value_task_def_group(m,g) task_def_group((m).t,g)
#define value_task_def_usemath(m) task_def_usemath((m).t)
#define value_task_def_system(m) task_def_system((m).t)
#define value_task_def_nokill(m) task_def_nokill((m).t)
#define value_task_def_ctrl_jet(m) task_def_ctrl_jet((m).t)
#define value_task_def_wcet(m,w) (m).wcet = (w)
#define value_task_def_dline(m,d) (m).dline = (d)
#define value_task_def_value(m,v) (m).value = (v)
#define value_task_def_penalty(m,p) (m).penalty = (p)
#define value_task_def_joinable(m) task_def_joinable((m).t)
#define value_task_def_unjoinable(m) task_def_unjoinable((m).t)
#endif