Subversion Repositories shark

Rev

Rev 547 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Project: S.Ha.R.K.
 *
 * Coordinators:
 *   Giorgio Buttazzo    <giorgio@sssup.it>
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *
 * Authors     :
 *   Mauro Marinoni      <mauro.marinoni@unipv.it>
 *
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


/*
 * Copyright (C) 2000 Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */


#define __JOY_DEBUG__
//#define __JOY_DUMP__

#include <kernel/kern.h>

#include "../include/drivers/shark_input26.h"
#include "../include/drivers/shark_joy26.h"

#include <kernel/func.h>

/* Devices */
extern int ns558_init(void);
extern int ns558_exit(void);

extern int analog_init(void);
extern int analog_exit(void);

extern int joydump_init(void);
extern int joydump_exit(void);

/* Handler */
extern int joystick_init(void);
extern int joystick_exit(void);

extern int input_installed;

/* User Functions */

/* Init the Linux Joystick Driver */
int JOY26_init() {

        int ret;

        if (input_installed == FALSE)
                if (INPUT26_init()) {
                        printk(KERN_ERR "Unable to open Input SubSystem.\n");
                        return -1;
                }

        ret = ns558_init();
        if (ret) {
                printk(KERN_ERR "Gameport_Init return: %d\n", ret);
                return -1;
        }

#ifdef __JOY_DUMP__
        ret = joydump_init();
#else
        ret = analog_init();
#endif
        if (ret) {
                printk(KERN_ERR "Joystick_Device_Init return: %d\n", ret);
                return -1;
        }

        ret = joystick_init();
        if (ret) {
                printk(KERN_ERR "Joystick_Handler_Init return: %d\n", ret);
                return -1;
        }
       
        return 0;
}

int JOY26_close() {

        joystick_exit();
#ifdef __JOY_DUMP__
        joydump_exit();
#else
        analog_exit();
#endif
        ns558_exit();
        return 0;
}