spkr.c (338c585e38c1bb047f6febb2ce98c78e0cc02788) | spkr.c (6bfa9a2d66dd0e00182017d6741d44e54d0b2cca) |
---|---|
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 * modified for PC98 by Kakefuda 7 */ 8 --- 405 unchanged lines hidden (view full) --- 414 int flags; 415 int fmt; 416 struct thread *td; 417{ 418#ifdef DEBUG 419 (void) printf("spkropen: entering with dev = %s\n", devtoname(dev)); 420#endif /* DEBUG */ 421 | 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 * modified for PC98 by Kakefuda 7 */ 8 --- 405 unchanged lines hidden (view full) --- 414 int flags; 415 int fmt; 416 struct thread *td; 417{ 418#ifdef DEBUG 419 (void) printf("spkropen: entering with dev = %s\n", devtoname(dev)); 420#endif /* DEBUG */ 421 |
422 if (minor(dev) != 0) | 422 if (dev2unit(dev) != 0) |
423 return(ENXIO); 424 else if (spkr_active) 425 return(EBUSY); 426 else { 427#ifdef DEBUG 428 (void) printf("spkropen: about to perform play initialization\n"); 429#endif /* DEBUG */ 430 playinit(); --- 8 unchanged lines hidden (view full) --- 439 struct cdev *dev; 440 struct uio *uio; 441 int ioflag; 442{ 443#ifdef DEBUG 444 printf("spkrwrite: entering with dev = %s, count = %d\n", 445 devtoname(dev), uio->uio_resid); 446#endif /* DEBUG */ | 423 return(ENXIO); 424 else if (spkr_active) 425 return(EBUSY); 426 else { 427#ifdef DEBUG 428 (void) printf("spkropen: about to perform play initialization\n"); 429#endif /* DEBUG */ 430 playinit(); --- 8 unchanged lines hidden (view full) --- 439 struct cdev *dev; 440 struct uio *uio; 441 int ioflag; 442{ 443#ifdef DEBUG 444 printf("spkrwrite: entering with dev = %s, count = %d\n", 445 devtoname(dev), uio->uio_resid); 446#endif /* DEBUG */ |
447 if (minor(dev) != 0) | 447 if (dev2unit(dev) != 0) |
448 return(ENXIO); 449 else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */ 450 return(E2BIG); 451 else { 452 unsigned n; 453 char *cp; 454 int error; 455 --- 14 unchanged lines hidden (view full) --- 470 int flags; 471 int fmt; 472 struct thread *td; 473{ 474#ifdef DEBUG 475 (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev)); 476#endif /* DEBUG */ 477 | 448 return(ENXIO); 449 else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */ 450 return(E2BIG); 451 else { 452 unsigned n; 453 char *cp; 454 int error; 455 --- 14 unchanged lines hidden (view full) --- 470 int flags; 471 int fmt; 472 struct thread *td; 473{ 474#ifdef DEBUG 475 (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev)); 476#endif /* DEBUG */ 477 |
478 if (minor(dev) != 0) | 478 if (dev2unit(dev) != 0) |
479 return(ENXIO); 480 else { 481 wakeup(&endtone); 482 wakeup(&endrest); 483 free(spkr_inbuf, M_SPKR); 484 spkr_active = FALSE; 485 return(0); 486 } --- 7 unchanged lines hidden (view full) --- 494 int flags; 495 struct thread *td; 496{ 497#ifdef DEBUG 498 (void) printf("spkrioctl: entering with dev = %s, cmd = %lx\n", 499 devtoname(dev), cmd); 500#endif /* DEBUG */ 501 | 479 return(ENXIO); 480 else { 481 wakeup(&endtone); 482 wakeup(&endrest); 483 free(spkr_inbuf, M_SPKR); 484 spkr_active = FALSE; 485 return(0); 486 } --- 7 unchanged lines hidden (view full) --- 494 int flags; 495 struct thread *td; 496{ 497#ifdef DEBUG 498 (void) printf("spkrioctl: entering with dev = %s, cmd = %lx\n", 499 devtoname(dev), cmd); 500#endif /* DEBUG */ 501 |
502 if (minor(dev) != 0) | 502 if (dev2unit(dev) != 0) |
503 return(ENXIO); 504 else if (cmd == SPKRTONE) { 505 tone_t *tp = (tone_t *)cmdarg; 506 507 if (tp->frequency == 0) 508 rest(tp->duration); 509 else 510 tone(tp->frequency, tp->duration); --- 50 unchanged lines hidden --- | 503 return(ENXIO); 504 else if (cmd == SPKRTONE) { 505 tone_t *tp = (tone_t *)cmdarg; 506 507 if (tp->frequency == 0) 508 rest(tp->duration); 509 else 510 tone(tp->frequency, tp->duration); --- 50 unchanged lines hidden --- |