Subversion Repositories shark

Rev

Rev 922 | 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
 ------------
922 pj 24
 CVS :        $Id: var.h,v 1.5 2005-01-08 14:50:58 pj Exp $
2 pj 25
 
26
 File:        $File$
922 pj 27
 Revision:    $Revision: 1.5 $
28
 Last update: $Date: 2005-01-08 14:50:58 $
2 pj 29
 ------------
30
 
31
Kernel global variables
32
 
33
**/
34
 
35
/*
36
 * Copyright (C) 2000 Paolo Gai
37
 *
38
 * This program is free software; you can redistribute it and/or modify
39
 * it under the terms of the GNU General Public License as published by
40
 * the Free Software Foundation; either version 2 of the License, or
41
 * (at your option) any later version.
42
 *
43
 * This program is distributed in the hope that it will be useful,
44
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
45
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46
 * GNU General Public License for more details.
47
 *
48
 * You should have received a copy of the GNU General Public License
49
 * along with this program; if not, write to the Free Software
50
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
51
 *
52
 */
53
 
54
#ifndef __KERNEL_VAR_H__
55
#define __KERNEL_VAR_H__
56
 
57
#include <ll/ll.h>
58
#include <sys/types.h>
59
#include <kernel/descr.h>
1689 fabio 60
#include <arch/sys/cdefs.h>
2 pj 61
 
79 pj 62
__BEGIN_DECLS
63
 
2 pj 64
/*---------------------------------------------------------------------*/
65
/* Kernel global variables: system queues & clock counters ...         */
66
/*---------------------------------------------------------------------*/
67
 
68
extern proc_des      proc_table[];     /*+ Process descriptor table   +*/
38 pj 69
 
2 pj 70
extern level_des    *level_table[];    /*+ Level descriptor table     +*/
38 pj 71
/* for a description of the following fields, look in kernel/kern.c */
72
extern size_t level_size[];
73
extern int level_used[];
74
extern int level_first;
75
extern int level_last;
76
extern int level_free;
77
extern int level_next[];
78
extern int level_prev[];
79
 
2 pj 80
extern resource_des *resource_table[]; /*+ Resource descriptor table  +*/
81
 
82
 
83
extern PID exec;              /*+ task suggested by the scheduler     +*/
84
extern PID exec_shadow;       /*+ task really executed                +*/
85
 
29 pj 86
extern IQUEUE freedesc;        /*+ Free descriptor handled as a queue  +*/
2 pj 87
 
88
extern TIME  sys_tick;        /*+ System tick (in usec)               +*/
89
extern struct timespec schedule_time;
90
                              /*+ Time at witch the last scheduler()
91
                                  was called                          +*/
92
 
93
extern int   cap_timer;       /*+ the capacity event posted when the
94
                                  task starts                         +*/
95
extern struct timespec cap_lasttime;
96
                              /*+ the time at whitch the capacity
97
                                  event is posted. Normally, it is
98
                                  equal to schedule_time              +*/
99
 
100
extern DWORD res_levels;      /*+ Resource levels active in the system +*/
101
 
102
extern int task_counter;      /*+ Application task counter. It represent
103
                                  the number of Application tasks in the
104
                                  system. When all Application Tasks end,
105
                                  also the system ends.                +*/
106
 
107
extern int system_counter;    /*+ System task counter. It represent
108
                                  the number of System tasks in the
109
                                  system with the NO_KILL flag reset.
110
                                  When all Application Tasks end,
111
                                  the system waits for the end of the
112
                                  system tasks and then it ends.       +*/
113
 
114
 
922 pj 115
extern int calling_runlevel_func; /*+ this variable is set to 1 into
2 pj 116
                                  call_runlevel_func (look at init.c)
117
                                  ad it is used because the task_activate
118
                                  (look at activate.c) must work in a
119
                                  different way when the system is in the
120
                                  global_context +*/
121
 
922 pj 122
#define EXIT_CALLED   1
123
#define _EXIT_CALLED  2
124
extern int _exit_has_been_called; /*+ this variable is set when _exit is
125
                                  called. in this case, the atexit
126
                                  functions will not be called.
127
                                  Values: - 0 neither exit or _exit
128
                                  have been called - 1 exit has been
129
                                  called - 2 _exit has been called +*/
130
 
131
extern CONTEXT global_context; /*+ Context used during initialization;
132
                                   It references also a safe stack      +*/
133
 
134
extern int runlevel;           /*+ this is the system runlevel... it
135
                                   may be from 0 to 4: 0 - init 1 -
136
                                   running 2 - shutdown 3 - before
137
                                   halting 4 - halting +*/
138
 
139
extern int event_noreschedule; /*+ This controls if the system needed
140
                                   to be rescheduled at the end of an
141
                                   IRQ/event or if must not because
142
                                   exit, _exit, or sys_abort_shutdown
143
                                   was called +*/
144
 
145
 
79 pj 146
__END_DECLS
2 pj 147
#endif /* __VAR_H__ */