Subversion Repositories shark

Rev

Rev 519 | Rev 549 | 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>
 *   (see the web pages for full authors list)
 *
 * 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 __MOUSE_DEBUG__ 1

#include <kernel/kern.h>

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

/* Devices */
extern int pcspkr_init(void);
extern int pcspkr_exit(void);

/* Handlers */
extern int  speaker_init(void);
extern void speaker_exit(void);

/* Functions */
extern void spk_mksound(unsigned int hz, unsigned int ticks);
extern void spk_nosound(unsigned long ignored);

extern int input_installed;

/* User Functions */

void speaker_sound(unsigned int hz, unsigned int ticks)
{
        spk_mksound(hz, ticks);
}

void speaker_mute(void)
{
        spk_nosound(0);
}

/* Init the Linux Speaker Driver */
int SPEAK26_init()
{
        int ret;

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

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

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

int SPEAK26_close()
{
        speaker_exit();
        pcspkr_exit();
        return 0;
}