Subversion Repositories shark

Rev

Details | 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: posix.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 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 __POSIX_H__
93
#define __POSIX_H__
94
 
95
#include <ll/ll.h>
96
#include <kernel/config.h>
97
#include <sys/types.h>
98
#include <kernel/types.h>
99
#include <modules/codes.h>
100
 
101
extern TASK __init__(void *arg);
102
 
103
 
104
 
105
/*+ Const: +*/
106
#define POSIX_MINIMUM_SLICE    1000 /*+ Minimum Timeslice +*/
107
#define POSIX_MAXIMUM_SLICE  500000 /*+ Maximum Timeslice +*/
108
 
109
#define POSIX_MAIN_YES            1 /*+ The level creates the main +*/
110
#define POSIX_MAIN_NO             0 /*+ The level does'nt create the main +*/
111
 
112
/*+ Registration function:
113
    TIME slice                the slice for the Round Robin queue
114
    int createmain            1 if the level creates the main task 0 otherwise
115
    struct multiboot_info *mb used if createmain specified   +*/
116
void POSIX_register_level(TIME slice,
117
                          int createmain,
118
                          struct multiboot_info *mb,
119
                          int prioritylevels);
120
 
121
/*+ this function forces the running task to go to his queue tail,
122
    then calls the scheduler and changes the context
123
    (it works only on the POSIX level) +*/
124
int POSIX_sched_yield(LEVEL l);
125
 
126
/* the following functions have to be called with interruptions DISABLED! */
127
 
128
/*+ this function returns the maximum level allowed for the POSIX level +*/
129
int POSIX_get_priority_max(LEVEL l);
130
 
131
/*+ this function returns the default timeslice for the POSIX level +*/
132
int POSIX_rr_get_interval(LEVEL l);
133
 
134
/*+ this functions returns some paramaters of a task;
135
    policy must be NRT_RR_POLICY or NRT_FIFO_POLICY;
136
    priority must be in the range [0..prioritylevels]
137
    returns ENOSYS or ESRCH if there are problems +*/
138
int POSIX_getschedparam(LEVEL l, PID p, int *policy, int *priority);
139
 
140
/*+ this functions sets paramaters of a task +*/
141
int POSIX_setschedparam(LEVEL l, PID p, int policy, int priority);
142
 
143
#endif
144
 
145
/*
146
MANCANO
147
13.3.6 GETPRIORITYMin da mettere a 0
148
*/