This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: problems with small CYGNUM_HAL_RTC_PERIOD
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: "David N. Welton" <davidw at dedasys dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Wed, 22 Jan 2003 17:27:50 +0000
- Subject: Re: [ECOS] problems with small CYGNUM_HAL_RTC_PERIOD
- References: <87fzrld14o.fsf@dedasys.com>
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,
#ifdef KEYBOARD_EN_US
#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:
cdl_option CYGSEM_HAL_I386_PCMB_KEYBOARD_LAYOUT {
display "Keyboard layout for diagnostic console"
legal_values { "US" "GB" }
default_value { "US" }
active_if CYGINT_HAL_I386_PCMB_SCREEN_SUPPORT
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:
#if defined( CYGSEM_HAL_I386_PCMB_KEYBOARD_LAYOUT_US )
...
#elif defined( CYGSEM_HAL_I386_PCMB_KEYBOARD_LAYOUT_GB )
...
#else
# error Unsupported keyboard layout
#endif
Jifl
--
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