Subversion Repositories shark

Rev

Rev 1618 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
961 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   Anton Cervin
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
 
22
/**
23
 ------------
24
 CVS :        $Id: edf.h,v 1.1 2005-02-25 10:53:41 pj Exp $
25
 
26
 File:        $File$
27
 Revision:    $Revision: 1.1 $
28
 Last update: $Date: 2005-02-25 10:53:41 $
29
 ------------
30
 
31
 This file contains the scheduling module EDF (Earliest Deadline First)
32
 
33
 Title:
34
   EDF (Earliest Deadline First)
35
 
36
 Task Models Accepted:
37
   HARD_TASK_MODEL - Hard Tasks (Periodic and Sporadic)
38
     wcet field and mit field must be != 0. They are used to set the wcet
39
       and period of the tasks.
40
     periodicity field can be either PERIODIC or APERIODIC
41
     drel field must be <= mit. NOTE 1: a drel of 0 is interpreted as mit.
42
       NOTE 2: The utilization of the task is computed as wcet/drel.
43
     offset field specifies a release offset relative to task_activate or
44
       group_activate.
45
 
46
 Guest Models Accepted:
47
   JOB_TASK_MODEL - a single guest task activation
48
     Identified by an absolute deadline and a period.
49
     period field is ignored
50
 
51
 Description:
52
   This module schedules periodic and sporadic tasks based on their
53
   absolute deadlines. The task guarantee is based on a simple
54
   utilization approach. The utilization factor of a task is computed
55
   as wcet/drel. (By default, drel = mit.) A periodic task must only
56
   be activated once; subsequent activations are triggered by an
57
   internal timer. By contrast, an sporadic task must be explicitely
58
   activated for each instance. NO GUARANTEE is performed on guest
59
   tasks. The guarantee must be performed by the level that inserts
60
   guest tasks in the EDF level.
61
 
62
 Exceptions raised:
63
   XUNVALID_GUEST
64
     This level doesn't support guests of this type. When a guest
65
     operation is called, the exception is raised.
66
 
67
   The following exceptions may be raised by the module:
68
   XDEADLINE_MISS
69
     If a task misses its deadline and the EDF_ENABLE_DL_EXCEPTION
70
     flag is set, this exception is raised.
71
 
72
   XWCET_VIOLATION
73
     If a task executes longer than its declared wcet and the
74
     EDF_ENABLE_WCET_EXCEPTION flag is set, this exception is raised.
75
 
76
   XACTIVATION
77
     If a sporadic task is activated more often than its declared mit
78
     and the EDF_ENABLE_ACT_EXCEPTION flag is set, this exception is
79
     raised. This exception is also raised if a periodic task is
80
     activated while not in the SLEEP state.
81
 
82
 Restrictions & special features:
83
 
84
   - Relative deadlines drel <= mit may be specified.
85
   - An offset > 0 will delay the activation of the task by the same
86
     amount of time. To synchronize a group of tasks, assign suitable
87
     offsets and then use the group_activate function.
88
   - This level doesn't manage the main task.
89
   - The level uses the priority and timespec_priority fields.
90
   - The guest tasks don't provide the guest_endcycle function.
91
   - At init time, the user can specify the behavior in case of
92
     deadline and wcet overruns. The following flags are available:
93
 
94
     (No flags enabled)      - Deadline and wcet overruns are ignored.
95
                               Pending periodic jobs are queued and are
96
                               eventually scheduled with correct deadlines
97
                               according to their original arrival times.
98
                               Sporadic tasks that arrive to often are
99
                               simply dropped.
100
     EDF_ENABLE_DL_CHECK     - When a deadline overrun occurs, the
101
                               dl_miss counter of the task is increased.
102
                               Same behavior for pending jobs as above.
103
     EDF_ENABLE_WCET_CHECK   - When a wcet overrun occurs, the
104
                               wcet_miss counter of the task is increased.
105
                               Same behavior for pending jobs as above.
106
     EDF_ENABLE_DL_EXCEPTION - When a deadline overrun occurs, an
107
                               exception is raised.
108
     EDF_ENABLE_WCET_EXCEPTION - When a wcet overrun occurs, an
109
                               exception is raised.
110
     EDF_ENABLE_ACT_EXCEPTION  When a periodic or sporadic task is activated
111
                               too often, an exception is raised.
112
 
113
   - The functions EDF_get_dl_miss, EDF_get_wcet_miss, EDF_get_act_miss,
114
     and EDF_get_nact can be used to find out the number of missed
115
     deadlines, the number of wcet overruns, the number of skipped
116
     activations, and the number of currently queued periodic activations.
117
 
118
**/
119
 
120
/*
121
 * Copyright (C) 2000 Paolo Gai
122
 *
123
 * This program is free software; you can redistribute it and/or modify
124
 * it under the terms of the GNU General Public License as published by
125
 * the Free Software Foundation; either version 2 of the License, or
126
 * (at your option) any later version.
127
 *
128
 * This program is distributed in the hope that it will be useful,
129
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
130
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
131
 * GNU General Public License for more details.
132
 *
133
 * You should have received a copy of the GNU General Public License
134
 * along with this program; if not, write to the Free Software
135
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
136
 *
137
 */
138
 
139
 
140
#ifndef __EDF_H__
141
#define __EDF_H__
142
 
143
#include <ll/ll.h>
144
#include <kernel/config.h>
145
#include <sys/types.h>
146
#include <kernel/types.h>
1621 fabio 147
#include <arch/sys/cdefs.h>
961 pj 148
 
149
__BEGIN_DECLS
150
 
151
/* Level flags */
152
#define EDF_DISABLE_ALL            0
153
#define EDF_ENABLE_GUARANTEE       1  /* Task guarantee enabled             */
154
#define EDF_ENABLE_WCET_CHECK      2  /* Wcet monitoring enabled            */
155
#define EDF_ENABLE_DL_CHECK        4  /* Deadline monitoring enabled        */
156
#define EDF_ENABLE_WCET_EXCEPTION  8  /* Wcet overrun exception enabled     */
157
#define EDF_ENABLE_DL_EXCEPTION   16  /* Deadline overrun exception enabled */
158
#define EDF_ENABLE_ACT_EXCEPTION  32  /* Activation exception enabled       */
159
#define EDF_ENABLE_ALL            63  /* All flags enabled                  */
160
 
161
/* Registration function */
162
LEVEL EDF_register_level(int flags);
163
 
164
 
165
/**** Public utility functions ****/
166
 
167
/* Get the bandwidth used by the level */
168
bandwidth_t EDF_usedbandwidth(LEVEL l);
169
 
170
/* Get the number of missed deadlines for a task */
171
int EDF_get_dl_miss(PID p);
172
 
173
/* Get the number of execution overruns for a task */
174
int EDF_get_wcet_miss(PID p);
175
 
176
/* Get the number of skipped activations for a task */
177
int EDF_get_act_miss(PID p);
178
 
179
/* Get the current number of queued activations for a task */
180
int EDF_get_nact(PID p);
181
 
182
 
183
__END_DECLS
184
#endif