Subversion Repositories shark

Rev

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

Rev Author Line No. Line
2 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
 *   (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
 ------------
38 pj 24
 CVS :        $Id: tbs.h,v 1.2 2003-01-07 17:12:20 pj Exp $
2 pj 25
 
26
 File:        $File$
38 pj 27
 Revision:    $Revision: 1.2 $
28
 Last update: $Date: 2003-01-07 17:12:20 $
2 pj 29
 ------------
30
 
31
 This file contains the aperiodic server TBS (Total Bandwidth Server)
32
 
33
 Title:
34
   TBS (Total Bandwidth Server)
35
 
36
 Task Models Accepted:
37
   SOFT_TASK_MODEL - Aperiodic Tasks
38
     wcet field must be != 0
39
     met field is ignored
40
     period field is ignored
41
     periodicity must be APERIODIC
42
     arrivals can be either SAVE or SKIP
43
 
44
 Description:
45
   This module schedule his tasks following the TBS scheme.
46
   Each task has a deadline assigned with the TBS scheme,
47
 
48
                       wcet
49
   d = max(r , d   ) + ----
50
    k       k   k-1     Us
51
 
52
   The tasks are inserted in an EDF level (or similar) with a JOB_TASK_MODEL,
53
   and the TBS level expects that the task is scheduled with the absolute
54
   deadline passed in the model.
55
 
56
   The task guarantee is based on the factor utilization approach.
57
   The theory guarantees that the task set is schedulable if
58
    Up + Us <= 1
59
   so it is sufficient to add the Us to the bandwidth used by the upper
60
   levels (we suppose that the levels with level number < of the current
61
   can guarantee their task sets basing on the same formula...
62
 
63
   All the tasks are put in a FIFO (FCFS) queue and at a time only the first
64
   task in the queue is put in the upper level.
65
 
66
 Exceptions raised:
67
   XUNVALID_GUEST
68
     This level doesn't support guests. When a guest operation
69
     is called, the exception is raised.
70
 
71
   These exceptions are pclass-dependent...
72
   XDEADLINE_MISS
73
     If a task miss his deadline, the exception is raised.
74
     Normally, a TBS task can't cause the raise of such exception because
75
     if it really use more time than declared a XWCET_VIOLATION is raised
76
     instead.
77
 
78
   XWCET_VIOLATION
79
     If a task doesn't end the current cycle before if consume the wcet,
80
     an exception is raised, and the task is put in the TBS_WCET_VIOLATED
81
     state. To reactivate it, use TBS_task_activate via task_activate or
82
     manage directly the TBS data structure. Note that if the exception
83
     is not handled properly, an XDEADLINE_MISS exception will also be
84
     raised at the absolute deadline...
85
 
86
 Restrictions & special features:
87
   - This level doesn't manage the main task.
88
   - At init time we have to specify:
89
     . The bandwidth used by the server
90
     . some flags
91
       . wcet check activated
92
          (If a task require more time than declared, it is stopped and put in
93
          the state TBS_WCET_VIOLATED; a XWCET_VIOLATION exception is raised)
94
       . guarantee check
95
          (when all task are created the system will check that the task_set
96
          will not use more than the available bandwidth)
97
   - The level don't use the priority field.
98
   - A function to return the used bandwidth of the level is provided.
99
 
100
**/
101
 
102
/*
103
 * Copyright (C) 2000 Paolo Gai
104
 *
105
 * This program is free software; you can redistribute it and/or modify
106
 * it under the terms of the GNU General Public License as published by
107
 * the Free Software Foundation; either version 2 of the License, or
108
 * (at your option) any later version.
109
 *
110
 * This program is distributed in the hope that it will be useful,
111
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
112
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
113
 * GNU General Public License for more details.
114
 *
115
 * You should have received a copy of the GNU General Public License
116
 * along with this program; if not, write to the Free Software
117
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
118
 *
119
 */
120
 
121
 
122
#ifndef __TBS_H__
123
#define __TBS_H__
124
 
125
#include <ll/ll.h>
126
#include <kernel/config.h>
127
#include <sys/types.h>
128
#include <kernel/types.h>
129
 
130
/*+ flags... +*/
131
#define TBS_DISABLE_ALL           0
132
#define TBS_ENABLE_WCET_CHECK     1  /*+ Wcet check enabled     +*/
133
#define TBS_ENABLE_GUARANTEE      2  /*+ Task Guarantee enabled +*/
134
#define TBS_ENABLE_ALL            3  /*+ All flags enabled      +*/
135
 
136
 
137
/*+ Registration function:
138
    bandwidth_t b Max bandwidth used by the TBS
139
    int flags     Options to be used in this level instance...
140
    LEVEL master  the level that must be used as master level for the
141
                  TBS tasks
142
    int num,den   used to compute the TBS bandwidth                      +*/
143
void TBS_register_level(int flags, LEVEL master, int num, int den);
144
 
145
/*+ Returns the used bandwidth of a level +*/
146
bandwidth_t TBS_usedbandwidth(LEVEL l);
147
 
148
/*+ Returns the number of pending activations of a task, or -1 if the level
149
    is wrong.
150
    No control is done if the task is not a TBS task! +*/
151
int TBS_get_nact(LEVEL l, PID p);
152
 
153
 
154
#endif