xref: /freebsd/sys/x86/include/ppireg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1d1f4c44aSDmitry Chagin /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3d1f4c44aSDmitry Chagin  *
4d1f4c44aSDmitry Chagin  * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved.
5d1f4c44aSDmitry Chagin  *
6d1f4c44aSDmitry Chagin  * Redistribution and use in source and binary forms, with or without
7d1f4c44aSDmitry Chagin  * modification, are permitted provided that the following conditions
8d1f4c44aSDmitry Chagin  * are met:
9d1f4c44aSDmitry Chagin  * 1. Redistributions of source code must retain the above copyright
10d1f4c44aSDmitry Chagin  *    notice, this list of conditions and the following disclaimer.
11d1f4c44aSDmitry Chagin  * 2. Redistributions in binary form must reproduce the above copyright
12d1f4c44aSDmitry Chagin  *    notice, this list of conditions and the following disclaimer in the
13d1f4c44aSDmitry Chagin  *    documentation and/or other materials provided with the distribution.
14d1f4c44aSDmitry Chagin  *
15d1f4c44aSDmitry Chagin  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16d1f4c44aSDmitry Chagin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17d1f4c44aSDmitry Chagin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18d1f4c44aSDmitry Chagin  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
19d1f4c44aSDmitry Chagin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20d1f4c44aSDmitry Chagin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21d1f4c44aSDmitry Chagin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22d1f4c44aSDmitry Chagin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23d1f4c44aSDmitry Chagin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24d1f4c44aSDmitry Chagin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25d1f4c44aSDmitry Chagin  * SUCH DAMAGE.
26d1f4c44aSDmitry Chagin  */
27d1f4c44aSDmitry Chagin 
28d1f4c44aSDmitry Chagin #ifndef _MACHINE_PPIREG_H_
29d1f4c44aSDmitry Chagin #define _MACHINE_PPIREG_H_
30d1f4c44aSDmitry Chagin 
31d1f4c44aSDmitry Chagin #ifdef _KERNEL
32d1f4c44aSDmitry Chagin 
33d1f4c44aSDmitry Chagin #define	IO_PPI		0x61	/* Programmable Peripheral Interface */
34d1f4c44aSDmitry Chagin 
35d1f4c44aSDmitry Chagin /*
36d1f4c44aSDmitry Chagin  * PPI speaker control values
37d1f4c44aSDmitry Chagin  */
38d1f4c44aSDmitry Chagin 
39d1f4c44aSDmitry Chagin #define	PIT_ENABLETMR2	0x01	/* Enable timer/counter 2 */
40d1f4c44aSDmitry Chagin #define	PIT_SPKRDATA	0x02	/* Direct to speaker */
41d1f4c44aSDmitry Chagin 
42d1f4c44aSDmitry Chagin #define	PIT_SPKR	(PIT_ENABLETMR2 | PIT_SPKRDATA)
43d1f4c44aSDmitry Chagin 
44d1f4c44aSDmitry Chagin #define	ppi_spkr_on()	outb(IO_PPI, inb(IO_PPI) | PIT_SPKR)
45d1f4c44aSDmitry Chagin #define	ppi_spkr_off()	outb(IO_PPI, inb(IO_PPI) & ~PIT_SPKR)
46d1f4c44aSDmitry Chagin 
47d1f4c44aSDmitry Chagin #endif /* _KERNEL */
48d1f4c44aSDmitry Chagin 
49d1f4c44aSDmitry Chagin #endif /* _MACHINE_PPIREG_H_ */
50