Subversion Repositories shark


Rev 1086 | Blame | Compare with Previous | Last modification | View Log | RSS feed

 * Project: S.Ha.R.K.
 * Coordinators:
 *   Giorgio Buttazzo    <>
 *   Paolo Gai           <>
 * Authors     :
 *   Paolo Gai           <>
 *   Massimiliano Giorgi <>
 *   Luca Abeni          <>
 *   (see the web pages for full authors list)
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)

 CVS :        $Id: cash.h,v 1.2 2003-01-07 17:10:16 pj Exp $

 File:        $File$
 Revision:    $Revision: 1.2 $
 Last update: $Date: 2003-01-07 17:10:16 $

 This file contains the server CBSHD (CASH Algorithm)

   CBSHD (Constant Bandwidth Server with hard deadlines)

 Task Models Accepted:
   ELASTIC_HARD_TASK_MODEL - Elastic Hard Tasks
     wcet field must be != 0
     cnormal field must be != 0
     period field must be != 0
   This module schedule his tasks following the CBSHD scheme.
   (see Marco Caccamo, Giorgio Buttazzo and Lui Sha
        "Elastic Feedback Control"
        Proceedings of the EUROMICRO 2000)

   The tasks are inserted in an EDF level (or similar) with a JOB_TASK_MODEL,
   and the CBSHD level expects that the task is scheduled with the absolute
   deadline passed in the model.

   The task guarantee is based on the factor utilization approach.

 Exceptions raised:
     This level doesn't support guests. When a guest operation
     is called, the exception is raised.

   These exceptions are pclass-dependent...
     If a task miss his deadline, the exception is raised.
 Restrictions & special features:
   - This level doesn't manage the main task.
   - At init time we have to specify:
       . guarantee check
          (when all task are created the system will check that the task_set
          will not use more than the available bandwidth)
   - A function to return the used bandwidth of the level is provided.
   - A function to return the pending activations of the task.


 * 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 WARRANTY; without even the implied warranty of
 * 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 __CBSGHD_H__
#define __CBSGHD_H__

#include <ll/ll.h>
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>

/*+ flags... +*/
#define CBSGHD_ENABLE_GUARANTEE      1  /*+ Task Guarantee enabled +*/
#define CBSGHD_ENABLE_ALL            1

#define CBSGHD_FAILED_GUARANTEE      8  /*+ used in the module, unsettabl
                                         in EDF_register_level... +*/

#define ELASTIC_HARD_PCLASS 0x0600                             

#define CBSGHD_LEVELNAME        "CBSGHD base"
#define CBSGHD_LEVEL_CODE       106

/* -----------------------------------------------------------------------
   ELASTIC_HARD_TASK_MODEL: elastic hard Tasks
   ----------------------------------------------------------------------- */

typedef struct {
  TIME cnormal;
  TIME period;
  TIME wcet;
  TIME maxperiod;

#define elastic_hard_task_default_model(m)                             \
                        task_default_model((m).t,ELASTIC_HARD_PCLASS), \
                        (m).cnormal    = 0,                            \
                        (m).period     = 0,                            \
                        (m).wcet       = 0,                            \
                        (m).maxperiod  = 0

#define elastic_hard_task_def_level(m,l)      task_def_level((m).t,l)
#define elastic_hard_task_def_arg(m,a)        task_def_arg((m).t,a)
#define elastic_hard_task_def_stack(m,s)      task_def_stack((m).t,s)
#define elastic_hard_task_def_stackaddr(m,s)  task_def_stackaddr((m).t,s)
#define elastic_hard_task_def_group(m,g)      task_def_group((m).t,g)
#define elastic_hard_task_def_usemath(m)      task_def_usemath((m).t)
#define elastic_hard_task_def_system(m)       task_def_system((m).t)
#define elastic_hard_task_def_nokill(m)       task_def_nokill((m).t)
#define elastic_hard_task_def_ctrl_jet(m)     task_def_ctrl_jet((m).t)
#define elastic_hard_task_def_cnormal(m,c)    (m).cnormal = (c)
#define elastic_hard_task_def_period(m,p)     (m).period = (p)
#define elastic_hard_task_def_wcet(m,w)       (m).wcet = (w)
#define elastic_hard_task_def_maxperiod(m,p)  (m).maxperiod = (p)      
#define elastic_hard_task_def_joinable(m)     task_def_joinable((m).t)
#define elastic_hard_task_def_unjoinable(m)   task_def_unjoinable((m).t)

/*+ Registration function:
    int flags     Options to be used in this level instance...
    LEVEL master  the level that must be used as master level for the
                  CBSGHD tasks

    returns the level number at which the module has been registered.

LEVEL CBSGHD_register_level(int flags, LEVEL master);

/*+ Returns the used bandwidth of a level +*/
bandwidth_t CBSGHD_usedbandwidth(LEVEL l);