Skip to content
Snippets Groups Projects
Commit 6c9578c0 authored by Martine Lenders's avatar Martine Lenders
Browse files

Add sixlowpan to auto_init

parent 00acab92
No related branches found
No related tags found
No related merge requests found
...@@ -51,6 +51,10 @@ ...@@ -51,6 +51,10 @@
#include "rtc.h" #include "rtc.h"
#endif #endif
#ifdef MODULE_SIXLOWPAN
#include "sixlowpan.h"
#endif
#ifdef MODULE_DESTINY #ifdef MODULE_DESTINY
#include "destiny.h" #include "destiny.h"
#endif #endif
...@@ -63,6 +67,14 @@ ...@@ -63,6 +67,14 @@
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
#ifndef CONF_RADIO_ADDR
#define CONF_RADIO_ADDR (1)
#endif
#ifndef CONF_PAN_ID
#define CONF_PAN_ID (0xabcd)
#endif
extern int main(void); extern int main(void);
void auto_init(void) void auto_init(void)
...@@ -103,6 +115,7 @@ void auto_init(void) ...@@ -103,6 +115,7 @@ void auto_init(void)
MCI_initialize(); MCI_initialize();
#endif #endif
#ifdef MODULE_NET_IF #ifdef MODULE_NET_IF
int iface;
DEBUG("Auto init net_if module.\n"); DEBUG("Auto init net_if module.\n");
transceiver_type_t transceivers = 0; transceiver_type_t transceivers = 0;
#ifdef MODULE_AT86RF231 #ifdef MODULE_AT86RF231
...@@ -128,13 +141,32 @@ void auto_init(void) ...@@ -128,13 +141,32 @@ void auto_init(void)
if (transceivers != 0) { if (transceivers != 0) {
transceiver_init(transceivers); transceiver_init(transceivers);
transceiver_start(); transceiver_start();
int iface = net_if_init_interface(0, transceivers); iface = net_if_init_interface(0, transceivers);
if (!net_if_get_hardware_address(iface)) {
DEBUG("Auto init radio address on interface %d to 0x%04x\n", iface, CONF_RADIO_ADDR);
DEBUG("Change this value at compile time with macro CONF_RADIO_ADDR\n");
net_if_set_hardware_address(iface, CONF_RADIO_ADDR);
}
if (net_if_get_pan_id(iface) <= 0) {
DEBUG("Auto init PAN ID on interface %d to 0x%04x\n", iface, CONF_PAN_ID);
DEBUG("Change this value at compile time with macro CONF_PAN_ID\n");
net_if_set_pan_id(iface, CONF_PAN_ID);
}
if (iface >= 0) { if (iface >= 0) {
DEBUG("Interface %d initialized\n", iface); DEBUG("Auto init interface %d\n", iface);
} }
} }
else {
iface = -1;
}
#ifdef MODULE_SIXLOWPAN
DEBUG("Auto init 6LoWPAN module.\n");
sixlowpan_lowpan_init();
#endif
#endif #endif
#ifdef MODULE_PROFILING #ifdef MODULE_PROFILING
extern void profiling_init(void); extern void profiling_init(void);
......
...@@ -142,10 +142,6 @@ int sixlowpan_lowpan_border_init(int if_id) ...@@ -142,10 +142,6 @@ int sixlowpan_lowpan_border_init(int if_id)
return 0; return 0;
} }
if (!sixlowpan_lowpan_init()) {
return 0;
}
if (!sixlowpan_lowpan_init_interface(if_id)) { if (!sixlowpan_lowpan_init_interface(if_id)) {
return 0; return 0;
} }
......
...@@ -209,10 +209,6 @@ uint8_t rpl_init(int if_id) ...@@ -209,10 +209,6 @@ uint8_t rpl_init(int if_id)
objective_functions[0] = rpl_get_of0(); objective_functions[0] = rpl_get_of0();
/* objective_functions[1] = rpl_get_of_ETX() */ /* objective_functions[1] = rpl_get_of_ETX() */
if (!sixlowpan_lowpan_init()) {
return 0;
}
sixlowpan_lowpan_init_interface(if_id); sixlowpan_lowpan_init_interface(if_id);
/* need link local prefix to query _our_ corresponding address */ /* need link local prefix to query _our_ corresponding address */
ipv6_addr_t ll_address; ipv6_addr_t ll_address;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment