spkr.c (10653) | spkr.c (12502) |
---|---|
1/* 2 * spkr.c -- device driver for console speaker 3 * 4 * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 5 * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su> 6 * | 1/* 2 * spkr.c -- device driver for console speaker 3 * 4 * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 5 * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su> 6 * |
7 * $Id: spkr.c,v 1.16 1995/09/08 11:07:59 bde Exp $ | 7 * $Id: spkr.c,v 1.17 1995/09/09 18:09:55 davidg Exp $ |
8 */ 9 10#include "speaker.h" 11 12#if NSPEAKER > 0 13 14#include <sys/param.h> 15#include <sys/systm.h> 16#include <sys/kernel.h> 17#include <sys/errno.h> 18#include <sys/buf.h> 19#include <sys/proc.h> 20#include <sys/uio.h> 21#include <i386/isa/isa.h> 22#include <i386/isa/timerreg.h> 23#include <machine/clock.h> 24#include <machine/speaker.h> 25 | 8 */ 9 10#include "speaker.h" 11 12#if NSPEAKER > 0 13 14#include <sys/param.h> 15#include <sys/systm.h> 16#include <sys/kernel.h> 17#include <sys/errno.h> 18#include <sys/buf.h> 19#include <sys/proc.h> 20#include <sys/uio.h> 21#include <i386/isa/isa.h> 22#include <i386/isa/timerreg.h> 23#include <machine/clock.h> 24#include <machine/speaker.h> 25 |
26#ifdef JREMOD 27#include <sys/conf.h> 28#define CDEV_MAJOR 26 29static void spkr_devsw_install(); 30#endif /*JREMOD*/ 31 32#if defined(DEVFS) || defined(JREMOD) 33#include "sys/kernel.h" 34 |
|
26#ifdef DEVFS 27#include <sys/devfsext.h> | 35#ifdef DEVFS 36#include <sys/devfsext.h> |
28#include "sys/kernel.h" | |
29int spkropen(); | 37int spkropen(); |
38#endif |
|
30 31void spkrdev_init(void *data) /* data not used */ 32{ 33 void * x; | 39 40void spkrdev_init(void *data) /* data not used */ 41{ 42 void * x; |
43#ifdef JREMOD 44 spkr_devsw_install(); 45#endif /*JREMOD*/ 46#ifdef DEVFS |
|
34/* path name devsw minor type uid gid perm*/ 35 x=dev_add("/misc", "speaker", spkropen, 0, DV_CHR, 0, 0, 0600); | 47/* path name devsw minor type uid gid perm*/ 48 x=dev_add("/misc", "speaker", spkropen, 0, DV_CHR, 0, 0, 0600); |
49#endif 50 |
|
36} 37SYSINIT(spkrdev,SI_SUB_DEVFS, SI_ORDER_ANY, spkrdev_init, NULL) | 51} 52SYSINIT(spkrdev,SI_SUB_DEVFS, SI_ORDER_ANY, spkrdev_init, NULL) |
38#endif /*DEVFS*/ | 53#endif /*DEVFS*/ /* JREMOD */ |
39 40/**************** MACHINE DEPENDENT PART STARTS HERE ************************* 41 * 42 * This section defines a function tone() which causes a tone of given 43 * frequency and duration from the 80x86's console speaker. 44 * Another function endtone() is defined to force sound off, and there is 45 * also a rest() entry point to do pauses. 46 * --- 520 unchanged lines hidden (view full) --- 567 else 568 tone(ttp.frequency, ttp.duration); 569 } 570 return(0); 571 } 572 return(EINVAL); 573} 574 | 54 55/**************** MACHINE DEPENDENT PART STARTS HERE ************************* 56 * 57 * This section defines a function tone() which causes a tone of given 58 * frequency and duration from the 80x86's console speaker. 59 * Another function endtone() is defined to force sound off, and there is 60 * also a rest() entry point to do pauses. 61 * --- 520 unchanged lines hidden (view full) --- 582 else 583 tone(ttp.frequency, ttp.duration); 584 } 585 return(0); 586 } 587 return(EINVAL); 588} 589 |
590#ifdef JREMOD 591struct cdevsw spkr_cdevsw = 592 { spkropen, spkrclose, noread, spkrwrite, /*26*/ 593 spkrioctl, nostop, nullreset, nodevtotty,/* spkr */ 594 seltrue, nommap, NULL }; 595 596static spkr_devsw_installed = 0; 597 598static void spkr_devsw_install() 599{ 600 dev_t descript; 601 if( ! spkr_devsw_installed ) { 602 descript = makedev(CDEV_MAJOR,0); 603 cdevsw_add(&descript,&spkr_cdevsw,NULL); 604#if defined(BDEV_MAJOR) 605 descript = makedev(BDEV_MAJOR,0); 606 bdevsw_add(&descript,&spkr_bdevsw,NULL); 607#endif /*BDEV_MAJOR*/ 608 spkr_devsw_installed = 1; 609 } 610} 611#endif /* JREMOD */ |
|
575#endif /* NSPEAKER > 0 */ 576/* spkr.c ends here */ | 612#endif /* NSPEAKER > 0 */ 613/* spkr.c ends here */ |