Subversion Repositories shark

Rev

Rev 38 | 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: edf.h,v 1.3 2003-03-13 13:39:04 pj Exp $

 File:        $File$
 Revision:    $Revision: 1.3 $
 Last update: $Date: 2003-03-13 13:39:04 $
 ------------

 This file contains the scheduling module EDF (Earliest Deadline First)

 Title:
   EDF (Earliest Deadline First)

 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.
     period field is ignored

 Description:
   This module schedule his tasks following the classic EDF 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 EDF_WCET_VIOLATED
     state. To reactivate it, use EDF_task_activate via task_activate or
     manage directly the EDF data structure. Note that the exception is not
     handled properly, an XDEADLINE_MISS exeeption 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 EDF_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 and timespec_priority fields.
   - A function to return the used bandwidth of a level is provided.
   - The guest tasks don't provide the guest_endcycle function

**/


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

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

__BEGIN_DECLS


/*+ flags... +*/
#define EDF_DISABLE_ALL           0
#define EDF_ENABLE_WCET_CHECK     1  /*+ Wcet check enabled     +*/
#define EDF_ENABLE_GUARANTEE      2  /*+ Task Guarantee enabled +*/
#define EDF_ENABLE_ALL            3  /*+ All flags enabled      +*/

#define EDF_FAILED_GUARANTEE      8  /*+ used in the module, unsettable
                                         in EDF_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 EDF_register_level(int flag);

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

__END_DECLS
#endif