All of lore.kernel.org
 help / color / mirror / Atom feed
* [Devel] Question about ACPICA, QNX and making beeps
@ 2021-09-28 19:04 Devin Steffler
  0 siblings, 0 replies; only message in thread
From: Devin Steffler @ 2021-09-28 19:04 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]

Hello,

I am using ACPICA to read battery information in QNX. That part is working
great so far. However, now some code that is being used to make beeps via
the PC speaker stopped working.

Strangely, this code stops working on a few devices only after ACPICA runs.
It works fine if I don't start ACPICA. The code is using I/O ports 0x43,
0x42, and 0x61 to generate beeps. This seems to be an industry standard way
to make beeps on x86 based PCs using a Programmable Interval Timer (PIT).

What could my ACPICA be doing (or failing to do) that could cause the beeps
to stop working with the code below? Is the PIT being disabled somehow? I
guess I'll need to learn more about the PIT and how to check its status to
see if it's being disabled after ACPICA runs.

Here's example code for QNX to generate a beep using the PC speaker:
// -----------------------------------------------
#include <sys/neutrino.h>
#include <hw/inout.h>
#include <unistd.h>

int main(void) {
    ThreadCtl( _NTO_TCTL_IO, 0 ); // get I/O permissions

    // start a beep
    int freq = 1000;
    int scale = 1193046 / freq;
    out8(0x43, 0xb6);
    out8(0x42, scale & 0xff);
    out8(0x42, scale >> 8);
    out8(0x61, in8(0x61) | 3);

    // let the beep play for a second
    delay(1000);

    // stop the beep
    out8(0x61, in8(0x61) & ~3);

    return 0;
}
// -----------------------------------------------

Thanks,
Devin

[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 1854 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-28 19:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 19:04 [Devel] Question about ACPICA, QNX and making beeps Devin Steffler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.