1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:32:45 +01:00

drivers/slipdev: register with netdev

This commit is contained in:
Benjamin Valentin 2021-06-07 10:37:46 +02:00 committed by Benjamin Valentin
parent 9fbab8f0f8
commit c1eead925d
5 changed files with 9 additions and 3 deletions

View File

@ -321,6 +321,7 @@ typedef enum {
NETDEV_SX126X,
NETDEV_CC2420,
NETDEV_ETHOS,
NETDEV_SLIPDEV,
/* add more if needed */
} netdev_type_t;
/** @} */

View File

@ -105,8 +105,10 @@ typedef struct {
*
* @param[in] dev device descriptor
* @param[in] params parameters for device initialization
* @param[in] index index of @p params in a global parameter struct array.
* If initialized manually, pass a unique identifier instead.
*/
void slipdev_setup(slipdev_t *dev, const slipdev_params_t *params);
void slipdev_setup(slipdev_t *dev, const slipdev_params_t *params, uint8_t index);
#ifdef __cplusplus
}

View File

@ -1,5 +1,6 @@
USEMODULE += tsrb
USEMODULE += eui_provider
USEMODULE += netdev_register
FEATURES_REQUIRED += periph_uart
ifneq (,$(filter slipdev_stdio,$(USEMODULE)))

View File

@ -252,12 +252,14 @@ static const netdev_driver_t slip_driver = {
.set = netdev_set_notsup,
};
void slipdev_setup(slipdev_t *dev, const slipdev_params_t *params)
void slipdev_setup(slipdev_t *dev, const slipdev_params_t *params, uint8_t index)
{
/* set device descriptor fields */
dev->config = *params;
dev->state = 0;
dev->netdev.driver = &slip_driver;
netdev_register(&dev->netdev, NETDEV_SLIPDEV, index);
}
/** @} */

View File

@ -48,7 +48,7 @@ void auto_init_slipdev(void)
LOG_DEBUG("[auto_init_netif] initializing slip #%u\n", i);
slipdev_setup(&slipdevs[i], p);
slipdev_setup(&slipdevs[i], p, i);
gnrc_netif_raw_create(&_netif[i], _slipdev_stacks[i], SLIPDEV_STACKSIZE,
SLIPDEV_PRIO, "slipdev",
(netdev_t *)&slipdevs[i]);