Séva Safris wrote:
Ok, so here's the deal:
I'm working on the implementation of the 802.14.5 security spec for the
telos platform. I need to do a memory write in the middle of a readRXFIFO()
function like this:
1) read out the header info making sure not to read out any of the data
2) build the nonce and write it into memory
3) call security decryption strobe (the correct nonce HAS to be written by
this time)
4) read out the now decrypted and authenticated data
All of this has to happen in the readRXFIFO() function of the HPLCC2420M.nc
file. If I do an asynchronous HPLCC2420RAM.write() in step 2) above, then I
can continue steps 3) and 4) in another function which will be called from
the writeDone() callback. However, this does not work because the
readRXFIFO() function will end up returning before the post of the
writeDone() is called. readRXFIFO() will return and I will never see the
packet.
Why does it all have to happen in the function? Why not do this:
Read the necessary header bytes from the RXFIFO.
In the readDone() event, build the nonce and write it.
In the writeDone() event, call the decryption strobe (a synchronous op).
Read the bytes out.
This will probably require that you add some states to the state machine.
Since we do not have a "real" thread architecture in the os, I do not
currently see a solution to this problem if I use asynchronous memory
writes.
Question: Can I do a HPLCC2420RAM.write() call in step 2) above and ignore
the writeDone() callback? I realize that alternate platform implementations
bind us to a common interface, but I am dealing with the telos platform in
particular. Or is it critical that I wait for the callback? The chipcon docs
don’t seem to specify a need for any special behavior when dealing with
memory access (beyond that of csn considerations).
Can I ignore the HPLCC2420RAM.writeDone(), just assuming it completes on
return of the HPLCC2420RAM.write() command (just for telos)?
I think that the current version in 1.x CVS isn't actually split phase,
so you might be able to get away with it. Joe was talking about making
it properly split phase, though, so...
Phil
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help