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