uts: make emu10k non-verbose
[unleashed.git] / include / sys / beep.h
blob5df351da6a681ca9a98db4fa0de942f59440ad8c
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_BEEP_H
27 #define _SYS_BEEP_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <sys/mutex.h>
34 * Interface to the system beeper.
36 * (This is the API, not the hardware interface.)
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
43 #if defined(_KERNEL)
45 /* beep_entry structure */
47 typedef struct beep_entry {
48 unsigned short frequency;
49 unsigned short duration;
50 } beep_entry_t;
52 typedef void (*beep_on_func_t)(void *arg);
54 typedef void (*beep_off_func_t)(void *arg);
56 typedef void (*beep_freq_func_t)(void *arg, int freq);
58 /* beep_state structure */
60 typedef struct beep_state {
62 /* Private data for beep_freq, beep_on, and beep_off functions */
63 void *arg;
65 /* Indicates if a beep command is already in progress */
66 enum {BEEP_UNINIT = 0, BEEP_OFF = 1,
67 BEEP_TIMED = 2, BEEP_ON = 3} mode;
69 /* Address of the hw-dependent beep_freq function */
70 beep_freq_func_t beep_freq;
72 /* Address of the hw-dependent beep_on function */
73 beep_on_func_t beep_on;
75 /* Address of the hw-dependent beep_off function */
76 beep_off_func_t beep_off;
78 /* Timeout id for the beep_timeout() function */
79 timeout_id_t timeout_id;
81 /* Mutex protecting mode, timeout_id, queue_head, queue_tail, */
82 /* and queue */
83 kmutex_t mutex;
85 /* Index of head of queue */
86 int queue_head;
88 /* Index of tail of queue */
89 int queue_tail;
91 /* Max queue size */
92 int queue_size;
94 /* Circular ring buffer */
95 beep_entry_t *queue;
96 } beep_state_t;
98 #define BEEP_QUEUE_SIZE 1000
100 /* BEEP_DEFAULT is a sentinel for the beep_param table. */
101 enum beep_type { BEEP_DEFAULT = 0, BEEP_CONSOLE = 1, BEEP_TYPE4 = 2 };
103 typedef struct beep_params {
104 enum beep_type type;
105 int frequency; /* Hz */
106 int duration; /* milliseconds */
107 } beep_params_t;
110 extern int beep_init(void *arg,
111 beep_on_func_t beep_on_func,
112 beep_off_func_t beep_off_func,
113 beep_freq_func_t beep_freq_func);
115 extern int beep_fini(void);
117 extern int beeper_off(void);
119 extern int beeper_freq(enum beep_type type, int freq);
121 extern int beep(enum beep_type type);
123 extern int beep_polled(enum beep_type type);
125 extern int beeper_on(enum beep_type type);
127 extern int beep_mktone(int frequency, int duration);
129 extern void beep_timeout(void *arg);
131 extern int beep_busy(void);
133 #endif /* _KERNEL */
135 #ifdef __cplusplus
137 #endif
139 #endif /* _SYS_BEEP_H */