Skip to content

Commit

Permalink
auto_init/cc2538_rf: add support for SubMAC
Browse files Browse the repository at this point in the history
  • Loading branch information
jia200x committed Sep 7, 2020
1 parent e90ee4f commit 83c8676
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sys/net/gnrc/netif/init_devs/auto_init_cc2538_rf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "log.h"
#include "net/gnrc/netif/ieee802154.h"
#include "net/ieee802154/radio.h"
#include "net/netdev/ieee802154_submac.h"

#include "cc2538_rf.h"

Expand All @@ -31,18 +33,31 @@
#define CC2538_MAC_PRIO (GNRC_NETIF_PRIO)
#endif

#if IS_USED(MODULE_IEEE802154_RADIO_HAL)
extern ieee802154_dev_t cc2538_rf_dev;
static netdev_ieee802154_submac_t cc2538_rf_submac;
#else
static cc2538_rf_t cc2538_rf_dev;
#endif
static char _cc2538_rf_stack[CC2538_MAC_STACKSIZE];
static gnrc_netif_t _netif;

void auto_init_cc2538_rf(void)
{
LOG_DEBUG("[auto_init_netif] initializing cc2538 radio\n");

netdev_t *netdev;
#if IS_USED(MODULE_IEEE802154_RADIO_HAL)
netdev_ieee802154_submac_init(&cc2538_rf_submac, &cc2538_rf_dev);
netdev = (netdev_t*) &cc2538_rf_submac;
cc2538_init();
#else
netdev = &cc2538_rf_dev.netdev.netdev;
cc2538_setup(&cc2538_rf_dev);
#endif
gnrc_netif_ieee802154_create(&_netif, _cc2538_rf_stack,
CC2538_MAC_STACKSIZE,
CC2538_MAC_PRIO, "cc2538_rf",
(netdev_t *)&cc2538_rf_dev);
netdev);
}
/** @} */

0 comments on commit 83c8676

Please sign in to comment.