[ECOS] CYGNUM_HAL_RTC_PERIOD / floating point

David N. Welton davidw@dedasys.com
Thu Jan 23 21:44:00 GMT 2003

Jonathan Larmour <jifl@eCosCentric.com> writes:

> > 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.

For now it seems to work ok, but when I make the system more complex,
I would like to have other threads be able to be scheduled in that

> > 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.

Tried that, and things still seem to not work quite right.  I guess
I'll keep experimenting and see what I can find.

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

Thought I had something pretty much identical, but it didn't seem to

> Then in the code use a test like:

That works.  Shall I try and create a patch out of it?

One more thing - I try and set up a floating point variable in my
cyg_start, and that seems to futz things up but good.

I had a look in the mailing list archives, and tried a few things like
turning off the lazy FPU switching, but to no avail.

This is, as usual on a standard i386 PC booting from floppy.

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

More information about the Ecos-discuss mailing list