xref: /netbsd/sys/dev/wscons/wsbelldata.h (revision 31467c43)
1*31467c43Snat /* $NetBSD: wsbelldata.h,v 1.2 2017/06/13 00:42:27 nat Exp $ */
289bbb6faSnat /*-
389bbb6faSnat  * Copyright (c) 2017 Nathanial Sloss <nathanialsloss@yahoo.com.au>
489bbb6faSnat  * All rights reserved.
589bbb6faSnat  *
689bbb6faSnat  * Redistribution and use in source and binary forms, with or without
789bbb6faSnat  * modification, are permitted provided that the following conditions
889bbb6faSnat  * are met:
989bbb6faSnat  * 1. Redistributions of source code must retain the above copyright
1089bbb6faSnat  *    notice, this list of conditions and the following disclaimer.
1189bbb6faSnat  * 2. Redistributions in binary form must reproduce the above copyright
1289bbb6faSnat  *    notice, this list of conditions and the following disclaimer in the
1389bbb6faSnat  *    documentation and/or other materials provided with the distribution.
1489bbb6faSnat  *
1589bbb6faSnat  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1689bbb6faSnat  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1789bbb6faSnat  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1889bbb6faSnat  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1989bbb6faSnat  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2089bbb6faSnat  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2189bbb6faSnat  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2289bbb6faSnat  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2389bbb6faSnat  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2489bbb6faSnat  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2589bbb6faSnat  * POSSIBILITY OF SUCH DAMAGE.
2689bbb6faSnat  */
2789bbb6faSnat 
2889bbb6faSnat #ifndef WSKBD_DEFAULT_BELL_PITCH
2989bbb6faSnat #define	WSKBD_DEFAULT_BELL_PITCH	1500	/* 1500Hz */
3089bbb6faSnat #endif
3189bbb6faSnat #ifndef WSKBD_DEFAULT_BELL_PERIOD
3289bbb6faSnat #define	WSKBD_DEFAULT_BELL_PERIOD	100	/* 100ms */
3389bbb6faSnat #endif
3489bbb6faSnat #ifndef WSKBD_DEFAULT_BELL_VOLUME
3589bbb6faSnat #define	WSKBD_DEFAULT_BELL_VOLUME	50	/* 50% volume */
3689bbb6faSnat #endif
3789bbb6faSnat 
38*31467c43Snat #define	SETBELL(dstp, srcp, dfltp)					\
39*31467c43Snat     do {								\
40*31467c43Snat 	(dstp)->pitch = ((srcp)->which & WSKBD_BELL_DOPITCH) ?		\
41*31467c43Snat 	    (srcp)->pitch : (dfltp)->pitch;				\
42*31467c43Snat 	(dstp)->period = ((srcp)->which & WSKBD_BELL_DOPERIOD) ?	\
43*31467c43Snat 	    (srcp)->period : (dfltp)->period;				\
44*31467c43Snat 	(dstp)->volume = ((srcp)->which & WSKBD_BELL_DOVOLUME) ?	\
45*31467c43Snat 	    (srcp)->volume : (dfltp)->volume;				\
46*31467c43Snat 	(dstp)->which = WSKBD_BELL_DOALL;				\
47*31467c43Snat     } while (0)
48*31467c43Snat 
4989bbb6faSnat static struct wskbd_bell_data wskbd_default_bell_data = {
5089bbb6faSnat 	WSKBD_BELL_DOALL,
5189bbb6faSnat 	WSKBD_DEFAULT_BELL_PITCH,
5289bbb6faSnat 	WSKBD_DEFAULT_BELL_PERIOD,
5389bbb6faSnat 	WSKBD_DEFAULT_BELL_VOLUME,
5489bbb6faSnat };
55