[ECOS] from ISR to thread

Nick Garnett nickg@redhat.com
Wed Dec 5 07:03:00 GMT 2001

Robin Farine <acnrf@dial.eunet.ch> writes:

> Hi,
> I do not understand, why don't you use a counting semaphore instead of the
> condition variable? What makes you think that a DSR can signal a condition
> variable but not a counting semaphore?

While there is no technical reason for not using a counting semaphore
in a DSR, there is no support for counting semaphores in the driver
API. The main reason for this is that properly written device drivers
should be able to work even when the eCos kernel is absent. To support
this there is a non-kernel implementation of the API in
hal/common/current/src/drv_api.c. It's a lot easier to implement
mutexes and condition variables in such an environment that more
complex synchronization mechanisms. Mutexes and condition variables
are also the best minimal synchronization primitives, since the effect
of any other primitive can be duplicated with them.

Of course if your driver is never going to be used in a non-kernel
situation, you can do whatever you want, it just won't be as portable.

Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK

More information about the Ecos-discuss mailing list