beep.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1999-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This is the Beep module for supporting keyboard beep for keyboards
* that do not have the beeping feature within themselves
*
*/
#include <sys/ddi_impldefs.h>
/*
* Debug stuff
* BEEP_DEBUG used for errors
* BEEP_DEBUG1 prints when beep_debug > 1 and used for normal messages
*/
#ifdef DEBUG
int beep_debug = 0;
#else
#define BEEP_DEBUG(args)
#define BEEP_DEBUG1(args)
#endif
/* Prototypes */
static void beep_timeout();
struct beep_params {
int frequency; /* Hz */
int duration; /* milliseconds */
};
struct beep_params beep_params[] = {
BEEP_TYPE4, 2000, 0,
};
/* beep_state structure */
typedef struct beep_state {
/* Indicates if a beep command is already in progress */
/* Address of the hw-dependent beep_freq function */
void (*beep_state_beep_freq) (dev_info_t *, int);
/* Address of the hw-dependent beep_on function */
void (*beep_state_beep_on) (dev_info_t *);
/* Address of the hw-dependent beep_off function */
void (*beep_state_beep_off) (dev_info_t *);
/* Timeout id for the beep() timeout function */
/* Mutex */
} beep_state_t;
/*
* beep_init :
* Alloc beep_state structure
* called from the beep driver attach routine
*/
int
void (*hwbeep_beep_off)(dev_info_t *),
void (*hwbeep_beep_freq)(dev_info_t *, int))
{
return (DDI_FAILURE);
}
(hwbeep_beep_freq == NULL)) {
"beep_init : Null routines passed for registration."));
return (DDI_FAILURE);
}
if (beep_statep == NULL) {
"beep_init : kmem_zalloc failed."));
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*
* beep :
* Start beeping for period specified by 'time' (in microsecond)
*/
void
{
struct beep_params *bp;
if (beep_statep == NULL) {
return;
}
break;
}
/* If type doesn't match, return silently without beeping */
return;
}
/* Beep only when no previous beep is in progress */
/* Set timeout for ending the beep after the specified time */
NULL,
}
}
/*ARGSUSED*/
void
{
/* No-op at this time */
}
/*
* beeper_on :
* Turn the beeper on
*/
void
{
struct beep_params *bp;
if (beep_statep == NULL) {
return;
}
break;
}
/* If type doesn't match, return silently */
return;
}
/* Start another beep only if the previous one is over */
}
}
/*
* beeper_off :
* Turn the beeper off
*/
void
{
if (beep_statep == NULL) {
return;
}
}
}
/*
* Turn the beeper off which had been turned on from beep()
* for a specified period of time
*/
void
{
}
}