generic radio return values

+ minor bug fix: SFD may go high without transmission starting (very seldom)
This commit is contained in:
fros4943 2009-11-13 10:07:53 +00:00
parent add9d2a387
commit 9cc57c4324

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: cc2420.c,v 1.34 2009/09/09 21:07:42 adamdunkels Exp $
* @(#)$Id: cc2420.c,v 1.35 2009/11/13 10:07:53 fros4943 Exp $
*/
/*
* This code is almost device independent and should be easy to port.
@ -387,6 +387,12 @@ cc2420_send(const void *payload, unsigned short payload_len)
for(i = LOOP_20_SYMBOLS; i > 0; i--) {
if(SFD_IS_1) {
if(!(status() & BV(CC2420_TX_ACTIVE))) {
/* SFD went high yet we are not transmitting!
* => We started receiving a packet right now */
return RADIO_TX_ERR;
}
#if CC2420_CONF_TIMESTAMPS
rtimer_clock_t txtime = timesynch_time();
#endif /* CC2420_CONF_TIMESTAMPS */
@ -429,7 +435,7 @@ cc2420_send(const void *payload, unsigned short payload_len)
}
RELEASE_LOCK();
return 0;
return RADIO_TX_OK;
}
}
@ -444,7 +450,7 @@ cc2420_send(const void *payload, unsigned short payload_len)
}
RELEASE_LOCK();
return -3; /* Transmission never started! */
return RADIO_TX_ERR; /* Transmission never started! */
}
/*---------------------------------------------------------------------------*/
int