public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Event based programming in ecos
@ 2005-03-23 18:40 Wayne Gemmell
  2005-03-23 18:42 ` Frank Pagliughi
  2005-03-23 21:36 ` Andrew Lunn
  0 siblings, 2 replies; 8+ messages in thread
From: Wayne Gemmell @ 2005-03-23 18:40 UTC (permalink / raw)
  To: ecos-discuss

Hi all

I'm looking to make an event based program. Is there any easy way to do this? 
Could you please give me some directions, links. I was thinking of running a 
loop to monitor the sensors but this doesn't strike me as efficient and could 
possibly be done better with interrupts and threads. 

Any pointers would be appreciated.


Thanks
Wayne Gemmell


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

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

* RE: [ECOS] Event based programming in ecos
  2005-03-23 18:40 [ECOS] Event based programming in ecos Wayne Gemmell
@ 2005-03-23 18:42 ` Frank Pagliughi
  2005-03-23 21:22   ` Wayne Gemmell
                     ` (2 more replies)
  2005-03-23 21:36 ` Andrew Lunn
  1 sibling, 3 replies; 8+ messages in thread
From: Frank Pagliughi @ 2005-03-23 18:42 UTC (permalink / raw)
  To: waynetg, ecos-discuss

I'm currently reading "Practical Statecharts in C/C++" by Miro Samek. Some
pretty neat ideas for implementing state machines, with examples for doing
it with an RTOS. There are some articles on the web. Search for
"statecharts" and "quantum programming"

http://www.embedded.com/2000/0008/0008feat1.htm
http://www.quantum-leaps.com/

The code library/frameworks are released under GPL, but currently no eCos
port. If I have some time...

Frank Pagliughi

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org]On Behalf Of Wayne
Gemmell
Sent: Wednesday, March 23, 2005 10:18 AM
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Event based programming in ecos


Hi all

I'm looking to make an event based program. Is there any easy way to do
this?
Could you please give me some directions, links. I was thinking of running a
loop to monitor the sensors but this doesn't strike me as efficient and
could
possibly be done better with interrupts and threads.

Any pointers would be appreciated.


Thanks
Wayne Gemmell


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




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

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

* Re: [ECOS] Event based programming in ecos
  2005-03-23 18:42 ` Frank Pagliughi
@ 2005-03-23 21:22   ` Wayne Gemmell
  2005-03-24  0:42   ` Andrew Lunn
  2005-03-24  3:44   ` Tony Butt
  2 siblings, 0 replies; 8+ messages in thread
From: Wayne Gemmell @ 2005-03-23 21:22 UTC (permalink / raw)
  To: Frank Pagliughi; +Cc: ecos-discuss

On Wednesday 23 March 2005 18:44, Frank Pagliughi wrote:
> I'm currently reading "Practical Statecharts in C/C++" by Miro Samek. Some
> pretty neat ideas for implementing state machines, with examples for doing
> it with an RTOS. There are some articles on the web. Search for
> "statecharts" and "quantum programming"
>
> http://www.embedded.com/2000/0008/0008feat1.htm
> http://www.quantum-leaps.com/
>
> The code library/frameworks are released under GPL, but currently no eCos
> port. If I have some time...
Thanks, thats a lot to read through... Luck this is gonna be a long weekend :)

Cheers
Wayne

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

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

* Re: [ECOS] Event based programming in ecos
  2005-03-23 18:40 [ECOS] Event based programming in ecos Wayne Gemmell
  2005-03-23 18:42 ` Frank Pagliughi
@ 2005-03-23 21:36 ` Andrew Lunn
  2005-04-07 21:30   ` [ECOS] Calling cyg_mbox_trypost() from DSR Frank Pagliughi
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2005-03-23 21:36 UTC (permalink / raw)
  To: Wayne Gemmell; +Cc: ecos-discuss

On Wed, Mar 23, 2005 at 05:17:44PM +0200, Wayne Gemmell wrote:
> Hi all
> 
> I'm looking to make an event based program. Is there any easy way to
> do this?  Could you please give me some directions, links. I was
> thinking of running a loop to monitor the sensors but this doesn't
> strike me as efficient and could possibly be done better with
> interrupts and threads.

eCos's message boxes are ideal for event loops. You have a thread
which simply takes takes messages out of the message box and acts on
them. The message box gives you a void * which is ideal as a pointer
to the actual message. 

Your sensors can then be interrupt driver. The DSR or a thread which
is woken up then posts a message to message box with the results from
the sensor. Just be careful not to use the blocking cyg_mbox_put()
from the DSR. You need to either use cyg_mbox_tryput() and handle the
case when the message box is full, or have the DSR signal a thread to
to the cyg_mbox_put() which can then block.

        Andrew

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

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

* Re: [ECOS] Event based programming in ecos
  2005-03-23 18:42 ` Frank Pagliughi
  2005-03-23 21:22   ` Wayne Gemmell
@ 2005-03-24  0:42   ` Andrew Lunn
  2005-03-24  3:44   ` Tony Butt
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2005-03-24  0:42 UTC (permalink / raw)
  To: Frank Pagliughi; +Cc: waynetg, ecos-discuss

On Wed, Mar 23, 2005 at 11:44:32AM -0500, Frank Pagliughi wrote:
> I'm currently reading "Practical Statecharts in C/C++" by Miro Samek. Some
> pretty neat ideas for implementing state machines, with examples for doing
> it with an RTOS. There are some articles on the web. Search for
> "statecharts" and "quantum programming"
> 
> http://www.embedded.com/2000/0008/0008feat1.htm
> http://www.quantum-leaps.com/
> 
> The code library/frameworks are released under GPL, but currently no eCos
> port. If I have some time...

You have to be careful with GPL code when used with eCos. Since you
directly link the GPL code with your application, the application also
has to be GPL.

        Andrew

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

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

* Re: [ECOS] Event based programming in ecos
  2005-03-23 18:42 ` Frank Pagliughi
  2005-03-23 21:22   ` Wayne Gemmell
  2005-03-24  0:42   ` Andrew Lunn
@ 2005-03-24  3:44   ` Tony Butt
  2 siblings, 0 replies; 8+ messages in thread
From: Tony Butt @ 2005-03-24  3:44 UTC (permalink / raw)
  To: ecos-discuss

Frank Pagliughi wrote:

>I'm currently reading "Practical Statecharts in C/C++" by Miro Samek. Some
>pretty neat ideas for implementing state machines, with examples for doing
>it with an RTOS. There are some articles on the web. Search for
>"statecharts" and "quantum programming"
>
>http://www.embedded.com/2000/0008/0008feat1.htm
>http://www.quantum-leaps.com/
>
>The code library/frameworks are released under GPL, but currently no eCos
>port. If I have some time...
>
>  
>
I  made a port of Quantum Frameworks 2.5 to eCos a few months ago. I got 
as far as running the Dining Philosophers test before I had to go and 
work on something else. It seemed to work OK - but without more 
comprehensive testing, I could not vouch for it's (the port's) reliabilty.

I will have a look for the source code, and if you are interested, try 
to get an OK to release it.

Tony Butt
CEA Technologies
Canberra, Australia.

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

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

* [ECOS] Calling cyg_mbox_trypost() from DSR
  2005-03-23 21:36 ` Andrew Lunn
@ 2005-04-07 21:30   ` Frank Pagliughi
  2005-04-07 22:10     ` Bart Veer
  0 siblings, 1 reply; 8+ messages in thread
From: Frank Pagliughi @ 2005-04-07 21:30 UTC (permalink / raw)
  To: ecos-discuss

Hey All,

Is it safe to call cyg_mbox_trypost() from a DSR? There's some differing
info in various documents, but I've seen it on this mailing list as a
solution for several different problems.

It appears to use Cyg_Scheduler::lock() for synchronization. Is that safe
from a DSR? What if two DSR's are posting to the same mbox? Could they
interrupt each other, or are DSR's serialized?

Thanks
Frank

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org]On Behalf Of Andrew Lunn
Sent: Wednesday, March 23, 2005 1:41 PM
To: Wayne Gemmell
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Event based programming in ecos


On Wed, Mar 23, 2005 at 05:17:44PM +0200, Wayne Gemmell wrote:
> Hi all
>
> I'm looking to make an event based program. Is there any easy way to
> do this?  Could you please give me some directions, links. I was
> thinking of running a loop to monitor the sensors but this doesn't
> strike me as efficient and could possibly be done better with
> interrupts and threads.

eCos's message boxes are ideal for event loops. You have a thread
which simply takes takes messages out of the message box and acts on
them. The message box gives you a void * which is ideal as a pointer
to the actual message.

Your sensors can then be interrupt driver. The DSR or a thread which
is woken up then posts a message to message box with the results from
the sensor. Just be careful not to use the blocking cyg_mbox_put()
from the DSR. You need to either use cyg_mbox_tryput() and handle the
case when the message box is full, or have the DSR signal a thread to
to the cyg_mbox_put() which can then block.

        Andrew

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




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

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

* Re: [ECOS] Calling cyg_mbox_trypost() from DSR
  2005-04-07 21:30   ` [ECOS] Calling cyg_mbox_trypost() from DSR Frank Pagliughi
@ 2005-04-07 22:10     ` Bart Veer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Veer @ 2005-04-07 22:10 UTC (permalink / raw)
  To: fpagliughi; +Cc: ecos-discuss

>>>>> "Frank" == Frank Pagliughi <fpagliughi@mindspring.com> writes:

    Frank> Is it safe to call cyg_mbox_trypost() from a DSR? There's
    Frank> some differing info in various documents, but I've seen it
    Frank> on this mailing list as a solution for several different
    Frank> problems.

    Frank> It appears to use Cyg_Scheduler::lock() for
    Frank> synchronization. Is that safe from a DSR? What if two DSR's
    Frank> are posting to the same mbox? Could they interrupt each
    Frank> other, or are DSR's serialized?

I assume you mean cyg_mbox_tryput(). See the last sentence @
http://ecos.sourceware.org/docs-latest/ref/kernel-mail-boxes.html
That is the authorative documentation, and explicitly lists
cyg_mbox_tryput() as callable from a DSR.

DSRs are serialized via the scheduler lock, that is what allows them
to manipulate kernel data structures without worrying about context
switches at an inconvenient moment. The scheduler is already locked on
entry to the DSR, and the call to Cyg_Scheduler::lock() just
increments a counter. Of course tryput() can also be called from
thread context, in which case locking the scheduler would be
essential.

The main problem with calling tryput() from a DSR is how to recover
when the tryput() fails. Presumably the DSR is trying to communicate
an event and some data to a thread. Some applications can cope if this
data is just discarded, but not all.

Bart

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


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

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

end of thread, other threads:[~2005-04-07 22:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-23 18:40 [ECOS] Event based programming in ecos Wayne Gemmell
2005-03-23 18:42 ` Frank Pagliughi
2005-03-23 21:22   ` Wayne Gemmell
2005-03-24  0:42   ` Andrew Lunn
2005-03-24  3:44   ` Tony Butt
2005-03-23 21:36 ` Andrew Lunn
2005-04-07 21:30   ` [ECOS] Calling cyg_mbox_trypost() from DSR Frank Pagliughi
2005-04-07 22:10     ` 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).