Does anyone know can make my PC speaker play a beep from a C program on QNX 6?
Thank you,
Jose
printf( "\a" );
This causes the speaker to emit a short beep on all the PC's I've
experimented with QNX on.
Mark
Jose A. Galvez <jaga...@iai.csic.es> wrote in message
news:3CBD9B73...@iai.csic.es...
dB
"Jose A. Galvez" <jaga...@iai.csic.es> wrote in message
news:3CBD9B73...@iai.csic.es...
> Thank you,
> Jose
--
// beep the PC speaker
#include <stdlib.h>
#include <stdio.h>
#include <x86/inout.h>
#include <sys/neutrino.h>
#include <unistd.h>
int main()
{
int system_control=0;
unsigned long i;
unsigned long kbd, ctr;
// turn on bits 0 & 1 of kbd 0x61
ThreadCtl(_NTO_TCTL_IO, 0);
kbd = mmap_device_io(4,0x60);
ctr = mmap_device_io(4,0x40);
system_control=in8(kbd + 1);
out8(kbd + 1,system_control | 0x03);
// load control word for 8254
out8(ctr + 3, 0xb7); // bcd count, square wave,
// r/w lsb then msb, channel 2
// load counts
// to get 440Hz tone, divide 8254 clock (1.1892 MHz) by 2702
out8(ctr + 2, 0x02); // lsb count
out8(ctr + 2, 0x27); // msb count
// pause a bit...
for(i=0; i<50000000; i++);
// shut it off
system_control=in8(kbd + 1);
out8(kbd + 1,system_control & 0xfc);
return(0);
}
---
Dave Green (dgr...@qnx.com)
QNX Software Systems Ltd.
http://www.qnx.com
printf("\a");
"Jose A. Galvez" <jaga...@iai.csic.es> wrote in message
news:3CBD9B73...@iai.csic.es...
I hope that modern people on modern computers with modern operating systems
use smth like Beep(<freq>,<time>) so system speacker is supported by os on
driver's level and you don't need to access hardware by hands just to say
"be-beep" ;)
// wbr
printf ("%c", 0x07);
Javier
"Jose A. Galvez" <jaga...@iai.csic.es> escribió en el mensaje
news:3CBD9B73...@iai.csic.es...