Subversion Repositories shark

Rev

Rev 1375 | Rev 1382 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1120 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
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
9
 *
10
 * http://www.sssup.it
11
 * http://retis.sssup.it
12
 * http://shark.sssup.it
13
 */
14
 
15
/*
16
 *
17
 * This program is free software; you can redistribute it and/or modify
18
 * it under the terms of the GNU General Public License as published by
19
 * the Free Software Foundation; either version 2 of the License, or
20
 * (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30
 *
31
*/
32
 
33
#include "kernel/kern.h"
1377 giacomo 34
#include "unistd.h"
1120 pj 35
 
1375 giacomo 36
#include "drivers/shark_linuxc26.h"
37
#include "drivers/shark_pci26.h"
1120 pj 38
 
1377 giacomo 39
PID shutdown_task_PID;
40
 
1375 giacomo 41
int device_drivers_init() {
42
 
43
        LINUXC26_register_module();
44
 
45
        PCI26_init();
1120 pj 46
 
1375 giacomo 47
        return 0;
48
 
1120 pj 49
}
50
 
1375 giacomo 51
int device_drivers_close() {
52
 
53
        return 0;
54
 
1120 pj 55
}
56
 
1377 giacomo 57
TASK shutdown_task_body(void *arg) {
1375 giacomo 58
 
1377 giacomo 59
        device_drivers_close();
60
 
61
        sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
62
 
63
        sys_end();
64
 
65
        return NULL;
66
 
67
}
68
 
69
void set_shutdown_task() {
70
 
71
        NRT_TASK_MODEL nrt;
72
 
73
        nrt_task_default_model(nrt);
74
 
75
        shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL);
76
        if (shutdown_task_PID == NIL) {
77
                sys_shutdown_message("Error: Cannot create shutdown task\n");
78
                sys_end();
79
        }
80
 
81
}
82
 
83
 
1120 pj 84
int main (int argc, char *argv[])
85
{
86
 
1377 giacomo 87
        set_shutdown_task();
1375 giacomo 88
 
89
        device_drivers_init();
90
 
91
        cprintf("Init Done...\n");
92
 
1377 giacomo 93
        sleep(5);
94
 
95
        task_activate(shutdown_task_PID);
1375 giacomo 96
 
97
        return 0;
98
 
1120 pj 99
}