Subversion Repositories shark

Rev

Rev 2 | 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
 ------------
24
 CVS :        $Id: ss.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
25
 
26
 File:        $File$
27
 Revision:    $Revision: 1.1.1.1 $
28
 Last update: $Date: 2002-03-29 14:12:51 $
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
#include <modules/codes.h>
107
 
108
/*+ 1 - ln(2) +*/
109
#ifndef RM_MINFREEBANDWIDTH
110
#define RM_MINFREEBANDWIDTH 1317922825
111
#endif
112
 
113
/*+ Max size of replenish queue +*/
114
#define SS_MAX_REPLENISH MAX_EVENT
115
 
116
/*+ flags... +*/
117
#define SS_DISABLE_ALL           0
118
#define SS_ENABLE_BACKGROUND     1  /*+ Background scheduling enabled +*/
119
#define SS_ENABLE_GUARANTEE_EDF  2  /*+ Task Guarantee enabled +*/
120
#define SS_ENABLE_ALL_EDF        3  /*+ guarantee+background enabled +*/
121
 
122
#define SS_ENABLE_GUARANTEE_RM   4  /*+ Task Guarantee enabled +*/
123
#define SS_ENABLE_ALL_RM         5  /*+ guarantee+background enabled +*/
124
 
125
/*+ internal flags +*/
126
#define SS_BACKGROUND            8  /*+ this flag is set when scheduling
127
                                        in background +*/
128
#define SS_BACKGROUND_BLOCK     16  /*+ this flag is set when we want to
129
                                        blocks the background scheduling +*/
130
 
131
/*+ internal switches +*/
132
typedef enum {
133
        SS_SERVER_NOTACTIVE,   /*+ SS is not active +*/
134
        SS_SERVER_ACTIVE       /*+ SS is active +*/
135
} ss_status;
136
 
137
/*+ internal functions +*/
138
 
139
/*+ Used to store replenishment events +*/
140
/* Now we use static allocated array. In this way, no more then
141
   SS_MAX_REPLENISH replenishments can be posted.
142
typedef struct {
143
        struct timespec rtime;
144
        int ramount;
145
        replenishq *next;
146
} replenishq;
147
*/
148
 
149
/*+ Registration function:
150
    bandwidth_t b Max bandwidth used by the SS
151
    int flags     Options to be used in this level instance...
152
    LEVEL master  The level that must be used as master level
153
    int Cs        Server capacity
154
    int per       Server period           +*/
155
void SS_register_level(int flags, LEVEL master, int Cs, int per);
156
 
157
/*+ Returns the used bandwidth of a level +*/
158
bandwidth_t SS_usedbandwidth(LEVEL l);
159
 
160
/*+ Returns tha available capacity +*/
161
int SS_availCs(LEVEL l);
162
 
163
#endif