Hi,
I have a few questions regarding CC2420TransmitP component:
0) What does the length field in CC2420 header mean? payload length only?
1)
async event void CC2420Receive.receive( uint8_t type, message_t* ack_msg )
{
cc2420_header_t* ack_header;
cc2420_header_t* msg_header;
cc2420_metadata_t* msg_metadata;
uint8_t* ack_buf;
uint8_t length;
if ( type == IEEE154_TYPE_ACK && m_msg) {
ack_header = call CC2420PacketBody.getHeader( ack_msg );
msg_header = call CC2420PacketBody.getHeader( m_msg );
if ( m_state == S_ACK_WAIT && msg_header->dsn == ack_header->dsn ) {
call BackoffTimer.stop();
msg_metadata = call CC2420PacketBody.getMetadata( m_msg );
ack_buf = (uint8_t *) ack_header;
length = ack_header->length;
msg_metadata->ack = TRUE;
//XL: why RSSI and LQI computed this way, using ACK packet
header?????????????
msg_metadata->rssi = ack_buf[ length - 1 ];
msg_metadata->lqi = ack_buf[ length ] & 0x7f;
signalDone(SUCCESS);
}
}
}
2)
void attemptSend() {
uint8_t status;
bool congestion = TRUE;
atomic {
if (m_state == S_CANCEL) {
call SFLUSHTX.strobe();
releaseSpiResource();
call CSN.set();
m_state = S_STARTED;
signal Send.sendDone( m_msg, ECANCEL );
return;
}
call CSN.clr();
status = m_cca ? call STXONCCA.strobe() : call STXON.strobe();
if ( !( status & CC2420_STATUS_TX_ACTIVE ) ) {
//XL: isn’t the status already returned by previous strobe(), why
read again????????
status = call SNOP.strobe();
if ( status & CC2420_STATUS_TX_ACTIVE ) {
congestion = FALSE;
}
}
m_state = congestion ? S_SAMPLE_CCA : S_SFD;
call CSN.set();
}
if ( congestion ) {
totalCcaChecks = 0;
releaseSpiResource();
congestionBackoff();
} else {
call BackoffTimer.start(CC2420_ABORT_PERIOD);
}
}
Can you please help me understand? I really appreciate.
--
-Xiaohui Liu
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help