Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/atwinc15x0: register with netdev #17887

Merged
merged 1 commit into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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