This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: buzzer on PC


Piotr Trojanek <ptroja@elproma.com.pl> writes:

> how to 'beep' on PC buzzer from ecos?

Oh, I know this one!

    countdown = 1193180 / speaker_frequency;

set_speaker(int countdown)
{
    char snd = 0;
    /* Init speaker.  */
    HAL_WRITE_UINT8(0x43, 0xb6);
    HAL_WRITE_UINT8(0x42, countdown & 0xff);
    HAL_WRITE_UINT8(0x42, countdown >> 8);
    HAL_READ_UINT8(0x61, snd);
    snd |= 3;
    HAL_WRITE_UINT8(0x61, snd);
}

Something like that ought to work.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]