public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Dave Milter <davemilter@gmail.com>
To: "Paul D. DeRocco" <pderocco@ix.netcom.com>
Cc: eCos Discuss <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] how to handle missed interrupt issue?
Date: Fri, 06 Feb 2009 11:48:00 -0000	[thread overview]
Message-ID: <2a382c6e0902060347n54ec36a4i50869b4b41403851@mail.gmail.com> (raw)
In-Reply-To: <PGEAIGBPLOMOJDAPCOJHIEPIMGAB.pderocco@ix.netcom.com>

On Thu, Feb 5, 2009 at 9:29 PM, Paul D. DeRocco <pderocco@ix.netcom.com> wrote:
> @ix.netcom.com
>> From: Dave Milter
>>
>> Some days ago I started development of ecos's driver for some device
>> which compatible with ARINC 429.
>> Processor is belong to ARM9 family, freq is 200Mhz.
>>
>> The logic is simple. Driver has circular buffer, and when it receive
>> from device interrupt, which means that it ready
>> to go, driver send to device next 32bit word, then it recieves next
>> interrupt and send next word and so on.
>> When driver sends all characters from circular buffer, it start from
>> begining of buffer.
>>
>> Now I want implement function to change circular buffer pointer,
>> but if I do such simple thing:
>> cyg_drv_isr_lock()
>> change pointer
>> cyg_drv_isr_unlock()
>>
>> there is probability that I lost interrupt between cyg_drv_isr_lock()
>> and cyg_drv_isr_unlock(),
>> and this of cause a problem, I willl wait interrupt and it never happens.
>>
>> I imagine such scheme:
>>
>> isr handler each time call dsr handler (via return value),
>> dsr signal via condition variable about interrupt,
>>
>> when I want to change pointer to circular buffer, I do
>> wait on condition variable, and then disable interrupt, change my
>> pointer and enable interrupt.
>>
>> This will works, because of maximum bit rate  of ARINC 429 is 100Kb/s, and
>> before next interrupt I have many time to disable/enable interrupts.
>>
>> But may be there is more clever way to handle such case?
>
> This shouldn't happen. Is it possible that your interrupt source generates a
> pulse, and your interrupt input is level-sensitive? That's a recipe for lost
> interrupts.
>
> I have no idea why you need to change the buffer pointer, but one
> alternative is to have the interrupt handler do that for you, in response to
> setting some request flag in the application.
>

you think that settting flag on arm9 is atomic thing?

I look at code atomic in linux kernel, in case of arm9 (armv5 core) it
disable interrupts
set flag and then enable interrupts.

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2009-02-06 11:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05 14:50 Dave Milter
2009-02-05 15:00 ` Andrew Lunn
2009-02-05 15:23   ` alys
2009-02-05 15:12 ` Nick Garnett
2009-02-06 11:41   ` Dave Milter
2009-02-05 15:30 ` alys
2009-02-05 18:29 ` Paul D. DeRocco
2009-02-06 11:48   ` Dave Milter [this message]
2009-02-06 18:36     ` Paul D. DeRocco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a382c6e0902060347n54ec36a4i50869b4b41403851@mail.gmail.com \
    --to=davemilter@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=pderocco@ix.netcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).