Bugfix: don't care about FIFOP when reading a packet; if the radio rx had been turned off before a packet was read, FIFOP would be zero and the packet would be trashed
This commit is contained in:
parent
6b7ec2d002
commit
67b0170a43
1 changed files with 3 additions and 7 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: cc2420.c,v 1.44 2010/03/14 22:45:20 adamdunkels Exp $
|
* @(#)$Id: cc2420.c,v 1.45 2010/03/16 18:10:09 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* This code is almost device independent and should be easy to port.
|
* This code is almost device independent and should be easy to port.
|
||||||
|
@ -608,6 +608,7 @@ PROCESS_THREAD(cc2420_process, ev, data)
|
||||||
len = cc2420_read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
len = cc2420_read(packetbuf_dataptr(), PACKETBUF_SIZE);
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
packetbuf_set_datalen(len);
|
packetbuf_set_datalen(len);
|
||||||
|
|
||||||
NETSTACK_RDC.input();
|
NETSTACK_RDC.input();
|
||||||
#if CC2420_TIMETABLE_PROFILING
|
#if CC2420_TIMETABLE_PROFILING
|
||||||
TIMETABLE_TIMESTAMP(cc2420_timetable, "end");
|
TIMETABLE_TIMESTAMP(cc2420_timetable, "end");
|
||||||
|
@ -632,11 +633,6 @@ cc2420_read(void *buf, unsigned short bufsize)
|
||||||
|
|
||||||
pending = 0;
|
pending = 0;
|
||||||
|
|
||||||
if(!FIFOP_IS_1) {
|
|
||||||
/* If FIFOP is 0, there is no packet in the RXFIFO. */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GET_LOCK();
|
GET_LOCK();
|
||||||
|
|
||||||
cc2420_packets_read++;
|
cc2420_packets_read++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue