[ECOS] Atomic operations

Boris V. Guzhov borg@int.spb.ru
Tue Aug 8 07:58:00 GMT 2000


>    Boris> Is there in eCos a something similar to simple CPU masking?
>
>This looks to me like a trywait() operation on a counting semaphore,
>which is provided by the kernel.
>
>Obviously the kernel implementation makes use of cyg_scheduler_lock()
>and cyg_scheduler_unlock() internally (there is no need for a mutex).
>However these are actually relatively cheap operations. Unless you are
>in a critical path and it is borderline whether or not your
>application is going to meet hard real-time constraints, it is not
>usually worth worrying about the cost of cyg_scheduler_lock().
>
>If you do need to go faster, you can try disabling and enabling
>interrupts using cyg_interrupt_disable() and cyg_interrupt_enable().
>Since there are only a few instructions involved for code like this,
>it is unlikely that the maximum interrupt latency will be affected.
>
>Alternatively there might be some x86 instructions which will do the
>right thing without having to disable interrupts, and which you could
>invoke using some inline assembler. It has been quite a while since I
>did any x86 assembler programming, I cannot help there.
>
>Bart Veer // eCos net maintainer

Thanks.
I think that the instructions of the CPU interrupts disabling/enabling are
available in many CPUs.
And it's useful to have  HAL macros's for them.

--
Boris Guzhov,
St.Petersburg, Russia





More information about the Ecos-discuss mailing list