spkr.c (10537) | spkr.c (10624) |
---|---|
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.14 1995/05/30 08:03:09 rgrimes Exp $ | 7 * $Id: spkr.c,v 1.15 1995/09/03 05:43:31 julian Exp $ |
8 */ 9 10#include "speaker.h" 11 12#if NSPEAKER > 0 13 14#include <sys/param.h> 15#include <sys/systm.h> --- 430 unchanged lines hidden (view full) --- 446 * 447 * This section implements driver hooks to run playstring() and the tone(), 448 * endtone(), and rest() functions defined above. 449 */ 450 451static int spkr_active = FALSE; /* exclusion flag */ 452static struct buf *spkr_inbuf; /* incoming buf */ 453 | 8 */ 9 10#include "speaker.h" 11 12#if NSPEAKER > 0 13 14#include <sys/param.h> 15#include <sys/systm.h> --- 430 unchanged lines hidden (view full) --- 446 * 447 * This section implements driver hooks to run playstring() and the tone(), 448 * endtone(), and rest() functions defined above. 449 */ 450 451static int spkr_active = FALSE; /* exclusion flag */ 452static struct buf *spkr_inbuf; /* incoming buf */ 453 |
454int spkropen(dev) 455dev_t dev; | 454int spkropen(dev, flags, fmt, p) 455dev_t dev; 456int flags; 457int fmt; 458struct proc *p; |
456{ 457#ifdef DEBUG 458 (void) printf("spkropen: entering with dev = %x\n", dev); 459#endif /* DEBUG */ 460 461 if (minor(dev) != 0) 462 return(ENXIO); 463 else if (spkr_active) --- 5 unchanged lines hidden (view full) --- 469#endif /* DEBUG */ 470 playinit(); 471 spkr_inbuf = geteblk(DEV_BSIZE); 472 spkr_active = TRUE; 473 return(0); 474 } 475} 476 | 459{ 460#ifdef DEBUG 461 (void) printf("spkropen: entering with dev = %x\n", dev); 462#endif /* DEBUG */ 463 464 if (minor(dev) != 0) 465 return(ENXIO); 466 else if (spkr_active) --- 5 unchanged lines hidden (view full) --- 472#endif /* DEBUG */ 473 playinit(); 474 spkr_inbuf = geteblk(DEV_BSIZE); 475 spkr_active = TRUE; 476 return(0); 477 } 478} 479 |
477int spkrwrite(dev, uio) | 480int spkrwrite(dev, uio, ioflag) |
478dev_t dev; 479struct uio *uio; | 481dev_t dev; 482struct uio *uio; |
483int ioflag; |
|
480{ 481#ifdef DEBUG 482 printf("spkrwrite: entering with dev = %x, count = %d\n", 483 dev, uio->uio_resid); 484#endif /* DEBUG */ 485 486 if (minor(dev) != 0) 487 return(ENXIO); --- 8 unchanged lines hidden (view full) --- 496 n = uio->uio_resid; 497 cp = spkr_inbuf->b_un.b_addr; 498 if (!(error = uiomove(cp, n, uio))) 499 playstring(cp, n); 500 return(error); 501 } 502} 503 | 484{ 485#ifdef DEBUG 486 printf("spkrwrite: entering with dev = %x, count = %d\n", 487 dev, uio->uio_resid); 488#endif /* DEBUG */ 489 490 if (minor(dev) != 0) 491 return(ENXIO); --- 8 unchanged lines hidden (view full) --- 500 n = uio->uio_resid; 501 cp = spkr_inbuf->b_un.b_addr; 502 if (!(error = uiomove(cp, n, uio))) 503 playstring(cp, n); 504 return(error); 505 } 506} 507 |
504int spkrclose(dev) 505dev_t dev; | 508int spkrclose(dev, flags, fmt, p) 509dev_t dev; 510int flags; 511int fmt; 512struct proc *p; |
506{ 507#ifdef DEBUG 508 (void) printf("spkrclose: entering with dev = %x\n", dev); 509#endif /* DEBUG */ 510 511 if (minor(dev) != 0) 512 return(ENXIO); 513 else 514 { 515 wakeup((caddr_t)&endtone); 516 wakeup((caddr_t)&endrest); 517 brelse(spkr_inbuf); 518 spkr_active = FALSE; 519 return(0); 520 } 521} 522 | 513{ 514#ifdef DEBUG 515 (void) printf("spkrclose: entering with dev = %x\n", dev); 516#endif /* DEBUG */ 517 518 if (minor(dev) != 0) 519 return(ENXIO); 520 else 521 { 522 wakeup((caddr_t)&endtone); 523 wakeup((caddr_t)&endrest); 524 brelse(spkr_inbuf); 525 spkr_active = FALSE; 526 return(0); 527 } 528} 529 |
523int spkrioctl(dev, cmd, cmdarg) 524dev_t dev; 525int cmd; 526caddr_t cmdarg; | 530int spkrioctl(dev, cmd, cmdarg, flags, p) 531dev_t dev; 532int cmd; 533caddr_t cmdarg; 534int flags; 535struct proc *p; |
527{ 528#ifdef DEBUG 529 (void) printf("spkrioctl: entering with dev = %x, cmd = %x\n"); 530#endif /* DEBUG */ 531 532 if (minor(dev) != 0) 533 return(ENXIO); 534 else if (cmd == SPKRTONE) --- 33 unchanged lines hidden --- | 536{ 537#ifdef DEBUG 538 (void) printf("spkrioctl: entering with dev = %x, cmd = %x\n"); 539#endif /* DEBUG */ 540 541 if (minor(dev) != 0) 542 return(ENXIO); 543 else if (cmd == SPKRTONE) --- 33 unchanged lines hidden --- |