Subversion Repositories shark

Rev

Rev 547 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
538 mauro 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
 *   Mauro Marinoni      <mauro.marinoni@unipv.it>
10
 *
11
 *
12
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
13
 *
14
 * http://www.sssup.it
15
 * http://retis.sssup.it
16
 * http://shark.sssup.it
17
 */
18
 
19
/*
20
 * Copyright (C) 2000 Paolo Gai
21
 *
22
 * This program is free software; you can redistribute it and/or modify
23
 * it under the terms of the GNU General Public License as published by
24
 * the Free Software Foundation; either version 2 of the License, or
25
 * (at your option) any later version.
26
 *
27
 * This program is distributed in the hope that it will be useful,
28
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30
 * GNU General Public License for more details.
31
 *
32
 * You should have received a copy of the GNU General Public License
33
 * along with this program; if not, write to the Free Software
34
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
35
 *
36
 */
37
 
38
#define __JOY_DEBUG__
39
//#define __JOY_DUMP__
40
 
41
#include <kernel/kern.h>
42
 
43
#include "../include/drivers/shark_input26.h"
44
#include "../include/drivers/shark_joy26.h"
45
 
46
#include <kernel/func.h>
47
 
48
/* Devices */
49
extern int ns558_init(void);
50
extern int ns558_exit(void);
51
 
52
extern int analog_init(void);
53
extern int analog_exit(void);
54
 
55
extern int joydump_init(void);
56
extern int joydump_exit(void);
57
 
58
/* Handler */
59
extern int joystick_init(void);
60
extern int joystick_exit(void);
61
 
62
extern int input_installed;
63
 
64
/* User Functions */
65
 
66
/* Init the Linux Joystick Driver */
67
int JOY26_init() {
68
 
69
        int ret;
70
 
71
        if (input_installed == FALSE)
72
                if (INPUT26_init()) {
73
                        printk(KERN_ERR "Unable to open Input SubSystem.\n");
74
                        return -1;
75
                }
76
 
77
        ret = ns558_init();
78
        if (ret) {
79
                printk(KERN_ERR "Gameport_Init return: %d\n", ret);
80
                return -1;
81
        }
82
 
83
#ifdef __JOY_DUMP__
84
        ret = joydump_init();
85
#else
86
        ret = analog_init();
87
#endif
88
        if (ret) {
89
                printk(KERN_ERR "Joystick_Device_Init return: %d\n", ret);
90
                return -1;
91
        }
92
 
93
        ret = joystick_init();
94
        if (ret) {
95
                printk(KERN_ERR "Joystick_Handler_Init return: %d\n", ret);
96
                return -1;
97
        }
98
 
99
        return 0;
100
}
101
 
102
int JOY26_close() {
103
 
104
        joystick_exit();
105
#ifdef __JOY_DUMP__
106
        joydump_exit();
107
#else
108
        analog_exit();
109
#endif
110
        ns558_exit();
111
        return 0;
112
}