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: ss.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 SS (Sporadic Server)
32
 
33
 Title:
34
   SS (Sporadic Server)
35
 
36
 Task Models Accepted:
37
   SOFT_TASK_MODEL - Soft Tasks
38
     wcet field is ignored
39
     met field is ignored
40
     period field is ignored
41
     periodicity field can be only APERIODIC
42
     arrivals field can be either SAVE or SKIP
43
 
44
 Description:
45
   This module schedule his tasks following the Sporadic Server scheme.
46
   The scheme is slightly modified respect to classic SS. The server
47
   becomes active at arrival time of a task must be served.
48
 
49
   All the tasks are put in a FIFO (FCFS) queue and at a time only the first
50
   task in the queue is put in the upper level.
51
 
52
   The module remembers pending activations when calling task_sleep...
53
 
54
 Exceptions raised:
55
   XUNVALID_GUEST
56
     This level doesn't support guests. When a guest operation
57
     is called, the exception is raised.
58
   XUNVALID_SS_REPLENISH
59
     Indicates an anomalous replenishment situation:
60
     . replenish time fires and no amounts are set
61
     . replenish amount posted when server is not active
62
     . no more space to post a replenish amount
63
 
64
 Restrictions & special features:
65
   - This level doesn't manage the main task.
66
   - At init time we have to specify:
67
     . The Capacity and the period used by the server
68
   - The level don't use the priority field.
69
   - if an aperiodic task calls a task_delay when owning a mutex implemented
70
     with shadows, the delay may have no effect, so don't use delay when
71
     using a mutex!!!
72
   - On calling task_delay and task_sleep the replenish amount is posted.
73
     This because replenish time may fires when task is sleeping (server
74
     is not active).
75
   - A function to return the used bandwidth of the level is provided.
76
   - A function to return the avail server capacity is provided.
77
 
78
**/
79
 
80
/*
81
 * Copyright (C) 2000 Paolo Gai
82
 *
83
 * This program is free software; you can redistribute it and/or modify
84
 * it under the terms of the GNU General Public License as published by
85
 * the Free Software Foundation; either version 2 of the License, or
86
 * (at your option) any later version.
87
 *
88
 * This program is distributed in the hope that it will be useful,
89
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
90
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
91
 * GNU General Public License for more details.
92
 *
93
 * You should have received a copy of the GNU General Public License
94
 * along with this program; if not, write to the Free Software
95
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
96
 *
97
 */
98
 
99
 
100
#ifndef __SS_H__
101
#define __SS_H__
102
 
103
#include <kernel/config.h>
104
#include <kernel/types.h>
105
#include <sys/types.h>
106
 
107
/*+ 1 - ln(2) +*/
108
#ifndef RM_MINFREEBANDWIDTH
109
#define RM_MINFREEBANDWIDTH 1317922825
110
#endif
111
 
112
/*+ Max size of replenish queue +*/
113
#define SS_MAX_REPLENISH MAX_EVENT
114
 
115
/*+ flags... +*/
116
#define SS_DISABLE_ALL           0
117
#define SS_ENABLE_BACKGROUND     1  /*+ Background scheduling enabled +*/
118
#define SS_ENABLE_GUARANTEE_EDF  2  /*+ Task Guarantee enabled +*/
119
#define SS_ENABLE_ALL_EDF        3  /*+ guarantee+background enabled +*/
120
 
121
#define SS_ENABLE_GUARANTEE_RM   4  /*+ Task Guarantee enabled +*/
122
#define SS_ENABLE_ALL_RM         5  /*+ guarantee+background enabled +*/
123
 
124
/*+ internal flags +*/
125
#define SS_BACKGROUND            8  /*+ this flag is set when scheduling
126
                                        in background +*/
127
#define SS_BACKGROUND_BLOCK     16  /*+ this flag is set when we want to
128
                                        blocks the background scheduling +*/
129
 
130
/*+ internal switches +*/
131
typedef enum {
132
        SS_SERVER_NOTACTIVE,   /*+ SS is not active +*/
133
        SS_SERVER_ACTIVE       /*+ SS is active +*/
134
} ss_status;
135
 
136
/*+ internal functions +*/
137
 
138
/*+ Used to store replenishment events +*/
139
/* Now we use static allocated array. In this way, no more then
140
   SS_MAX_REPLENISH replenishments can be posted.
141
typedef struct {
142
        struct timespec rtime;
143
        int ramount;
144
        replenishq *next;
145
} replenishq;
146
*/
147
 
148
/*+ Registration function:
149
    bandwidth_t b Max bandwidth used by the SS
150
    int flags     Options to be used in this level instance...
151
    LEVEL master  The level that must be used as master level
152
    int Cs        Server capacity
38 pj 153
    int per       Server period          
2 pj 154
 
38 pj 155
    returns the level number at which the module has been registered.
156
+*/
157
LEVEL SS_register_level(int flags, LEVEL master, int Cs, int per);
158
 
2 pj 159
/*+ Returns the used bandwidth of a level +*/
160
bandwidth_t SS_usedbandwidth(LEVEL l);
161
 
162
/*+ Returns tha available capacity +*/
163
int SS_availCs(LEVEL l);
164
 
165
#endif