[projects test_rpl] [sys net sixlowpan rpl]
* removed vtimer_init from rpl_init * some transceiver watchdog workaround foobar
This commit is contained in:
parent
7397d98f8a
commit
e9cdacbf51
@ -14,7 +14,29 @@
|
|||||||
#include "sys/net/sixlowpan/rpl/rpl.h"
|
#include "sys/net/sixlowpan/rpl/rpl.h"
|
||||||
#include "sys/net/sixlowpan/rpl/rpl_dodag.h"
|
#include "sys/net/sixlowpan/rpl/rpl_dodag.h"
|
||||||
|
|
||||||
|
#define TR_WD_STACKSIZE (256)
|
||||||
|
|
||||||
|
char tr_wd_stack[TR_WD_STACKSIZE];
|
||||||
|
|
||||||
|
void wakeup_thread(void) {
|
||||||
|
while (1) {
|
||||||
|
if (thread_getstatus(transceiver_pid) == STATUS_SLEEPING) {
|
||||||
|
vtimer_usleep(100 * 1000);
|
||||||
|
if (thread_getstatus(transceiver_pid) == STATUS_SLEEPING) {
|
||||||
|
puts("WAKEUP!");
|
||||||
|
thread_wakeup(transceiver_pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vtimer_usleep(1000 * 1000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void init(char *str){
|
void init(char *str){
|
||||||
|
transceiver_command_t tcmd;
|
||||||
|
msg_t m;
|
||||||
|
uint8_t chan = 10;
|
||||||
|
|
||||||
char command;
|
char command;
|
||||||
uint16_t r_addr;
|
uint16_t r_addr;
|
||||||
|
|
||||||
@ -54,9 +76,21 @@ void init(char *str){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("ERROR: Unknown command '%c'\n", command);
|
printf("ERROR: Unknown command '%c'\n", command);
|
||||||
break;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set channel to 10 */
|
||||||
|
tcmd.transceivers = TRANSCEIVER_CC1100;
|
||||||
|
tcmd.data = &chan;
|
||||||
|
m.type = SET_CHANNEL;
|
||||||
|
m.content.ptr = (void*) &tcmd;
|
||||||
|
|
||||||
|
msg_send_receive(&m, &m, transceiver_pid);
|
||||||
|
|
||||||
|
/* start transceiver watchdog */
|
||||||
|
thread_create(tr_wd_stack, TR_WD_STACKSIZE, PRIORITY_MAIN-3, CREATE_STACKTEST, wakeup_thread, "TX/RX WD");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void table(char *str){
|
void table(char *str){
|
||||||
rpl_routing_entry_t * rtable;
|
rpl_routing_entry_t * rtable;
|
||||||
@ -89,9 +123,17 @@ void dodag(char *str){
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern void cc1100_print_config(void);
|
extern void cc1100_print_config(void);
|
||||||
|
extern void cc1100_print_statistic(void);
|
||||||
|
|
||||||
void cc1100_cfg(char* unused) {
|
void cc1100_cfg(char* unused) {
|
||||||
cc1100_print_config();
|
cc1100_print_config();
|
||||||
|
puts("=============================================");
|
||||||
|
cc1100_print_statistic();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wakeup(char* unused) {
|
||||||
|
thread_wakeup(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
const shell_command_t shell_commands[] = {
|
const shell_command_t shell_commands[] = {
|
||||||
@ -99,12 +141,13 @@ const shell_command_t shell_commands[] = {
|
|||||||
{"table", "", table},
|
{"table", "", table},
|
||||||
{"dodag", "", dodag},
|
{"dodag", "", dodag},
|
||||||
{"cc1100", "", cc1100_cfg},
|
{"cc1100", "", cc1100_cfg},
|
||||||
|
{"wakeup", "", wakeup},
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
printf("RPL Test Application\n");
|
printf("RPL Test Application\n");
|
||||||
vtimer_init();
|
|
||||||
|
|
||||||
posix_open(uart0_handler_pid, 0);
|
posix_open(uart0_handler_pid, 0);
|
||||||
|
|
||||||
|
|||||||
@ -142,7 +142,6 @@ rpl_of_t *rpl_get_of_for_ocp(uint16_t ocp){
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t rpl_init(transceiver_type_t trans, uint16_t rpl_address){
|
uint8_t rpl_init(transceiver_type_t trans, uint16_t rpl_address){
|
||||||
vtimer_init();
|
|
||||||
mutex_init(&rpl_send_mutex);
|
mutex_init(&rpl_send_mutex);
|
||||||
mutex_init(&rpl_recv_mutex);
|
mutex_init(&rpl_recv_mutex);
|
||||||
if(rpl_address == 0){
|
if(rpl_address == 0){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user