Merge branch 'refs/heads/master' of https://fros4943@github.com/adamdunkels/contiki-2.x.git into HEAD

This commit is contained in:
Fredrik Osterlind 2011-02-11 13:32:38 +01:00
commit a49c08caf4
5 changed files with 100 additions and 3 deletions

View File

@ -56,6 +56,9 @@ SHELL_COMMAND(reboot_command,
PROCESS_THREAD(shell_reboot_process, ev, data)
{
static struct etimer etimer;
PROCESS_EXITHANDLER(leds_off(LEDS_ALL);)
PROCESS_BEGIN();
shell_output_str(&reboot_command,

View File

@ -129,7 +129,11 @@
#define DEFAULT_RPL_LIFETIME_UNIT 0xffff
#define DEFAULT_RPL_DEF_LIFETIME 0xff
#ifndef RPL_CONF_MIN_HOPRANKINC
#define DEFAULT_MIN_HOPRANKINC 256
#else
#define DEFAULT_MIN_HOPRANKINC RPL_CONF_MIN_HOPRANKINC
#endif
#define DEFAULT_MAX_RANKINC (3 * DEFAULT_MIN_HOPRANKINC)
#define DAG_RANK(fixpt_rank, dag) ((fixpt_rank) / (dag)->min_hoprankinc)

View File

@ -104,7 +104,7 @@ void uip_log(char *msg);
#ifdef SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS
#define SICSLOWPAN_MAX_MAC_TRANSMISSIONS SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS
#else
#define SICSLOWPAN_MAX_MAC_TRANSMISSIONS 3
#define SICSLOWPAN_MAX_MAC_TRANSMISSIONS 4
#endif
#ifndef SICSLOWPAN_COMPRESSION
@ -1297,13 +1297,20 @@ output(uip_lladdr_t *localdest)
SICSLOWPAN_MAX_MAC_TRANSMISSIONS);
#define TCP_FIN 0x01
#define TCP_ACK 0x10
#define TCP_CTL 0x3f
/* Set stream mode for all TCP packets, except FIN packets. */
if(UIP_IP_BUF->proto == UIP_PROTO_TCP &&
(UIP_TCP_BUF->flags & TCP_FIN) == 0) {
(UIP_TCP_BUF->flags & TCP_FIN) == 0 &&
(UIP_TCP_BUF->flags & TCP_CTL) != TCP_ACK) {
packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE,
PACKETBUF_ATTR_PACKET_TYPE_STREAM);
} else if(UIP_IP_BUF->proto == UIP_PROTO_TCP &&
(UIP_TCP_BUF->flags & TCP_FIN) == TCP_FIN) {
packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE,
PACKETBUF_ATTR_PACKET_TYPE_STREAM_END);
}
/*
* The destination address will be tagged to each outbound
* packet. If the argument localdest is NULL, we are sending a

View File

@ -0,0 +1,54 @@
#!/usr/bin/perl
$num = 0;
$override_range = $ARGV[0];
# Go through the .csc file; find the transmission range and all the
# nodes' x and y coordinates.
while(<STDIN>) {
if(/\<transmitting_range\>([\d.]+)\<\//) {
$range = $1;
}
if(/\<x\>([\d.]+)\</) {
$x[$num] = $1;
}
if(/\<y\>([\d.]+)\</) {
$y[$num] = $1;
$num++;
}
}
print "Range $range num $num override range $override_range\n";
if($override_range) {
$range = $override_range;
}
$no_neighbors = 0;
$all_neighbors = 0;
$total_neighbors = 0;
# Go through all nodes, find how many are in their range.
for($i = 0; $i < $num; $i++) {
$neighbors = 0;
for($j = 0; $j < $num; $j++) {
if($i != $j) {
if(($x[$i] - $x[$j]) * ($x[$i] - $x[$j]) +
($y[$i] - $y[$j]) * ($y[$i] - $y[$j]) <=
$range * $range) {
$neighbors++;
}
}
}
if($neighbors == 0) {
$no_neighbors++;
}
if($neighbors == $num - 1) {
$all_neighbors++;
}
$total_neighbors += $neighbors;
}
print "Num nodes $num, average neighbors " . ($total_neighbors / $num) .
", $no_neighbors nodes (" . (100 * $no_neighbors / $num) .
"%) have no neighbors, $all_neighbors (" . (100 * $all_neighbors / $num) .
"%) have all nodes as neighbors\n";

View File

@ -0,0 +1,29 @@
#!/usr/bin/perl
$csc = $ARGV[0];
$range = $ARGV[1];
$success = $ARGV[2];
if(!$success) {
print "takes a .csc file as input, creates a .csc file with a given tx range and reliability\n";
exit 0;
}
open(F, $csc);
$csc =~ s/\.csc/-$range-$success.csc/g;
open(O, "> $csc");
while(<F>) {
if(m-\<transmitting_range\>[\d.]+\</transmitting_range\>-) {
print O "<transmitting_range>$range</transmitting_range>\n";
} elsif(m-\<interference_range\>[\d.]+\</interference_range\>-) {
print O "<interference_range>" . ($range * 2) . "</transmitting_range>\n";
} elsif(m-\<success_ratio_rx\>[\d.]+\</success_ratio_rx\>-) {
print O "<success_ratio_rx>$success</success_ratio_rx>\n";
} else {
print O;
}
}