This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Atomic operations
- To: <ecos-discuss at sourceware dot cygnus dot com>
- Subject: Re: [ECOS] Atomic operations
- From: "Boris V. Guzhov" <borg at int dot spb dot ru>
- Date: Tue, 8 Aug 2000 18:45:40 +0400
> 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