|
|
|
@ -19,6 +19,8 @@
|
|
|
|
|
|
|
|
|
|
#ifdef MODULE_CC110X |
|
|
|
|
|
|
|
|
|
#include "log.h" |
|
|
|
|
#include "debug.h" |
|
|
|
|
#include "board.h" |
|
|
|
|
#include "net/gnrc/netdev2.h" |
|
|
|
|
#include "gnrc_netdev2_cc110x.h" |
|
|
|
@ -27,9 +29,6 @@
|
|
|
|
|
#include "cc110x.h" |
|
|
|
|
#include "cc110x_params.h" |
|
|
|
|
|
|
|
|
|
#define ENABLE_DEBUG (0) |
|
|
|
|
#include "debug.h" |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Define stack parameters for the MAC layer thread |
|
|
|
|
* @{ |
|
|
|
@ -48,19 +47,21 @@ static gnrc_netdev2_t _gnrc_netdev2_devs[CC110X_NUM];
|
|
|
|
|
|
|
|
|
|
void auto_init_cc110x(void) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < CC110X_NUM; i++) { |
|
|
|
|
for (unsigned i = 0; i < CC110X_NUM; i++) { |
|
|
|
|
const cc110x_params_t *p = &cc110x_params[i]; |
|
|
|
|
DEBUG("Initializing CC110X radio at SPI_%i\n", p->spi); |
|
|
|
|
|
|
|
|
|
LOG_DEBUG("[auto_init_netif] initializing cc110x #%u\n", i); |
|
|
|
|
|
|
|
|
|
int res = netdev2_cc110x_setup(&cc110x_devs[i], p); |
|
|
|
|
if (res < 0) { |
|
|
|
|
DEBUG("Error initializing CC110X radio device!\n"); |
|
|
|
|
LOG_ERROR("[auto_init_netif] error initializing cc110x #%u\n", i); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
gnrc_netdev2_cc110x_init(&_gnrc_netdev2_devs[i], &cc110x_devs[i]); |
|
|
|
|
res = gnrc_netdev2_init(_stacks[i], CC110X_MAC_STACKSIZE, |
|
|
|
|
CC110X_MAC_PRIO, "cc110x", &_gnrc_netdev2_devs[i]); |
|
|
|
|
if (res < 0) { |
|
|
|
|
DEBUG("Error starting gnrc_cc110x thread for CC110X!\n"); |
|
|
|
|
LOG_ERROR("[auto_init_netif] error starting gnrc_cc110x thread\n"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|