Skip to content

Commit

Permalink
Merge pull request #17887 from benpicco/drivers/atwinc15x0-register
Browse files Browse the repository at this point in the history
drivers/atwinc15x0: register with netdev
  • Loading branch information
benpicco authored Mar 30, 2022
2 parents fca56ba + d800cca commit b20a300
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion drivers/atwinc15x0/atwinc15x0_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,15 @@ const netdev_driver_t atwinc15x0_netdev_driver = {
.set = _atwinc15x0_set,
};

void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params)
void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx)
{
assert(dev);

atwinc15x0 = dev;
atwinc15x0->netdev.driver = &atwinc15x0_netdev_driver;
atwinc15x0->params = *params;

netdev_register(&dev->netdev, NETDEV_ATWINC15X0, idx);
}

void atwinc15x0_irq(void)
Expand Down
3 changes: 2 additions & 1 deletion drivers/include/atwinc15x0.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ typedef struct atwinc15x0 {
*
* @param[in] dev Device descriptor
* @param[in] params Parameters for device initialization
* @param[in] idx Index in the params struct
*/
void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params);
void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx);

#ifdef __cplusplus
}
Expand Down
1 change: 1 addition & 0 deletions drivers/include/net/netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ typedef enum {
NETDEV_TAP,
NETDEV_W5100,
NETDEV_ENCX24J600,
NETDEV_ATWINC15X0,
/* add more if needed */
} netdev_type_t;
/** @} */
Expand Down
2 changes: 1 addition & 1 deletion pkg/lwip/init_devs/auto_init_atwinc15x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static atwinc15x0_t atwinc15x0_devs[NETIF_ATWINC_NUMOF];
static void auto_init_atwinc15x0(void)
{
for (unsigned i = 0; i < NETIF_ATWINC_NUMOF; i++) {
atwinc15x0_setup(&atwinc15x0_devs[i], &atwinc15x0_params[i]);
atwinc15x0_setup(&atwinc15x0_devs[i], &atwinc15x0_params[i], i);
if (lwip_add_ethernet(&netif[i], &atwinc15x0_devs[i].netdev) == NULL) {
DEBUG("Could not add atwinc15x0 device\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion sys/net/gnrc/netif/init_devs/auto_init_atwinc15x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void auto_init_atwinc15x0(void)
LOG_DEBUG("[auto_init_netif] initializing atwinc15x0 #%u\n", i);

/* setup netdev device */
atwinc15x0_setup(&dev[i], &atwinc15x0_params[i]);
atwinc15x0_setup(&dev[i], &atwinc15x0_params[i], i);
gnrc_netif_ethernet_create(&_netif[i], stack[i],
ATWINC15X0_MAC_STACKSIZE,
ATWINC15X0_MAC_PRIO, "atwinc15x0",
Expand Down

0 comments on commit b20a300

Please sign in to comment.