/*
* 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"
/*
* 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>
#include <sys/inttypes.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
#endif
/*
* Note that mutex_init is not called on the mutex in beep_state,
* But assumes that zeroed memory does not need to call mutex_init,
* as documented in mutex.c
*/
{BEEP_TYPE4, 2000, 0},
};
/*
* beep_init:
* Allocate the beep_queue structure
* Initialize beep_state structure
* Called from beep driver attach routine
*/
int
{
"beep_init(0x%lx, 0x%lx, 0x%lx, 0x%lx) : start.",
(unsigned long) arg,
(unsigned long) beep_on_func,
(unsigned long) beep_off_func,
(unsigned long) beep_freq_func));
"beep_init : beep_state already initialized."));
return (DDI_SUCCESS);
}
KM_SLEEP);
"beep_init : beep_queue kmem_zalloc(%d) = 0x%lx.",
(int)sizeof (beep_entry_t) * beep_queue_size,
(unsigned long)queue));
"beep_init : kmem_zalloc of beep_queue failed."));
return (DDI_FAILURE);
}
beep_state.timeout_id = 0;
beep_state.queue_head = 0;
beep_state.queue_tail = 0;
return (DDI_SUCCESS);
}
int
beep_fini(void)
{
(void) beeper_off();
"beep_fini : beep_state already uninitialized."));
return (0);
}
beep_state.timeout_id = 0;
beep_state.queue_head = 0;
beep_state.queue_tail = 0;
beep_state.queue_size = 0;
return (0);
}
int
beeper_off(void)
{
return (ENXIO);
}
beep_state.timeout_id = 0;
}
}
beep_state.queue_head = 0;
beep_state.queue_tail = 0;
return (0);
}
int
{
/*
* The frequency value is limited to the range of [0 - 32767]
*/
return (EINVAL);
break;
}
return (EINVAL);
}
return (0);
}
/*
* beep :
* Start beeping for period specified by the type value,
* from the value in the beep_param structure in milliseconds.
*/
int
{
break;
}
/* If type doesn't match, return silently without beeping */
return (EINVAL);
}
}
/*ARGSUSED*/
int
{
/*
* No-op at this time.
*
* Don't think we can make this work in general, as tem_safe
* has a requirement of no mutexes, but kbd sends messages
* through streams.
*/
return (0);
}
/*
* beeper_on :
* Turn the beeper on
*/
int
{
int status = 0;
break;
}
/* If type doesn't match, return silently without beeping */
return (EINVAL);
}
/* Start another beep only if the previous one is over */
}
} else {
}
return (status);
}
int
{
int next;
int status = 0;
duration));
/*
* The frequency value is limited to the range of [0 - 32767]
*/
return (EINVAL);
/* If already processing a beep, queue this one */
if (frequency != 0) {
next = 0;
/*
* If there is room in the queue,
* add this entry
*/
} else {
}
}
/* Start another beep only if the previous one is over */
if (frequency != 0) {
/*
* Set timeout for ending the beep after the
* specified time
*/
}
} else {
}
return (status);
}
/*
* Turn the beeper off which had been turned on from beep()
* for a specified period of time
*/
/*ARGSUSED*/
void
{
int frequency;
int duration;
int next;
beep_state.timeout_id = 0;
return;
}
}
next++;
next = 0;
if (frequency != 0) {
}
/* Set timeout for ending the beep after the specified time */
}
}
/*
* Return true (1) if we are sounding a tone.
*/
int
beep_busy(void)
{
int status;
return (status);
}