To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1633
1632  |  1634
Subject: 
Re: LegOS 0.2.5 and LNP
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Wed, 17 Jan 2001 22:57:54 GMT
Viewed: 
1346 times
  
Yesterday I downloaded legOS 0.2.5 and peeked at the code. • Btw. README is
not up to date.

Ooops... :-) Changed to 0.2.5 version inside.

For last two month I was working with a friend of mine on a • transport
protocol implemented on top of LNP for the transmission of • packets of
unlimited size and with acknowledgements.  This was meant • mainly as way for
a PC to communicate with an RCX without bothering with • collisions, lost
packets, retransmissions...  (I know that there is a program • which works as
gateway between TCP and LNP, but on the RCX you still have to • write code to
communicate and (but I'm not sure) it have no acknowledgments. • To cut time
in programming and, above all, in debugging, I decided to write • code that
could be run both on Linux and on legOS, using preprocessor • directives
where necessary.  I wanted to use the same lnp.c on both • platforms and so I
studied LNP in depth (but not so deep to reach the interrupt • calling
mechanism).

Interesting. I'm always working (but I'm in a "no time period")
in a port for LNPD on Win32 and everything that could clean up
code for LNP is welcome!

This is the introduction, now comes the real stuff.  In version • 0.2.3
lnp_addressing_write() and lnp_integrity_write() were not • thread-safe.  The
patch applied in 0.2.4 fixes this, but it raises two problems:

1. Now lnp_logical_write() is no more thread-safe.  Furthermore • calling
   lnp_logical_write() screw up the semaphore (tx_sem) and so • the other two
   lnp_XXX_write() become thread-unsafe.

2. On the host computer LNP is still thread unsafe.

I fix this in my work.  I wonder if there is some interest in a • patch to
apply to the ufficial distribution.

We are surely interested in it. You can upload the patch on
legos.sourceforge.net in the patch section or send it to one of
the developers. If you like, I can apply it for you on official
distribution.

During my perusuals I noticed two points that can be improved • in lnp.c.
The function lnp_checksum() computes a 16-bit checksum, while • LNP uses only
the 8 low order bits.  Removing some lines of unuseful code can • speed up
the function.  The other interesting thing is how • lnp_integrity_byte()
checks the incoming message for integrity.  When all data is • received it
computes the checksum and compare it with the checksum read • from the IR
port.  Then it calls the handler set up by the user program, • and that
handler probably copies the received packet in a buffer for • later
inspection.  So the packet is read two times during the same • interrupt
call, while previous calls of the same interrupt did very • little work.  It
seems to me a good idea to generate the checksum as data • arrives, easing
the burden of the last call.  An alternative could be to • compute the
checksum immediatly after receiving the last data byte, but • before the
arrival of the checksum byte.

Both things are interesting and if you can post the patch they
will be included in legOS distribution. :-)

Let me know!

Bye,
     Paolo.

---
A good imagination unfortunately also makes for vivid nightmares.



Message has 1 Reply:
  Re: LegOS 0.2.5 and LNP
 
(...) Ok, I clean up the code and send you a patch. (...) This one is not yet ready. As soon as I do it you'll know. bye Bernardo (24 years ago, 18-Jan-01, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  LegOS 0.2.5 and LNP
 
Yesterday I downloaded legOS 0.2.5 and peeked at the code. Btw. README is not up to date. For last two month I was working with a friend of mine on a transport protocol implemented on top of LNP for the transmission of packets of unlimited size and (...) (24 years ago, 17-Jan-01, to lugnet.robotics.rcx.legos)

9 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR