beeper.c revision 8ffc942d5d69695c8690274a7a3649bf0a80d3fb
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Simple beeper support for PC platform, using standard timer 2 beeper.
* Eventually this should probably be in a driver.
*/
#include <sys/inttypes.h>
#define NELEM(a) (sizeof (a) / sizeof ((a)[0]))
#define TIMER 0x40
#define TONE_CTL 0x61
#define T_CTLWORD 0xB6
#define TONE_ON 0x03
static struct beep_state {
} beep_state;
static void beep_end(void *);
static void beep_on(void);
static void beep_off(void);
static void beep_frequency(int frequency);
struct beep_params {
int frequency; /* Hz */
int duration; /* milliseconds */
};
struct beep_params beep_params[] = {
{ BEEP_TYPE4, 2000, 0 },
};
/* ARGSUSED */
void
{
struct beep_params *bp;
/*
* In the fullness of time, we would use the "type" argument
* to determine frequency, volume, duration, waveform, sample
* to be played, ...
*/
break;
}
beep_on();
}
}
/* ARGSUSED */
void
{
/* No-op at this time */
}
static void
{
/* Perhaps we should enforce a small "quiet" period between beeps. */
beep_off();
}
static void
beep_frequency(int frequency)
{
int counter;
if (counter > 65535)
counter = 65535;
else if (counter < 1)
counter = 1;
}
static void
beep_on(void)
{
}
static void
beep_off(void)
{
}
void
{
struct beep_params *bp;
break;
}
beep_on();
}
}
}
void
{
beep_off();
}
}
int
{
struct beep_params *bp;
/*
* The frequency value is limited to the range of [0 - 32767]
*/
return (EINVAL);
break;
}
return (0);
}