Subversion Repositories shark

Rev

Rev 38 | Go to most recent revision | 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: posix.h,v 1.3 2003-03-13 13:39:04 pj Exp $
2 pj 25
 
26
 File:        $File$
80 pj 27
 Revision:    $Revision: 1.3 $
28
 Last update: $Date: 2003-03-13 13:39:04 $
2 pj 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>
80 pj 99
#include "ll/sys/cdefs.h"
2 pj 100
 
80 pj 101
__BEGIN_DECLS
102
 
2 pj 103
extern TASK __init__(void *arg);
104
 
105
 
106
 
107
/*+ Const: +*/
108
#define POSIX_MINIMUM_SLICE    1000 /*+ Minimum Timeslice +*/
109
#define POSIX_MAXIMUM_SLICE  500000 /*+ Maximum Timeslice +*/
110
 
111
#define POSIX_MAIN_YES            1 /*+ The level creates the main +*/
112
#define POSIX_MAIN_NO             0 /*+ The level does'nt create the main +*/
113
 
114
/*+ Registration function:
115
    TIME slice                the slice for the Round Robin queue
116
    int createmain            1 if the level creates the main task 0 otherwise
38 pj 117
    struct multiboot_info *mb used if createmain specified  
118
 
119
    returns the level number at which the module has been registered.
120
+*/
121
LEVEL POSIX_register_level(TIME slice,
2 pj 122
                          int createmain,
123
                          struct multiboot_info *mb,
124
                          int prioritylevels);
125
 
126
/*+ this function forces the running task to go to his queue tail,
127
    then calls the scheduler and changes the context
128
    (it works only on the POSIX level) +*/
129
int POSIX_sched_yield(LEVEL l);
130
 
131
/* the following functions have to be called with interruptions DISABLED! */
132
 
133
/*+ this function returns the maximum level allowed for the POSIX level +*/
134
int POSIX_get_priority_max(LEVEL l);
135
 
136
/*+ this function returns the default timeslice for the POSIX level +*/
137
int POSIX_rr_get_interval(LEVEL l);
138
 
139
/*+ this functions returns some paramaters of a task;
140
    policy must be NRT_RR_POLICY or NRT_FIFO_POLICY;
141
    priority must be in the range [0..prioritylevels]
142
    returns ENOSYS or ESRCH if there are problems +*/
143
int POSIX_getschedparam(LEVEL l, PID p, int *policy, int *priority);
144
 
145
/*+ this functions sets paramaters of a task +*/
146
int POSIX_setschedparam(LEVEL l, PID p, int policy, int priority);
147
 
80 pj 148
__END_DECLS
2 pj 149
#endif
150
 
151
/*
152
MANCANO
153
13.3.6 GETPRIORITYMin da mettere a 0
154
*/