mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers: net: adapt to removed event_callback argument
This commit is contained in:
parent
82243b86fc
commit
d7b17684e4
@ -98,7 +98,7 @@ static inline int _set_promiscous(netdev2_t *netdev, int value)
|
||||
static inline void _isr(netdev2_t *netdev)
|
||||
{
|
||||
if (netdev->event_callback) {
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE);
|
||||
}
|
||||
#if DEVELHELP
|
||||
else {
|
||||
@ -297,7 +297,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, int n)
|
||||
netdev->stats.tx_bytes += bytes;
|
||||
#endif
|
||||
if (netdev->event_callback) {
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -313,7 +313,7 @@ static void _tap_isr(int fd) {
|
||||
netdev2_t *netdev = (netdev2_t *)&netdev2_tap;
|
||||
|
||||
if (netdev->event_callback) {
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_ISR, netdev->isr_arg);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_ISR);
|
||||
}
|
||||
else {
|
||||
puts("netdev2_tap: _isr: no event callback.");
|
||||
|
@ -218,6 +218,6 @@ void at86rf2xx_tx_exec(at86rf2xx_t *dev)
|
||||
AT86RF2XX_TRX_STATE__TX_START);
|
||||
if (netdev->event_callback &&
|
||||
(dev->netdev.flags & AT86RF2XX_OPT_TELL_TX_START)) {
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_STARTED, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_STARTED);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ static void _irq_handler(void *arg)
|
||||
netdev2_t *dev = (netdev2_t *) arg;
|
||||
|
||||
if (dev->event_callback) {
|
||||
dev->event_callback(dev, NETDEV2_EVENT_ISR, NULL);
|
||||
dev->event_callback(dev, NETDEV2_EVENT_ISR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ static void _isr(netdev2_t *netdev)
|
||||
AT86RF2XX_TRX_STATE_MASK__TRAC;
|
||||
|
||||
if (irq_mask & AT86RF2XX_IRQ_STATUS_MASK__RX_START) {
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_STARTED, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_STARTED);
|
||||
DEBUG("[at86rf2xx] EVT - RX_START\n");
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ static void _isr(netdev2_t *netdev)
|
||||
if (!(dev->netdev.flags & AT86RF2XX_OPT_TELL_RX_END)) {
|
||||
return;
|
||||
}
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE);
|
||||
}
|
||||
else if (state == AT86RF2XX_STATE_TX_ARET_ON ||
|
||||
state == AT86RF2XX_STATE_BUSY_TX_ARET) {
|
||||
@ -635,15 +635,15 @@ static void _isr(netdev2_t *netdev)
|
||||
switch (trac_status) {
|
||||
case AT86RF2XX_TRX_STATE__TRAC_SUCCESS:
|
||||
case AT86RF2XX_TRX_STATE__TRAC_SUCCESS_DATA_PENDING:
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE);
|
||||
DEBUG("[at86rf2xx] TX SUCCESS\n");
|
||||
break;
|
||||
case AT86RF2XX_TRX_STATE__TRAC_NO_ACK:
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_NOACK, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_NOACK);
|
||||
DEBUG("[at86rf2xx] TX NO_ACK\n");
|
||||
break;
|
||||
case AT86RF2XX_TRX_STATE__TRAC_CHANNEL_ACCESS_FAILURE:
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_MEDIUM_BUSY, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_MEDIUM_BUSY);
|
||||
DEBUG("[at86rf2xx] TX_CHANNEL_ACCESS_FAILURE\n");
|
||||
break;
|
||||
default:
|
||||
|
@ -164,7 +164,7 @@ static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len)
|
||||
static void _netdev2_cc110x_isr(void *arg)
|
||||
{
|
||||
netdev2_t *netdev2 = (netdev2_t*) arg;
|
||||
netdev2->event_callback(netdev2, NETDEV2_EVENT_ISR, netdev2->isr_arg);
|
||||
netdev2->event_callback(netdev2, NETDEV2_EVENT_ISR);
|
||||
}
|
||||
|
||||
static void _netdev2_cc110x_rx_callback(void *arg)
|
||||
@ -172,7 +172,7 @@ static void _netdev2_cc110x_rx_callback(void *arg)
|
||||
netdev2_t *netdev2 = (netdev2_t*) arg;
|
||||
cc110x_t *cc110x = &((netdev2_cc110x_t*) arg)->cc110x;
|
||||
gpio_irq_disable(cc110x->params.gdo2);
|
||||
netdev2->event_callback(netdev2, NETDEV2_EVENT_RX_COMPLETE, NULL);
|
||||
netdev2->event_callback(netdev2, NETDEV2_EVENT_RX_COMPLETE);
|
||||
}
|
||||
|
||||
static void _isr(netdev2_t *dev)
|
||||
|
@ -216,7 +216,7 @@ static void mac_set(enc28j60_t *dev, uint8_t *mac)
|
||||
static void on_int(void *arg)
|
||||
{
|
||||
netdev2_t *netdev = (netdev2_t *)arg;
|
||||
netdev->event_callback(arg, NETDEV2_EVENT_ISR, netdev->isr_arg);
|
||||
netdev->event_callback(arg, NETDEV2_EVENT_ISR);
|
||||
}
|
||||
|
||||
static int nd_send(netdev2_t *netdev, const struct iovec *data, int count)
|
||||
@ -400,17 +400,17 @@ static void nd_isr(netdev2_t *netdev)
|
||||
/* go and tell the new link layer state to upper layers */
|
||||
if (cmd_r_phy(dev, REG_PHY_PHSTAT2) & PHSTAT2_LSTAT) {
|
||||
DEBUG("[enc28j60] isr: link up!\n");
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_LINK_UP, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_LINK_UP);
|
||||
}
|
||||
else {
|
||||
DEBUG("[enc28j60] isr: link down!\n");
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_LINK_DOWN, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_LINK_DOWN);
|
||||
}
|
||||
}
|
||||
if (eir & EIR_PKTIF) {
|
||||
do {
|
||||
DEBUG("[enc28j60] isr: packet received\n");
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE);
|
||||
} while (cmd_rcr(dev, REG_B1_EPKTCNT, 1) > 0);
|
||||
}
|
||||
if (eir & EIR_RXERIF) {
|
||||
@ -419,7 +419,7 @@ static void nd_isr(netdev2_t *netdev)
|
||||
}
|
||||
if (eir & EIR_TXIF) {
|
||||
DEBUG("[enc28j60] isr: packet transmitted\n");
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE, NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE);
|
||||
cmd_bfc(dev, REG_EIR, -1, EIR_TXIF);
|
||||
}
|
||||
if (eir & EIR_TXERIF) {
|
||||
|
@ -96,13 +96,12 @@ void encx24j600_setup(encx24j600_t *dev, const encx24j600_params_t *params)
|
||||
static void encx24j600_isr(void *arg)
|
||||
{
|
||||
encx24j600_t *dev = (encx24j600_t *) arg;
|
||||
netdev2_t *netdev = (netdev2_t *) arg;
|
||||
|
||||
/* disable interrupt line */
|
||||
gpio_irq_disable(dev->int_pin);
|
||||
|
||||
/* call netdev2 hook */
|
||||
dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_ISR, netdev->isr_arg);
|
||||
dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_ISR);
|
||||
}
|
||||
|
||||
static void _isr(netdev2_t *netdev)
|
||||
@ -124,15 +123,14 @@ static void _isr(netdev2_t *netdev)
|
||||
NETDEV2_EVENT_LINK_DOWN :
|
||||
NETDEV2_EVENT_LINK_UP;
|
||||
|
||||
netdev->event_callback(netdev, event, NULL);
|
||||
netdev->event_callback(netdev, event);
|
||||
}
|
||||
|
||||
/* check & handle available packets */
|
||||
if (eir & ENC_PKTIF) {
|
||||
while (_packets_available(dev)) {
|
||||
unlock(dev);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE,
|
||||
NULL);
|
||||
netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE);
|
||||
lock(dev);
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ static void _end_of_frame(ethos_t *dev)
|
||||
case ETHOS_FRAME_TYPE_DATA:
|
||||
if (dev->framesize) {
|
||||
dev->last_framesize = dev->framesize;
|
||||
dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_ISR, dev->netdev.isr_arg);
|
||||
dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_ISR);
|
||||
}
|
||||
break;
|
||||
case ETHOS_FRAME_TYPE_HELLO:
|
||||
@ -177,7 +177,7 @@ static void ethos_isr(void *arg, uint8_t c)
|
||||
static void _isr(netdev2_t *netdev)
|
||||
{
|
||||
ethos_t *dev = (ethos_t *) netdev;
|
||||
dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_RX_COMPLETE, NULL);
|
||||
dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_RX_COMPLETE);
|
||||
}
|
||||
|
||||
static int _init(netdev2_t *encdev)
|
||||
|
@ -45,11 +45,9 @@ static void _pass_on_packet(gnrc_pktsnip_t *pkt);
|
||||
* @brief Function called by the device driver on device events
|
||||
*
|
||||
* @param[in] event type of event
|
||||
* @param[in] data optional parameter
|
||||
*/
|
||||
static void _event_cb(netdev2_t *dev, netdev2_event_t event, void *data)
|
||||
static void _event_cb(netdev2_t *dev, netdev2_event_t event)
|
||||
{
|
||||
(void) data;
|
||||
gnrc_netdev2_t *gnrc_netdev2 = (gnrc_netdev2_t*) dev->isr_arg;
|
||||
|
||||
if (event == NETDEV2_EVENT_ISR) {
|
||||
|
@ -42,10 +42,8 @@ static const shell_command_t shell_commands[] = {
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void _event_cb(netdev2_t *dev, netdev2_event_t event, void *data)
|
||||
static void _event_cb(netdev2_t *dev, netdev2_event_t event)
|
||||
{
|
||||
(void) data;
|
||||
|
||||
if (event == NETDEV2_EVENT_ISR) {
|
||||
msg_t msg;
|
||||
|
||||
|
@ -153,8 +153,7 @@ static int test_receive(void)
|
||||
/* register for GNRC_NETTYPE_UNDEF */
|
||||
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &me);
|
||||
/* fire ISR event */
|
||||
_dev.netdev.event_callback((netdev2_t *)&_dev.netdev, NETDEV2_EVENT_ISR,
|
||||
&_dev.netdev.isr_arg);
|
||||
_dev.netdev.event_callback((netdev2_t *)&_dev.netdev, NETDEV2_EVENT_ISR);
|
||||
/* wait for packet from MAC layer*/
|
||||
msg_receive(&msg);
|
||||
/* check message */
|
||||
@ -289,7 +288,7 @@ static void _dev_isr(netdev2_t *dev)
|
||||
{
|
||||
(void)dev;
|
||||
if (dev->event_callback) {
|
||||
dev->event_callback(dev, NETDEV2_EVENT_RX_COMPLETE, dev->isr_arg);
|
||||
dev->event_callback(dev, NETDEV2_EVENT_RX_COMPLETE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user