From 520f5b60b3efca5282a7aee4a70ba9b78fd8db85 Mon Sep 17 00:00:00 2001 From: smlng Date: Wed, 11 Jul 2018 11:00:07 +0200 Subject: [PATCH 1/2] cpu/cc2538: use netdev reset function in radio driver --- cpu/cc2538/radio/cc2538_rf_netdev.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cpu/cc2538/radio/cc2538_rf_netdev.c b/cpu/cc2538/radio/cc2538_rf_netdev.c index 71f6206c86..aff953216c 100644 --- a/cpu/cc2538/radio/cc2538_rf_netdev.c +++ b/cpu/cc2538/radio/cc2538_rf_netdev.c @@ -367,6 +367,8 @@ static int _init(netdev_t *netdev) uint16_t addr_short = cc2538_get_addr_short(); uint64_t addr_long = cc2538_get_addr_long(); + netdev_ieee802154_reset(&dev->netdev); + /* Initialise netdev_ieee802154_t struct */ netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_NID, &pan, sizeof(pan)); @@ -379,12 +381,6 @@ static int _init(netdev_t *netdev) cc2538_set_state(dev, NETOPT_STATE_IDLE); - /* set default protocol */ -#ifdef MODULE_GNRC_SIXLOWPAN - dev->netdev.proto = GNRC_NETTYPE_SIXLOWPAN; -#elif MODULE_GNRC - dev->netdev.proto = GNRC_NETTYPE_UNDEF; -#endif #ifdef MODULE_NETSTATS_L2 memset(&netdev->stats, 0, sizeof(netstats_t)); #endif From 0067be035cd1fff0f7a289fa521c6fbd6c3de33a Mon Sep 17 00:00:00 2001 From: smlng Date: Wed, 11 Jul 2018 11:02:11 +0200 Subject: [PATCH 2/2] cpu/cc2538: cleanup netdev calls in radio driver Cleanup netdev calls using &dev->netdev for all functions and thereby omiting the explicit cast. --- cpu/cc2538/radio/cc2538_rf_netdev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cpu/cc2538/radio/cc2538_rf_netdev.c b/cpu/cc2538/radio/cc2538_rf_netdev.c index aff953216c..387abb9fb3 100644 --- a/cpu/cc2538/radio/cc2538_rf_netdev.c +++ b/cpu/cc2538/radio/cc2538_rf_netdev.c @@ -370,13 +370,13 @@ static int _init(netdev_t *netdev) netdev_ieee802154_reset(&dev->netdev); /* Initialise netdev_ieee802154_t struct */ - netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_NID, &pan, - sizeof(pan)); - netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_CHANNEL, &chan, - sizeof(chan)); - netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_ADDRESS, + netdev_ieee802154_set(&dev->netdev, NETOPT_NID, + &pan, sizeof(pan)); + netdev_ieee802154_set(&dev->netdev, NETOPT_CHANNEL, + &chan, sizeof(chan)); + netdev_ieee802154_set(&dev->netdev, NETOPT_ADDRESS, &addr_short, sizeof(addr_short)); - netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_ADDRESS_LONG, + netdev_ieee802154_set(&dev->netdev, NETOPT_ADDRESS_LONG, &addr_long, sizeof(addr_long)); cc2538_set_state(dev, NETOPT_STATE_IDLE);