Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki

This commit is contained in:
Joakim Eriksson 2011-10-17 14:16:57 +02:00
commit 2399689bbd
5 changed files with 35 additions and 27 deletions

View file

@ -527,11 +527,11 @@ generate_sensor_readings(void *arg)
uint16_t days,h,m,s; uint16_t days,h,m,s;
unsigned long seconds=clock_seconds(); unsigned long seconds=clock_seconds();
static const char httpd_cgi_sensor0[] HTTPD_STRING_ATTR = "[Updated %d seconds ago]<br><br>"; static const char httpd_cgi_sensor0[] HTTPD_STRING_ATTR = "[Updated %d seconds ago]<br><br>";
static const char httpd_cgi_sensor1[] HTTPD_STRING_ATTR = "<em>Temperature:</em> %s<br>"; static const char httpd_cgi_sensor1[] HTTPD_STRING_ATTR = "<pre><em>Temperature:</em> %s\n";
static const char httpd_cgi_sensor2[] HTTPD_STRING_ATTR = "<em>Battery:</em> %s<br>"; static const char httpd_cgi_sensor2[] HTTPD_STRING_ATTR = "<em>Battery :</em> %s\n";
// static const char httpd_cgi_sensr12[] HTTPD_STRING_ATTR = "<em>Temperature:</em> %s <em>Battery:</em> %s<br>"; // static const char httpd_cgi_sensr12[] HTTPD_STRING_ATTR = "<em>Temperature:</em> %s <em>Battery:</em> %s<br>";
static const char httpd_cgi_sensor3[] HTTPD_STRING_ATTR = "<em>Uptime :</em> %02d:%02d:%02d<br>"; static const char httpd_cgi_sensor3[] HTTPD_STRING_ATTR = "<em>Uptime :</em> %02d:%02d:%02d\n";
static const char httpd_cgi_sensor3d[] HTTPD_STRING_ATTR = "<em>Uptime :</em> %u days %02u:%02u:%02u<br>"; static const char httpd_cgi_sensor3d[] HTTPD_STRING_ATTR = "<em>Uptime :</em> %u days %02u:%02u:%02u/n";
// static const char httpd_cgi_sensor4[] HTTPD_STRING_ATTR = "<em>Sleeping time :</em> %02d:%02d:%02d (%d%%)<br>"; // static const char httpd_cgi_sensor4[] HTTPD_STRING_ATTR = "<em>Sleeping time :</em> %02d:%02d:%02d (%d%%)<br>";
numprinted=0; numprinted=0;
@ -595,17 +595,20 @@ generate_sensor_readings(void *arg)
#else #else
energest_flush(); energest_flush();
#endif #endif
static const char httpd_cgi_sensor10[] HTTPD_STRING_ATTR = "<em>Radio (ENERGEST):</em> Tx %02u:%02u:%02u (%u.%02u%%) "; static const char httpd_cgi_sensor10[] HTTPD_STRING_ATTR = "<em>Radio (ENERGEST):</em> Tx %02u:%02u:%02u (%u.%02u%%) ";
static const char httpd_cgi_sensor11[] HTTPD_STRING_ATTR = "Tx %02u:%02u:%02u (%u.%02u%%)<br>"; static const char httpd_cgi_sensor11[] HTTPD_STRING_ATTR = "Rx %02u:%02u:%02u (%u.%02u%%)\n";
s=energest_total_time[ENERGEST_TYPE_LISTEN].current/RTIMER_ARCH_SECOND; s=energest_total_time[ENERGEST_TYPE_TRANSMIT].current/RTIMER_ARCH_SECOND;
h=s*10000/seconds;p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60; h=((10000UL*energest_total_time[ENERGEST_TYPE_TRANSMIT].current)/RTIMER_ARCH_SECOND)/seconds;
p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor10, h,m,s,p1,p2); numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor10, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;} if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;} else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;} else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;} else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
s=energest_total_time[ENERGEST_TYPE_TRANSMIT].current/RTIMER_ARCH_SECOND; s=energest_total_time[ENERGEST_TYPE_LISTEN].current/RTIMER_ARCH_SECOND;
h=s*10000/seconds;p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60; h=((10000UL*energest_total_time[ENERGEST_TYPE_LISTEN].current)/RTIMER_ARCH_SECOND)/seconds;
p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor11, h,m,s,p1,p2); numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor11, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;} if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;} else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
@ -614,29 +617,24 @@ generate_sensor_readings(void *arg)
} }
#endif /* ENERGEST_CONF_ON */ #endif /* ENERGEST_CONF_ON */
#if RIMESTATS_CONF_ON
#include "net/rime/rimestats.h"
static const char httpd_cgi_sensor21[] HTTPD_STRING_ATTR = "<em>Packets (RIMESTATS) :</em> Tx=%5lu Rx=%5lu TxL=%5lu RxL=%5lu<br>";
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor21,
rimestats.tx,rimestats.rx,rimestats.lltx-rimestats.tx,rimestats.llrx-rimestats.rx);
#endif
#if CONTIKIMAC_CONF_COMPOWER #if CONTIKIMAC_CONF_COMPOWER
#include "sys/compower.h" #include "sys/compower.h"
{uint8_t p1,p2; {uint8_t p1,p2;
extern struct compower_activity current_packet; // extern struct compower_activity current_packet;
static const char httpd_cgi_sensor31[] HTTPD_STRING_ATTR = "<em>ContikiMAC (COMPOWER):</em> Idle Rx %02u:%02u:%02u (%u.%02u%%) "; static const char httpd_cgi_sensor31[] HTTPD_STRING_ATTR = "<em>ContikiMAC (COMPOWER):</em> Tx %02u:%02u:%02u (%u.%02u%%) ";
static const char httpd_cgi_sensor32[] HTTPD_STRING_ATTR = "Tx %02u:%02u:%02u (%u.%0u%%)<br>"; static const char httpd_cgi_sensor32[] HTTPD_STRING_ATTR = "Rx %02u:%02u:%02u (%u.%02u%%)\n";
s=100UL*compower_idle_activity.listen/RTIMER_ARCH_SECOND; s=compower_idle_activity.transmit/RTIMER_ARCH_SECOND;
h=s*100/seconds;p1=h/100;p2=h-p1*100;s/=100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60; h=((10000UL*compower_idle_activity.transmit)/RTIMER_ARCH_SECOND)/seconds;
p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor31, h,m,s,p1,p2); numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor31, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;} if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;} else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;} else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;} else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
s=100UL*compower_idle_activity.transmit/RTIMER_ARCH_SECOND; s=compower_idle_activity.listen/RTIMER_ARCH_SECOND;
h=s*100/seconds;p1=h/100;p2=h-p1*100;s/=100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60; h=((10000UL*compower_idle_activity.listen)/RTIMER_ARCH_SECOND)/seconds;
p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor32, h,m,s,p1,p2); numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor32, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;} if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;} else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
@ -645,6 +643,15 @@ generate_sensor_readings(void *arg)
} }
#endif #endif
#if RIMESTATS_CONF_ON
#include "net/rime/rimestats.h"
static const char httpd_cgi_sensor21[] HTTPD_STRING_ATTR = "<em>Packets (RIMESTATS):</em> Tx=%5lu Rx=%5lu TxL=%4lu RxL=%4lu\n";
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor21,
rimestats.tx,rimestats.rx,rimestats.lltx-rimestats.tx,rimestats.llrx-rimestats.rx);
#endif
static const char httpd_cgi_sensor99[] HTTPD_STRING_ATTR = "</pre>";
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor99);
return numprinted; return numprinted;
} }

View file

@ -40,6 +40,7 @@
#include "net/mac/nullrdc-noframer.h" #include "net/mac/nullrdc-noframer.h"
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/queuebuf.h"
#include "net/netstack.h" #include "net/netstack.h"
#include <string.h> #include <string.h>

View file

@ -41,6 +41,7 @@
#include "net/mac/nullrdc.h" #include "net/mac/nullrdc.h"
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/queuebuf.h"
#include "net/netstack.h" #include "net/netstack.h"
#include <string.h> #include <string.h>

View file

@ -48,6 +48,7 @@
#include "net/mac/sicslowmac.h" #include "net/mac/sicslowmac.h"
#include "net/mac/frame802154.h" #include "net/mac/frame802154.h"
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/queuebuf.h"
#include "net/netstack.h" #include "net/netstack.h"
#include "lib/random.h" #include "lib/random.h"

View file

@ -148,8 +148,6 @@ LIST(queuebuf_list);
uint8_t queuebuf_len, queuebuf_ref_len, queuebuf_max_len; uint8_t queuebuf_len, queuebuf_ref_len, queuebuf_max_len;
#endif /* QUEUEBUF_STATS */ #endif /* QUEUEBUF_STATS */
static void queuebuf_remove_from_file(int swap_id);
#if WITH_SWAP #if WITH_SWAP
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void