This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: HAL_DELAY_US() default implementation
Getting rid of calibration is not easy.
Take the AT91 HAL variants specifically. There are 5'ish different
sub-hals * 3 types of memory(flash + internal/external RAM). Thats
15'ish combinations.
How about this approach?
- No automatic calibration
- Add a machine code busy loop/CPU type. Machine code is
used to make the busy loop independent of compiler optimisations
- Some(many?) HAL's have a HAL_DELAY_US() that works out
of the box according to the newest HAL_DELAY_US() specification and
hence won't need any calibration.
- If the user provides a CDL parameter which calibrates the busy loop
he gets HAL_DELAY_US(), otherwise he doesn't. It is better with a
compile time error than a broken HAL_DELAY_US().
- If a HAL knows that it can accuratly estimate this parameter in all
cases, it can provide a default value and HAL_DELAY_US() works out of
the box.
--
Øyvind Harboe
http://www.zylin.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss