Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1624 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
 ------------
24
 CVS :        $Id: cbsstar.h,v 1.1.1.1 2004-05-24 17:54:51 giacomo Exp $
25
 
26
 File:        $File$
27
 Revision:    $Revision: 1.1.1.1 $
28
 Last update: $Date: 2004-05-24 17:54:51 $
29
 ------------
30
 
31
 This file contains the budget support for the multiapplication
32
 scheduling algorithm proposed in the framework of the FIRST Project
33
 
34
 Title:
35
   CBSSTAR
36
 
37
 Task Models Accepted:
38
   None!
39
 
40
 Guest Models Accepted:
41
   BUDGET_TASK_MODEL - A task that is attached to a budget
42
     int b; --> the number of the budget which the task is attached to
43
 
44
 Description:
45
   This module schedule its tasks following the CBS scheme.
46
   Every task is inserted using the guest calls.
47
 
48
   The module defines a limited set of budgets that the application
49
   can use. Every guest task will use a particular budget; FIFO
50
   scheduling is used inside a budget to schedule more than one ready
51
   task attached to the same budget.
52
 
53
   The tasks are inserted in an EDF level (or similar) with a JOB_TASK_MODEL,
54
   and the CBS level expects that the task is scheduled with the absolute
55
   deadline passed in the model.
56
 
57
   This module tries to implement a simplified version of the guest
58
   task interface:
59
   - To insert a guest task, use guest_create
60
   - When a task is dispatched, use guest_dispatch
61
   - When a task have to be suspended, you have to use:
62
     -> preemption: use guest_epilogue
63
     -> synchronization, end: use guest_end
64
   Remember: no check is done on the budget number passed with the model!!!
65
 
66
 Exceptions raised:
67
   XUNVALID_TASK
68
     This level doesn't support normal tasks, but just guest tasks.
69
     When a task operation is called, an exception is raised.
70
 
71
 Restrictions & special features:
72
   - This level doesn't manage the main task.
73
   - At init time we have to specify:
74
       . guarantee check
75
          (when all task are created the system will check that the task_set
76
          will not use more than the available bandwidth)
77
   - A function to return the used bandwidth of the level is provided.
78
 
79
   - A function is provided to allocate a buffer.
80
*/
81
 
82
/*
83
 * Copyright (C) 2002 Paolo Gai
84
 *
85
 * This program is free software; you can redistribute it and/or modify
86
 * it under the terms of the GNU General Public License as published by
87
 * the Free Software Foundation; either version 2 of the License, or
88
 * (at your option) any later version.
89
 *
90
 * This program is distributed in the hope that it will be useful,
91
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
92
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
93
 * GNU General Public License for more details.
94
 *
95
 * You should have received a copy of the GNU General Public License
96
 * along with this program; if not, write to the Free Software
97
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
98
 *
99
 */
100
 
101
 
102
#ifndef __CBSSTAR_H__
103
#define __CBSSTAR_H__
104
 
105
#include <kernel/kern.h>
106
 
107
//#include <ll/ll.h>
108
//#include <kernel/config.h>
109
//#include <sys/types.h>
110
//#include <kernel/types.h>
111
//#include <modules/codes.h>
112
 
113
/* -----------------------------------------------------------------------
114
   BUDGET_TASK_MODEL: a model for guest tasks
115
   ----------------------------------------------------------------------- */
116
 
117
#define BUDGET_PCLASS 0x0600                            
118
 
119
typedef struct {
120
  TASK_MODEL t;
121
  int b;
122
} BUDGET_TASK_MODEL;
123
 
124
#define budget_task_default_model(m,buf)                          \
125
                        task_default_model((m).t, BUDGET_PCLASS), \
126
                        (m).b    = (buf);
127
 
128
 
129
 
130
/* some constants for registering the Module in the right place */
131
#define CBSSTAR_LEVELNAME       "CBSSTAR"
132
#define CBSSTAR_LEVEL_CODE       106
133
#define CBSSTAR_LEVEL_VERSION    1
134
 
135
 
136
 
137
 
138
/* Registration function:
139
    int N         Maximum number of budgets allocated for the applications
140
    LEVEL master  the level that must be used as master level for the
141
                  CBS tasks
142
*/
143
LEVEL CBSSTAR_register_level(int n, LEVEL master);
144
 
145
/* Allocates a budget to be used for an application.
146
   Input parameters:
147
     Q The budget
148
     T The period of the budget
149
   Return value:
150
     0..N The ID of the budget
151
     -1   no more free budgets
152
     -2   The budgets allocated locally to this module have bandwidth > 1
153
     -3   wrong LEVEL id
154
*/
155
int CBSSTAR_setbudget(LEVEL l, TIME Q, TIME T);
156
 
157
#endif