1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/atwinc15x0: register with netdev

This commit is contained in:
Benjamin Valentin 2022-03-30 16:07:29 +02:00
parent 6849e33854
commit d800cca1c3
5 changed files with 8 additions and 4 deletions

View File

@ -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)

View File

@ -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
}

View File

@ -326,6 +326,7 @@ typedef enum {
NETDEV_TAP,
NETDEV_W5100,
NETDEV_ENCX24J600,
NETDEV_ATWINC15X0,
/* add more if needed */
} netdev_type_t;
/** @} */

View File

@ -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;

View File

@ -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",