| Author |
Message |
|
|
Post subject: Beep PC Speaker
Posted: Apr 08, 2008 - 12:48 PM
|
|
Active Member
Joined: Feb 26, 2007
Posts: 24
|
|
Hi! Why won't the PC speaker (connected to motherboard) beep without the Audio drivers? It works in VMWare with all the audio things disabled, but not on a native PC.
Is there a way to bypass the integrated audio shit? The BIOS does it....
Code:
#include <stdlib.h>
#include <stdio.h>
#include <x86/inout.h>
#include <sys/neutrino.h>
#include <unistd.h>
#include <stdint.h>
#include <qnx/mma.h>
int main()
{
int system_control=0;
unsigned long i;
unsigned long kbd, clk;
ThreadCtl(_NTO_TCTL_IO, 0);
kbd = mmap_device_io(4,0x60);
clk = mmap_device_io(4,0x40);
// turn on bits 0 & 1 of kbd 0x61
system_control=in8(kbd + 1);
out8(kbd + 1,system_control | 0x03);
// load control word for 8254
out8(clk + 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(clk + 2,0x02); // lsb count
out8(clk + 2,0x27); // msb count - remember, we're using BCD
// pause a bit...
sleep(1);
// shut it off
system_control=in8(kbd + 1);
out8(kbd + 1,system_control & 0xfc);
return(0);
} |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Beep PC Speaker
Posted: Apr 08, 2008 - 03:00 PM
|
|
QNX Master
Joined: Jun 25, 2003
Posts: 1058
|
|
| If the speaker won't beep, then it probably isn't there. Maybe VMWare is virtualizing the beep through the Windows/Linux audio system. |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: RE: Beep PC Speaker
Posted: Apr 08, 2008 - 04:01 PM
|
|
Active Member
Joined: Feb 26, 2007
Posts: 24
|
|
|
maschoen wrote:
If the speaker won't beep, then it probably isn't there. Maybe VMWare is virtualizing the beep through the Windows/Linux audio system.
It beeps on BIOS complete. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Re: RE: Beep PC Speaker
Posted: Apr 08, 2008 - 04:38 PM
|
|
QNX Master
Joined: Jun 25, 2003
Posts: 1058
|
|
| By not there, I mean the normal hardware might not be there. The BIOS might know where its non-standard location is. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Re: RE: Beep PC Speaker
Posted: Apr 08, 2008 - 05:00 PM
|
|
QNX Master
Joined: Sep 01, 2002
Posts: 2831
|
|
| If you press CTRL-G in a shell do you hear a beep? If you do then you're code has something wrong in it. If you don't then most probably the sound device isn't a standard one ( but I doubt that). |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Apr 09, 2008 - 05:56 AM
|
|
Active Member
Joined: Feb 26, 2007
Posts: 24
|
|
| No beep,. What do you mean sound system? I assume you don't need the audio drivers installed to get the PC speaker to make noises. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Apr 09, 2008 - 11:53 AM
|
|
Active Member
Joined: Feb 26, 2007
Posts: 24
|
|
| I found a driver for my Audio card.. Problem solved. |
|
|
| |
|
|
|
 |
|
|