Subversion Repositories shark

Rev

Rev 3 | Blame | Compare with Previous | 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>
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
 *   Luca Abeni          <luca@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: rm.h,v 1.2 2003-01-07 17:12:20 pj Exp $

 File:        $File$
 Revision:    $Revision: 1.2 $
 Last update: $Date: 2003-01-07 17:12:20 $
 ------------

 This file contains the scheduling module RM (Rate Monotonic)

 Title:
   RM (Rate Monotonic

 Task Models Accepted:
   HARD_TASK_MODEL - Hard Tasks (Periodic and Sporadic)
     wcet field and mit field must be != 0. They are used to set the wcet
       and period of the tasks.
     periodicity field can be either PERIODIC or APERIODIC
     drel field is ignored

 Guest Models Accepted:
   JOB_TASK_MODEL - a single guest task activation
     Identified by an absolute deadline and a period.
     all fieds are used

 Description:
   This module schedule his tasks following the classic RM scheme.
   The task guarantee is based on the factor utilization approach.
   The tasks scheduled are periodic and sporadic. The sporadic tasks
   are like hard task with periodicity set to APERIODIC; they are guaranteed
   as a periodic task with period equal to the minimum interarrival time.
   All the task are put in a queue and the scheduling is based on the
   deadline value.
   NO GUARANTEE is performed on guest tasks. The guarantee must be performed
   by the level that inserts guest tasks in the EDF level.

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

   These exceptions are pclass-dependent...
   XDEADLINE_MISS
     If a task miss his deadline, the exception is raised.

   XWCET_VIOLATION
     If a task doesn't end the current cycle before if consume the wcet,
     an exception is raised, and the task is put in the RM_WCET_VIOLATED
     state. To reactivate it, use RM_task_activate via task_activate or
     manage directly the RM data structure. Note that the exception is not
     handled properly, an XDEADLINE_MISS exeception will also be raised at
     the period end...

   XACTIVATION
     If a sporadic task is activated with a rate that is greather than the
     rate declared in the model, this exception is raised and the task is NOT
     activated.
     This exception is also raised if we are trying to activate a periodic task
     stopped with task_sleep before the deadline in which the task_sleep is
     called.

 Restrictions & special features:
   - This level doesn't manage the main task.
   - At init time we can choose if the level have to activate
     . the wcet check
       (If a task require more time than declared, it is stopped and put in
        the state RM_WCET_VIOLATED; a XWCET_VIOLATION exception is raised)
     . the task guarantee algorithm
       (when all task are created the system will check that the task_set
        will not use more than the available bandwidth)
   - The level use the priority field.
   - A function to return the used bandwidth of a level is provided.

**/


/*
 * 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
 * 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 __RM_H__
#define __RM_H__

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

/*+ 1 - ln(2) +*/

#ifndef RM_MINFREEBANDWIDTH
#define RM_MINFREEBANDWIDTH 1317922825
#endif



/*+ flags... +*/
#define RM_DISABLE_ALL           0
#define RM_ENABLE_WCET_CHECK     1  /*+ Wcet check enabled     +*/
#define RM_ENABLE_GUARANTEE      2  /*+ Task Guarantee enabled +*/
#define RM_ENABLE_ALL            3  /*+ All flags enabled      +*/

#define RM_FAILED_GUARANTEE      8  /*+ used in the module, unsettable
                                         in RM_register_level... +*/


/*+ Registration function:
    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);

#endif