Skip to content

Commit

Permalink
Merge pull request #20991 from benpicco/rivers/dose-new_api
Browse files Browse the repository at this point in the history
drivers/dose: port to netdev_new_api
  • Loading branch information
maribu authored Nov 21, 2024
2 parents d7d6a36 + 8e4bdca commit 7832253
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/dose/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ USEMODULE += chunked_ringbuffer
USEMODULE += eui_provider
USEMODULE += iolist
USEMODULE += netdev_eth
USEMODULE += netdev_legacy_api
USEMODULE += netdev_new_api
USEMODULE += random
USEMODULE += ztimer_usec
14 changes: 9 additions & 5 deletions drivers/dose/dose.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,13 @@ static inline void _send_done(dose_t *ctx, bool collision)
#endif
}

static int _confirm_send(netdev_t *dev, void *info)
{
(void)dev;
(void)info;
return -EOPNOTSUPP;
}

static int _send(netdev_t *dev, const iolist_t *iolist)
{
dose_t *ctx = container_of(dev, dose_t, netdev);
Expand Down Expand Up @@ -593,9 +600,6 @@ static int _send(netdev_t *dev, const iolist_t *iolist)

_send_done(ctx, false);

/* We probably sent the whole packet?! */
dev->event_callback(dev, NETDEV_EVENT_TX_COMPLETE);

/* Get out of the SEND state */
state(ctx, DOSE_SIGNAL_END);

Expand All @@ -605,7 +609,6 @@ static int _send(netdev_t *dev, const iolist_t *iolist)
_send_done(ctx, true);
DEBUG("dose _send(): collision!\n");
if (--retries < 0) {
dev->event_callback(dev, NETDEV_EVENT_TX_MEDIUM_BUSY);
return -EBUSY;
}

Expand Down Expand Up @@ -765,7 +768,8 @@ static const netdev_driver_t netdev_driver_dose = {
.init = _init,
.isr = _isr,
.get = _get,
.set = _set
.set = _set,
.confirm_send = _confirm_send,
};

void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
Expand Down

0 comments on commit 7832253

Please sign in to comment.