OpenQNX :: The QNX Community Portal

Aug 21, 2008 - 06:27 AM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 49 unlogged users and 0 registered users online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Alexbleks
Post subject: Beep PC Speaker  PostPosted: 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);

}
 
 View user's profile Send private message  
Reply with quote Back to top
maschoen
Post subject: RE: Beep PC Speaker  PostPosted: 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.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Alexbleks
Post subject: Re: RE: Beep PC Speaker  PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
maschoen
Post subject: RE: Re: RE: Beep PC Speaker  PostPosted: 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.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
mario
Post subject: RE: Re: RE: Beep PC Speaker  PostPosted: 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).
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Alexbleks
Post subject:   PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
Alexbleks
Post subject:   PostPosted: Apr 09, 2008 - 11:53 AM
Active Member


Joined: Feb 26, 2007
Posts: 24

I found a driver for my Audio card.. Problem solved.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.