1 /* $NetBSD: isabeep.c,v 1.2 2000/06/29 07:47:52 mrg Exp $ */ 2 3 /* 4 * Copyright (c) 1995, 1996 Carnegie-Mellon University. 5 * All rights reserved. 6 * 7 * Author: Chris G. Demetriou 8 * 9 * Permission to use, copy, modify and distribute this software and 10 * its documentation is hereby granted, provided that both the copyright 11 * notice and this permission notice appear in all copies of the 12 * software, derivative works or modified versions, and any portions 13 * thereof, and that both notices appear in supporting documentation. 14 * 15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 18 * 19 * Carnegie Mellon requests users of this software to return to 20 * 21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 22 * School of Computer Science 23 * Carnegie Mellon University 24 * Pittsburgh PA 15213-3890 25 * 26 * any improvements or extensions that they make and grant Carnegie the 27 * rights to redistribute these changes. 28 */ 29 30 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 31 32 #include <sys/types.h> 33 #include <sys/param.h> 34 #include <sys/time.h> 35 #include <sys/systm.h> 36 #include <sys/errno.h> 37 #include <sys/device.h> 38 #include <uvm/uvm_extern.h> 39 40 #include <dev/isa/isavar.h> 41 42 #include "pcppi.h" 43 #if NPCPPI > 0 44 #include <dev/isa/pcppivar.h> 45 46 int isabeepmatch __P((struct device *, struct cfdata *, void *)); 47 void isabeepattach __P((struct device *, struct device *, void *)); 48 49 struct cfattach isabeep_ca = { 50 sizeof(struct device), isabeepmatch, isabeepattach 51 }; 52 53 static int ppi_attached; 54 static pcppi_tag_t ppicookie; 55 56 int 57 isabeepmatch(parent, match, aux) 58 struct device *parent; 59 struct cfdata *match; 60 void *aux; 61 { 62 return (!ppi_attached); 63 } 64 65 void 66 isabeepattach(parent, self, aux) 67 struct device *parent, *self; 68 void *aux; 69 { 70 printf("\n"); 71 72 ppicookie = ((struct pcppi_attach_args *)aux)->pa_cookie; 73 ppi_attached = 1; 74 } 75 #endif 76 77 void 78 isabeep(pitch, period) 79 int pitch, period; 80 { 81 #if NPCPPI > 0 82 if (ppi_attached) 83 pcppi_bell(ppicookie, pitch, period, 0); 84 #endif 85 } 86