public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Testing interrupts ???
@ 2003-08-29 15:11 Matthieu.GIRARDIN
  2003-08-29 22:27 ` Carlos Camargo
  2003-09-01 13:31 ` Bart Veer
  0 siblings, 2 replies; 4+ messages in thread
From: Matthieu.GIRARDIN @ 2003-08-29 15:11 UTC (permalink / raw)
  To: ecos-discuss

Well, hello everybody !

Try to imagine :
	I create a thread which create itself an interrupt (vector 29),
attach it and then stand by (for(;;)). 
	My isr function might just do a little "printf("\nOK !\n");
	As it compiled well, I launched the application.
	I tried then to launch a "kill -s 29 my_pid" under Linux, where
"my_pid" is the pid of my application eCos.

So if you understood my way of thinking :
	Can I do a printf in an isr or must I do it in my dsr ? (for the
moment there is no dsr)
	Can I send an signal from Linux to my eCos application ?
	(if not how to test interrupts under Linux with a synthetic target
?)

Thanks by advance ! 
Matthieu

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] Testing interrupts ???
  2003-08-29 15:11 [ECOS] Testing interrupts ??? Matthieu.GIRARDIN
@ 2003-08-29 22:27 ` Carlos Camargo
  2003-08-29 22:38   ` Gary Thomas
  2003-09-01 13:31 ` Bart Veer
  1 sibling, 1 reply; 4+ messages in thread
From: Carlos Camargo @ 2003-08-29 22:27 UTC (permalink / raw)
  To: Matthieu.GIRARDIN, ecos-discuss

>Can I do a printf in an isr or must I do it in my dsr ? 
>(for the moment there is no dsr)

NO you can't do a printf in isr


******************************************************
*            Carlos Iván Camargo Bareño              *
* Departamento de Ingenierìa Eléctrica y Electrónica * 
*        Universidad Nacional de Colombia            *
******************************************************

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] Testing interrupts ???
  2003-08-29 22:27 ` Carlos Camargo
@ 2003-08-29 22:38   ` Gary Thomas
  0 siblings, 0 replies; 4+ messages in thread
From: Gary Thomas @ 2003-08-29 22:38 UTC (permalink / raw)
  To: Carlos Camargo; +Cc: Matthieu.GIRARDIN, eCos Discussion

On Fri, 2003-08-29 at 16:53, Carlos Camargo wrote:
> >Can I do a printf in an isr or must I do it in my dsr ? 
> >(for the moment there is no dsr)
> 
> NO you can't do a printf in isr

Actually, you *can* call "diag_printf()" from an ISR.  It will
vastly perturb the timings, but it will work.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] Testing interrupts ???
  2003-08-29 15:11 [ECOS] Testing interrupts ??? Matthieu.GIRARDIN
  2003-08-29 22:27 ` Carlos Camargo
@ 2003-09-01 13:31 ` Bart Veer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Veer @ 2003-09-01 13:31 UTC (permalink / raw)
  To: Matthieu.GIRARDIN; +Cc: ecos-discuss

>>>>> "Matthieu" == Matthieu GIRARDIN <Matthieu.GIRARDIN@fr.thalesgroup.com> writes:

    Matthieu> Well, hello everybody !
    Matthieu> Try to imagine :
    Matthieu> 	I create a thread which create itself an interrupt
    Matthieu> (vector 29), attach it and then stand by (for(;;)).

You cannot just "create" an interrupt, even on the synthetic target.
The goal of the synthetic target is to emulate real hardware, for
example an ethernet device. If you want interrupts then you must
either interact with an existing emulated device, or you must write
some new device emulation code. Read the synthetic target
documentation at
http://sources.redhat.com/ecos/docs-latest/ref/hal-synth-arch.html
The overview explains a bit more about how things work. The sections
on writing new devices, both target and host, are also relevant.

Once you have read the documentation I suggest looking at the
implementation of an existing device, for example the synthetic
ethernet driver, and at the synth_intr.c file in the synthetic target
architectural HAL package.

If you need something quick and dirty, it may be possible to use
another signal like SIGUSR1 rather than going via the I/O auxiliary.
As an example of how to do that, look at the way the clock is
implemented in synth_intr.c and especially synth_alrm_sighandler().
However this is not how things are expected to work, so it is not a
long-term solution.

    Matthieu> 	My isr function might just do a little "printf("\nOK!\n");

This is a very bad idea. An interrupt handler is supposed to service
the hardware as quickly as possible and then return to higher-level
code. printf() can take a long time, and if some other code happened
to be calling printf() at the time the interrupt occurred then bad
things will happen. diag_printf() is slightly safer but only slightly,
and should still be avoided if at all possible. Take a look at the
kernel documentation, especially the section "Threads and Interrupt
Handling". 

    Matthieu> 	As it compiled well, I launched the application.
    Matthieu> 	I tried then to launch a "kill -s 29 my_pid" under Linux, where
    Matthieu> "my_pid" is the pid of my application eCos.

No. Signal 29 is SIGIO, and is reserved for use between the synthetic
target I/O auxiliary and the eCos application. What is likely to
happen is that the eCos code in synth_intr.c will detect this signal,
send a message to the I/O auxiliary to ask what emulated interrupt(s)
have happened, and things will get very confused because there have
not actually been any emulated interrupts.

    Matthieu> So if you understood my way of thinking :
    Matthieu> 	Can I do a printf in an isr or must I do it in my dsr
    Matthieu> ? (for the moment there is no dsr)

Neither. Both the ISR and the DSR should do whatever work is
appropriate for servicing the hardware. The DSR can also inform a
foreground thread that an event has happened, for example by posting a
semaphore. Operations like printf() should only happen at thread level.

    Matthieu> 	Can I send an signal from Linux to my eCos application
    Matthieu> 	? (if not how to test interrupts under Linux with a
    Matthieu> 	synthetic target ?)

It is not that simple. Read the documentation.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-09-01 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-29 15:11 [ECOS] Testing interrupts ??? Matthieu.GIRARDIN
2003-08-29 22:27 ` Carlos Camargo
2003-08-29 22:38   ` Gary Thomas
2003-09-01 13:31 ` Bart Veer

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).