cc2420ReceiveP.nc 阅读



1) async event void  InterruptFIFOP.fired();

-> 调用了 beginReceive();

2)beginReceive();

-> 调用了receive();

3)receive();

-> 调用了RXFIFO.beginRead();因此需要实现 event                     //  tos.chips.cc2420.interfaces.CC2420Fifo

4)async event void RXFIFO.readDone();

event void readDone(uint8_t *data, uint8_t length, error_t error)

Signals the completion of a read operation.
Parameters:
data - a pointer to the receive buffer.
length - number of bytes read.
error - notification of how the operation went

switch(m_state)

{

1)S_RX_LENGTH:

m_state=S_RX_FCF

m_state=S_RX_PAYLOAD

2)S_RX_DEC

3)S_RX_FCF:此状态,只能从一开始的S_RX_LENGTH状态转移过来,并且,上一次+continueread(,SACK_HEADER_LENGH);上上次,beginread(,1);,所以此次continueread(,rxFrameLength-SACK_HEADER_LENGTH);rxFrameLength=length,此length 不包括1个byte的legnth,

m_state=S_RX_PAYLOAD

4)S_RX_PAYLOAD:

这里需要验证timestamp,只有m_timestamp ==1 的时候,才是正确的数据,否则,需要丢弃。当然首先是需要验证m_missed_packets 

5)S_RX_DEC_WAIT

}


      /*
       * The FIFOP pin here is high when there are 0 bytes in the RX FIFO
       * and goes low as soon as there are bytes in the RX FIFO.  The pin
       * is inverted from what the datasheet says, and its threshold is 127.
       * Whenever the FIFOP line goes low, as you can see from the interrupt
       * handler elsewhere in this module, it means we received a new packet.
       * If the line stays low without generating an interrupt, that means
       * there's still more data to be received.
       */


Annotations that you will find in TinyOS code are:

ONE 
A pointer that always refers to a single object, similar to a C++ reference.
ONE_NOK 
Same as ONE but may be NULL.
COUNT(n) 
A pointer that always refers to a block of at least n objects.
COUNT_NOK(n) 
Same as COUNT but may be NULL.
BND(n,m) 
A pointer p such that n≤p<m, and that is aligned with respect to n and m.
BND_NOK(n,m) 
Same as BND but may be NULL.
TCAST(type,expr) 
A trusted cast, which tells Deputy to just trust the programmer. This is needed to perform casts that are safe, but are beyond the reach of Deputy's type system. Pointer casts in the network stack (e.g. getHeader() and getFooter() code) tend to fall into this category.
TRUSTEDBLOCK 
Code that is completely trusted (i.e., ignored by Deputy). This is used in very few places, and should be avoided when possible.



//基本阅读完了receivep ,还是有一些地方没有完全弄明白,对于加密的没有看。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值