Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/**
 This file contains a minimal version of 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:
   none
   
 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.

   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.
   - The level use the priority and timespec_priority fields.
   - 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 __EDF_H__
#define __EDF_H__

#include "valmodel.h"
#include <ll/ll.h>
#include <kernel/config.h>
#include <sys/types.h>
#include <kernel/types.h>
#include <modules/codes.h>


//pic a code and a version not used into the file include/modules/codes.h
#define DOG_LEVELNAME      "GROUP5 Scheduling Module"
#define DOG_LEVEL_CODE     167
#define DOG_LEVEL_VERSION  1


/*+ flags... +*/
#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... +*/

void EDF_register_level();

/* checks if the task is accepted */
int is_accepted(LEVEL l, PID p);

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

#endif