[ECOS] problems with small CYGNUM_HAL_RTC_PERIOD

Jonathan Larmour jifl@eCosCentric.com
Wed Jan 22 17:29:00 GMT 2003

David N. Welton wrote:
> I have an experimental app that drives the PC speaker.
> CYGNUM_HAL_RTC_PERIOD is, on the i386 platform, normally defined as
> 11932, making for 100 ticks per second.  That's not very fine grained
> for what I want to do.
> 1) Is there any way to do some sort of sleep/alarm/whatever in less
>    than a tick? I don't think so, but just checking...

You can probably use a hal_delay_us which does a busy wait reading the 
hardware timer. A busy wait isn't necessarily what you want though.

> 2) I drop that number down to 1193, and things work ok, but I try and
>    drop it further to 119, and the system no longer seems to respond
>    to events (keyboard interrupts, to be specific).  Same problem with
>    alarms.  Any idea what could be going on?

If you change the period, you also have to change the clock resolution 
numerator/denominator too. That way the kernel knows how to map the clock 
interrupt frequency to real elapsed time.

You can find the CYGNUM_HAL_RTC_NUMERATOR aloingside the period option in 
the pcmb package. If you reduce the period by a factor of 100, reduce the 
numerator by a factor of 100.

> BTW, on a completely unrelated note,
> #include <cyg/hal/pcmb_keyboard_en_us.h>
> #else if ....
> #include <cyg/hal/pcmb_keyboard_en_gb.h>
> ...
> with an accompanying bit of CDL would be convenient in pcmb_screen.c
> in order to pick whichever keyboard is the most convenient.
> Unfortunately, I couldn't quite get the CDL right to make this work
> well enough to submit a patch.

Something like the following at the bottom of hal_i386_pcmb.cdl:

   display "Keyboard layout for diagnostic console"
   legal_values { "US" "GB" }
   default_value { "US" }
   description "
      This option allows the changing of keyboard layout when used with
      the PC screen and keyboard diagnostic console."

Then in the code use a test like:

# error Unsupported keyboard layout

eCosCentric       http://www.eCosCentric.com/       <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine

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

More information about the Ecos-discuss mailing list