mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
[w5100] Fixed RX interrupt handling
This commit is contained in:
parent
ab0071622b
commit
9bd15141a3
@ -34,7 +34,6 @@
|
|||||||
#define ENABLE_DEBUG (0)
|
#define ENABLE_DEBUG (0)
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
#define SPI_CONF SPI_MODE_0
|
#define SPI_CONF SPI_MODE_0
|
||||||
#define RMSR_DEFAULT_VALUE (0x55)
|
#define RMSR_DEFAULT_VALUE (0x55)
|
||||||
|
|
||||||
@ -285,14 +284,21 @@ static void isr(netdev_t *netdev)
|
|||||||
uint8_t ir;
|
uint8_t ir;
|
||||||
w5100_t *dev = (w5100_t *)netdev;
|
w5100_t *dev = (w5100_t *)netdev;
|
||||||
|
|
||||||
/* we only react on RX events, and if we see one, we read from the RX buffer
|
/* read interrupt register */
|
||||||
* until it is empty */
|
|
||||||
spi_acquire(dev->p.spi, dev->p.cs, SPI_CONF, dev->p.clk);
|
spi_acquire(dev->p.spi, dev->p.cs, SPI_CONF, dev->p.clk);
|
||||||
ir = rreg(dev, S0_IR);
|
ir = rreg(dev, S0_IR);
|
||||||
spi_release(dev->p.spi);
|
spi_release(dev->p.spi);
|
||||||
|
|
||||||
|
/* we only react on RX events, and if we see one, we read from the RX buffer
|
||||||
|
* until it is empty */
|
||||||
while (ir & IR_RECV) {
|
while (ir & IR_RECV) {
|
||||||
DEBUG("[w5100] netdev RX complete\n");
|
DEBUG("[w5100] netdev RX complete\n");
|
||||||
netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE);
|
netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE);
|
||||||
|
|
||||||
|
/* reread interrupt register */
|
||||||
|
spi_acquire(dev->p.spi, dev->p.cs, SPI_CONF, dev->p.clk);
|
||||||
|
ir = rreg(dev, S0_IR);
|
||||||
|
spi_release(dev->p.spi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user