This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: ISR Vs DSR
- From: Gary Thomas <gary at mlbassoc dot com>
- To: ecosrtos ecosrtos <ecosrtos at gmail dot com>
- Cc: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 13 Jan 2005 15:03:31 -0700
- Subject: Re: [ECOS] ISR Vs DSR
- Organization: MLB Associates
- References: <852b699905011313559f51acc@mail.gmail.com>
On Thu, 2005-01-13 at 13:55 -0800, ecosrtos ecosrtos wrote:
> Reference to Page 47 Step 9 ECOS book by Massa book
>
> http://www.informit.com/content/downloads/perens/0130354732.pdf
>
> If scheduler lock variable is 0 then the DSR executes else the thread
> that locked the scheduler variable executes, therby delaying the DSR.
> In my application I want to timestamp when the interrupt occurs (using
> cyg_current_time() and HAL_CLOCK_READ()) accurately right after the
> interrupt occurs and these functions are called in the DSR of the
> interrupt.
>
> Now if the DSR is delayed because some other thread starts running
> then I will get a wrong reading of the time. An option is to transfer
> the timestamping code into the ISR. However this goes against the
> 'conventional' philosophy that ISR should do as little as possible.
>
> Question) Is there a better way to solve this issue that putting
> timestamping code into ISR?
It depends on what the timestamp is supposed to represent. If you want
it to mean the absolute time when the interrupt occurred, then you'd
have to take the timestamp in the ISR. If you mean it to be the time
when "meaningful" action for that interrupt takes place, then put it
in the DSR.
>
> Note timestamping code is really just 3 – 4 lines of code. Is it just
> OK to leave it in the ISR?
Not really as you could get incorrect results if your interrupt occurred
during the time that the system clock DSR was running!
Depending on your hardware, you might be able to use a separate
timer (hopefully high resolution) to capture the timestamps. Then
a simple correlation between those timer values and the system
time (cyg_current_time()) would get you the absolute time.
--
------------------------------------------------------------
Gary Thomas |
MLB Associates | Consulting for the
+1 (970) 352-4947 | Embedded world
http://www.mlbassoc.com/ |
email: <gary@mlbassoc.com> |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss