[Tinyos-help] A question for serial stack

li peng poppeter1982 at gmail.com
Thu Jul 30 10:15:19 PDT 2009


 Hi There

Currently, I am testing a simulation tool , and in the testing for serial
part, I think I met a potential problem for SerialDispatcherP.nc, the
concrete description is as follows:

Since this component provides two buffering in order to make the system not
miss the incoming byte stream.

1. The initial buffer is 0, which is unlocked, then buffer 0 can receive the
byte stream successfully. Once the byte stream is end successfully, then the
buffer is switched to 1, and the handling of buffer 0 is postponed into a
task. (Note: currently, buffer 0 is still locked, once the task is
scheduled, the lock can be released)

2. In my test, before the task for dealing with buffer 0 is scheduled,
another byte stream is coming. Since current buffer has been switched to
Buffer 1, which is unlocked, hence buffer 1 should receive these bytes
successfully, but in my test, it is not.

Then I checked the code of SerialDispatcherP.nc, I found the function below
seems not right:

 bool isCurrentBufferLocked() {
   return (receiveState.which)? receiveState.bufZeroLocked :
receiveState.bufOneLocked;
 }

I think the zero and one branches may be backwards, going back to the
procedure above, since receiveState.which has been set to 1, but it still
returns the state of buffer zero and vice versa, this is the cause why
buffer 1 can not receive the byte streams.

I am not very sure whether my analysis is right and reasonable, thus I need
your help! Thanks a lot!

Regards

Peng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090730/7f6c0048/attachment.htm 


More information about the Tinyos-help mailing list