Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1658 giacomo 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
 *   (see the web pages for full authors list)
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
 CVS :        $Id: cash.h,v 1.1 2004-06-01 11:42:41 giacomo Exp $
24
 
25
 File:        $File$
26
 Revision:    $Revision: 1.1 $
27
 Last update: $Date: 2004-06-01 11:42:41 $
28
 ------------
29
 
30
 This file contains the server CBSHD (CASH Algorithm)
31
 
32
 Title:
33
   CBSHD (Constant Bandwidth Server with hard deadlines)
34
 
35
 Task Models Accepted:
36
   ELASTIC_HARD_TASK_MODEL - Elastic Hard Tasks
37
     wcet field must be != 0
38
     cnormal field must be != 0
39
     period field must be != 0
40
 
41
 Description:
42
   This module schedule his tasks following the CBSHD scheme.
43
   (see Marco Caccamo, Giorgio Buttazzo and Lui Sha
44
        "Elastic Feedback Control"
45
        Proceedings of the EUROMICRO 2000)
46
 
47
   The tasks are inserted in an EDF level (or similar) with a JOB_TASK_MODEL,
48
   and the CBSHD level expects that the task is scheduled with the absolute
49
   deadline passed in the model.
50
 
51
   The task guarantee is based on the factor utilization approach.
52
 
53
 Exceptions raised:
54
   XUNVALID_GUEST
55
     This level doesn't support guests. When a guest operation
56
     is called, the exception is raised.
57
 
58
   These exceptions are pclass-dependent...
59
   XDEADLINE_MISS
60
     If a task miss his deadline, the exception is raised.
61
 
62
 Restrictions & special features:
63
   - This level doesn't manage the main task.
64
   - At init time we have to specify:
65
       . guarantee check
66
          (when all task are created the system will check that the task_set
67
          will not use more than the available bandwidth)
68
   - A function to return the used bandwidth of the level is provided.
69
   - A function to return the pending activations of the task.
70
 
71
**/
72
 
73
/*
74
 * Copyright (C) 2000 Paolo Gai
75
 *
76
 * This program is free software; you can redistribute it and/or modify
77
 * it under the terms of the GNU General Public License as published by
78
 * the Free Software Foundation; either version 2 of the License, or
79
 * (at your option) any later version.
80
 *
81
 * This program is distributed in the hope that it will be useful,
82
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
83
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
84
 * GNU General Public License for more details.
85
 *
86
 * You should have received a copy of the GNU General Public License
87
 * along with this program; if not, write to the Free Software
88
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
89
 *
90
 */
91
 
92
 
93
#ifndef __CBSGHD_H__
94
#define __CBSGHD_H__
95
 
96
#include <ll/ll.h>
97
#include <kernel/config.h>
98
#include <sys/types.h>
99
#include <kernel/types.h>
100
 
101
 
102
 
103
 
104
 
105
 
106
 
107
 
108
/*+ flags... +*/
109
#define CBSGHD_ENABLE_GUARANTEE      1  /*+ Task Guarantee enabled +*/
110
#define CBSGHD_ENABLE_ALL            1
111
 
112
#define CBSGHD_FAILED_GUARANTEE      8  /*+ used in the module, unsettabl
113
                                         in EDF_register_level... +*/
114
 
115
 
116
 
117
 
118
 
119
#define ELASTIC_HARD_PCLASS 0x0600                              
120
 
121
#define CBSGHD_LEVELNAME        "CBSGHD base"
122
#define CBSGHD_LEVEL_CODE       106
123
#define CBSGHD_LEVEL_VERSION    1
124
 
125
 
126
/* -----------------------------------------------------------------------
127
   ELASTIC_HARD_TASK_MODEL: elastic hard Tasks
128
   ----------------------------------------------------------------------- */
129
 
130
 
131
typedef struct {
132
  TASK_MODEL t;
133
  TIME cnormal;
134
  TIME period;
135
  TIME wcet;
136
  TIME maxperiod;
137
} ELASTIC_HARD_TASK_MODEL;
138
 
139
#define elastic_hard_task_default_model(m)                             \
140
                        task_default_model((m).t,ELASTIC_HARD_PCLASS), \
141
                        (m).cnormal    = 0,                            \
142
                        (m).period     = 0,                            \
143
                        (m).wcet       = 0,                            \
144
                        (m).maxperiod  = 0
145
#define elastic_hard_task_def_level(m,l)      task_def_level((m).t,l)
146
#define elastic_hard_task_def_arg(m,a)        task_def_arg((m).t,a)
147
#define elastic_hard_task_def_stack(m,s)      task_def_stack((m).t,s)
148
#define elastic_hard_task_def_stackaddr(m,s)  task_def_stackaddr((m).t,s)
149
#define elastic_hard_task_def_group(m,g)      task_def_group((m).t,g)
150
#define elastic_hard_task_def_usemath(m)      task_def_usemath((m).t)
151
#define elastic_hard_task_def_system(m)       task_def_system((m).t)
152
#define elastic_hard_task_def_nokill(m)       task_def_nokill((m).t)
153
#define elastic_hard_task_def_ctrl_jet(m)     task_def_ctrl_jet((m).t)
154
#define elastic_hard_task_def_cnormal(m,c)    (m).cnormal = (c)
155
#define elastic_hard_task_def_period(m,p)     (m).period = (p)
156
#define elastic_hard_task_def_wcet(m,w)       (m).wcet = (w)
157
#define elastic_hard_task_def_maxperiod(m,p)  (m).maxperiod = (p)       
158
#define elastic_hard_task_def_joinable(m)     task_def_joinable((m).t)
159
#define elastic_hard_task_def_unjoinable(m)   task_def_unjoinable((m).t)
160
 
161
 
162
 
163
 
164
/*+ Registration function:
165
    int flags     Options to be used in this level instance...
166
    LEVEL master  the level that must be used as master level for the
167
                  CBSGHD tasks
168
 
169
    returns the level number at which the module has been registered.
170
+*/
171
LEVEL CBSGHD_register_level(int flags, LEVEL master);
172
 
173
/*+ Returns the used bandwidth of a level +*/
174
bandwidth_t CBSGHD_usedbandwidth(LEVEL l);
175
 
176
#endif
177