2019-12-13 17:47:03 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 ML!PA Consulting GmbH
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @ingroup sys_auto_init_gnrc_netif
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Auto initialization for at86rf215 network interfaces
|
|
|
|
*
|
|
|
|
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define USED_BANDS (IS_USED(MODULE_AT86RF215_SUBGHZ) + IS_USED(MODULE_AT86RF215_24GHZ))
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
#include "board.h"
|
|
|
|
#include "net/gnrc/netif/ieee802154.h"
|
|
|
|
#ifdef MODULE_GNRC_LWMAC
|
|
|
|
#include "net/gnrc/lwmac/lwmac.h"
|
|
|
|
#endif
|
|
|
|
#ifdef MODULE_GNRC_GOMACH
|
|
|
|
#include "net/gnrc/gomach/gomach.h"
|
|
|
|
#endif
|
|
|
|
#include "net/gnrc.h"
|
2020-11-22 23:50:51 +01:00
|
|
|
#include "include/init_devs.h"
|
2019-12-13 17:47:03 +01:00
|
|
|
|
|
|
|
#include "at86rf215.h"
|
|
|
|
#include "at86rf215_params.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define stack parameters for the MAC layer thread
|
|
|
|
* @{
|
|
|
|
*/
|
2020-11-22 23:50:51 +01:00
|
|
|
#define AT86RF215_MAC_STACKSIZE (IEEE802154_STACKSIZE_DEFAULT)
|
2019-12-13 17:47:03 +01:00
|
|
|
#ifndef AT86RF215_MAC_PRIO
|
|
|
|
#define AT86RF215_MAC_PRIO (GNRC_NETIF_PRIO)
|
|
|
|
#endif
|
|
|
|
#ifndef AT86RF215_MAC_PRIO_SUBGHZ
|
|
|
|
#define AT86RF215_MAC_PRIO_SUBGHZ (AT86RF215_MAC_PRIO)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define AT86RF215_NUM ARRAY_SIZE(at86rf215_params)
|
|
|
|
|
|
|
|
static at86rf215_t at86rf215_devs[AT86RF215_NUM * USED_BANDS];
|
2019-12-19 19:23:15 +01:00
|
|
|
static gnrc_netif_t _netif[AT86RF215_NUM * USED_BANDS];
|
2019-12-13 17:47:03 +01:00
|
|
|
static char _at86rf215_stacks[AT86RF215_NUM * USED_BANDS][AT86RF215_MAC_STACKSIZE];
|
|
|
|
|
2019-12-19 19:23:15 +01:00
|
|
|
static inline void _setup_netif(gnrc_netif_t *netif, void* netdev, void* stack,
|
drivers/at86rf215: give driver threads different names
Use different names for the sub-GHz and 2.4 GHz driver thread to make
it easier to tell which is which.
```
2020-10-21 19:53:50,608 # pid | name | state Q | pri | stack ( used) ( free) | base addr | current
2020-10-21 19:53:50,622 # - | isr_stack | - - | - | 512 ( 232) ( 280) | 0x20000000 | 0x200001c8
2020-10-21 19:53:50,623 # 1 | main | running Q | 7 | 1536 ( 660) ( 876) | 0x200002f8 | 0x2000075c
2020-10-21 19:53:50,639 # 2 | pktdump | bl rx _ | 6 | 1536 ( 236) ( 1300) | 0x200035a8 | 0x20003abc
2020-10-21 19:53:50,653 # 3 | 6lo | bl rx _ | 3 | 1024 ( 332) ( 692) | 0x2000420c | 0x2000450c
2020-10-21 19:53:50,655 # 4 | ipv6 | bl rx _ | 4 | 1024 ( 376) ( 648) | 0x200009d4 | 0x20000cd4
2020-10-21 19:53:50,670 # 5 | udp | bl rx _ | 5 | 1024 ( 252) ( 772) | 0x200049f0 | 0x20004cf4
2020-10-21 19:53:50,672 # 6 | at86rf215 [sub GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001200 | 0x200014c4
2020-10-21 19:53:50,687 # 7 | at86rf215 [2.4 GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001600 | 0x200018c4
2020-10-21 19:53:50,689 # | SUM | | | 8704 ( 3160) ( 5544)
```
2020-10-21 19:54:32 +02:00
|
|
|
int prio, const char *name)
|
2019-12-19 19:23:15 +01:00
|
|
|
{
|
|
|
|
if (netif == NULL || netdev == NULL) {
|
2019-12-13 17:47:03 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(MODULE_GNRC_GOMACH)
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_gomach_create(netif, stack,
|
2019-12-13 17:47:03 +01:00
|
|
|
AT86RF215_MAC_STACKSIZE,
|
drivers/at86rf215: give driver threads different names
Use different names for the sub-GHz and 2.4 GHz driver thread to make
it easier to tell which is which.
```
2020-10-21 19:53:50,608 # pid | name | state Q | pri | stack ( used) ( free) | base addr | current
2020-10-21 19:53:50,622 # - | isr_stack | - - | - | 512 ( 232) ( 280) | 0x20000000 | 0x200001c8
2020-10-21 19:53:50,623 # 1 | main | running Q | 7 | 1536 ( 660) ( 876) | 0x200002f8 | 0x2000075c
2020-10-21 19:53:50,639 # 2 | pktdump | bl rx _ | 6 | 1536 ( 236) ( 1300) | 0x200035a8 | 0x20003abc
2020-10-21 19:53:50,653 # 3 | 6lo | bl rx _ | 3 | 1024 ( 332) ( 692) | 0x2000420c | 0x2000450c
2020-10-21 19:53:50,655 # 4 | ipv6 | bl rx _ | 4 | 1024 ( 376) ( 648) | 0x200009d4 | 0x20000cd4
2020-10-21 19:53:50,670 # 5 | udp | bl rx _ | 5 | 1024 ( 252) ( 772) | 0x200049f0 | 0x20004cf4
2020-10-21 19:53:50,672 # 6 | at86rf215 [sub GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001200 | 0x200014c4
2020-10-21 19:53:50,687 # 7 | at86rf215 [2.4 GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001600 | 0x200018c4
2020-10-21 19:53:50,689 # | SUM | | | 8704 ( 3160) ( 5544)
```
2020-10-21 19:54:32 +02:00
|
|
|
prio, name, netdev);
|
2019-12-13 17:47:03 +01:00
|
|
|
#elif defined(MODULE_GNRC_LWMAC)
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_lwmac_create(netif, stack,
|
|
|
|
AT86RF215_MAC_STACKSIZE,
|
drivers/at86rf215: give driver threads different names
Use different names for the sub-GHz and 2.4 GHz driver thread to make
it easier to tell which is which.
```
2020-10-21 19:53:50,608 # pid | name | state Q | pri | stack ( used) ( free) | base addr | current
2020-10-21 19:53:50,622 # - | isr_stack | - - | - | 512 ( 232) ( 280) | 0x20000000 | 0x200001c8
2020-10-21 19:53:50,623 # 1 | main | running Q | 7 | 1536 ( 660) ( 876) | 0x200002f8 | 0x2000075c
2020-10-21 19:53:50,639 # 2 | pktdump | bl rx _ | 6 | 1536 ( 236) ( 1300) | 0x200035a8 | 0x20003abc
2020-10-21 19:53:50,653 # 3 | 6lo | bl rx _ | 3 | 1024 ( 332) ( 692) | 0x2000420c | 0x2000450c
2020-10-21 19:53:50,655 # 4 | ipv6 | bl rx _ | 4 | 1024 ( 376) ( 648) | 0x200009d4 | 0x20000cd4
2020-10-21 19:53:50,670 # 5 | udp | bl rx _ | 5 | 1024 ( 252) ( 772) | 0x200049f0 | 0x20004cf4
2020-10-21 19:53:50,672 # 6 | at86rf215 [sub GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001200 | 0x200014c4
2020-10-21 19:53:50,687 # 7 | at86rf215 [2.4 GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001600 | 0x200018c4
2020-10-21 19:53:50,689 # | SUM | | | 8704 ( 3160) ( 5544)
```
2020-10-21 19:54:32 +02:00
|
|
|
prio, name, netdev);
|
2019-12-13 17:47:03 +01:00
|
|
|
#else
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_ieee802154_create(netif, stack,
|
|
|
|
AT86RF215_MAC_STACKSIZE,
|
drivers/at86rf215: give driver threads different names
Use different names for the sub-GHz and 2.4 GHz driver thread to make
it easier to tell which is which.
```
2020-10-21 19:53:50,608 # pid | name | state Q | pri | stack ( used) ( free) | base addr | current
2020-10-21 19:53:50,622 # - | isr_stack | - - | - | 512 ( 232) ( 280) | 0x20000000 | 0x200001c8
2020-10-21 19:53:50,623 # 1 | main | running Q | 7 | 1536 ( 660) ( 876) | 0x200002f8 | 0x2000075c
2020-10-21 19:53:50,639 # 2 | pktdump | bl rx _ | 6 | 1536 ( 236) ( 1300) | 0x200035a8 | 0x20003abc
2020-10-21 19:53:50,653 # 3 | 6lo | bl rx _ | 3 | 1024 ( 332) ( 692) | 0x2000420c | 0x2000450c
2020-10-21 19:53:50,655 # 4 | ipv6 | bl rx _ | 4 | 1024 ( 376) ( 648) | 0x200009d4 | 0x20000cd4
2020-10-21 19:53:50,670 # 5 | udp | bl rx _ | 5 | 1024 ( 252) ( 772) | 0x200049f0 | 0x20004cf4
2020-10-21 19:53:50,672 # 6 | at86rf215 [sub GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001200 | 0x200014c4
2020-10-21 19:53:50,687 # 7 | at86rf215 [2.4 GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001600 | 0x200018c4
2020-10-21 19:53:50,689 # | SUM | | | 8704 ( 3160) ( 5544)
```
2020-10-21 19:54:32 +02:00
|
|
|
prio, name, netdev);
|
2019-12-13 17:47:03 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void auto_init_at86rf215(void)
|
|
|
|
{
|
|
|
|
unsigned i = 0;
|
2020-07-07 20:47:06 +02:00
|
|
|
for (unsigned j = 0; j < AT86RF215_NUM; ++j) {
|
2019-12-13 17:47:03 +01:00
|
|
|
|
|
|
|
at86rf215_t *dev_09 = NULL;
|
|
|
|
at86rf215_t *dev_24 = NULL;
|
|
|
|
void *stack_09 = NULL;
|
|
|
|
void *stack_24 = NULL;
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_t *netif_09 = NULL;
|
|
|
|
gnrc_netif_t *netif_24 = NULL;
|
2019-12-13 17:47:03 +01:00
|
|
|
|
|
|
|
if (IS_USED(MODULE_AT86RF215_SUBGHZ)) {
|
|
|
|
dev_09 = &at86rf215_devs[i];
|
|
|
|
stack_09 = &_at86rf215_stacks[i];
|
2019-12-19 19:23:15 +01:00
|
|
|
netif_09 = &_netif[i];
|
2019-12-13 17:47:03 +01:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IS_USED(MODULE_AT86RF215_24GHZ)) {
|
|
|
|
dev_24 = &at86rf215_devs[i];
|
|
|
|
stack_24 = &_at86rf215_stacks[i];
|
2019-12-19 19:23:15 +01:00
|
|
|
netif_24 = &_netif[i];
|
2019-12-13 17:47:03 +01:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2020-07-07 20:47:06 +02:00
|
|
|
at86rf215_setup(dev_09, dev_24, &at86rf215_params[j], j);
|
2019-12-13 17:47:03 +01:00
|
|
|
|
|
|
|
/* setup sub-GHz interface */
|
drivers/at86rf215: give driver threads different names
Use different names for the sub-GHz and 2.4 GHz driver thread to make
it easier to tell which is which.
```
2020-10-21 19:53:50,608 # pid | name | state Q | pri | stack ( used) ( free) | base addr | current
2020-10-21 19:53:50,622 # - | isr_stack | - - | - | 512 ( 232) ( 280) | 0x20000000 | 0x200001c8
2020-10-21 19:53:50,623 # 1 | main | running Q | 7 | 1536 ( 660) ( 876) | 0x200002f8 | 0x2000075c
2020-10-21 19:53:50,639 # 2 | pktdump | bl rx _ | 6 | 1536 ( 236) ( 1300) | 0x200035a8 | 0x20003abc
2020-10-21 19:53:50,653 # 3 | 6lo | bl rx _ | 3 | 1024 ( 332) ( 692) | 0x2000420c | 0x2000450c
2020-10-21 19:53:50,655 # 4 | ipv6 | bl rx _ | 4 | 1024 ( 376) ( 648) | 0x200009d4 | 0x20000cd4
2020-10-21 19:53:50,670 # 5 | udp | bl rx _ | 5 | 1024 ( 252) ( 772) | 0x200049f0 | 0x20004cf4
2020-10-21 19:53:50,672 # 6 | at86rf215 [sub GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001200 | 0x200014c4
2020-10-21 19:53:50,687 # 7 | at86rf215 [2.4 GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001600 | 0x200018c4
2020-10-21 19:53:50,689 # | SUM | | | 8704 ( 3160) ( 5544)
```
2020-10-21 19:54:32 +02:00
|
|
|
_setup_netif(netif_09, dev_09, stack_09, AT86RF215_MAC_PRIO_SUBGHZ, "at86rf215 [sub GHz]");
|
2019-12-13 17:47:03 +01:00
|
|
|
|
|
|
|
/* setup 2.4-GHz interface */
|
drivers/at86rf215: give driver threads different names
Use different names for the sub-GHz and 2.4 GHz driver thread to make
it easier to tell which is which.
```
2020-10-21 19:53:50,608 # pid | name | state Q | pri | stack ( used) ( free) | base addr | current
2020-10-21 19:53:50,622 # - | isr_stack | - - | - | 512 ( 232) ( 280) | 0x20000000 | 0x200001c8
2020-10-21 19:53:50,623 # 1 | main | running Q | 7 | 1536 ( 660) ( 876) | 0x200002f8 | 0x2000075c
2020-10-21 19:53:50,639 # 2 | pktdump | bl rx _ | 6 | 1536 ( 236) ( 1300) | 0x200035a8 | 0x20003abc
2020-10-21 19:53:50,653 # 3 | 6lo | bl rx _ | 3 | 1024 ( 332) ( 692) | 0x2000420c | 0x2000450c
2020-10-21 19:53:50,655 # 4 | ipv6 | bl rx _ | 4 | 1024 ( 376) ( 648) | 0x200009d4 | 0x20000cd4
2020-10-21 19:53:50,670 # 5 | udp | bl rx _ | 5 | 1024 ( 252) ( 772) | 0x200049f0 | 0x20004cf4
2020-10-21 19:53:50,672 # 6 | at86rf215 [sub GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001200 | 0x200014c4
2020-10-21 19:53:50,687 # 7 | at86rf215 [2.4 GHz] | bl rx _ | 2 | 1024 ( 536) ( 488) | 0x20001600 | 0x200018c4
2020-10-21 19:53:50,689 # | SUM | | | 8704 ( 3160) ( 5544)
```
2020-10-21 19:54:32 +02:00
|
|
|
_setup_netif(netif_24, dev_24, stack_24, AT86RF215_MAC_PRIO, "at86rf215 [2.4 GHz]");
|
2019-12-13 17:47:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/** @} */
|