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: posixstar.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 scheduling module compatible with POSIX
32
 specifications
33
 
34
 Title:
35
   POSIX version 1
36
 
37
 Task Models Accepted:
38
   NRT_TASK_MODEL - Non-Realtime Tasks
39
     weight field is ignored
40
     slice  field is used to set the slice of a task, if it is !=0
41
     policy field is ignored
42
     inherit field is ignored
43
 
44
 Description:
45
   This module schedule his tasks following the POSIX specifications...
46
 
47
   A task can be scheduled in a Round Robin way or in a FIFO way.
48
   The tasks have also a priority field.
49
 
50
   The slices can be different one task from one another.
51
 
52
   The module can SAVE or SKIP activations
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
 
59
 Restrictions & special features:
60
   - if specified, it creates at init time a task,
61
     called "Main", attached to the function __init__().
62
   - There must be only one module in the system that creates a task
63
     attached to the function __init__().
64
   - The level tries to guarantee that a RR task uses a "full" timeslice
65
     before going to the queue tail. "full" means that a task can execute
66
     a maximum time of slice+sys_tick due to the approx. done by
67
     the Virtual Machine. If a task execute more time than the slice,
68
     the next time it execute less...
69
 
70
**/
71
 
72
/*
73
 * Copyright (C) 2000 Paolo Gai
74
 *
75
 * This program is free software; you can redistribute it and/or modify
76
 * it under the terms of the GNU General Public License as published by
77
 * the Free Software Foundation; either version 2 of the License, or
78
 * (at your option) any later version.
79
 *
80
 * This program is distributed in the hope that it will be useful,
81
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
83
 * GNU General Public License for more details.
84
 *
85
 * You should have received a copy of the GNU General Public License
86
 * along with this program; if not, write to the Free Software
87
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
88
 *
89
 */
90
 
91
 
92
#ifndef __POSIXSTAR_H__
93
#define __POSIXSTAR_H__
94
 
95
#include <ll/ll.h>
96
#include <kernel/config.h>
97
#include <sys/types.h>
98
#include <kernel/types.h>
99
//#define POSIXSTAR_DEBUG
100
 
101
/*+ Const: +*/
102
#define POSIXSTAR_MINIMUM_SLICE    1000 /*+ Minimum Timeslice +*/
103
#define POSIXSTAR_MAXIMUM_SLICE  500000 /*+ Maximum Timeslice +*/
104
 
105
/*+ Registration function:
106
    TIME slice                the slice for the Round Robin queue
107
    int createmain            1 if the level creates the main task 0 otherwise
108
    struct multiboot_info *mb used if createmain specified  
109
 
110
    returns the level number at which the module has been registered.
111
+*/
112
LEVEL POSIXSTAR_register_level(int budget, int master, TIME slice,
113
                          int prioritylevels);
114
 
115
/*+ this function forces the running task to go to his queue tail,
116
    then calls the scheduler and changes the context
117
    (it works only on the POSIX level) +*/
118
int POSIXSTAR_sched_yield(LEVEL l);
119
 
120
/* the following functions have to be called with interruptions DISABLED! */
121
 
122
/*+ this function returns the maximum level allowed for the POSIX level +*/
123
int POSIXSTAR_get_priority_max(LEVEL l);
124
 
125
/*+ this function returns the default timeslice for the POSIX level +*/
126
int POSIXSTAR_rr_get_interval(LEVEL l);
127
 
128
/*+ this functions returns some paramaters of a task;
129
    policy must be NRT_RR_POLICY or NRT_FIFO_POLICY;
130
    priority must be in the range [0..prioritylevels]
131
    returns ENOSYS or ESRCH if there are problems +*/
132
int POSIXSTAR_getschedparam(LEVEL l, PID p, int *policy, int *priority);
133
 
134
/*+ this functions sets paramaters of a task +*/
135
int POSIXSTAR_setschedparam(LEVEL l, PID p, int policy, int priority);
136
 
137
#endif
138
 
139
/*
140
MANCANO
141
13.3.6 GETPRIORITYMin da mettere a 0
142
*/