Skip to content
Snippets Groups Projects
Unverified Commit afa69c55 authored by José Ignacio Alamos Aste's avatar José Ignacio Alamos Aste Committed by GitHub
Browse files

Merge pull request #10416 from maribu/cc2420

drivers/cc2420: Implemented missing drop case
parents 241c870d aac69c3a
No related branches found
No related tags found
No related merge requests found
......@@ -180,14 +180,21 @@ int cc2420_rx(cc2420_t *dev, uint8_t *buf, size_t max_len, void *info)
cc2420_ram_read(dev, CC2420_RAM_RXFIFO, &len, 1);
len -= 2; /* subtract RSSI and FCF */
DEBUG("cc2420: recv: packet of length %i in RX FIFO\n", (int)len);
if (max_len != 0) {
DEBUG("cc2420: recv: Dropping frame as requested\n");
_flush_rx_fifo(dev);
}
}
else {
/* read length byte */
cc2420_fifo_read(dev, &len, 1);
len -= 2; /* subtract RSSI and FCF */
/* if a buffer is given, read (and drop) the packet */
len = (len > max_len) ? max_len : len;
if (len > max_len) {
DEBUG("cc2420: recv: Supplied buffer to small\n");
_flush_rx_fifo(dev);
return -ENOBUFS;
}
/* read fifo contents */
DEBUG("cc2420: recv: reading %i byte of the packet\n", (int)len);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment